tests: add test_internal__safe_cast()
This commit is contained in:
parent
e7757fcbda
commit
39c3692d21
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "../src/gmio_core/internal/byte_codec.h"
|
#include "../src/gmio_core/internal/byte_codec.h"
|
||||||
#include "../src/gmio_core/internal/byte_swap.h"
|
#include "../src/gmio_core/internal/byte_swap.h"
|
||||||
|
#include "../src/gmio_core/internal/safe_cast.h"
|
||||||
#include "../src/gmio_core/internal/string_parse.h"
|
#include "../src/gmio_core/internal/string_parse.h"
|
||||||
|
|
||||||
#include "stream_buffer.h"
|
#include "stream_buffer.h"
|
||||||
@ -56,6 +57,17 @@ const char* test_internal__byte_codec()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* test_internal__safe_cast()
|
||||||
|
{
|
||||||
|
#if GMIO_TARGET_ARCH_BIT_SIZE > 32
|
||||||
|
const size_t maxUInt32 = 0xFFFFFFFF;
|
||||||
|
UTEST_ASSERT(gmio_size_to_uint32(maxUInt32 + 1) == 0xFFFFFFFF);
|
||||||
|
UTEST_ASSERT(gmio_size_to_uint32(0xFFFFFFFF) == 0xFFFFFFFF);
|
||||||
|
UTEST_ASSERT(gmio_size_to_uint32(100) == 100);
|
||||||
|
#endif
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const char* test_internal__string_parse()
|
const char* test_internal__string_parse()
|
||||||
{
|
{
|
||||||
const char text[] =
|
const char text[] =
|
||||||
@ -127,6 +139,7 @@ const char* all_tests()
|
|||||||
UTEST_SUITE_START();
|
UTEST_SUITE_START();
|
||||||
UTEST_RUN(test_internal__byte_swap);
|
UTEST_RUN(test_internal__byte_swap);
|
||||||
UTEST_RUN(test_internal__byte_codec);
|
UTEST_RUN(test_internal__byte_codec);
|
||||||
|
UTEST_RUN(test_internal__safe_cast);
|
||||||
UTEST_RUN(test_internal__string_parse);
|
UTEST_RUN(test_internal__string_parse);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user