diff options
| author | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 17:35:01 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 17:35:01 +0300 |
| commit | 1a0ffe372f4da8408c5d08a36013536a3396b9e6 (patch) | |
| tree | 440f2a9a325c9ab4cb5b16dc6a8193317cabf8d7 /test/format_test.cpp | |
| parent | f4d8ea0fa76174843adf7f77ebad0ad17d2377ed (diff) | |
| download | Project-Tick-1a0ffe372f4da8408c5d08a36013536a3396b9e6.tar.gz Project-Tick-1a0ffe372f4da8408c5d08a36013536a3396b9e6.zip | |
NOISSUE reformat libnbtplusplus to new MeshMC clang format rules
Signed-off-by: Mehmet Samet Duman <yongdohyun@projecttick.org>
Diffstat (limited to 'test/format_test.cpp')
| -rw-r--r-- | test/format_test.cpp | 119 |
1 files changed, 60 insertions, 59 deletions
diff --git a/test/format_test.cpp b/test/format_test.cpp index ed8d2d1bfc..f7d95985c9 100644 --- a/test/format_test.cpp +++ b/test/format_test.cpp @@ -21,7 +21,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with libnbt++. If not, see <http://www.gnu.org/licenses/>. */ -//#include "text/json_formatter.h" +// #include "text/json_formatter.h" #include "io/stream_reader.h" #include "io/stream_writer.h" #include <fstream> @@ -33,73 +33,74 @@ using namespace nbt; int main() { - // Write that into a file and read back for testing - tag_compound comp{ - {"byte", tag_byte(-128)}, - {"short", tag_short(-32768)}, - {"int", tag_int(-2147483648)}, - {"long", tag_long(-9223372036854775808U)}, + // Write that into a file and read back for testing + tag_compound comp{ + {"byte", tag_byte(-128)}, + {"short", tag_short(-32768)}, + {"int", tag_int(-2147483648)}, + {"long", tag_long(-9223372036854775808U)}, - {"float 1", 1.618034f}, - {"float 2", 6.626070e-34f}, - {"float 3", 2.273737e+29f}, - {"float 4", -std::numeric_limits<float>::infinity()}, - {"float 5", std::numeric_limits<float>::quiet_NaN()}, + {"float 1", 1.618034f}, + {"float 2", 6.626070e-34f}, + {"float 3", 2.273737e+29f}, + {"float 4", -std::numeric_limits<float>::infinity()}, + {"float 5", std::numeric_limits<float>::quiet_NaN()}, - {"double 1", 3.141592653589793}, - {"double 2", 1.749899444387479e-193}, - {"double 3", 2.850825855152578e+175}, - {"double 4", -std::numeric_limits<double>::infinity()}, - {"double 5", std::numeric_limits<double>::quiet_NaN()}, + {"double 1", 3.141592653589793}, + {"double 2", 1.749899444387479e-193}, + {"double 3", 2.850825855152578e+175}, + {"double 4", -std::numeric_limits<double>::infinity()}, + {"double 5", std::numeric_limits<double>::quiet_NaN()}, - {"string 1", "Hello World! \u00E4\u00F6\u00FC\u00DF"}, - {"string 2", "String with\nline breaks\tand tabs"}, + {"string 1", "Hello World! \u00E4\u00F6\u00FC\u00DF"}, + {"string 2", "String with\nline breaks\tand tabs"}, - {"byte array", tag_byte_array{12, 13, 14, 15, 16}}, - {"int array", tag_int_array{0x0badc0de, -0x0dedbeef, 0x1badbabe}}, - {"long array", tag_long_array{0x0badc0de0badc0de, -0x0dedbeef0dedbeef, 0x1badbabe1badbabe}}, + {"byte array", tag_byte_array{12, 13, 14, 15, 16}}, + {"int array", tag_int_array{0x0badc0de, -0x0dedbeef, 0x1badbabe}}, + {"long array", tag_long_array{0x0badc0de0badc0de, -0x0dedbeef0dedbeef, + 0x1badbabe1badbabe}}, - {"list (empty)", tag_list::of<tag_byte_array>({})}, - {"list (float)", tag_list{2.0f, 1.0f, 0.5f, 0.25f}}, - {"list (list)", tag_list::of<tag_list>({ - {}, - {4, 5, 6}, - {tag_compound{{"egg", "ham"}}, tag_compound{{"foo", "bar"}}} - })}, - {"list (compound)", tag_list::of<tag_compound>({ - {{"created-on", 42}, {"names", tag_list{"Compound", "tag", "#0"}}}, - {{"created-on", 45}, {"names", tag_list{"Compound", "tag", "#1"}}} - })}, + {"list (empty)", tag_list::of<tag_byte_array>({})}, + {"list (float)", tag_list{2.0f, 1.0f, 0.5f, 0.25f}}, + {"list (list)", + tag_list::of<tag_list>( + {{}, + {4, 5, 6}, + {tag_compound{{"egg", "ham"}}, tag_compound{{"foo", "bar"}}}})}, + {"list (compound)", + tag_list::of<tag_compound>( + {{{"created-on", 42}, + {"names", tag_list{"Compound", "tag", "#0"}}}, + {{"created-on", 45}, + {"names", tag_list{"Compound", "tag", "#1"}}}})}, - {"compound (empty)", tag_compound()}, - {"compound (nested)", tag_compound{ - {"key", "value"}, - {"key with \u00E4\u00F6\u00FC", tag_byte(-1)}, - {"key with\nnewline and\ttab", tag_compound{}} - }}, + {"compound (empty)", tag_compound()}, + {"compound (nested)", + tag_compound{{"key", "value"}, + {"key with \u00E4\u00F6\u00FC", tag_byte(-1)}, + {"key with\nnewline and\ttab", tag_compound{}}}}, - {"null", nullptr} - }; + {"null", nullptr}}; - std::cout << "----- default operator<<:\n"; - std::cout << comp; - std::cout << "\n-----" << std::endl; + std::cout << "----- default operator<<:\n"; + std::cout << comp; + std::cout << "\n-----" << std::endl; - // Write to file and read back - { - tag_compound file_comp = comp; - file_comp.erase("null"); - std::ofstream out("test_output.nbt", std::ios::binary); - nbt::io::write_tag("root", file_comp, out); - } + // Write to file and read back + { + tag_compound file_comp = comp; + file_comp.erase("null"); + std::ofstream out("test_output.nbt", std::ios::binary); + nbt::io::write_tag("root", file_comp, out); + } - { - std::ifstream in("test_output.nbt", std::ios::binary); - auto read_pair = nbt::io::read_compound(in); - std::cout << "----- read back from file:\n"; - std::cout << *read_pair.second; - std::cout << "\n-----" << std::endl; - } + { + std::ifstream in("test_output.nbt", std::ios::binary); + auto read_pair = nbt::io::read_compound(in); + std::cout << "----- read back from file:\n"; + std::cout << *read_pair.second; + std::cout << "\n-----" << std::endl; + } - return 0; + return 0; } |
