diff options
author | David Robillard <d@drobilla.net> | 2022-11-25 09:55:27 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-25 10:08:49 -0500 |
commit | 0569a7ad70a82d68548bbe4cf79bcc64d5f9878d (patch) | |
tree | 1eefbd728f33f31b0d270b5c0e76754a6ced7913 /test/test_tree.c | |
parent | 112fa18bfa293629ccb90fbd952aa6e61398da80 (diff) | |
download | zix-0569a7ad70a82d68548bbe4cf79bcc64d5f9878d.tar.gz zix-0569a7ad70a82d68548bbe4cf79bcc64d5f9878d.tar.bz2 zix-0569a7ad70a82d68548bbe4cf79bcc64d5f9878d.zip |
Constrain test parameters to reasonable limits
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 fcab59d..700729b 100644 --- a/test/test_tree.c +++ b/test/test_tree.c @@ -4,6 +4,7 @@ #undef NDEBUG #include "failing_allocator.h" +#include "test_args.h" #include "test_data.h" #include "zix/allocator.h" @@ -250,7 +251,7 @@ int main(int argc, char** argv) { const unsigned n_tests = 3; - unsigned n_elems = 0; + size_t n_elems = 0; assert(!zix_tree_iter_next(NULL)); assert(!zix_tree_iter_prev(NULL)); @@ -259,9 +260,9 @@ main(int argc, char** argv) test_failed_alloc(); if (argc == 1) { - n_elems = 100000; + n_elems = 100000U; } else { - n_elems = (unsigned)strtoul(argv[1], NULL, 10); + n_elems = zix_test_size_arg(argv[1], 4U, 1U << 20U); if (argc > 2) { seed = strtoul(argv[2], NULL, 10); } else { @@ -269,13 +270,13 @@ main(int argc, char** argv) } } - if (n_elems == 0) { + if (!n_elems) { fprintf(stderr, "USAGE: %s [N_ELEMS]\n", argv[0]); return 1; } printf( - "Running %u tests with %u elements (seed %zu)", n_tests, n_elems, seed); + "Running %u tests with %zu elements (seed %zu)", n_tests, n_elems, seed); for (unsigned i = 0; i < n_tests; ++i) { printf("."); |