summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/test/initial/seqOfClass.xml11
-rw-r--r--slicer/test/initial/seqOfClass2.json1
-rw-r--r--slicer/test/serializers.cpp20
3 files changed, 32 insertions, 0 deletions
diff --git a/slicer/test/initial/seqOfClass.xml b/slicer/test/initial/seqOfClass.xml
new file mode 100644
index 0000000..0ed2ccf
--- /dev/null
+++ b/slicer/test/initial/seqOfClass.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Classes>
+ <element>
+ <a>1</a>
+ <b>2</b>
+ </element>
+ <element>
+ <a>4</a>
+ <b>5</b>
+ </element>
+</Classes>
diff --git a/slicer/test/initial/seqOfClass2.json b/slicer/test/initial/seqOfClass2.json
new file mode 100644
index 0000000..c394b90
--- /dev/null
+++ b/slicer/test/initial/seqOfClass2.json
@@ -0,0 +1 @@
+[{"a":1.000000,"b":2.000000},{"a":4.000000,"b":5.000000}]
diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp
index 5c40302..efe9b9d 100644
--- a/slicer/test/serializers.cpp
+++ b/slicer/test/serializers.cpp
@@ -180,6 +180,16 @@ checkOptionals_areset(const TestModule::OptionalsPtr & opts)
BOOST_REQUIRE_EQUAL(opts->optDict->find(13)->second->b, 15);
}
+void
+checkSeqOfClass(const TestModule::Classes & seqOfClass)
+{
+ BOOST_REQUIRE_EQUAL(seqOfClass.size(), 2);
+ BOOST_REQUIRE_EQUAL(seqOfClass[0]->a, 1);
+ BOOST_REQUIRE_EQUAL(seqOfClass[0]->b, 2);
+ BOOST_REQUIRE_EQUAL(seqOfClass[1]->a, 4);
+ BOOST_REQUIRE_EQUAL(seqOfClass[1]->b, 5);
+}
+
xmlpp::Document *
readXml(const fs::path & path)
{
@@ -228,6 +238,16 @@ BOOST_AUTO_TEST_CASE( builtins_xml )
verifyByFile<TestModule::BuiltInsPtr, Slicer::XmlFileDeserializer>("builtins.xml", checkBuiltIns_valuesCorrect);
}
+BOOST_AUTO_TEST_CASE( sequenceOfClass_xml )
+{
+ verifyByFile<TestModule::Classes, Slicer::XmlFileDeserializer>("seqOfClass.xml", checkSeqOfClass);
+}
+
+BOOST_AUTO_TEST_CASE( sequenceOfClass_json )
+{
+ verifyByFile<TestModule::Classes, Slicer::JsonFileDeserializer>("seqOfClass2.json", checkSeqOfClass);
+}
+
BOOST_AUTO_TEST_CASE( optionals_notset_xml )
{
verifyByFile<TestModule::OptionalsPtr, Slicer::XmlFileDeserializer>("optionals-notset.xml", checkOptionals_notset);