]> Creatis software - creaImageIO.git/blobdiff - tests/TestDcmDescriptor.cpp
Relevant Ctests for creaImageIO
[creaImageIO.git] / tests / TestDcmDescriptor.cpp
diff --git a/tests/TestDcmDescriptor.cpp b/tests/TestDcmDescriptor.cpp
new file mode 100644 (file)
index 0000000..4637c6e
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+* \file TestDcmDescriptor.cxx
+* \brief Test the Descriptor reading.
+*/
+#include <stdlib.h>
+#include <iostream>
+
+#include <creaImageIOTreeDescriptor.h>
+
+/**
+* TestDcmDescriptor
+* \brief Read a descriptor file and check its content.
+* \param argc Argument count (unused).
+* \param argv Argument list (unused).
+* \return The test result.
+*/
+int TestDcmDescriptor( int argc, char* argv[] )
+{
+    std::cout << "TestDcmDescriptor..." << std::endl;
+    
+
+    // read a descriptor file
+    creaImageIO::tree::Descriptor dscp;
+    const std::string path = GIMMICK_TEST_DATA_DIR;
+    const std::string filepath = path + "/localdatabase_Descriptor.dscp";
+     std::cout << path << std::endl;
+    dscp.createDescriptorfromFile(filepath);
+
+    // get Attribute map
+        creaImageIO::tree::AttributeMapType tags;
+        dscp.BuildAttributeMap(tags);
+    
+    // check its content
+    std::cout << "tags size: " << tags.size() << std::endl;
+    creaImageIO::tree::AttributeMapType::iterator it;
+    for ( it=tags.begin() ; it != tags.end(); it++ )
+    {
+        std::cout << (*it).first << " => " <<  "empty" << std::endl;
+    }
+
+    
+    // default test result
+    return EXIT_FAILURE;
+}