summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-08-06 14:22:03 +0200
committerljfa-ag <ljfa-ag@web.de>2015-08-06 14:22:03 +0200
commit4805f8d6680c99a416764a03156907adabdc534b (patch)
treea20f9a814f836381a2266672c9dc54a7c065ff28
parent8e2fe9c45f69d6dc0ab9157f5198238bb0c2583e (diff)
downloadProject-Tick-4805f8d6680c99a416764a03156907adabdc534b.tar.gz
Project-Tick-4805f8d6680c99a416764a03156907adabdc534b.zip
Move bigtest validation to its own function
-rw-r--r--test/read_test.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/test/read_test.cpp b/test/read_test.cpp
index 291bf35309..e7b0e2796a 100644
--- a/test/read_test.cpp
+++ b/test/read_test.cpp
@@ -97,19 +97,9 @@ void test_stream_reader_little()
ASSERT(!is);
}
-void test_read_bigtest()
+//Tests if comp equals an extended variant of Notch's bigtest NBT
+void verify_bigtest_structure(const tag_compound& comp)
{
- //Uses an extended variant of Notch's original bigtest file
- std::ifstream file("bigtest_uncompr", std::ios::binary);
- ASSERT(file);
- nbt::io::stream_reader reader(file);
-
- auto pair = reader.read_tag();
- ASSERT(pair.first == "Level");
-
- ASSERT(pair.second->get_type() == tag_type::Compound);
- const tag_compound& comp = pair.second->as<tag_compound>();
-
ASSERT(comp.size() == 13);
ASSERT(comp.at("byteTest") == tag_byte(127));
@@ -143,6 +133,19 @@ void test_read_bigtest()
{0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f}));
}
+void test_read_bigtest()
+{
+ //Uses an extended variant of Notch's original bigtest file
+ std::ifstream file("bigtest_uncompr", std::ios::binary);
+ ASSERT(file);
+ nbt::io::stream_reader reader(file);
+
+ auto pair = reader.read_tag();
+ ASSERT(pair.first == "Level");
+ ASSERT(pair.second->get_type() == tag_type::Compound);
+ verify_bigtest_structure(pair.second->as<tag_compound>());
+}
+
void test_read_errors()
{
std::ifstream file;