diff options
author | David Robillard <d@drobilla.net> | 2022-08-18 13:18:52 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-18 14:33:37 -0400 |
commit | f65912600fc301cbdbb613f1df0dc29820f1da35 (patch) | |
tree | 43db69627433fbb8f5acd13c6cf0ef8a3c3b829d /test/bitset_test.c | |
parent | c4b8ca3dc222b06c40ebcb416d653e17e88de858 (diff) | |
download | zix-f65912600fc301cbdbb613f1df0dc29820f1da35.tar.gz zix-f65912600fc301cbdbb613f1df0dc29820f1da35.tar.bz2 zix-f65912600fc301cbdbb613f1df0dc29820f1da35.zip |
Use conventional test executable names
Diffstat (limited to 'test/bitset_test.c')
-rw-r--r-- | test/bitset_test.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/test/bitset_test.c b/test/bitset_test.c deleted file mode 100644 index ef0528f..0000000 --- a/test/bitset_test.c +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2014-2020 David Robillard <d@drobilla.net> -// SPDX-License-Identifier: ISC - -#undef NDEBUG - -#include "zix/bitset.h" - -#include <assert.h> - -#define N_BITS 256U -#define N_ELEMS (ZIX_BITSET_ELEMS(N_BITS)) - -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) - -int -main(void) -{ - ZixBitset b[N_ELEMS]; - ZixBitsetTally t[N_ELEMS]; - - zix_bitset_clear(b, t, N_BITS); - assert(zix_bitset_count_up_to(b, t, N_BITS) == 0); - - for (size_t i = 0; i < N_BITS; ++i) { - zix_bitset_set(b, t, i); - assert(zix_bitset_get(b, i)); - - const size_t count = zix_bitset_count_up_to(b, t, N_BITS); - assert(count == i + 1); - } - - for (size_t i = 0; i <= N_BITS; ++i) { - const size_t count = zix_bitset_count_up_to(b, t, i); - assert(count == i); - } - - for (size_t i = 0; i <= N_BITS; ++i) { - if (i < N_BITS) { - zix_bitset_reset(b, t, i); - } - - const size_t count = zix_bitset_count_up_to(b, t, i); - assert(count == 0); - } - - zix_bitset_clear(b, t, N_BITS); - for (size_t i = 0; i < N_BITS; i += 2) { - zix_bitset_set(b, t, i); - - const size_t count = zix_bitset_count_up_to(b, t, i + 1); - const size_t result = MIN(N_BITS / 2, i / 2 + 1); - - assert(count == result); - } - - zix_bitset_clear(b, t, N_BITS); - for (size_t i = 0; i < N_BITS; ++i) { - if (i % 2 == 0) { - zix_bitset_set(b, t, i); - - const size_t count = zix_bitset_count_up_to_if(b, t, i); - const size_t result = MIN(N_BITS / 2, i / 2); - assert(count == result); - } else { - assert(zix_bitset_count_up_to_if(b, t, i) == (size_t)-1); - } - } - - return 0; -} |