summaryrefslogtreecommitdiff
path: root/test/nbttest.cpp
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-07-12 20:14:15 +0200
committerljfa-ag <ljfa-ag@web.de>2015-07-12 20:14:15 +0200
commit37717c56332a524026272c4d91b7bd01b3c699fc (patch)
tree2c3eae6aa8027c8f9e1fd90c91bacb39cb6ec825 /test/nbttest.cpp
parent94df1cdedd83beecec1bc0b1fa90445cc7e369db (diff)
downloadProject-Tick-37717c56332a524026272c4d91b7bd01b3c699fc.tar.gz
Project-Tick-37717c56332a524026272c4d91b7bd01b3c699fc.zip
Implement and test list accessors for value
Diffstat (limited to 'test/nbttest.cpp')
-rw-r--r--test/nbttest.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/nbttest.cpp b/test/nbttest.cpp
index 8fdffd0467..8553284543 100644
--- a/test/nbttest.cpp
+++ b/test/nbttest.cpp
@@ -81,7 +81,8 @@ void test_tag_compound()
tag_compound comp{
{"foo", int16_t(12)},
{"bar", "baz"},
- {"baz", -2.0}
+ {"baz", -2.0},
+ {"list", tag_list{int8_t(16), int8_t(17)}}
};
ASSERT(comp["foo"].get_type() == tag_type::Short);
@@ -110,6 +111,7 @@ void test_tag_compound()
ASSERT(comp.at("quux").get_type() == tag_type::Compound);
ASSERT(std::string(comp["quux"].at("Hello")) == "World");
ASSERT(std::string(comp["quux"]["Hello"]) == "World");
+ ASSERT(comp["list"][1] == tag_byte(17));
EXPECT_EXCEPTION(comp.at("nothing"), std::out_of_range);
@@ -117,14 +119,15 @@ void test_tag_compound()
{"foo", int16_t(32)},
{"bar", "barbaz"},
{"baz", -2.0},
- {"quux", tag_compound{{"Hello", "World"}, {"zero", 0}}}
+ {"quux", tag_compound{{"Hello", "World"}, {"zero", 0}}},
+ {"list", tag_list{int8_t(16), int8_t(17)}}
};
ASSERT(comp == comp2);
ASSERT(comp != (const tag_compound&)comp2["quux"]);
ASSERT(comp != comp2["quux"]);
- ASSERT(comp2.size() == 4);
- const char* keys[] = {"bar", "baz", "foo", "quux"}; //alphabetic order
+ ASSERT(comp2.size() == 5);
+ const char* keys[] = {"bar", "baz", "foo", "list", "quux"}; //alphabetic order
unsigned i = 0;
for(const std::pair<const std::string, value>& val: comp2)
{