From 0e6562512870b19bc6e87e23369d372c5eedf992 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 6 Jan 2015 21:48:33 +0000 Subject: Add tests and test data for sequence roots --- slicer/test/initial/seqOfClass.xml | 11 +++++++++++ slicer/test/initial/seqOfClass2.json | 1 + slicer/test/serializers.cpp | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 slicer/test/initial/seqOfClass.xml create mode 100644 slicer/test/initial/seqOfClass2.json 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 @@ + + + + 1 + 2 + + + 4 + 5 + + 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("builtins.xml", checkBuiltIns_valuesCorrect); } +BOOST_AUTO_TEST_CASE( sequenceOfClass_xml ) +{ + verifyByFile("seqOfClass.xml", checkSeqOfClass); +} + +BOOST_AUTO_TEST_CASE( sequenceOfClass_json ) +{ + verifyByFile("seqOfClass2.json", checkSeqOfClass); +} + BOOST_AUTO_TEST_CASE( optionals_notset_xml ) { verifyByFile("optionals-notset.xml", checkOptionals_notset); -- cgit v1.2.3