diff options
-rw-r--r-- | slicer/slicer/slicer.h | 6 | ||||
-rw-r--r-- | slicer/test/serializers.cpp | 27 |
2 files changed, 30 insertions, 3 deletions
diff --git a/slicer/slicer/slicer.h b/slicer/slicer/slicer.h index c837913..196b765 100644 --- a/slicer/slicer/slicer.h +++ b/slicer/slicer/slicer.h @@ -17,10 +17,10 @@ namespace Slicer { } template <typename Deserializer, typename Object, typename ... SerializerParams> - Object + IceInternal::Handle<Object> Deserialize(SerializerParams & ... sp) { - return *DeserializeAny<Deserializer, IceInternal::Handle<Object>, SerializerParams...>(sp ...); + return DeserializeAny<Deserializer, IceInternal::Handle<Object>, SerializerParams...>(sp ...); } template <typename Serializer, typename Object, typename ... SerializerParams> @@ -36,7 +36,7 @@ namespace Slicer { void Serialize(IceInternal::Handle<Object> object, SerializerParams & ... sp) { - SerializeAny(*object, sp ...); + SerializeAny<Serializer>(object, sp ...); } } diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp index 6151420..a13bb49 100644 --- a/slicer/test/serializers.cpp +++ b/slicer/test/serializers.cpp @@ -390,5 +390,32 @@ BOOST_AUTO_TEST_CASE( optionals_areset_xml ) verifyByHelper<TestModule::OptionalsPtr, Slicer::XmlDocumentDeserializer, Slicer::XmlDocumentSerializer, xmlpp::Document *>("optionals-areset.xml", readXml, writeXml, freeXml, checkOptionals_areset); } +BOOST_FIXTURE_TEST_SUITE ( compatWrapper, FileBased ); + +BOOST_AUTO_TEST_CASE( any ) +{ + BOOST_TEST_CHECKPOINT("Create folders"); + const fs::path tmpf = tmp / "compatWrapper"; + fs::create_directory(tmpf); + + BOOST_TEST_CHECKPOINT("Figure out paths"); + const boost::filesystem::path input = root / "initial" / "builtins.xml"; + const boost::filesystem::path output = tmpf / "builtins.xml"; + + BOOST_TEST_CHECKPOINT("Deserialize with wrapper"); + TestModule::BuiltInsPtr object = Slicer::Deserialize<Slicer::XmlFileDeserializer, TestModule::BuiltIns>(input); + + BOOST_TEST_CHECKPOINT("Test object"); + checkBuiltIns_valuesCorrect(object); + + BOOST_TEST_CHECKPOINT("Serialize with wrapper"); + Slicer::Serialize<Slicer::XmlFileSerializer>(object, output); + + BOOST_TEST_CHECKPOINT("Checksum: " << input << " === " << output); + system(stringbf("diff -w %s %s", input, output)); +} + +BOOST_AUTO_TEST_SUITE_END(); + BOOST_AUTO_TEST_SUITE_END(); |