diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-13 18:31:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-13 18:31:30 +0300 |
commit | dca3de26978bf0a9d7ac9df8524c90b85f8920da (patch) | |
tree | 0d575e647028c1f3d75e5ee1e4d93603bcda1783 /src/utils/xmlutils_unittest.cc | |
parent | 0dbd25bacb312932e343f154001531b6be84a6ac (diff) | |
download | manaverse-dca3de26978bf0a9d7ac9df8524c90b85f8920da.tar.gz manaverse-dca3de26978bf0a9d7ac9df8524c90b85f8920da.tar.bz2 manaverse-dca3de26978bf0a9d7ac9df8524c90b85f8920da.tar.xz manaverse-dca3de26978bf0a9d7ac9df8524c90b85f8920da.zip |
Add into xmlutils function for read xml file into int map.
Diffstat (limited to 'src/utils/xmlutils_unittest.cc')
-rw-r--r-- | src/utils/xmlutils_unittest.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utils/xmlutils_unittest.cc b/src/utils/xmlutils_unittest.cc index 3fc27c598..55e6397d2 100644 --- a/src/utils/xmlutils_unittest.cc +++ b/src/utils/xmlutils_unittest.cc @@ -89,3 +89,32 @@ TEST_CASE("xmlutils readXmlStringMap 1") REQUIRE(arr["Metal"] == "26"); ResourceManager::deleteInstance(); } + +TEST_CASE("xmlutils readXmlIntMap 1") +{ + client = new Client; + PHYSFS_init("manaplus"); + dirSeparator = "/"; + XML::initXML(); + logger = new Logger(); + ResourceManager::init(); + resourceManager->addToSearchPath("data/test", Append_false); + resourceManager->addToSearchPath("../data/test", Append_false); + + std::map<int32_t, int32_t> arr; + + readXmlIntMap("testintmap.xml", + "tests", + "sub", + "item", + "id", + "val", + arr, + SkipError_false); + + REQUIRE(arr.size() == 3); + REQUIRE(arr[1] == 2); + REQUIRE(arr[10] == 20); + REQUIRE(arr[3] == 0); + ResourceManager::deleteInstance(); +} |