comparison OrthancFramework/UnitTestsSources/ToolboxTests.cpp @ 5379:b31c73bc7cb6

Toolbox : more set functions
author Alain Mazy <am@osimis.io>
date Thu, 31 Aug 2023 15:20:41 +0200
parents 0ea402b4d901
children b83192e7ad10
comparison
equal deleted inserted replaced
5378:d857c6210c50 5379:b31c73bc7cb6
278 ASSERT_TRUE(Toolbox::IsSetInSet<int>(needles, haystack)); 278 ASSERT_TRUE(Toolbox::IsSetInSet<int>(needles, haystack));
279 ASSERT_EQ(0u, Toolbox::GetMissingsFromSet<int>(missings, needles, haystack)); 279 ASSERT_EQ(0u, Toolbox::GetMissingsFromSet<int>(missings, needles, haystack));
280 } 280 }
281 } 281 }
282 282
283 TEST(Toolbox, GetSetIntersection)
284 {
285 {
286 std::set<int> target;
287 std::set<int> a;
288 std::set<int> b;
289
290 Toolbox::GetIntersection(target, a, b);
291 ASSERT_EQ(0u, target.size());
292 }
293
294 {
295 std::set<int> target;
296 std::set<int> a;
297 std::set<int> b;
298
299 a.insert(1);
300 b.insert(1);
301
302 Toolbox::GetIntersection(target, a, b);
303 ASSERT_EQ(1u, target.size());
304 ASSERT_EQ(1u, target.count(1));
305 }
306
307 {
308 std::set<int> target;
309 std::set<int> a;
310 std::set<int> b;
311
312 a.insert(1);
313 a.insert(2);
314 b.insert(2);
315
316 Toolbox::GetIntersection(target, a, b);
317 ASSERT_EQ(1u, target.size());
318 ASSERT_EQ(0u, target.count(1));
319 ASSERT_EQ(1u, target.count(2));
320 }
321
322 }
323
324
283 TEST(Toolbox, JoinStrings) 325 TEST(Toolbox, JoinStrings)
284 { 326 {
285 { 327 {
286 std::set<std::string> source; 328 std::set<std::string> source;
287 std::string result; 329 std::string result;