From 4805f8d6680c99a416764a03156907adabdc534b Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Thu, 6 Aug 2015 14:22:03 +0200 Subject: Move bigtest validation to its own function --- test/read_test.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'test/read_test.cpp') 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(); - 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()); +} + void test_read_errors() { std::ifstream file; -- cgit 0.0.5-2-1-g0f52