From 58ea36a8c5b6deed8b2f0dc216efb5803ab87951 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 9 Jan 2015 21:36:12 +0000 Subject: Fix the compat interface and add covering test --- slicer/slicer/slicer.h | 6 +++--- 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 - Object + IceInternal::Handle Deserialize(SerializerParams & ... sp) { - return *DeserializeAny, SerializerParams...>(sp ...); + return DeserializeAny, SerializerParams...>(sp ...); } template @@ -36,7 +36,7 @@ namespace Slicer { void Serialize(IceInternal::Handle object, SerializerParams & ... sp) { - SerializeAny(*object, sp ...); + SerializeAny(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("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(input); + + BOOST_TEST_CHECKPOINT("Test object"); + checkBuiltIns_valuesCorrect(object); + + BOOST_TEST_CHECKPOINT("Serialize with wrapper"); + Slicer::Serialize(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(); -- cgit v1.2.3