tesst/nbt_tags: Choose a more sensible value for int8_0

Soda
BodgeMaster 2022-10-06 20:46:50 +02:00
parent 6bdf99c897
commit be08a97275
1 changed files with 9 additions and 5 deletions

View File

@ -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;