summaryrefslogtreecommitdiff
path: root/slicer/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-09-30 15:19:43 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-09-30 15:19:43 +0100
commitd7cca3056ac2ad1734989600b6652efefa185dbc (patch)
tree3c335d50e668e2d82d645180e3837bd541bb2a34 /slicer/test
parentAdd new test type (diff)
downloadslicer-d7cca3056ac2ad1734989600b6652efefa185dbc.tar.bz2
slicer-d7cca3056ac2ad1734989600b6652efefa185dbc.tar.xz
slicer-d7cca3056ac2ad1734989600b6652efefa185dbc.zip
Partially revert changes to IceMetaData constructor
Fixes issue where some metadata names/keys were corrupted. Includes new tests which highlighted problem, only to certain values, yay undefined behaviour.
Diffstat (limited to 'slicer/test')
-rw-r--r--slicer/test/collections.ice2
-rw-r--r--slicer/test/initial/dictNamed.xml17
-rw-r--r--slicer/test/serializers.cpp7
3 files changed, 25 insertions, 1 deletions
diff --git a/slicer/test/collections.ice b/slicer/test/collections.ice
index 62d3d3e..f2ccc74 100644
--- a/slicer/test/collections.ice
+++ b/slicer/test/collections.ice
@@ -10,7 +10,7 @@ module TestModule {
local sequence<StructType> Structs;
dictionary<int, ClassType> ClassMap;
local dictionary<int, StructType> StructMap;
- ["slicer:key:id","slicer:value:res","slicer:item:thing"]
+ ["slicer:value:res","slicer:key:id","slicer:item:thing"]
local dictionary<long, StructType> StructMapNamed;
};
diff --git a/slicer/test/initial/dictNamed.xml b/slicer/test/initial/dictNamed.xml
new file mode 100644
index 0000000..2e1fe7e
--- /dev/null
+++ b/slicer/test/initial/dictNamed.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<StructMapNamed>
+ <thing>
+ <id>1</id>
+ <res>
+ <a>1</a>
+ <b>2</b>
+ </res>
+ </thing>
+ <thing>
+ <id>2</id>
+ <res>
+ <a>3</a>
+ <b>4</b>
+ </res>
+ </thing>
+</StructMapNamed>
diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp
index 1780237..525d68d 100644
--- a/slicer/test/serializers.cpp
+++ b/slicer/test/serializers.cpp
@@ -710,3 +710,10 @@ BOOST_DATA_TEST_CASE(typeid_specifies_no_such_type,
BOOST_CHECK_THROW(std::ignore = (Slicer::DeserializeAny<Slicer::XmlStreamDeserializer, TestModule::D12Ptr>(in)),
Slicer::UnknownType);
}
+
+BOOST_AUTO_TEST_CASE(dict_with_name_overrides)
+{
+ auto res = Slicer::DeserializeAny<Slicer::XmlFileDeserializer, TestModule::StructMapNamed>(
+ rootDir / "initial/dictNamed.xml");
+ BOOST_REQUIRE_EQUAL(res.size(), 2);
+}