MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/xstudio / TEST

Function TEST

src/utility/test/json_store_sync_test.cpp:10–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8using namespace nlohmann;
9
10TEST(JsonStoreSyncTest, Test) {
11
12 JsonStoreSync a(R"({"children":[]})"_json);
13 JsonStoreSync b(R"({"children":[]})"_json);
14 JsonStoreSync c(R"({"children":[]})"_json);
15
16 a.bind_send_event_func(
17 [&](auto &&PH1, auto &&PH2) { b.process_event(std::forward<decltype(PH1)>(PH1)); });
18
19 b.bind_send_event_func(
20 [&](auto &&PH1, auto &&PH2) { a.process_event(std::forward<decltype(PH1)>(PH1)); });
21
22 a.insert_rows(0, 1, R"([{"hello":true}])"_json);
23 EXPECT_EQ(a.dump(), b.dump());
24
25 b.insert_rows(1, 1, R"([{"goodbye":true}])"_json);
26 EXPECT_EQ(a.dump(), b.dump());
27
28 a.set(0, "hello", R"(false)"_json);
29 EXPECT_EQ(a.dump(), b.dump());
30
31 b.set(1, "goodbye", R"(false)"_json);
32 EXPECT_EQ(a.dump(), b.dump());
33
34 a.remove_rows(1, 1);
35 EXPECT_EQ(a.dump(), b.dump());
36
37 b.remove_rows(0, 1);
38 EXPECT_EQ(a.dump(), b.dump());
39
40
41 a.insert("test1", R"({"hellogoodbye":true})"_json);
42 EXPECT_EQ(a.dump(), b.dump());
43
44 b.insert("test2", R"({"goodbyehello":true})"_json);
45 EXPECT_EQ(a.dump(), b.dump());
46
47 a.remove("test1");
48 EXPECT_EQ(a.dump(), b.dump());
49
50 b.remove("test2");
51 EXPECT_EQ(a.dump(), b.dump());
52
53
54 EXPECT_EQ(a.dump(), c.dump());
55}
56
57TEST(JsonStoreSyncTestMove, Test) {
58 JsonStoreSync a(R"({"children":[]})"_json);

Callers

nothing calls this directly

Calls 15

bind_send_event_funcMethod · 0.80
move_rowsMethod · 0.80
last_eventMethod · 0.80
unapply_eventMethod · 0.80
reset_dataMethod · 0.80
atMethod · 0.80
process_eventMethod · 0.45
insert_rowsMethod · 0.45
dumpMethod · 0.45
setMethod · 0.45
remove_rowsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected