From 079408702055a7edbc019a2ca1874da5ad3c0d93 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 8 Jan 2015 21:11:30 +0000 Subject: Test data and test case for bare XML containers --- slicer/test/initial/bare.xml | 25 +++++++++++++++++++++++++ slicer/test/preprocessor.cpp | 2 +- slicer/test/serializers.cpp | 16 ++++++++++++++++ slicer/test/types.ice | 6 ++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 slicer/test/initial/bare.xml diff --git a/slicer/test/initial/bare.xml b/slicer/test/initial/bare.xml new file mode 100644 index 0000000..aba53ec --- /dev/null +++ b/slicer/test/initial/bare.xml @@ -0,0 +1,25 @@ + + + + 1 + 2 + + + 3 + 4 + + + 5 + + 6 + 7 + + + + 8 + + 9 + 10 + + + diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp index 10fedef..c318e84 100644 --- a/slicer/test/preprocessor.cpp +++ b/slicer/test/preprocessor.cpp @@ -13,7 +13,7 @@ namespace fs = boost::filesystem; -const unsigned int COMPONENTS_IN_TEST_ICE = 27; +const unsigned int COMPONENTS_IN_TEST_ICE = 28; BOOST_FIXTURE_TEST_SUITE ( preprocessor, FileStructure ); diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp index 76a5033..f489af3 100644 --- a/slicer/test/serializers.cpp +++ b/slicer/test/serializers.cpp @@ -211,6 +211,17 @@ checkEntityRef(const TestModule2::EntityRef & er) BOOST_REQUIRE_EQUAL(er.Name, "Hull City"); } +void +checkBare(const TestModule::BareContainers & bc) +{ + BOOST_REQUIRE_EQUAL(bc.bareSeq.size(), 2); + BOOST_REQUIRE_EQUAL(bc.bareSeq[0]->a, 1); + BOOST_REQUIRE_EQUAL(bc.bareSeq[0]->b, 2); + BOOST_REQUIRE_EQUAL(bc.bareSeq[1]->a, 3); + BOOST_REQUIRE_EQUAL(bc.bareSeq[1]->b, 4); + BOOST_REQUIRE_EQUAL(bc.bareMap.size(), 2); +} + xmlpp::Document * readXml(const fs::path & path) { @@ -359,6 +370,11 @@ BOOST_AUTO_TEST_CASE( xml_attribute_xml ) verifyByFile("xmlattr.xml"); } +BOOST_AUTO_TEST_CASE( xml_barecontainers_xml ) +{ + verifyByFile("bare.xml", checkBare); +} + BOOST_AUTO_TEST_SUITE_END(); diff --git a/slicer/test/types.ice b/slicer/test/types.ice index 7a66387..4192448 100644 --- a/slicer/test/types.ice +++ b/slicer/test/types.ice @@ -100,6 +100,12 @@ module TestModule { class InheritanceContMapped { Base2 b; }; + struct BareContainers { + [ "slicer:xml:bare" ] + Classes bareSeq; + [ "slicer:xml:bare" ] + ClassMap bareMap; + }; }; module TestModule2 { -- cgit v1.2.3