diff options
| author | Mattias Andrée <m@maandree.se> | 2025-12-04 19:25:47 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2025-12-04 19:25:47 +0100 |
| commit | 2bf851de6dd3a64f91a72a9afba2b3637dbbe154 (patch) | |
| tree | 5326b90653cb19bbe3749522c95d33ac736167bf /libj2_j2u_test_high_ju.c | |
| download | libj2-2bf851de6dd3a64f91a72a9afba2b3637dbbe154.tar.gz libj2-2bf851de6dd3a64f91a72a9afba2b3637dbbe154.tar.bz2 libj2-2bf851de6dd3a64f91a72a9afba2b3637dbbe154.tar.xz | |
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | libj2_j2u_test_high_ju.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libj2_j2u_test_high_ju.c b/libj2_j2u_test_high_ju.c new file mode 100644 index 0000000..0d03b40 --- /dev/null +++ b/libj2_j2u_test_high_ju.c @@ -0,0 +1,35 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + +extern inline int libj2_j2u_test_high_ju(const struct libj2_j2u *a, uintmax_t b); +/* TODO Add man page */ + + +#else + +int +main(void) +{ + struct libj2_j2u a; + uintmax_t h, i, j; + + for (h = 0; h < 10; h++) { + a.low = h; + for (i = 0; i < 128; i++) { + for (j = 0; j < 128; j++) { + a.high = i; + if (i & j) + EXPECT(libj2_j2u_test_high_ju(&a, j) == 1); + else + EXPECT(libj2_j2u_test_high_ju(&a, j) == 0); + EXPECT(a.low == h); + EXPECT(a.high == i); + } + } + } + + return 0; +} + +#endif |
