summaryrefslogtreecommitdiffstats
path: root/test/test_bitset.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-11-17 12:10:38 -0500
committerDavid Robillard <d@drobilla.net>2022-11-17 12:11:12 -0500
commitf85870e15491cc98f8a0fa247d79073e98f1694e (patch)
tree7a14ad94359f472a0a26491b3d3c6ceb1f1ee745 /test/test_bitset.c
parent68d02a48ea89d45f16f7901bf46849ea923841c0 (diff)
downloadzix-f85870e15491cc98f8a0fa247d79073e98f1694e.tar.gz
zix-f85870e15491cc98f8a0fa247d79073e98f1694e.tar.bz2
zix-f85870e15491cc98f8a0fa247d79073e98f1694e.zip
Remove ZixBitset
Diffstat (limited to 'test/test_bitset.c')
-rw-r--r--test/test_bitset.c71
1 files changed, 0 insertions, 71 deletions
diff --git a/test/test_bitset.c b/test/test_bitset.c
deleted file mode 100644
index 67f6567..0000000
--- a/test/test_bitset.c
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2014-2020 David Robillard <d@drobilla.net>
-// SPDX-License-Identifier: ISC
-
-#undef NDEBUG
-
-#include "zix/bitset.h"
-
-#include <assert.h>
-#include <stddef.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;
-}