diff OrthancFramework/UnitTestsSources/DicomMapTests.cpp @ 4933:312c6f4da888 more-tags

adding MainDicomTags signatures
author Alain Mazy <am@osimis.io>
date Wed, 09 Mar 2022 12:16:45 +0100
parents b7ce2bb6b881
children 304514ce84ee
line wrap: on
line diff
--- a/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Wed Mar 09 11:17:08 2022 +0100
+++ b/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Wed Mar 09 12:16:45 2022 +0100
@@ -138,6 +138,35 @@
     // adding another tag with same name should throw
     ASSERT_THROW(DicomMap::AddMainDicomTag(DICOM_TAG_BITS_STORED, "BitsAllocated", ResourceType_Instance), OrthancException);
   }
+
+  TEST_F(DicomMapMainTagsTests, Signatures)
+  {
+    std::string defaultPatientSignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Patient);
+    std::string defaultStudySignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Study);
+    std::string defaultSeriesSignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Series);
+    std::string defaultInstanceSignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Instance);
+
+    ASSERT_NE(defaultInstanceSignature, defaultPatientSignature);
+    ASSERT_NE(defaultSeriesSignature, defaultStudySignature);
+    ASSERT_NE(defaultSeriesSignature, defaultPatientSignature);
+
+    std::string patientSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Patient);
+    std::string studySignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Study);
+    std::string seriesSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Series);
+    std::string instanceSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Instance);
+
+    // at start, default and current signature should be equal
+    ASSERT_EQ(defaultPatientSignature, patientSignature);
+    ASSERT_EQ(defaultStudySignature, studySignature);
+    ASSERT_EQ(defaultSeriesSignature, seriesSignature);
+    ASSERT_EQ(defaultInstanceSignature, instanceSignature);
+
+    DicomMap::AddMainDicomTag(DICOM_TAG_BITS_ALLOCATED, "BitsAllocated", ResourceType_Instance);
+    instanceSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Instance);
+    
+    ASSERT_NE(defaultInstanceSignature, instanceSignature);
+  }
+
 }
 
 TEST(DicomMap, Tags)