summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-08-05 14:47:19 +0200
committerljfa-ag <ljfa-ag@web.de>2015-08-05 14:47:19 +0200
commit9ac0ed01c014b75441601271c5ab0cf9b8ec4791 (patch)
treed4508580579329d70adcbf3694e7171db930ecac
parent7f2dc607b7ba1192feeae00f4aeff50385e097ae (diff)
downloadProject-Tick-9ac0ed01c014b75441601271c5ab0cf9b8ec4791.tar.gz
Project-Tick-9ac0ed01c014b75441601271c5ab0cf9b8ec4791.zip
Extend bigtest with tag_list (end) and tag_int_array
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/io/bigtest.nbtbin515 -> 561 bytes
-rw-r--r--test/io/bigtest_uncompr (renamed from test/io/bigtest_uncompressed)bin1544 -> 1601 bytes
-rw-r--r--test/io/read_test.cpp10
4 files changed, 8 insertions, 4 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ae8c7c03e0..09520c31bd 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,5 +14,5 @@ add_executable(read_test io/read_test.cpp)
target_link_libraries(read_test nbt++)
add_custom_command(TARGET read_test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
- copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/io/bigtest_uncompressed ${CMAKE_CURRENT_BINARY_DIR})
+ copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/io/bigtest_uncompr ${CMAKE_CURRENT_BINARY_DIR})
add_test(read_test read_test)
diff --git a/test/io/bigtest.nbt b/test/io/bigtest.nbt
index 945b86f562..de1a91268b 100644
--- a/test/io/bigtest.nbt
+++ b/test/io/bigtest.nbt
Binary files differ
diff --git a/test/io/bigtest_uncompressed b/test/io/bigtest_uncompr
index a2021df7cb..dc1c9c113f 100644
--- a/test/io/bigtest_uncompressed
+++ b/test/io/bigtest_uncompr
Binary files differ
diff --git a/test/io/read_test.cpp b/test/io/read_test.cpp
index a2c6b48844..d057a686f9 100644
--- a/test/io/read_test.cpp
+++ b/test/io/read_test.cpp
@@ -99,7 +99,8 @@ void test_stream_reader_little()
void test_read_bigtest()
{
- std::ifstream file("bigtest_uncompressed", std::ios::binary);
+ //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);
@@ -110,7 +111,7 @@ void test_read_bigtest()
ASSERT(tagptr->get_type() == tag_type::Compound);
const tag_compound& comp = static_cast<const tag_compound&>(*tagptr);
- ASSERT(comp.size() == 11);
+ ASSERT(comp.size() == 13);
ASSERT(comp.at("byteTest") == tag_byte(127));
ASSERT(comp.at("shortTest") == tag_short(32767));
@@ -131,13 +132,16 @@ void test_read_bigtest()
{{"created-on", tag_long(1264099775885)}, {"name", "Compound tag #0"}},
{{"created-on", tag_long(1264099775885)}, {"name", "Compound tag #1"}}
}));
-
ASSERT(comp.at("listTest (long)") == tag_list::of<tag_long>({11, 12, 13, 14, 15}));
+ ASSERT(comp.at("listTest (end)") == tag_list());
ASSERT((comp.at("nested compound test") == tag_compound{
{"egg", tag_compound{{"value", 0.5f}, {"name", "Eggbert"}}},
{"ham", tag_compound{{"value", 0.75f}, {"name", "Hampus"}}}
}));
+
+ ASSERT(comp.at("intArrayTest") == tag_int_array(
+ {0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f}));
}
int main()