From f85870e15491cc98f8a0fa247d79073e98f1694e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 17 Nov 2022 12:10:38 -0500 Subject: Remove ZixBitset --- test/cpp/test_headers_cpp.cpp | 1 - test/headers/test_headers.c | 1 - test/test_bitset.c | 71 ------------------------------------------- 3 files changed, 73 deletions(-) delete mode 100644 test/test_bitset.c (limited to 'test') diff --git a/test/cpp/test_headers_cpp.cpp b/test/cpp/test_headers_cpp.cpp index d637988..3fabe6e 100644 --- a/test/cpp/test_headers_cpp.cpp +++ b/test/cpp/test_headers_cpp.cpp @@ -7,7 +7,6 @@ #include "zix/allocator.h" // IWYU pragma: keep #include "zix/attributes.h" // IWYU pragma: keep -#include "zix/bitset.h" // IWYU pragma: keep #include "zix/btree.h" // IWYU pragma: keep #include "zix/bump_allocator.h" // IWYU pragma: keep #include "zix/digest.h" // IWYU pragma: keep diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c index 265c9a2..a610600 100644 --- a/test/headers/test_headers.c +++ b/test/headers/test_headers.c @@ -3,7 +3,6 @@ #include "zix/allocator.h" // IWYU pragma: keep #include "zix/attributes.h" // IWYU pragma: keep -#include "zix/bitset.h" // IWYU pragma: keep #include "zix/btree.h" // IWYU pragma: keep #include "zix/bump_allocator.h" // IWYU pragma: keep #include "zix/digest.h" // IWYU pragma: keep 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 -// SPDX-License-Identifier: ISC - -#undef NDEBUG - -#include "zix/bitset.h" - -#include -#include - -#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; -} -- cgit v1.2.1