From b14874978a3e3da6439b8a71c9cd3c804ebab33c Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Thu, 13 Jan 2022 21:23:20 +0100 Subject: Fix WriteXZYPosition64 and add tests --- tests/ByteBuffer/ByteBufferTest.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/ByteBuffer/ByteBufferTest.cpp') diff --git a/tests/ByteBuffer/ByteBufferTest.cpp b/tests/ByteBuffer/ByteBufferTest.cpp index 9aecc2e3c..0cd14e246 100644 --- a/tests/ByteBuffer/ByteBufferTest.cpp +++ b/tests/ByteBuffer/ByteBufferTest.cpp @@ -70,8 +70,40 @@ static void TestWrap(void) +static void TestXYZPositionRoundtrip(void) +{ + cByteBuffer buf(50); + buf.WriteXYZPosition64(-33554432, -2048, -33554432); // Testing the minimun values + int x, y, z; + TEST_TRUE(buf.ReadXYZPosition64(x, y, z)); + TEST_EQUAL(x, -33554432); + TEST_EQUAL(y, -2048); + TEST_EQUAL(z, -33554432); +} + + + + + +static void TestXZYPositionRoundtrip(void) +{ + cByteBuffer buf(50); + buf.WriteXZYPosition64(-33554432, -2048, -33554432); // Testing the minimun values + int x, y, z; + TEST_TRUE(buf.ReadXZYPosition64(x, y, z)); + TEST_EQUAL(x, -33554432); + TEST_EQUAL(y, -2048); + TEST_EQUAL(z, -33554432); +} + + + + + IMPLEMENT_TEST_MAIN("ByteBuffer", TestRead(); TestWrite(); TestWrap(); + TestXYZPositionRoundtrip(); + TestXZYPositionRoundtrip(); ) -- cgit v1.2.3