diff OrthancFramework/UnitTestsSources/DicomMapTests.cpp @ 4940:304514ce84ee more-tags

tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
author Alain Mazy <am@osimis.io>
date Tue, 15 Mar 2022 15:57:21 +0100
parents 312c6f4da888
children f377d5643538
line wrap: on
line diff
--- a/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Tue Mar 15 09:09:52 2022 +0100
+++ b/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Tue Mar 15 15:57:21 2022 +0100
@@ -556,6 +556,54 @@
 }
 
 
+TEST(DicomMap, ComputedTags)
+{
+  {
+    std::set<DicomTag> tags;
+
+    ASSERT_FALSE(DicomMap::HasOnlyComputedTags(tags));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Study));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient));
+  }
+
+  {
+    std::set<DicomTag> tags;
+    tags.insert(DICOM_TAG_ACCESSION_NUMBER);
+
+    ASSERT_FALSE(DicomMap::HasOnlyComputedTags(tags));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Study));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient));
+  }
+
+  {
+    std::set<DicomTag> tags;
+    tags.insert(DICOM_TAG_MODALITIES_IN_STUDY);
+
+    ASSERT_TRUE(DicomMap::HasOnlyComputedTags(tags));
+    ASSERT_TRUE(DicomMap::HasComputedTags(tags, ResourceType_Study));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance));
+  }
+
+  {
+    std::set<DicomTag> tags;
+    tags.insert(DICOM_TAG_ACCESSION_NUMBER);
+    tags.insert(DICOM_TAG_MODALITIES_IN_STUDY);
+
+    ASSERT_FALSE(DicomMap::HasOnlyComputedTags(tags));
+    ASSERT_TRUE(DicomMap::HasComputedTags(tags, ResourceType_Study));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series));
+    ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance));
+  }
+
+}
+
 TEST(DicomMap, RemoveBinary)
 {
   DicomMap b;