From 5400790e78ee966e890405932bc1268222a41f5d Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Thu, 11 Aug 2022 06:20:07 +0200 Subject: [PATCH] test/nbt*: rename files, move byte tag object test from helper test file into its own file --- ...helpers.cpp => nbt_read_write_helpers.cpp} | 10 ----- src/test/nbt_tags.cpp | 44 +++++++++++++++++++ ....cpp => nbt_write_string_failure_mode.cpp} | 0 3 files changed, 44 insertions(+), 10 deletions(-) rename src/test/{nbt_helpers.cpp => nbt_read_write_helpers.cpp} (98%) create mode 100644 src/test/nbt_tags.cpp rename src/test/{nbt_writestring_failure_mode.cpp => nbt_write_string_failure_mode.cpp} (100%) diff --git a/src/test/nbt_helpers.cpp b/src/test/nbt_read_write_helpers.cpp similarity index 98% rename from src/test/nbt_helpers.cpp rename to src/test/nbt_read_write_helpers.cpp index 594ab1c..d01d91b 100644 --- a/src/test/nbt_helpers.cpp +++ b/src/test/nbt_read_write_helpers.cpp @@ -524,15 +524,5 @@ int main(){ std::cout << "Passed writeString NBT helper test." << std::endl; - //Byte tag constructor test - uint8_t bytetest[] = {0x01, 0x00, 0x02, 0x68, 0x69, 0x32}; - NBT::Byte byte = NBT::Byte(bytetest); - - ASSERT(byte.tagType == 1); - ASSERT(byte.nameSize == 2); - ASSERT(byte.content = 0x32); - ASSERT(byte.name == tiny_utf8::string("hi")); - - std::cout << "Passed Byte Tag constructor test." << std::endl; return 0; } diff --git a/src/test/nbt_tags.cpp b/src/test/nbt_tags.cpp new file mode 100644 index 0000000..7da49f8 --- /dev/null +++ b/src/test/nbt_tags.cpp @@ -0,0 +1,44 @@ +// Copyright 2022, FOSS-VG Developers and Contributers +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, version 3. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied +// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// version 3 along with this program. +// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html + +#include +#include +#include +#include + +#include "assert.hpp" + +#include "../lib/nbt.hpp" +#include "../lib/error.hpp" +#include "../lib/javacompat.hpp" + +int main(){ + std::cout << "################################################################################" << std::endl; + std::cout << "NBT object tests" << std::endl; + std::cout << "################################################################################" << std::endl; + + //Byte tag constructor test + uint8_t bytetest[] = {0x01, 0x00, 0x02, 0x68, 0x69, 0x32}; + NBT::Byte byte = NBT::Byte(bytetest); + + ASSERT(byte.tagType == 1); + ASSERT(byte.nameSize == 2); + ASSERT(byte.content = 0x32); + ASSERT(byte.name == tiny_utf8::string("hi")); + + std::cout << "Passed Byte Tag constructor test." << std::endl; + + return 0; +} diff --git a/src/test/nbt_writestring_failure_mode.cpp b/src/test/nbt_write_string_failure_mode.cpp similarity index 100% rename from src/test/nbt_writestring_failure_mode.cpp rename to src/test/nbt_write_string_failure_mode.cpp