From be08a972753d009b804abf903b555d84e37a61f1 Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Thu, 6 Oct 2022 20:46:50 +0200 Subject: [PATCH] tesst/nbt_tags: Choose a more sensible value for int8_0 --- src/test/nbt_tags.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/test/nbt_tags.cpp b/src/test/nbt_tags.cpp index 6c5515a..31bf51a 100644 --- a/src/test/nbt_tags.cpp +++ b/src/test/nbt_tags.cpp @@ -59,15 +59,16 @@ int main(){ std::cout << "Passed End test." << std::endl; NBT::Tag::Int8 int8_0 = NBT::Tag::Int8(); - int8_0.setValue(69); + int8_0.setValue(-128); int8_0.name = "int8_0"; NBT::Tag::Int8 int8_1 = NBT::Tag::Int8("int8_1", 127); - ASSERT(int8_0.getValue() == 69); + ASSERT(int8_0.getValue() == -128); ASSERT(int8_1.getValue() == 127); ASSERT(int8_0.getTagType() == 1 && int8_1.getTagType() == 1); ASSERT(!int8_0.serialize(&vector).isError); ASSERT(!int8_1.serialize(&vector).isError); ASSERT(vector.size() == 20); + std::cout << (int) vector.at(9) << std::endl; ASSERT( vector.at( 0) == 1 && vector.at( 1) == 0 && @@ -78,7 +79,7 @@ int main(){ vector.at( 6) == '8' && vector.at( 7) == '_' && vector.at( 8) == '0' && - vector.at( 9) == 69 && + vector.at( 9) == 128 && vector.at(10) == 1 && vector.at(11) == 0 && vector.at(12) == 6 && @@ -98,19 +99,22 @@ int main(){ vector.at(0) == 1 && vector.at(1) == 0 && vector.at(2) == 0 && - vector.at(3) == 69 + vector.at(3) == 128 ); vector.clear(); ASSERT(!int8_0.serializeWithoutHeader(&vector).isError); ASSERT(!int8_1.serializeWithoutHeader(&vector).isError); ASSERT(vector.size() == 2); ASSERT( - vector.at(0) == 69 && + vector.at(0) == 128 && vector.at(1) == 127 ); vector.clear(); std::cout << "Passed Int8 test." << std::endl; + //NBT::Tag::Int16 int16_0 = NBT::Tag::Int16(); + //int16_0.name = "int16_0"; + //int16_0.setValue(32767); //TODO: Check that we actually get overrun when trying to store a name that's too long return 0;