aboutsummaryrefslogtreecommitdiff
path: root/zencore/intmath.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-09-16 17:04:23 +0200
committerMartin Ridgers <[email protected]>2021-09-16 17:04:44 +0200
commitc3531ee1011a6027f66102c631c45fe077a09202 (patch)
treef046d437e3a20f183eb3d647f960441314b1f88a /zencore/intmath.cpp
parentMissing include (diff)
downloadzen-c3531ee1011a6027f66102c631c45fe077a09202.tar.xz
zen-c3531ee1011a6027f66102c631c45fe077a09202.zip
Added ByteSwap() tests
Diffstat (limited to 'zencore/intmath.cpp')
-rw-r--r--zencore/intmath.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/zencore/intmath.cpp b/zencore/intmath.cpp
index 4039a3b39..ae65085b6 100644
--- a/zencore/intmath.cpp
+++ b/zencore/intmath.cpp
@@ -1,5 +1,6 @@
// Copyright Epic Games, Inc. All Rights Reserved.
+#include <zencore/endian.h>
#include <zencore/intmath.h>
#include <doctest/doctest.h>
@@ -51,6 +52,10 @@ TEST_CASE("intmath")
CHECK(CountTrailingZeros64(0x0000'0000'0000'0001ull) == 0);
CHECK(CountTrailingZeros64(0x0000'0000'8000'0000ull) == 31);
CHECK(CountTrailingZeros64(0x0000'0001'0000'0000ull) == 32);
+
+ CHECK(ByteSwap(uint16_t(0x6d72)) == 0x726d);
+ CHECK(ByteSwap(uint32_t(0x2741'3965)) == 0x6539'4127);
+ CHECK(ByteSwap(uint64_t(0x214d'6172'7469'6e21ull)) == 0x216e'6974'7261'4d21ull);
}
} // namespace zen