983 test_strtoint_impl(LL, num, base, l, LONG_MIN, LONG_MAX); \ |
983 test_strtoint_impl(LL, num, base, l, LONG_MIN, LONG_MAX); \ |
984 test_strtoint_impl(LL, num, base, ll, LLONG_MIN, LLONG_MAX); \ |
984 test_strtoint_impl(LL, num, base, ll, LLONG_MIN, LLONG_MAX); \ |
985 test_strtoint_impl(LL, num, base, i8, INT8_MIN, INT8_MAX); \ |
985 test_strtoint_impl(LL, num, base, i8, INT8_MIN, INT8_MAX); \ |
986 test_strtoint_impl(LL, num, base, i16, INT16_MIN, INT16_MAX); \ |
986 test_strtoint_impl(LL, num, base, i16, INT16_MIN, INT16_MAX); \ |
987 test_strtoint_impl(LL, num, base, i32, INT32_MIN, INT32_MAX); \ |
987 test_strtoint_impl(LL, num, base, i32, INT32_MIN, INT32_MAX); \ |
988 test_strtoint_impl(LL, num, base, i64, INT64_MIN, INT64_MAX); \ |
988 test_strtoint_impl(LL, num, base, i64, INT64_MIN, INT64_MAX); |
989 test_strtoint_impl(LL, num, base, z, -SSIZE_MAX-1, SSIZE_MAX) |
|
990 |
989 |
991 #define test_strtoint_rollout_signed(num, base) \ |
990 #define test_strtoint_rollout_signed(num, base) \ |
992 test_strtoint_rollout_signed_impl(num, base); \ |
991 test_strtoint_rollout_signed_impl(num, base); \ |
993 test_strtoint_rollout_signed_impl(-num, base) |
992 test_strtoint_rollout_signed_impl(-num, base) |
994 |
993 |
999 test_strtoint_impl(ULL, num, base, ull, 0, ULLONG_MAX); \ |
998 test_strtoint_impl(ULL, num, base, ull, 0, ULLONG_MAX); \ |
1000 test_strtoint_impl(ULL, num, base, u8, 0, UINT8_MAX); \ |
999 test_strtoint_impl(ULL, num, base, u8, 0, UINT8_MAX); \ |
1001 test_strtoint_impl(ULL, num, base, u16, 0, UINT16_MAX); \ |
1000 test_strtoint_impl(ULL, num, base, u16, 0, UINT16_MAX); \ |
1002 test_strtoint_impl(ULL, num, base, u32, 0, UINT32_MAX); \ |
1001 test_strtoint_impl(ULL, num, base, u32, 0, UINT32_MAX); \ |
1003 test_strtoint_impl(ULL, num, base, u64, 0, UINT64_MAX); \ |
1002 test_strtoint_impl(ULL, num, base, u64, 0, UINT64_MAX); \ |
1004 test_strtoint_impl(ULL, num, base, uz, 0, SIZE_MAX) |
1003 test_strtoint_impl(ULL, num, base, z, 0, SIZE_MAX) |
1005 |
1004 |
1006 CX_TEST(test_string_to_signed_integer) { |
1005 CX_TEST(test_string_to_signed_integer) { |
1007 short s; |
1006 short s; |
1008 int i; |
1007 int i; |
1009 long l; |
1008 long l; |
1010 long long ll; |
1009 long long ll; |
1011 int8_t i8; |
1010 int8_t i8; |
1012 int16_t i16; |
1011 int16_t i16; |
1013 int32_t i32; |
1012 int32_t i32; |
1014 int64_t i64; |
1013 int64_t i64; |
1015 ssize_t z; |
|
1016 CX_TEST_DO { |
1014 CX_TEST_DO { |
1017 // do some brute force tests with all ranges |
1015 // do some brute force tests with all ranges |
1018 test_strtoint_rollout_signed(47, 10); |
1016 test_strtoint_rollout_signed(47, 10); |
1019 test_strtoint_rollout_signed(210, 10); |
1017 test_strtoint_rollout_signed(210, 10); |
1020 test_strtoint_rollout_signed(5678, 10); |
1018 test_strtoint_rollout_signed(5678, 10); |
1098 unsigned long long ull; |
1096 unsigned long long ull; |
1099 uint8_t u8; |
1097 uint8_t u8; |
1100 uint16_t u16; |
1098 uint16_t u16; |
1101 uint32_t u32; |
1099 uint32_t u32; |
1102 uint64_t u64; |
1100 uint64_t u64; |
1103 size_t uz; |
1101 size_t z; |
1104 CX_TEST_DO { |
1102 CX_TEST_DO { |
1105 // do some brute force tests with all ranges |
1103 // do some brute force tests with all ranges |
1106 test_strtoint_rollout(47, 10); |
1104 test_strtoint_rollout(47, 10); |
1107 test_strtoint_rollout(210, 10); |
1105 test_strtoint_rollout(210, 10); |
1108 test_strtoint_rollout(5678, 10); |
1106 test_strtoint_rollout(5678, 10); |