changeset 3497:db71bd11affc

fix unit tests if dcmtk != 3.6.1
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 21 Aug 2019 16:57:02 +0200
parents 109631ed3564
children 957e06cbe76a
files UnitTestsSources/DicomMapTests.cpp UnitTestsSources/MemoryCacheTests.cpp UnitTestsSources/UnitTestsMain.cpp
diffstat 3 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/UnitTestsSources/DicomMapTests.cpp	Wed Aug 21 16:47:17 2019 +0200
+++ b/UnitTestsSources/DicomMapTests.cpp	Wed Aug 21 16:57:02 2019 +0200
@@ -867,7 +867,6 @@
     ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0028, 0x2000), true));   ASSERT_EQ("OB", s);
     ASSERT_TRUE(m.CopyToString(s, DicomTag(0x7fe0, 0x0009), true));   ASSERT_EQ("OD", s);
     ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0064, 0x0009), true));   ASSERT_EQ("OF", s);
-    ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0066, 0x0040), false));  ASSERT_EQ("46", s);
     ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0028, 0x1201), true));   ASSERT_EQ("OWOW", s);
     ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0010, 0x0010), false));  ASSERT_EQ("PN", s);
     ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0008, 0x0050), false));  ASSERT_EQ("SH", s);
@@ -882,6 +881,13 @@
     ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0008, 0x0120), false));  ASSERT_EQ("UR", s);
     ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0008, 0x0301), false));  ASSERT_EQ("17", s);
     ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0040, 0x0031), false));  ASSERT_EQ("UT", s);
+
+#if DCMTK_VERSION_NUMBER == 361
+    ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0066, 0x0040), false));
+#else
+    ASSERT_TRUE(m.CopyToString(s, DicomTag(0x0066, 0x0040), true));
+#endif
+    ASSERT_EQ("46", s);
   }
 }
 
@@ -931,6 +937,6 @@
   {
     DicomMap m;
     m.FromDicomWeb(visitor.GetResult());
-    ASSERT_EQ(0, m.GetSize());  // Sequences are not handled by Orthanc::DicomMap
+    ASSERT_EQ(0u, m.GetSize());  // Sequences are not handled by Orthanc::DicomMap
   }
 }
--- a/UnitTestsSources/MemoryCacheTests.cpp	Wed Aug 21 16:47:17 2019 +0200
+++ b/UnitTestsSources/MemoryCacheTests.cpp	Wed Aug 21 16:57:02 2019 +0200
@@ -179,13 +179,13 @@
   r.AddOrMakeMostRecent("a", 420);
   r.GetAllKeys(keys);
 
-  ASSERT_EQ(1, keys.size());
+  ASSERT_EQ(1u, keys.size());
   ASSERT_EQ("a", keys[0]);
 
   r.AddOrMakeMostRecent("b", 421);
   r.GetAllKeys(keys);
 
-  ASSERT_EQ(2, keys.size());
+  ASSERT_EQ(2u, keys.size());
   ASSERT_TRUE(std::find(keys.begin(), keys.end(),"a") != keys.end());
   ASSERT_TRUE(std::find(keys.begin(), keys.end(),"b") != keys.end());
 }
--- a/UnitTestsSources/UnitTestsMain.cpp	Wed Aug 21 16:47:17 2019 +0200
+++ b/UnitTestsSources/UnitTestsMain.cpp	Wed Aug 21 16:57:02 2019 +0200
@@ -480,8 +480,8 @@
 {
   // https://en.wikipedia.org/wiki/UTF-8
   
-  ASSERT_EQ(1, sizeof(char));
-  ASSERT_EQ(1, sizeof(uint8_t));
+  ASSERT_EQ(1u, sizeof(char));
+  ASSERT_EQ(1u, sizeof(uint8_t));
   
   {
     const uint8_t data[] = { 0x24 };