summaryrefslogtreecommitdiff
path: root/src/utils/xmlutils_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-29 01:01:26 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-29 01:01:26 +0300
commitc963418a6a073f4d69a818f5f763133b0c4d44d5 (patch)
tree3c35fbacffe9a45d2eca21da182f672ebdfad4dc /src/utils/xmlutils_unittest.cc
parent0a05a1a91398f97dd3d7fcc2d8c630e1ef6f29dd (diff)
downloadplus-c963418a6a073f4d69a818f5f763133b0c4d44d5.tar.gz
plus-c963418a6a073f4d69a818f5f763133b0c4d44d5.tar.bz2
plus-c963418a6a073f4d69a818f5f763133b0c4d44d5.tar.xz
plus-c963418a6a073f4d69a818f5f763133b0c4d44d5.zip
Add test for function readXmlStringMap.
Diffstat (limited to 'src/utils/xmlutils_unittest.cc')
-rw-r--r--src/utils/xmlutils_unittest.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/utils/xmlutils_unittest.cc b/src/utils/xmlutils_unittest.cc
index 0143c16f3..9ea9921aa 100644
--- a/src/utils/xmlutils_unittest.cc
+++ b/src/utils/xmlutils_unittest.cc
@@ -58,3 +58,30 @@ TEST_CASE("xmlutils readXmlIntVector 1")
REQUIRE(1 == arr[3]);
REQUIRE(1 == arr[4]);
}
+
+TEST_CASE("xmlutils readXmlStringMap 1")
+{
+ client = new Client;
+ PHYSFS_init("manaplus");
+ dirSeparator = "/";
+ XML::initXML();
+ logger = new Logger();
+ ResourceManager::init();
+ resourceManager->addToSearchPath("data", Append_false);
+ resourceManager->addToSearchPath("../data", Append_false);
+
+ std::map<std::string, std::string> arr;
+
+ readXmlStringMap("graphics/sprites/manaplus_emotes.xml",
+ "emotes",
+ "emote",
+ "sprite",
+ "name",
+ "variant",
+ arr);
+
+ REQUIRE(arr.size() == 27);
+ REQUIRE(arr["Kitty"] == "0");
+ REQUIRE(arr["xD"] == "1");
+ REQUIRE(arr["Metal"] == "26");
+}