From 5272636cb8fa394e1cc959d0f24b0580a732c37d Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Mon, 15 Aug 2022 13:30:53 +0200 Subject: [PATCH] test/nbt_read_write_helpers: fix unit tests for readString() --- src/test/nbt_read_write_helpers.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/nbt_read_write_helpers.cpp b/src/test/nbt_read_write_helpers.cpp index cd08330..02b5b54 100644 --- a/src/test/nbt_read_write_helpers.cpp +++ b/src/test/nbt_read_write_helpers.cpp @@ -490,9 +490,10 @@ int main(){ tiny_utf8::string normalString = tiny_utf8::string(normalStdString); - ASSERT(normalString == NBT::helper::readString(reinterpret_cast(javaStdString.data()), 0x75, 0).value) - ASSERT(NBT::helper::readString(reinterpret_cast(javaStdString.data()), 0xFFFFF, 0).errorCode == ErrorCodes::OVERRUN); - ASSERT(NBT::helper::readString(reinterpret_cast(javaStdString.data()), 0xF, 0).errorCode == ErrorCodes::MISMATCHEDSIZE); + ASSERT(normalString == NBT::helper::readString(reinterpret_cast(javaStdString.data()), javaStdString.size(), 0).value) + + javaStdString[0] = '1'; + ASSERT(NBT::helper::readString(reinterpret_cast(javaStdString.data()), javaStdString.size(), 0).errorCode == ErrorCodes::OVERRUN); std::cout << "Passed readString NBT helper test." << std::endl; delete nextChar;