diff OrthancFramework/UnitTestsSources/FrameworkTests.cpp @ 5377:daf4807631c5

ComputeMD5 for std::set
author Alain Mazy <am@osimis.io>
date Thu, 24 Aug 2023 13:35:18 +0200
parents 123a94dd57df
children 48b8dae6dc77
line wrap: on
line diff
--- a/OrthancFramework/UnitTestsSources/FrameworkTests.cpp	Tue Aug 22 16:35:22 2023 +0200
+++ b/OrthancFramework/UnitTestsSources/FrameworkTests.cpp	Thu Aug 24 13:35:18 2023 +0200
@@ -381,6 +381,21 @@
   ASSERT_EQ("8b1a9953c4611296a827abf8c47804d7", s);
   Toolbox::ComputeMD5(s, "");
   ASSERT_EQ("d41d8cd98f00b204e9800998ecf8427e", s);
+
+  Toolbox::ComputeMD5(s, "aaabbbccc");
+  ASSERT_EQ("d1aaf4767a3c10a473407a4e47b02da6", s);
+
+  std::set<std::string> set;
+
+  Toolbox::ComputeMD5(s, set);
+  ASSERT_EQ("d41d8cd98f00b204e9800998ecf8427e", s);  // empty set same as empty string
+
+  set.insert("bbb");
+  set.insert("ccc");
+  set.insert("aaa");
+
+  Toolbox::ComputeMD5(s, set);
+  ASSERT_EQ("d1aaf4767a3c10a473407a4e47b02da6", s); // set md5 same as string with the values sorted
 }
 
 TEST(Toolbox, ComputeSHA1)