Mercurial > hg > orthanc
diff OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp @ 4935:acd3f72e2a21 more-tags
split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 10 Mar 2022 19:00:43 +0100 |
parents | 43e613a7756b |
children | 96a3e81eba90 |
line wrap: on
line diff
--- a/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp Thu Mar 10 09:03:24 2022 +0100 +++ b/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp Thu Mar 10 19:00:43 2022 +0100 @@ -358,6 +358,44 @@ } +TEST(FromDcmtkBridge, ParseListOfTags) +{ + {// nominal test + std::string source = "0010,0010;PatientBirthDate;0020,0020"; + std::set<DicomTag> result; + FromDcmtkBridge::ParseListOfTags(result, source); + + ASSERT_TRUE(result.find(DICOM_TAG_PATIENT_NAME) != result.end()); + ASSERT_TRUE(result.find(DICOM_TAG_PATIENT_BIRTH_DATE) != result.end()); + ASSERT_TRUE(result.find(DICOM_TAG_PATIENT_ORIENTATION) != result.end()); + ASSERT_TRUE(result.find(DICOM_TAG_PATIENT_ID) == result.end()); + } + + {// no tag + std::string source = ""; + std::set<DicomTag> result; + FromDcmtkBridge::ParseListOfTags(result, source); + + ASSERT_EQ(0, result.size()); + } + + {// invalid tag + std::string source = "0010,0010;Patient-BirthDate;0020,0020"; + std::set<DicomTag> result; + + ASSERT_THROW(FromDcmtkBridge::ParseListOfTags(result, source), OrthancException); + } + + {// duplicate tag only once + std::string source = "0010,0010;PatientName"; + std::set<DicomTag> result; + + FromDcmtkBridge::ParseListOfTags(result, source); + + ASSERT_EQ(1, result.size()); + } + +} static const DicomTag REFERENCED_STUDY_SEQUENCE(0x0008, 0x1110); static const DicomTag REFERENCED_PATIENT_SEQUENCE(0x0008, 0x1120);