MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/base/base_tests/clustering_map_tests.cpp:85–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83};
84
85UNIT_TEST(ClusteringMap_Smoke)
86{
87 {
88 ClusteringMapAdapter<int, string> m;
89 TEST(m.Get(0).empty(), ());
90 TEST(m.Get(1).empty(), ());
91
92 m.Union(0, 1);
93 TEST(m.Get(0).empty(), ());
94 TEST(m.Get(1).empty(), ());
95 }
96
97 {
98 ClusteringMapAdapter<int, string> m;
99 m.Append(0, "Hello");
100 m.Append(1, "World!");
101
102 TEST_EQUAL(m.Get(0), vector<string>({"Hello"}), ());
103 TEST_EQUAL(m.Get(1), vector<string>({"World!"}), ());
104
105 m.Union(0, 1);
106 TEST_EQUAL(m.Get(0), vector<string>({"Hello", "World!"}), ());
107 TEST_EQUAL(m.Get(1), vector<string>({"Hello", "World!"}), ());
108
109 m.Append(2, "alpha");
110 m.Append(3, "beta");
111 m.Append(4, "gamma");
112
113 TEST_EQUAL(m.Get(2), vector<string>({"alpha"}), ());
114 TEST_EQUAL(m.Get(3), vector<string>({"beta"}), ());
115 TEST_EQUAL(m.Get(4), vector<string>({"gamma"}), ());
116
117 m.Union(2, 3);
118 m.Union(3, 4);
119
120 TEST_EQUAL(m.Get(2), vector<string>({"alpha", "beta", "gamma"}), ());
121 TEST_EQUAL(m.Get(3), vector<string>({"alpha", "beta", "gamma"}), ());
122 TEST_EQUAL(m.Get(4), vector<string>({"alpha", "beta", "gamma"}), ());
123
124 TEST_EQUAL(m.Get(5), vector<string>(), ());
125 m.Union(2, 5);
126 TEST_EQUAL(m.Get(5), vector<string>({"alpha", "beta", "gamma"}), ());
127 }
128}
129
130UNIT_TEST(ClusteringMap_ForEach)
131{

Callers

nothing calls this directly

Calls 6

TESTFunction · 0.85
ClustersMethod · 0.80
emptyMethod · 0.45
GetMethod · 0.45
UnionMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected