| 1001 int16_t i16; |
1001 int16_t i16; |
| 1002 int32_t i32; |
1002 int32_t i32; |
| 1003 int64_t i64; |
1003 int64_t i64; |
| 1004 CX_TEST_DO { |
1004 CX_TEST_DO { |
| 1005 // do some brute force tests with all ranges |
1005 // do some brute force tests with all ranges |
| |
1006 test_strtoint_rollout_signed(5, 10); |
| 1006 test_strtoint_rollout_signed(47, 10); |
1007 test_strtoint_rollout_signed(47, 10); |
| 1007 test_strtoint_rollout_signed(210, 10); |
1008 test_strtoint_rollout_signed(210, 10); |
| 1008 test_strtoint_rollout_signed(5678, 10); |
1009 test_strtoint_rollout_signed(5678, 10); |
| 1009 test_strtoint_rollout_signed(40678, 10); |
1010 test_strtoint_rollout_signed(40678, 10); |
| 1010 test_strtoint_rollout_signed(1350266537, 10); |
1011 test_strtoint_rollout_signed(1350266537, 10); |
| 1116 test_strtoint_rollout(0xfdf9CE03AbC90815, 16); |
1117 test_strtoint_rollout(0xfdf9CE03AbC90815, 16); |
| 1117 // TODO: roll out base 2 tests, but that needs C23 |
1118 // TODO: roll out base 2 tests, but that needs C23 |
| 1118 |
1119 |
| 1119 // do some special case tests |
1120 // do some special case tests |
| 1120 // -------------------------- |
1121 // -------------------------- |
| |
1122 |
| |
1123 // leading plus |
| |
1124 CX_TEST_ASSERT(0 == cx_strtou32(cx_str("+5"), &u32, 10)); |
| |
1125 CX_TEST_ASSERT(u32 == 5); |
| 1121 |
1126 |
| 1122 // group separators |
1127 // group separators |
| 1123 CX_TEST_ASSERT(0 == cx_strtou32(cx_str("123,456"), &u32, 10)); |
1128 CX_TEST_ASSERT(0 == cx_strtou32(cx_str("123,456"), &u32, 10)); |
| 1124 CX_TEST_ASSERT(u32 == 123456); |
1129 CX_TEST_ASSERT(u32 == 123456); |
| 1125 errno = 0; |
1130 errno = 0; |