diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-03-01 19:30:30 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-03-01 19:30:30 -0500 |
commit | 8396c02590a6a0d34d0ba667c5e5cff4860d1ebc (patch) | |
tree | 656562ee65309d548c57dc420d49e46e31ebddc1 /limits.c | |
parent | 4db28a13a8bbc2eabe69f2b86eda392f3bd72274 (diff) |
basic tests for <limits.h>, <float.h>, and <iso646.h>
Diffstat (limited to 'limits.c')
-rw-r--r-- | limits.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/limits.c b/limits.c new file mode 100644 index 0000000..d02935f --- /dev/null +++ b/limits.c @@ -0,0 +1,39 @@ +#include <limits.h> +#include "test.h" + +void test_limits_h(void) +{ + testing_header("limits.h"); + + test_min(CHAR_BIT, 8); + + test_min(SCHAR_MIN, -127); + test_min(SCHAR_MAX, 127); + + test_min(UCHAR_MAX, 255); + test_true(CHAR_MIN == SCHAR_MIN || CHAR_MIN == 0); + test_true(CHAR_MAX == UCHAR_MAX || CHAR_MAX == SCHAR_MAX); + + test_min(MB_LEN_MAX, 1); + + test_min(SHRT_MIN, -32767); + test_min(SHRT_MAX, 32767); + test_min(USHRT_MAX, 65535u); + + test_min(INT_MIN, -32767); + test_min(INT_MAX, 32767); + test_min(UINT_MAX, 65535u); + + test_min(LONG_MIN, -2147483647l); + test_min(LONG_MAX, 2147483647l); + test_min(ULONG_MAX, 4294967295ul); + + #if defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ + test_min(LLONG_MIN, -9223372036854775807ll); + test_min(LLONG_MAX, 9223372036854775807ll); + test_min(ULLONG_MAX, 18446744073709551615ull); + #endif + + + testing_end(); +} |