diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-03-02 05:48:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-03-03 01:13:59 +0300 |
commit | f18d40351434f7baff2ddf1d34933c19cada5dba (patch) | |
tree | 7461cb0d74fe9049b9393e4def7a343ca55a17b0 /src/unittests | |
parent | d7f491da52e985ea50464804d342d9d45ae407f7 (diff) | |
download | manaverse-f18d40351434f7baff2ddf1d34933c19cada5dba.tar.gz manaverse-f18d40351434f7baff2ddf1d34933c19cada5dba.tar.bz2 manaverse-f18d40351434f7baff2ddf1d34933c19cada5dba.tar.xz manaverse-f18d40351434f7baff2ddf1d34933c19cada5dba.zip |
Add support for item stat ranges.
Example:
...
hp="10-15"
mp="1-2"
...
Diffstat (limited to 'src/unittests')
-rw-r--r-- | src/unittests/utils/itemxmlutils.cc | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/unittests/utils/itemxmlutils.cc b/src/unittests/utils/itemxmlutils.cc index 44eba8e61..825bc2f97 100644 --- a/src/unittests/utils/itemxmlutils.cc +++ b/src/unittests/utils/itemxmlutils.cc @@ -171,6 +171,41 @@ TEST_CASE("itemxmlutils readItemStatsString 1", "") } } + SECTION("test4") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test4"); + readItemStatsString(effect, node, fields); + REQUIRE(effect == "HP +10 - +15"); + } + + SECTION("test5") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test5"); + readItemStatsString(effect, node, fields); + REQUIRE(effect == "Weight 2"); + } + + SECTION("test6") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test6"); + readItemStatsString(effect, node, fields); + REQUIRE(effect == "Weight 2 - 3"); + } + + SECTION("test7") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test7"); + readItemStatsString(effect, node, fields); + REQUIRE(effect == "Weight 2-"); + } + + SECTION("test8") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test8"); + readItemStatsString(effect, node, fields); + REQUIRE(effect == "Weight -2"); + } + delete2(userPalette); delete2(theme); delete2(client); @@ -329,6 +364,46 @@ TEST_CASE("itemxmlutils readItemStatsVector 1", "") } } + SECTION("test4") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test4"); + readItemStatsVector(effect, node, fields); + REQUIRE(effect.size() == 1); + REQUIRE(effect[0] == "HP +10 - +15"); + } + + SECTION("test5") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test5"); + readItemStatsVector(effect, node, fields); + REQUIRE(effect.size() == 1); + REQUIRE(effect[0] == "Weight 2"); + } + + SECTION("test6") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test6"); + readItemStatsVector(effect, node, fields); + REQUIRE(effect.size() == 1); + REQUIRE(effect[0] == "Weight 2 - 3"); + } + + SECTION("test7") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test7"); + readItemStatsVector(effect, node, fields); + REQUIRE(effect.size() == 1); + REQUIRE(effect[0] == "Weight 2-"); + } + + SECTION("test8") + { + XmlNodePtr node = XML::findFirstChildByName(root, "test8"); + readItemStatsVector(effect, node, fields); + REQUIRE(effect.size() == 1); + REQUIRE(effect[0] == "Weight -2"); + } + delete2(userPalette); delete2(theme); delete2(client); |