diff options
author | Jens Bocklage <jens_bocklage@mentor.com> | 2015-05-05 14:17:42 +0200 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2015-06-17 08:49:34 +0200 |
commit | 0b8287247b30b16c5855e7420e4a9164e02fd5e1 (patch) | |
tree | 8592d1f5aebcce6d7521156ae180013fef3481ff /tests/gtest_dlt_user.cpp | |
parent | 1ff2b808f479dab106545cc90cfb37e84bab204a (diff) | |
download | DLT-daemon-0b8287247b30b16c5855e7420e4a9164e02fd5e1.tar.gz |
Fixing MIN and MAX defines for base integer types
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'tests/gtest_dlt_user.cpp')
-rw-r--r-- | tests/gtest_dlt_user.cpp | 116 |
1 files changed, 99 insertions, 17 deletions
diff --git a/tests/gtest_dlt_user.cpp b/tests/gtest_dlt_user.cpp index c7ffe41..6e9743a 100644 --- a/tests/gtest_dlt_user.cpp +++ b/tests/gtest_dlt_user.cpp @@ -55,6 +55,88 @@ int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const int dlt_unregister_context(DltContext *handle); */ +// define some min and max values (if not present in <limits.h>) +#ifndef UINT8_MIN +#define UINT8_MIN 0 +#endif + +#ifndef UINT16_MIN +#define UINT16_MIN 0 +#endif + +#ifndef UINT32_MIN +#define UINT32_MIN 0 +#endif + +#ifndef UINT64_MIN +#define UINT64_MIN 0 +#endif + +#ifndef UINT8_MAX +#define UINT8_MAX 255 +#endif + +#ifndef UINT16_MAX +#define UINT16_MAX 65535 +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX 4294967295 +#endif + +#ifndef UINT64_MAX +#define UINT64_MAX 18446744073709551615 +#endif + +#ifndef INT8_MIN +#define INT8_MIN -128 +#endif + +#ifndef INT16_MIN +#define INT16_MIN -32768 +#endif + +#ifndef INT32_MIN +#define INT32_MIN -2147483648 +#endif + +#ifndef INT64_MIN +#define INT64_MIN -9223372036854775808 +#endif + +#ifndef INT8_MAX +#define INT8_MAX 127 +#endif + +#ifndef INT16_MAX +#define INT16_MAX 32767 +#endif + +#ifndef INT32_MAX +#define INT32_MAX 2147483647 +#endif + +#ifndef INT64_MAX +#define INT64_MAX 9223372036854775807 +#endif + +#ifndef UINT_MIN +#define UINT_MIN UINT32_MIN +#endif + +#ifndef UINT_MAX +#define UINT_MAX UINT32_MAX +#endif + +#ifndef INT_MIN +#define INT_MIN INT32_MIN +#endif + +#ifndef INT_MAX +#define INT_MAX INT32_MAX +#endif + + ///////////////////////////////////////// // t_dlt_user_log_write_start TEST(t_dlt_user_log_write_start, normal) @@ -474,7 +556,7 @@ TEST(t_dlt_user_log_write_uint, normal) // normal values EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); - data = 0; + data = UINT_MIN; EXPECT_LE(0,dlt_user_log_write_uint(&contextData, data)); data = 1; EXPECT_LE(0,dlt_user_log_write_uint(&contextData, data)); @@ -540,7 +622,7 @@ TEST(t_dlt_user_log_write_uint8, normal) // normal values EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); - data = 0; + data = UINT8_MIN; EXPECT_LE(0,dlt_user_log_write_uint8(&contextData, data)); data = 1; EXPECT_LE(0,dlt_user_log_write_uint8(&contextData, data)); @@ -585,7 +667,7 @@ TEST(t_dlt_user_log_write_uint16, normal) // normal values EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); - data = 0; + data = UINT16_MIN; EXPECT_LE(0,dlt_user_log_write_uint16(&contextData, data)); data = 1; EXPECT_LE(0,dlt_user_log_write_uint16(&contextData, data)); @@ -630,7 +712,7 @@ TEST(t_dlt_user_log_write_uint32, normal) // normal values EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); - data = 0; + data = UINT32_MIN; EXPECT_LE(0,dlt_user_log_write_uint32(&contextData, data)); data = 1; EXPECT_LE(0,dlt_user_log_write_uint32(&contextData, data)); @@ -675,7 +757,7 @@ TEST(t_dlt_user_log_write_uint64, normal) // normal values EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); - data = 0; + data = UINT64_MIN; EXPECT_LE(0,dlt_user_log_write_uint64(&contextData, data)); data = 1; EXPECT_LE(0,dlt_user_log_write_uint64(&contextData, data)); @@ -720,7 +802,7 @@ TEST(t_dlt_user_log_write_uint8_formatted, normal) // normal values EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); - data = 0; + data = UINT8_MIN; EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_DEFAULT)); EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX8)); EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX16)); @@ -813,7 +895,7 @@ TEST(t_dlt_user_log_write_uint16_formatted, normal) // normal values EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); - data = 0; + data = UINT16_MIN; EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_DEFAULT)); EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX8)); EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX16)); @@ -906,7 +988,7 @@ TEST(t_dlt_user_log_write_uint32_formatted, normal) // normal values EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); - data = 0; + data = UINT32_MIN; EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_DEFAULT)); EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX8)); EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX16)); @@ -999,7 +1081,7 @@ TEST(t_dlt_user_log_write_uint64_formatted, normal) // normal values EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); - data = 0; + data = UINT64_MIN; EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_DEFAULT)); EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX8)); EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX16)); @@ -1684,7 +1766,7 @@ TEST(t_dlt_log_string_int, normal) // normal values const char text1[6] = "test1"; - int data = 1; + int data = INT_MIN; EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_DEFAULT, text1, data)); EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_OFF, text1, data)); EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_FATAL, text1, data)); @@ -1701,7 +1783,7 @@ TEST(t_dlt_log_string_int, normal) EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_WARN, text2, data)); EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_INFO, text2, data)); EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_VERBOSE, text2, data)); - data = -1; + data = INT_MAX; EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_DEFAULT, text2, data)); EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_OFF, text2, data)); EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_FATAL, text2, data)); @@ -1769,7 +1851,7 @@ TEST(t_dlt_log_string_uint, normal) // normal values const char text1[6] = "test1"; - unsigned int data = 1; + unsigned int data = UINT_MIN; EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, text1, data)); EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_OFF, text1, data)); EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_FATAL, text1, data)); @@ -1786,7 +1868,7 @@ TEST(t_dlt_log_string_uint, normal) EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_WARN, text2, data)); EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_INFO, text2, data)); EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_VERBOSE, text2, data)); - data = -1; + data = UINT_MAX; EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, text2, data)); EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_OFF, text2, data)); EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_FATAL, text2, data)); @@ -1853,7 +1935,7 @@ TEST(t_dlt_log_int, normal) EXPECT_EQ(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_int normal")); // normal values - int data = 1; + int data = INT_MIN; EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_DEFAULT, data)); EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_OFF, data)); EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_FATAL, data)); @@ -1869,7 +1951,7 @@ TEST(t_dlt_log_int, normal) EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_WARN, data)); EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_INFO, data)); EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_VERBOSE, data)); - data = -1; + data = INT_MAX; EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_DEFAULT, data)); EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_OFF, data)); EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_FATAL, data)); @@ -1932,7 +2014,7 @@ TEST(t_dlt_log_uint, normal) EXPECT_EQ(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_uint normal")); // normal values - unsigned int data = 1; + unsigned int data = UINT_MIN; EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_DEFAULT, data)); EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_OFF, data)); EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_FATAL, data)); @@ -1948,7 +2030,7 @@ TEST(t_dlt_log_uint, normal) EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_WARN, data)); EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_INFO, data)); EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_VERBOSE, data)); - data = -1; + data = UINT_MAX; EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_DEFAULT, data)); EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_OFF, data)); EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_FATAL, data)); |