MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / TEST_CASE

Function TEST_CASE

test/sqlite.cpp:28–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26#include <test.hpp>
27
28TEST_CASE(read_write)
29{
30 const std::string create_table = R"__migraphx__(
31 CREATE TABLE IF NOT EXISTS test_db (
32 id INTEGER PRIMARY KEY ASC,
33 data TEXT NOT NULL
34 );
35 INSERT INTO test_db (id, data) VALUES (1, "a");
36 )__migraphx__";
37
38 const std::string select_all = R"__migraphx__(
39 SELECT * FROM test_db;
40 )__migraphx__";
41
42 migraphx::tmp_dir td{};
43 auto db_path = td.path / "test.db";
44 {
45 auto db = migraphx::sqlite::write(db_path);
46 db.execute(create_table);
47 }
48 {
49 auto db = migraphx::sqlite::read(db_path);
50 auto rows = db.execute(select_all);
51 EXPECT(rows.size() == 1);
52 const auto& row = rows.front();
53 EXPECT(row.at("data") == "a");
54 EXPECT(row.at("id") == "1");
55 }
56}
57
58int main(int argc, const char* argv[]) { test::run(argc, argv); }

Callers

nothing calls this directly

Calls 5

readClass · 0.85
frontMethod · 0.80
atMethod · 0.80
executeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected