diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-01-08 21:11:30 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-01-08 21:11:30 +0000 |
commit | 079408702055a7edbc019a2ca1874da5ad3c0d93 (patch) | |
tree | 4789b07775c9bb6de861ed8cb6e88af0c2dd4406 | |
parent | Support for bare containers in XML (diff) | |
download | slicer-079408702055a7edbc019a2ca1874da5ad3c0d93.tar.bz2 slicer-079408702055a7edbc019a2ca1874da5ad3c0d93.tar.xz slicer-079408702055a7edbc019a2ca1874da5ad3c0d93.zip |
Test data and test case for bare XML containers
-rw-r--r-- | slicer/test/initial/bare.xml | 25 | ||||
-rw-r--r-- | slicer/test/preprocessor.cpp | 2 | ||||
-rw-r--r-- | slicer/test/serializers.cpp | 16 | ||||
-rw-r--r-- | slicer/test/types.ice | 6 |
4 files changed, 48 insertions, 1 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<BareContainers> + <bareSeq> + <a>1</a> + <b>2</b> + </bareSeq> + <bareSeq> + <a>3</a> + <b>4</b> + </bareSeq> + <bareMap> + <key>5</key> + <value> + <a>6</a> + <b>7</b> + </value> + </bareMap> + <bareMap> + <key>8</key> + <value> + <a>9</a> + <b>10</b> + </value> + </bareMap> +</BareContainers> 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<TestModule::ClassClassPtr, Slicer::XmlFileDeserializer>("xmlattr.xml"); } +BOOST_AUTO_TEST_CASE( xml_barecontainers_xml ) +{ + verifyByFile<TestModule::BareContainers, Slicer::XmlFileDeserializer>("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 { |