diff options
author | David Robillard <d@drobilla.net> | 2022-11-25 09:19:05 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-25 10:08:49 -0500 |
commit | b2b54b8a11d96f934066af7b5b7d1bce2dd10c57 (patch) | |
tree | a18ba5bcffbdf6fe61eb312c43b766f00da4b30d /test/test_tree.c | |
parent | f33daa2cff42d94401a2eb512a9e0fcbb03f7e34 (diff) | |
download | zix-b2b54b8a11d96f934066af7b5b7d1bce2dd10c57.tar.gz zix-b2b54b8a11d96f934066af7b5b7d1bce2dd10c57.tar.bz2 zix-b2b54b8a11d96f934066af7b5b7d1bce2dd10c57.zip |
Avoid truncating test random seed
Diffstat (limited to 'test/test_tree.c')
-rw-r--r-- | test/test_tree.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/test_tree.c b/test/test_tree.c index f227143..fcab59d 100644 --- a/test/test_tree.c +++ b/test/test_tree.c @@ -19,7 +19,7 @@ #include <stdlib.h> #include <time.h> -static unsigned seed = 1; +static uintptr_t seed = 1; static int int_cmp(const void* a, const void* b, const void* ZIX_UNUSED(user_data)) @@ -263,9 +263,9 @@ main(int argc, char** argv) } else { n_elems = (unsigned)strtoul(argv[1], NULL, 10); if (argc > 2) { - seed = (unsigned)strtoul(argv[2], NULL, 10); + seed = strtoul(argv[2], NULL, 10); } else { - seed = (unsigned)time(NULL); + seed = (uintptr_t)time(NULL); } } @@ -274,13 +274,14 @@ main(int argc, char** argv) return 1; } - printf("Running %u tests with %u elements (seed %u)", n_tests, n_elems, seed); + printf( + "Running %u tests with %u elements (seed %zu)", n_tests, n_elems, seed); for (unsigned i = 0; i < n_tests; ++i) { printf("."); fflush(stdout); if (stress(NULL, i, n_elems)) { - return test_fail("Failure with random seed %u\n", seed); + return test_fail("Failure with random seed %zu\n", seed); } } |