MCPcopy Create free account
hub / github.com/Kitware/CMake / testEdition

Function testEdition

Tests/CMakeLib/testCMExtEnumSet.cxx:165–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void testEdition()
166{
167 std::cout << "testEdition()" << std::endl;
168
169 {
170 EnumSetTest testSet{ Test::A, Test::C, Test::B };
171
172 auto pos = testSet.insert(Test::E);
173 if (!pos.second || testSet.size() != 4 || *(pos.first) != Test::E ||
174 testSet.find(Test::E) == testSet.end()) {
175 ++failed;
176 }
177 testSet.insert(Test::E);
178 if (testSet.size() != 4 || testSet.find(Test::E) == testSet.end()) {
179 ++failed;
180 }
181
182 testSet.erase(Test::A);
183 if (testSet.size() != 3 || testSet.find(Test::A) != testSet.end()) {
184 ++failed;
185 }
186 testSet.erase(Test::A);
187 if (testSet.size() != 3 || testSet.find(Test::A) != testSet.end()) {
188 ++failed;
189 }
190 }
191 {
192 EnumSetTest testSet{ Test::A, Test::C, Test::B };
193
194 testSet += { Test::D, Test::E };
195
196 std::set<std::uint8_t> reference{ static_cast<std::uint8_t>(Test::A),
197 static_cast<std::uint8_t>(Test::B),
198 static_cast<std::uint8_t>(Test::C),
199 static_cast<std::uint8_t>(Test::D),
200 static_cast<std::uint8_t>(Test::E) };
201 std::set<std::uint8_t> s;
202 for (auto e : testSet) {
203 s.insert(static_cast<std::uint8_t>(e));
204 }
205 if (s != reference) {
206 ++failed;
207 }
208
209 testSet -= { Test::D, Test::B };
210 reference.erase(static_cast<std::uint8_t>(Test::D));
211 reference.erase(static_cast<std::uint8_t>(Test::B));
212 s.clear();
213 for (auto e : testSet) {
214 s.insert(static_cast<std::uint8_t>(e));
215 }
216 if (s != reference) {
217 ++failed;
218 }
219 }
220 {
221 EnumSetTest testSet1{ Test::A, Test::C, Test::B };
222 EnumSetTest testSet2{ Test::A, Test::D, Test::E };

Callers 1

testCMExtEnumSetFunction · 0.85

Calls 11

eraseMethod · 0.80
cbeginMethod · 0.80
cendMethod · 0.80
setMethod · 0.80
max_sizeMethod · 0.80
insertMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…