aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_basictypeconv.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-05-01 04:51:26 +0200
committerSven Gothel <[email protected]>2022-05-01 04:51:26 +0200
commit0e7bd37a2e2f9e16dfecc693bab8692e90288deb (patch)
treebd094ef0f61b3d1e5c8b70cc71b9c2720066f5e2 /test/test_basictypeconv.cpp
parent2673fe362a92dbec38504d32bf0df4d68167ceac (diff)
Complete jau::int_literals: Add 8-, 16- and 32- bit wide signed and unsigned integer literals (stdint), Fix Return type and align signed and unsigned suffixes: 'u' unsigned and 'i' signed integer value; Added unit test.
Diffstat (limited to 'test/test_basictypeconv.cpp')
-rw-r--r--test/test_basictypeconv.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_basictypeconv.cpp b/test/test_basictypeconv.cpp
index a3d6621..5ecab12 100644
--- a/test/test_basictypeconv.cpp
+++ b/test/test_basictypeconv.cpp
@@ -33,6 +33,8 @@
static constexpr inline bool VERBOSE = false;
+using namespace jau::int_literals;
+
/**
* Test private impl namespace
*/
@@ -367,3 +369,23 @@ TEST_CASE( "HexString from and to byte vector conversion - Test 04", "[hexstring
// Assert.assertArrayEquals(lalaSink1, lalaSink2);
}
}
+
+TEST_CASE( "Integer Type Test Test 05", "[integer][type]" ) {
+ REQUIRE( 3_i8 == (int8_t)3 );
+ REQUIRE( 3_u8 == (uint8_t)3 );
+
+ REQUIRE( 3_i16 == (int16_t)3 );
+ REQUIRE( 3_u16 == (uint16_t)3 );
+
+ REQUIRE( 3_i32 == (int32_t)3 );
+ REQUIRE( 3_u32 == (uint32_t)3 );
+
+ REQUIRE( 3_i64 == (int64_t)3 );
+ REQUIRE( 3_u64 == (uint64_t)3 );
+
+ REQUIRE( 3_iz == (ssize_t)3 );
+ REQUIRE( 3_uz == (size_t)3 );
+
+ REQUIRE( 3_inz == (jau::snsize_t)3 );
+ REQUIRE( 3_unz == (jau::nsize_t)3 );
+}