From 4b531ec1b91280c283c0b1f48460339f93698229 Mon Sep 17 00:00:00 2001 From: Alex Lopez Date: Tue, 24 Nov 2026 05:58:13 -0800 Subject: [PATCH] eliminate CCC_Bit type --- CONTRIBUTING.md | 2 +- DOXYGEN_README.md | 2 +- README.md | 8 +- ccc/flat_bitset.h | 22 +- ccc/private/private_flat_bitset.h | 6 +- samples/ccczip.c | 4 +- .../test_array_tree_map_erase.c | 8 +- .../test_array_tree_map_iterator.c | 6 +- .../test_doubly_linked_list_iterate.c | 3 +- .../flat_bitset/test_flat_bitset_construct.c | 43 ++-- tests/flat_bitset/test_flat_bitset_erase.c | 2 +- tests/flat_bitset/test_flat_bitset_insert.c | 7 +- .../test_flat_bitset_test_and_set.c | 212 +++++++++--------- tests/flat_buffer/test_flat_buffer_erase.c | 4 +- .../test_flat_double_ended_queue_iterate.c | 6 +- .../test_flat_hash_map_iterator.c | 6 +- .../test_flat_priority_queue_erase.c | 6 +- .../test_singly_linked_list_iterate.c | 3 +- .../adaptive_map/test_adaptive_map_erase.c | 6 +- .../adaptive_map/test_adaptive_map_iterator.c | 3 +- .../test_array_adaptive_map_erase.c | 8 +- .../test_array_adaptive_map_iterator.c | 10 +- .../test_priority_queue_erase.c | 2 +- tests/tree_map/test_tree_map_erase.c | 6 +- tests/tree_map/test_tree_map_iterator.c | 5 +- 25 files changed, 208 insertions(+), 182 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 53d27bb2a..887306175 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -235,7 +235,7 @@ static CCC_Flat_buffer buffer static CCC_Flat_bitset bitset = CCC_flat_bitset_with_storage( 1024, - (CCC_Bit[1024]){} + (CCC_Tribool[1024]){} ); ``` diff --git a/DOXYGEN_README.md b/DOXYGEN_README.md index a8da538c1..5b9a017c8 100644 --- a/DOXYGEN_README.md +++ b/DOXYGEN_README.md @@ -361,7 +361,7 @@ static CCC_Flat_buffer buffer static CCC_Flat_bitset bitset = CCC_flat_bitset_with_storage( 1024, - (CCC_Bit[1024]){} + (CCC_Tribool[1024]){} ); ``` diff --git a/README.md b/README.md index 53c390b92..dfe76bfed 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ validate_sudoku_box(int const board[9][9], Flat_bitset *const row_check, Flat_bitset *const col_check, size_t const row_start, size_t const col_start) { Flat_bitset box_check - = flat_bitset_with_storage(DIGITS, (Bit[DIGITS]){}); + = flat_bitset_with_storage(DIGITS, (CCC_Tribool[DIGITS]){}); CCC_Tribool was_on = CCC_FALSE; for (size_t r = row_start; r < row_start + BOX_SIZE; ++r) { for (size_t c = col_start; c < col_start + BOX_SIZE; ++c) { @@ -223,9 +223,9 @@ validate_sudoku_box(int const board[9][9], Flat_bitset *const row_check, static CCC_Tribool is_valid_sudoku(int const board[9][9]) { Flat_bitset row_check = flat_bitset_with_storage( - ROWS * DIGITS, (Bit[ROWS * DIGITS]){}); + ROWS * DIGITS, (CCC_Tribool[ROWS * DIGITS]){}); Flat_bitset col_check = flat_bitset_with_storage( - COLS * DIGITS, (Bit[COLS * DIGITS]){}); + COLS * DIGITS, (CCC_Tribool[COLS * DIGITS]){}); for (size_t row = 0; row < ROWS; row += BOX_SIZE) { for (size_t col = 0; col < COLS; col += BOX_SIZE) { if (!validate_sudoku_box(board, &row_check, &col_check, row, col)) { @@ -1003,7 +1003,7 @@ static CCC_Flat_buffer buffer static CCC_Flat_bitset bitset = CCC_flat_bitset_with_storage( 1024, - (CCC_Bit[1024]){} + (CCC_Tribool[1024]){} ); ``` diff --git a/ccc/flat_bitset.h b/ccc/flat_bitset.h index 3007d88cd..eff8909df 100644 --- a/ccc/flat_bitset.h +++ b/ccc/flat_bitset.h @@ -71,13 +71,6 @@ All types and functions can then be written without the `CCC_` prefix. */ Types available in the container interface. */ /**@{*/ -/** @brief A type to represent a single bit in the bit set. - -This is used to pass a compound literal of desired bits to various initializers -and macros. The bit set is then custom built to accommodate this bit count with -platform specific blocks of fixed width integers. */ -typedef uint8_t CCC_Bit; - /** @brief The bit set type that may be stored and initialized on the stack, heap, or data segment at compile or run time. @@ -120,7 +113,7 @@ number of bytes occupied by the number of bit blocks that must be allocated. */ or compile time with no allocation permissions or context from a compound literal of bitset blocks. @param[in] count the count of bits <= capacity of this bit set. -@param[in] compound_literal_array the compound literal of CCC_Bit specifying +@param[in] compound_literal_array the compound literal of CCC_Tribool specifying the desired bit count for the bit set. A platform specific array of fixed width integers is constructed to accommodate this bit count. @param[in] optional_storage_specifier a storage specifier for the backing block @@ -135,7 +128,7 @@ A fixed size bit set. #define FLAT_BITSET_USING_NAMESPACE_CCC static Flat_bitset bitset = flat_bitset_with_storage( 4096, - (Bit[4096]){} + (CCC_Tribool[4096]){} ); ``` @@ -237,7 +230,7 @@ static and stack based initialization options. */ /** @brief Create the underlying fixed size storage for a bit set given a compound literal array of bits the user wishes to store. -@param[in] bit_compound_literal_array a compound literal array of `CCC_Bit` +@param[in] bit_compound_literal_array a compound literal array of `CCC_Tribool` representing the number of bits the user wishes to store in the bit set. @param[in] optional_storage_specifier a storage specifier for the backing block storage may be added on newer compilers. @@ -255,7 +248,7 @@ int main(void) { void *const storage = malloc( - sizeof(CCC_flat_bitset_storage_for((CCC_Bit[4096]){})) + sizeof(CCC_flat_bitset_storage_for((CCC_Tribool[4096]){})) ); defer free(storage); CCC_Flat_bitset bitset = CCC_flat_bitset_for( @@ -301,7 +294,7 @@ int main(void) { void *const storage = malloc( - sizeof(CCC_flat_bitset_storage_for((CCC_Bit[4096]){})) + sizeof(CCC_flat_bitset_storage_for((CCC_Tribool[4096]){})) ); defer free(storage); CCC_Flat_bitset bitset = CCC_flat_bitset_for( @@ -340,12 +333,12 @@ Manual memory management with no allocation function provided. #define FLAT_BITSET_USING_NAMESPACE_CCC static Flat_bitset source = flat_bitset_with_storage( 11, - (Bit[11]){} + (Tribool[11]){} ); set_rand_bits(&source); static Flat_bitset source = flat_bitset_with_storage( 13 - (Bit[13]){} + (CCC_Tribool[13]){} ); CCC_Result res = flat_bitset_copy(&destination, &source, &(CCC_Allocator){}); ``` @@ -1011,7 +1004,6 @@ CCC_Tribool CCC_flat_bitset_pop_back(CCC_Flat_bitset *bitset); container. Check for namespace clashes before name shortening. */ #ifdef FLAT_BITSET_USING_NAMESPACE_CCC /* NOLINTBEGIN(readability-identifier-naming) */ -typedef CCC_Bit Bit; typedef CCC_Flat_bitset Flat_bitset; # define FLAT_BITSET_BLOCK_BITS CCC_FLAT_BITSET_BLOCK_BITS # define flat_bitset_block_count(arguments...) \ diff --git a/ccc/private/private_flat_bitset.h b/ccc/private/private_flat_bitset.h index 299acccd8..8a5b3e39c 100644 --- a/ccc/private/private_flat_bitset.h +++ b/ccc/private/private_flat_bitset.h @@ -185,11 +185,13 @@ specifiers which is a feature of C23. Not all compilers support this yet. */ "Specify non-zero capacity of bits." \ ); \ static_assert( \ - sizeof(*(private_bit_compound_literal)) == sizeof(CCC_Bit), \ + sizeof(*(private_bit_compound_literal)) \ + == sizeof(CCC_Tribool), \ "CCC_flat_bitset_storage_for and " \ "CCC_flat_bitset_with_storage only " \ "accept " \ - "a (CCC_Bit[N]){} compound literal array as an argument. Do " \ + "a (CCC_Tribool[N]){} compound literal array as an argument. " \ + "Do " \ "not " \ "use CCC_flat_bitset_storage_for as an argument to " \ "CCC_flat_bitset_with_storage." \ diff --git a/samples/ccczip.c b/samples/ccczip.c index fb61b6d91..0f6abdcc9 100644 --- a/samples/ccczip.c +++ b/samples/ccczip.c @@ -549,7 +549,7 @@ set blocks. The queue is initialized as empty with the specified capacity. */ #define bitq_from_storage(capacity, optional_storage_specifier...) \ (struct Bit_queue) { \ .bs = CCC_flat_bitset_with_storage( \ - capacity, (CCC_Bit[capacity]){}, optional_storage_specifier \ + capacity, (CCC_Tribool[capacity]){}, optional_storage_specifier \ ) \ } @@ -1573,7 +1573,7 @@ lzw_encode( check(!first_char.error); Lzw_code prefix = first_char.c; CCC_Flat_bitset sliding_code_window = flat_bitset_with_storage( - 0, (CCC_Bit[sizeof(Lzw_code) * CHAR_BIT]){} + 0, (CCC_Tribool[sizeof(Lzw_code) * CHAR_BIT]){} ); foreach_filechar(f, 1, c, { CCC_Entry const e = lzw_try_insert( diff --git a/tests/array_tree_map/test_array_tree_map_erase.c b/tests/array_tree_map/test_array_tree_map_erase.c index e55b3f9ee..51fd390d8 100644 --- a/tests/array_tree_map/test_array_tree_map_erase.c +++ b/tests/array_tree_map/test_array_tree_map_erase.c @@ -71,7 +71,7 @@ check_static_begin(array_tree_map_test_prime_shuffle) { reduce the shuffle range so it will repeat some values. */ size_t shuffled_index = PRIME % (SHUFFLE_CAP - LESS); Flat_bitset repeats - = flat_bitset_with_storage(SHUFFLE_CAP, (CCC_Bit[SHUFFLE_CAP]){}); + = flat_bitset_with_storage(SHUFFLE_CAP, (CCC_Tribool[SHUFFLE_CAP]){}); for (size_t i = 0; i < SHUFFLE_CAP; ++i) { if (occupied(array_tree_map_try_insert_wrap( &s, @@ -111,7 +111,7 @@ check_static_begin(array_tree_map_test_weak_srand) { }; int id_keys[SRAND_CAP]; Flat_bitset repeats - = flat_bitset_with_storage(SRAND_CAP, (CCC_Bit[SRAND_CAP]){}); + = flat_bitset_with_storage(SRAND_CAP, (CCC_Tribool[SRAND_CAP]){}); for (int i = 0; i < SRAND_CAP; ++i) { int const rand_i = (int)rand(); /* NOLINT */ if (occupied(array_tree_map_try_insert_wrap( @@ -156,7 +156,7 @@ check_static_begin(array_tree_map_test_insert_erase_cycles_no_allocate) { ); int id_keys[CYCLES_TEST_CAP]; Flat_bitset repeats = flat_bitset_with_storage( - CYCLES_TEST_CAP, (CCC_Bit[CYCLES_TEST_CAP]){} + CYCLES_TEST_CAP, (CCC_Tribool[CYCLES_TEST_CAP]){} ); for (int i = 0; i < CYCLES_TEST_CAP; ++i) { int const rand_i = (int)rand(); /* NOLINT */ @@ -210,7 +210,7 @@ check_static_begin(array_tree_map_test_insert_erase_cycles_allocate) { ); int id_keys[CYCLES_TEST_CAP]; CCC_Flat_bitset repeats = CCC_flat_bitset_with_storage( - CYCLES_TEST_CAP, (CCC_Bit[CYCLES_TEST_CAP]){} + CYCLES_TEST_CAP, (CCC_Tribool[CYCLES_TEST_CAP]){} ); for (int i = 0; i < CYCLES_TEST_CAP; ++i) { int const rand_i = (int)rand(); /* NOLINT */ diff --git a/tests/array_tree_map/test_array_tree_map_iterator.c b/tests/array_tree_map/test_array_tree_map_iterator.c index 78f6854d5..ed195c982 100644 --- a/tests/array_tree_map/test_array_tree_map_iterator.c +++ b/tests/array_tree_map/test_array_tree_map_iterator.c @@ -491,7 +491,8 @@ check_static_begin(array_tree_map_test_clear_with_destructor) { CCC_Array_tree_map map = array_tree_map_with_storage( id, (CCC_Key_comparator){.compare = id_order}, (struct Val[MIN_CAP]){} ); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[MIN_CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(0, (CCC_Tribool[MIN_CAP]){}); int i = 0; for (;;) { CCC_Handle const *const e = array_tree_map_try_insert_with( @@ -546,7 +547,8 @@ check_static_begin(array_tree_map_test_clear_and_free_with_destructor) { allocator, MIN_CAP ); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[MIN_CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(0, (CCC_Tribool[MIN_CAP]){}); int i = 0; for (;;) { CCC_Handle const *const e = array_tree_map_try_insert_with( diff --git a/tests/doubly_linked_list/test_doubly_linked_list_iterate.c b/tests/doubly_linked_list/test_doubly_linked_list_iterate.c index 6b91e52b9..18d98e99f 100644 --- a/tests/doubly_linked_list/test_doubly_linked_list_iterate.c +++ b/tests/doubly_linked_list/test_doubly_linked_list_iterate.c @@ -157,7 +157,8 @@ check_static_begin(doubly_linked_list_test_clear_with_destructor) { CCC_doubly_linked_list_clear(&list, &(CCC_Destructor){}, NULL), CCC_RESULT_ARGUMENT_ERROR ); - Flat_bitset is_destroyed = flat_bitset_with_storage(CAP, (Bit[CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(CAP, (CCC_Tribool[CAP]){}); check( CCC_doubly_linked_list_clear( &list, diff --git a/tests/flat_bitset/test_flat_bitset_construct.c b/tests/flat_bitset/test_flat_bitset_construct.c index d1ac42f01..948321280 100644 --- a/tests/flat_bitset/test_flat_bitset_construct.c +++ b/tests/flat_bitset/test_flat_bitset_construct.c @@ -9,7 +9,7 @@ typedef typeof(*(CCC_Flat_bitset){}.blocks) Bitblocks; static CCC_Flat_bitset static_bitset - = CCC_flat_bitset_with_storage(32, (CCC_Bit[32]){}); + = CCC_flat_bitset_with_storage(32, (CCC_Tribool[32]){}); check_static_begin(flat_bitset_test_static) { check(CCC_flat_bitset_data(NULL), NULL); @@ -37,7 +37,7 @@ check_static_begin(flat_bitset_test_static) { check_static_begin(flat_bitset_test_construct) { CCC_Flat_bitset bs = CCC_flat_bitset_for( - 10, 10, CCC_flat_bitset_storage_for((CCC_Bit[10]){}) + 10, 10, CCC_flat_bitset_storage_for((CCC_Tribool[10]){}) ); check(CCC_flat_bitset_popcount(&bs).count, 0); size_t i = 0; @@ -50,7 +50,7 @@ check_static_begin(flat_bitset_test_construct) { } check_static_begin(flat_bitset_test_construct_with_literal) { - CCC_Flat_bitset bs = CCC_flat_bitset_with_storage(10, (CCC_Bit[10]){}); + CCC_Flat_bitset bs = CCC_flat_bitset_with_storage(10, (CCC_Tribool[10]){}); check(CCC_flat_bitset_popcount(&bs).count, 0); size_t i = 0; for (; i < CCC_flat_bitset_count(&bs).count; ++i) { @@ -63,7 +63,7 @@ check_static_begin(flat_bitset_test_construct_with_literal) { check_static_begin(flat_bitset_test_construct_with_literal_full_block) { CCC_Flat_bitset bs = CCC_flat_bitset_with_storage( - CCC_FLAT_BITSET_BLOCK_BITS, (CCC_Bit[CCC_FLAT_BITSET_BLOCK_BITS]){} + CCC_FLAT_BITSET_BLOCK_BITS, (CCC_Tribool[CCC_FLAT_BITSET_BLOCK_BITS]){} ); check(CCC_flat_bitset_popcount(&bs).count, 0); size_t i = 0; @@ -76,7 +76,8 @@ check_static_begin(flat_bitset_test_construct_with_literal_full_block) { } check_static_begin(flat_bitset_test_copy_no_allocate) { - CCC_Flat_bitset source = CCC_flat_bitset_with_storage(0, (CCC_Bit[512]){}); + CCC_Flat_bitset source + = CCC_flat_bitset_with_storage(0, (CCC_Tribool[512]){}); check(CCC_flat_bitset_capacity(&source).count, 512); check(CCC_flat_bitset_count(&source).count, 0); CCC_Result push_status = CCC_RESULT_OK; @@ -93,7 +94,7 @@ check_static_begin(flat_bitset_test_copy_no_allocate) { } check(push_status, CCC_RESULT_NO_ALLOCATION_FUNCTION); CCC_Flat_bitset destination - = CCC_flat_bitset_with_storage(0, (CCC_Bit[513]){}); + = CCC_flat_bitset_with_storage(0, (CCC_Tribool[513]){}); check( CCC_flat_bitset_copy(NULL, &source, &(CCC_Allocator){}), CCC_RESULT_ARGUMENT_ERROR @@ -146,8 +147,9 @@ check_static_begin(flat_bitset_test_copy_no_allocate) { check_static_begin(flat_bitset_test_copy_allocate) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, - .context - = &stack_allocator_for(CCC_flat_bitset_storage_for((CCC_Bit[1024]){})), + .context = &stack_allocator_for( + CCC_flat_bitset_storage_for((CCC_Tribool[1024]){}) + ), }; CCC_Flat_bitset source = CCC_flat_bitset_with_capacity(allocator, 512, 0); for (size_t i = 0; i < 512; ++i) { @@ -197,8 +199,9 @@ check_static_begin(flat_bitset_test_copy_allocate) { check_static_begin(flat_bitset_test_copy_exhaustion) { CCC_Allocator allocator = { .allocate = stack_allocator_allocate, - .context - = &stack_allocator_for(CCC_flat_bitset_storage_for((CCC_Bit[512]){})), + .context = &stack_allocator_for( + CCC_flat_bitset_storage_for((CCC_Tribool[512]){}) + ), }; CCC_Flat_bitset source = CCC_flat_bitset_with_capacity(allocator, 512, 0); CCC_Flat_bitset destination = CCC_flat_bitset_default(); @@ -206,8 +209,9 @@ check_static_begin(flat_bitset_test_copy_exhaustion) { CCC_flat_bitset_copy(&destination, &source, &allocator), CCC_RESULT_ALLOCATOR_ERROR ); - allocator.context - = &stack_allocator_for(CCC_flat_bitset_storage_for((CCC_Bit[1024]){})); + allocator.context = &stack_allocator_for( + CCC_flat_bitset_storage_for((CCC_Tribool[1024]){}) + ); source.blocks = NULL; check( CCC_flat_bitset_copy(&destination, &source, &allocator), @@ -220,8 +224,9 @@ check_static_begin(flat_bitset_test_init_from) { SV_Str_view const input = SV_from("110110"); CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, - .context - = &stack_allocator_for(CCC_flat_bitset_storage_for((CCC_Bit[256]){})), + .context = &stack_allocator_for( + CCC_flat_bitset_storage_for((CCC_Tribool[256]){}) + ), }; CCC_Flat_bitset b = CCC_flat_bitset_from( allocator, 0, SV_len(input), '1', SV_begin(input) @@ -238,8 +243,9 @@ check_static_begin(flat_bitset_test_init_from_cap) { SV_Str_view input = SV_from("110110"); CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, - .context - = &stack_allocator_for(CCC_flat_bitset_storage_for((CCC_Bit[256]){})), + .context = &stack_allocator_for( + CCC_flat_bitset_storage_for((CCC_Tribool[256]){}) + ), }; CCC_Flat_bitset b = CCC_flat_bitset_from( allocator, 0, SV_len(input), '1', SV_begin(input), SV_len(input) * 2 @@ -287,8 +293,9 @@ check_static_begin(flat_bitset_test_init_from_cap_fail) { check_static_begin(flat_bitset_test_init_with_capacity) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, - .context - = &stack_allocator_for(CCC_flat_bitset_storage_for((CCC_Bit[10]){})), + .context = &stack_allocator_for( + CCC_flat_bitset_storage_for((CCC_Tribool[10]){}) + ), }; CCC_Flat_bitset b = CCC_flat_bitset_with_capacity(allocator, 10); check(CCC_flat_bitset_popcount(&b).count, 0); diff --git a/tests/flat_bitset/test_flat_bitset_erase.c b/tests/flat_bitset/test_flat_bitset_erase.c index 100b69894..f4d41d6f6 100644 --- a/tests/flat_bitset/test_flat_bitset_erase.c +++ b/tests/flat_bitset/test_flat_bitset_erase.c @@ -8,7 +8,7 @@ check_static_begin(flat_bitset_test_push_pop_back_no_reallocate) { CCC_Flat_bitset bs = CCC_flat_bitset_for( - 16, 0, CCC_flat_bitset_storage_for((CCC_Bit[16]){}) + 16, 0, CCC_flat_bitset_storage_for((CCC_Tribool[16]){}) ); check(CCC_flat_bitset_capacity(&bs).count, 16); check(CCC_flat_bitset_count(&bs).count, 0); diff --git a/tests/flat_bitset/test_flat_bitset_insert.c b/tests/flat_bitset/test_flat_bitset_insert.c index 2e822a4c1..35ace26c0 100644 --- a/tests/flat_bitset/test_flat_bitset_insert.c +++ b/tests/flat_bitset/test_flat_bitset_insert.c @@ -19,7 +19,7 @@ check_static_begin(flat_bitset_test_push_back_no_reallocate) { CCC_RESULT_ARGUMENT_ERROR ); CCC_Flat_bitset bs = CCC_flat_bitset_for( - 16, 0, CCC_flat_bitset_storage_for((CCC_Bit[16]){}) + 16, 0, CCC_flat_bitset_storage_for((CCC_Tribool[16]){}) ); check( CCC_flat_bitset_push_back(&bs, CCC_TRIBOOL_ERROR, &(CCC_Allocator){}), @@ -114,8 +114,9 @@ check_static_begin(flat_bitset_test_push_back_reserve) { check_static_begin(flat_bitset_test_reserve_fail) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, - .context - = &stack_allocator_for(CCC_flat_bitset_storage_for((CCC_Bit[32]){})), + .context = &stack_allocator_for( + CCC_flat_bitset_storage_for((CCC_Tribool[32]){}) + ), }; CCC_Flat_bitset bs = CCC_flat_bitset_default(); check( diff --git a/tests/flat_bitset/test_flat_bitset_test_and_set.c b/tests/flat_bitset/test_flat_bitset_test_and_set.c index eeb0a5b1a..407bb3f6b 100644 --- a/tests/flat_bitset/test_flat_bitset_test_and_set.c +++ b/tests/flat_bitset/test_flat_bitset_test_and_set.c @@ -10,7 +10,7 @@ check_static_begin(flat_bitset_test_set_one) { check(flat_bitset_set(NULL, 5, CCC_TRUE), CCC_TRIBOOL_ERROR); - Flat_bitset bs = flat_bitset_with_storage(10, (Bit[10]){}); + Flat_bitset bs = flat_bitset_with_storage(10, (CCC_Tribool[10]){}); check(flat_bitset_capacity(&bs).count >= 10, CCC_TRUE); /* Was false before. */ check(flat_bitset_set(&bs, 5, CCC_TRUE), CCC_FALSE); @@ -26,7 +26,7 @@ check_static_begin(flat_bitset_test_set_one) { check_static_begin(flat_bitset_test_set_shuffled) { check(flat_bitset_test(NULL, 0), CCC_TRIBOOL_ERROR); - Flat_bitset bs = flat_bitset_with_storage(10, (Bit[10]){}); + Flat_bitset bs = flat_bitset_with_storage(10, (CCC_Tribool[10]){}); size_t const larger_prime = 11; for (size_t i = 0, shuf_i = larger_prime % 10; i < 10; ++i, shuf_i = (shuf_i + larger_prime) % 10) { @@ -43,7 +43,7 @@ check_static_begin(flat_bitset_test_set_shuffled) { } check_static_begin(flat_bitset_test_set_all) { - Flat_bitset bs = flat_bitset_with_storage(10, (Bit[10]){}); + Flat_bitset bs = flat_bitset_with_storage(10, (CCC_Tribool[10]){}); check(flat_bitset_set_all(NULL, CCC_TRUE), CCC_RESULT_ARGUMENT_ERROR); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&bs).count, 10); @@ -56,7 +56,7 @@ check_static_begin(flat_bitset_test_set_all) { } check_static_begin(flat_bitset_test_set_range) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check( flat_bitset_set_range(&bs, 0, 513, CCC_TRUE), CCC_RESULT_ARGUMENT_ERROR ); @@ -95,7 +95,7 @@ check_static_begin(flat_bitset_test_set_range) { check_static_begin(flat_bitset_test_reset) { check(flat_bitset_reset(NULL, 11), CCC_TRIBOOL_ERROR); - Flat_bitset bs = flat_bitset_with_storage(10, (Bit[10]){}); + Flat_bitset bs = flat_bitset_with_storage(10, (CCC_Tribool[10]){}); check(flat_bitset_reset(&bs, 11), CCC_TRIBOOL_ERROR); check(flat_bitset_set(&bs, 0, CCC_TRUE), CCC_FALSE); check(flat_bitset_reset_range(&bs, 0, 1), CCC_RESULT_OK); @@ -115,7 +115,7 @@ check_static_begin(flat_bitset_test_reset) { check_static_begin(flat_bitset_test_reset_all) { check(flat_bitset_reset_all(NULL), CCC_RESULT_ARGUMENT_ERROR); - Flat_bitset bs = flat_bitset_with_storage(10, (Bit[10]){}); + Flat_bitset bs = flat_bitset_with_storage(10, (CCC_Tribool[10]){}); check(flat_bitset_capacity(&bs).count >= 10, CCC_TRUE); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&bs).count, 10); @@ -132,7 +132,7 @@ check_static_begin(flat_bitset_test_reset_all) { check_static_begin(flat_bitset_test_reset_range) { check(flat_bitset_reset_range(NULL, 0, 1), CCC_RESULT_ARGUMENT_ERROR); - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); /* Start with a full range and reduce from the end. */ for (size_t i = 0; i < 512; ++i) { size_t const count = 512 - i; @@ -168,7 +168,7 @@ check_static_begin(flat_bitset_test_reset_range) { check_static_begin(flat_bitset_test_flip) { check(flat_bitset_flip(NULL, 9), CCC_TRIBOOL_ERROR); - Flat_bitset bs = flat_bitset_with_storage(10, (Bit[10]){}); + Flat_bitset bs = flat_bitset_with_storage(10, (CCC_Tribool[10]){}); check(flat_bitset_flip(&bs, 11), CCC_TRIBOOL_ERROR); check(flat_bitset_capacity(&bs).count >= 10, CCC_TRUE); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); @@ -183,7 +183,7 @@ check_static_begin(flat_bitset_test_flip) { check_static_begin(flat_bitset_test_flip_all) { check(flat_bitset_flip_all(&flat_bitset_default()), CCC_RESULT_OK); check(flat_bitset_flip_all(NULL), CCC_RESULT_ARGUMENT_ERROR); - Flat_bitset bs = flat_bitset_with_storage(10, (Bit[10]){}); + Flat_bitset bs = flat_bitset_with_storage(10, (CCC_Tribool[10]){}); check(flat_bitset_capacity(&bs).count >= 10, CCC_TRUE); for (size_t i = 0; i < 10; i += 2) { check(flat_bitset_set(&bs, i, CCC_TRUE), CCC_FALSE); @@ -208,7 +208,7 @@ check_static_begin(flat_bitset_test_flip_range) { check( flat_bitset_popcount_range(NULL, 0, 0).error, CCC_RESULT_ARGUMENT_ERROR ); - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check( flat_bitset_popcount_range(&bs, 0, 0).error, CCC_RESULT_ARGUMENT_ERROR ); @@ -256,7 +256,7 @@ check_static_begin(flat_bitset_test_any_range_in_one_block) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -282,7 +282,7 @@ check_static_begin(flat_bitset_test_any_range_in_multiple_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -314,7 +314,7 @@ check_static_begin(flat_bitset_test_all_range_in_one_block) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -338,7 +338,7 @@ check_static_begin(flat_bitset_test_all_range_in_multiple_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -362,7 +362,7 @@ check_static_begin(flat_bitset_test_all_range_in_multiple_blocks) { } check_static_begin(flat_bitset_test_any) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_any_range(&bs, 0, 0), CCC_TRIBOOL_ERROR); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); size_t const cap = flat_bitset_capacity(&bs).count; @@ -386,7 +386,7 @@ check_static_begin(flat_bitset_test_any) { } check_static_begin(flat_bitset_test_none) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); size_t const cap = flat_bitset_capacity(&bs).count; /* Start with a full range and reduce by moving start forward. */ @@ -407,7 +407,7 @@ check_static_begin(flat_bitset_test_none) { } check_static_begin(flat_bitset_test_all_three_blocks) { - Flat_bitset bs = flat_bitset_with_storage(128, (Bit[128]){}); + Flat_bitset bs = flat_bitset_with_storage(128, (CCC_Tribool[128]){}); check(flat_bitset_all_range(&bs, 0, 0), CCC_TRIBOOL_ERROR); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_set(&bs, 64, CCC_FALSE), CCC_TRUE); @@ -419,7 +419,7 @@ check_static_begin(flat_bitset_test_all_three_blocks) { } check_static_begin(flat_bitset_test_all) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); size_t const cap = flat_bitset_capacity(&bs).count; check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_all(&bs), CCC_TRUE); @@ -443,7 +443,7 @@ check_static_begin(flat_bitset_test_all) { } check_static_begin(flat_bitset_test_first_trailing_one) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check( flat_bitset_first_trailing_one_range(&bs, 0, 0).error, CCC_RESULT_ARGUMENT_ERROR @@ -472,7 +472,7 @@ check_static_begin(flat_bitset_test_first_trailing_one_range_within_block) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -498,7 +498,7 @@ check_static_begin(flat_bitset_test_first_trailing_one_range_within_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -525,7 +525,7 @@ check_static_begin(flat_bitset_test_first_trailing_ones_range_within_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -556,7 +556,7 @@ check_static_begin(flat_bitset_test_first_trailing_zeros_range_within_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -587,7 +587,7 @@ check_static_begin(flat_bitset_test_first_trailing_ones_off_by_one) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -609,7 +609,7 @@ check_static_begin(flat_bitset_test_first_trailing_ones_match_at_capacity) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -632,7 +632,7 @@ check_static_begin( CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -653,7 +653,7 @@ check_static_begin(flat_bitset_test_first_trailing_zeros_match_at_capacity) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -675,7 +675,7 @@ check_static_begin(flat_bitset_test_first_trailing_ones_straddle_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -695,7 +695,7 @@ check_static_begin(flat_bitset_test_first_trailing_ones_broken_runs) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -716,7 +716,7 @@ check_static_begin(flat_bitset_test_first_trailing_ones_multiblock_prefix) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -749,7 +749,7 @@ check_static_begin( CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -785,7 +785,7 @@ check_static_begin(flat_bitset_test_first_trailing_zeros_off_by_one) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -807,7 +807,7 @@ check_static_begin(flat_bitset_test_first_trailing_zeros_straddle_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -828,7 +828,7 @@ check_static_begin(flat_bitset_test_first_trailing_zeros_broken_runs) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -850,7 +850,7 @@ check_static_begin(flat_bitset_test_first_trailing_zeros_multiblock_prefix) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -883,7 +883,7 @@ check_static_begin( CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -913,7 +913,7 @@ check_static_begin( } check_static_begin(flat_bitset_test_first_trailing_ones) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); size_t window = FLAT_BITSET_BLOCK_BITS; /* Slide a group of int size as a window across the set. */ for (size_t i = 0; i < (512 - window - 1); ++i) { @@ -1007,7 +1007,7 @@ check_static_begin(flat_bitset_test_first_trailing_ones) { } check_static_begin(flat_bitset_test_first_trailing_ones_fail) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check( flat_bitset_first_trailing_ones_range(&bs, 0, 0, 0).error, CCC_RESULT_ARGUMENT_ERROR @@ -1073,7 +1073,7 @@ check_static_begin(flat_bitset_test_first_trailing_ones_fail) { } check_static_begin(flat_bitset_test_first_trailing_zero) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); /* Start with an almost full range and reduce by moving start forward. */ for (size_t i = 0, end = 512; i < end - 1; ++i) { check(flat_bitset_set(&bs, i, CCC_TRUE), CCC_FALSE); @@ -1091,7 +1091,7 @@ check_static_begin(flat_bitset_test_first_trailing_zero) { } check_static_begin(flat_bitset_test_first_trailing_zeros) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); size_t window = FLAT_BITSET_BLOCK_BITS; /* Slide a group of int size as a window across the set. */ @@ -1189,7 +1189,7 @@ check_static_begin(flat_bitset_test_first_trailing_zeros) { } check_static_begin(flat_bitset_test_first_trailing_zeros_fail) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); size_t const end = flat_bitset_block_count(512); size_t const first_half = FLAT_BITSET_BLOCK_BITS / 2; @@ -1252,7 +1252,7 @@ check_static_begin(flat_bitset_test_first_trailing_zeros_fail) { } check_static_begin(flat_bitset_test_first_leading_one) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); /* Start with an almost full range and reduce by moving start backwards. */ for (size_t i = 512; i-- > 1;) { @@ -1277,7 +1277,7 @@ check_static_begin(flat_bitset_test_first_leading_one_range_within_block) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1303,7 +1303,7 @@ check_static_begin(flat_bitset_test_first_leading_one_range_within_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1330,7 +1330,7 @@ check_static_begin(flat_bitset_test_first_leading_ones_range_within_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1360,7 +1360,7 @@ check_static_begin(flat_bitset_test_first_leading_zeros_range_within_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1391,7 +1391,7 @@ check_static_begin(flat_bitset_test_first_leading_ones_off_by_one) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1414,7 +1414,7 @@ check_static_begin( CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1435,7 +1435,7 @@ check_static_begin(flat_bitset_test_first_leading_ones_match_at_capacity) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1456,7 +1456,7 @@ check_static_begin(flat_bitset_test_first_leading_zeros_match_at_capacity) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1477,7 +1477,7 @@ check_static_begin(flat_bitset_test_first_leading_ones_straddle_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1496,7 +1496,7 @@ check_static_begin(flat_bitset_test_first_leading_ones_broken_runs) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1517,7 +1517,7 @@ check_static_begin(flat_bitset_test_first_leading_zeros_off_by_one) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1539,7 +1539,7 @@ check_static_begin(flat_bitset_test_first_leading_zeros_straddle_blocks) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1558,7 +1558,7 @@ check_static_begin(flat_bitset_test_first_leading_zeros_broken_runs) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1579,7 +1579,7 @@ check_static_begin(flat_bitset_test_first_leading_ones_multiblock_prefix) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1612,7 +1612,7 @@ check_static_begin( CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1649,7 +1649,7 @@ check_static_begin(flat_bitset_test_first_leading_zeros_multiblock_prefix) { CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1682,7 +1682,7 @@ check_static_begin( CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, .context = &stack_allocator_for( - (typeof(flat_bitset_storage_for((Bit[CAP]){}))[1]){} + (typeof(flat_bitset_storage_for((CCC_Tribool[CAP]){}))[1]){} ), }; Flat_bitset bs = CCC_flat_bitset_from( @@ -1713,7 +1713,7 @@ check_static_begin( } check_static_begin(flat_bitset_test_first_leading_one_range) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); size_t const bit_of_interest = 4; check(flat_bitset_set(&bs, bit_of_interest, CCC_TRUE), CCC_FALSE); for (size_t i = 0; i < bit_of_interest; ++i) { @@ -1750,7 +1750,7 @@ check_static_begin(flat_bitset_test_first_leading_one_range) { } check_static_begin(flat_bitset_test_first_leading_ones) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check( flat_bitset_first_leading_ones_range(&bs, 0, 0, 0).error, CCC_RESULT_ARGUMENT_ERROR @@ -1872,7 +1872,7 @@ check_static_begin(flat_bitset_test_first_leading_ones) { } check_static_begin(flat_bitset_test_first_leading_ones_fail) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); size_t const first_half = FLAT_BITSET_BLOCK_BITS / 2; size_t const second_half = first_half - 1; /* We are going to search for a group of 17 which we will be very close @@ -1944,7 +1944,7 @@ check_static_begin(flat_bitset_test_first_leading_ones_fail) { } check_static_begin(flat_bitset_test_first_leading_zero) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); /* Start with an almost full range and reduce by moving start backwards. */ for (size_t i = 512; i-- > 1;) { check(flat_bitset_set(&bs, i, CCC_TRUE), CCC_FALSE); @@ -1962,7 +1962,7 @@ check_static_begin(flat_bitset_test_first_leading_zero) { } check_static_begin(flat_bitset_test_first_leading_zero_range) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); (void)flat_bitset_set_all(&bs, CCC_TRUE); size_t const bit_of_interest = 4; check(flat_bitset_set(&bs, bit_of_interest, CCC_FALSE), CCC_TRUE); @@ -2000,7 +2000,7 @@ check_static_begin(flat_bitset_test_first_leading_zero_range) { } check_static_begin(flat_bitset_test_first_leading_zeros) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); size_t window = FLAT_BITSET_BLOCK_BITS; /* Slide a group of int size as a window across the set. */ @@ -2119,7 +2119,7 @@ check_static_begin(flat_bitset_test_first_leading_zeros) { } check_static_begin(flat_bitset_test_first_leading_zeros_fail) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); size_t const first_half = FLAT_BITSET_BLOCK_BITS / 2; size_t const second_half = first_half - 1; @@ -2196,8 +2196,9 @@ check_static_begin(flat_bitset_test_or_same_size) { flat_bitset_or(&flat_bitset_default(), &flat_bitset_default()), CCC_RESULT_OK ); - Flat_bitset source = flat_bitset_with_storage(512, (Bit[512]){}); - Flat_bitset destination = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset source = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); + Flat_bitset destination + = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_or(&destination, &flat_bitset_default()), CCC_RESULT_OK); check(flat_bitset_or(&source, &flat_bitset_default()), CCC_RESULT_OK); check(flat_bitset_or(NULL, &source), CCC_RESULT_ARGUMENT_ERROR); @@ -2217,9 +2218,10 @@ check_static_begin(flat_bitset_test_or_same_size) { } check_static_begin(flat_bitset_test_or_diff_size) { - Flat_bitset destination = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset destination + = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); /* Make it slightly harder by not ending on a perfect block boundary. */ - Flat_bitset source = flat_bitset_with_storage(244, (Bit[244]){}); + Flat_bitset source = flat_bitset_with_storage(244, (CCC_Tribool[244]){}); check(flat_bitset_set_all(&source, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&source).count, 244); check(flat_bitset_popcount(&destination).count, 0); @@ -2230,13 +2232,14 @@ check_static_begin(flat_bitset_test_or_diff_size) { check_static_begin(flat_bitset_test_and_same_size) { Flat_bitset zero = flat_bitset_default(); - Flat_bitset to_zero = flat_bitset_with_storage(32, (Bit[32]){}); + Flat_bitset to_zero = flat_bitset_with_storage(32, (CCC_Tribool[32]){}); check(flat_bitset_and(&zero, &to_zero), CCC_RESULT_OK); check(flat_bitset_popcount(&zero).count, 0); check(flat_bitset_and(&to_zero, &zero), CCC_RESULT_OK); check(flat_bitset_popcount(&to_zero).count, 0); - Flat_bitset source = flat_bitset_with_storage(512, (Bit[512]){}); - Flat_bitset destination = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset source = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); + Flat_bitset destination + = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_and(NULL, &source), CCC_RESULT_ARGUMENT_ERROR); check(flat_bitset_and(&destination, NULL), CCC_RESULT_ARGUMENT_ERROR); size_t const size = 512; @@ -2254,9 +2257,10 @@ check_static_begin(flat_bitset_test_and_same_size) { } check_static_begin(flat_bitset_test_and_diff_size) { - Flat_bitset destination = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset destination + = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); /* Make it slightly harder by not ending on a perfect block boundary. */ - Flat_bitset source = flat_bitset_with_storage(244, (Bit[244]){}); + Flat_bitset source = flat_bitset_with_storage(244, (CCC_Tribool[244]){}); check(flat_bitset_set_all(&destination, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_set_all(&source, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&destination).count, 512); @@ -2272,8 +2276,9 @@ check_static_begin(flat_bitset_test_xor_same_size) { flat_bitset_or(&flat_bitset_default(), &flat_bitset_default()), CCC_RESULT_OK ); - Flat_bitset source = flat_bitset_with_storage(512, (Bit[512]){}); - Flat_bitset destination = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset source = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); + Flat_bitset destination + = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_xor(NULL, &destination), CCC_RESULT_ARGUMENT_ERROR); check(flat_bitset_xor(&destination, NULL), CCC_RESULT_ARGUMENT_ERROR); check(flat_bitset_xor(&destination, &flat_bitset_default()), CCC_RESULT_OK); @@ -2293,9 +2298,10 @@ check_static_begin(flat_bitset_test_xor_same_size) { } check_static_begin(flat_bitset_test_xor_diff_size) { - Flat_bitset destination = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset destination + = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); /* Make it slightly harder by not ending on a perfect block boundary. */ - Flat_bitset source = flat_bitset_with_storage(244, (Bit[244]){}); + Flat_bitset source = flat_bitset_with_storage(244, (CCC_Tribool[244]){}); check(flat_bitset_set_all(&destination, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_set_all(&source, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&destination).count, 512); @@ -2308,7 +2314,7 @@ check_static_begin(flat_bitset_test_xor_diff_size) { check_static_begin(flat_bitset_test_shift_left) { check(flat_bitset_shift_left(NULL, 0), CCC_RESULT_ARGUMENT_ERROR); - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_shift_left(&bs, 0), CCC_RESULT_OK); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&bs).count, 512); @@ -2340,7 +2346,7 @@ check_static_begin(flat_bitset_test_shift_left) { } check_static_begin(flat_bitset_test_shift_left_edgecase) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&bs).count, 512); check(flat_bitset_shift_left(&bs, 510), CCC_RESULT_OK); @@ -2349,7 +2355,7 @@ check_static_begin(flat_bitset_test_shift_left_edgecase) { } check_static_begin(flat_bitset_test_shift_left_edgecase_small) { - Flat_bitset bs = flat_bitset_with_storage(8, (Bit[8]){}); + Flat_bitset bs = flat_bitset_with_storage(8, (CCC_Tribool[8]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&bs).count, 8); check(flat_bitset_shift_left(&bs, 7), CCC_RESULT_OK); @@ -2359,7 +2365,7 @@ check_static_begin(flat_bitset_test_shift_left_edgecase_small) { check_static_begin(flat_bitset_test_shift_right) { check(flat_bitset_shift_right(NULL, 0), CCC_RESULT_ARGUMENT_ERROR); - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_shift_right(&bs, 0), CCC_RESULT_OK); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&bs).count, 512); @@ -2397,7 +2403,7 @@ check_static_begin(flat_bitset_test_shift_right) { } check_static_begin(flat_bitset_test_shift_right_edgecase) { - Flat_bitset bs = flat_bitset_with_storage(512, (Bit[512]){}); + Flat_bitset bs = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&bs).count, 512); check(flat_bitset_shift_right(&bs, 510), CCC_RESULT_OK); @@ -2406,7 +2412,7 @@ check_static_begin(flat_bitset_test_shift_right_edgecase) { } check_static_begin(flat_bitset_test_shift_right_edgecase_small) { - Flat_bitset bs = flat_bitset_with_storage(8, (Bit[8]){}); + Flat_bitset bs = flat_bitset_with_storage(8, (CCC_Tribool[8]){}); check(flat_bitset_set_all(&bs, CCC_TRUE), CCC_RESULT_OK); check(flat_bitset_popcount(&bs).count, 8); check(flat_bitset_shift_right(&bs, 7), CCC_RESULT_OK); @@ -2415,9 +2421,9 @@ check_static_begin(flat_bitset_test_shift_right_edgecase_small) { } check_static_begin(flat_bitset_test_subset) { - Flat_bitset set = flat_bitset_with_storage(512, (Bit[512]){}); - Flat_bitset subset1 = flat_bitset_with_storage(512, (Bit[512]){}); - Flat_bitset subset2 = flat_bitset_with_storage(244, (Bit[244]){}); + Flat_bitset set = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); + Flat_bitset subset1 = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); + Flat_bitset subset2 = flat_bitset_with_storage(244, (CCC_Tribool[244]){}); for (size_t i = 0; i < 512; i += 2) { check(flat_bitset_set(&set, i, CCC_TRUE), CCC_FALSE); check(flat_bitset_set(&subset1, i, CCC_TRUE), CCC_FALSE); @@ -2436,9 +2442,9 @@ check_static_begin(flat_bitset_test_subset) { } check_static_begin(flat_bitset_test_proper_subset) { - Flat_bitset set = flat_bitset_with_storage(512, (Bit[512]){}); - Flat_bitset subset1 = flat_bitset_with_storage(512, (Bit[512]){}); - Flat_bitset subset2 = flat_bitset_with_storage(244, (Bit[244]){}); + Flat_bitset set = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); + Flat_bitset subset1 = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); + Flat_bitset subset2 = flat_bitset_with_storage(244, (CCC_Tribool[244]){}); check(flat_bitset_is_proper_subset(NULL, &set), CCC_TRIBOOL_ERROR); check(flat_bitset_is_proper_subset(&subset1, NULL), CCC_TRIBOOL_ERROR); check(flat_bitset_is_subset(NULL, &set), CCC_TRIBOOL_ERROR); @@ -2464,9 +2470,9 @@ check_static_begin(flat_bitset_test_proper_subset) { } check_static_begin(flat_bitset_test_is_equal) { - Flat_bitset a = flat_bitset_with_storage(512, (Bit[512]){}); - Flat_bitset b = flat_bitset_with_storage(512, (Bit[512]){}); - Flat_bitset c = flat_bitset_with_storage(244, (Bit[244]){}); + Flat_bitset a = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); + Flat_bitset b = flat_bitset_with_storage(512, (CCC_Tribool[512]){}); + Flat_bitset c = flat_bitset_with_storage(244, (CCC_Tribool[244]){}); check(flat_bitset_is_equal(NULL, &b), CCC_TRIBOOL_ERROR); check(flat_bitset_is_equal(&a, NULL), CCC_TRIBOOL_ERROR); check(flat_bitset_is_equal(&a, &b), CCC_TRUE); @@ -2491,7 +2497,7 @@ validate_sudoku_box( size_t const row_start, size_t const col_start ) { - Flat_bitset box_check = flat_bitset_with_storage(9, (Bit[9]){}); + Flat_bitset box_check = flat_bitset_with_storage(9, (CCC_Tribool[9]){}); CCC_Tribool was_on = CCC_FALSE; for (size_t r = row_start; r < row_start + 3; ++r) { for (size_t c = col_start; c < col_start + 3; ++c) { @@ -2547,10 +2553,12 @@ check_static_begin(flat_bitset_test_valid_sudoku) { ,{0,6,0, 0,0,0, 2,8,0} ,{0,0,0, 4,1,9, 0,0,5} - ,{0,0,0, 0,8,0, 0,7,9}}; + ,{0,0,0, 0,8,0, 0,7,9},}; /* clang-format on */ - Flat_bitset row_check = flat_bitset_with_storage(9L * 9L, (Bit[9L * 9L]){}); - Flat_bitset col_check = flat_bitset_with_storage(9L * 9L, (Bit[9L * 9L]){}); + Flat_bitset row_check + = flat_bitset_with_storage(9L * 9L, (CCC_Tribool[9L * 9L]){}); + Flat_bitset col_check + = flat_bitset_with_storage(9L * 9L, (CCC_Tribool[9L * 9L]){}); size_t const box_step = 3; for (size_t row = 0; row < 9; row += box_step) { for (size_t col = 0; col < 9; col += box_step) { @@ -2576,10 +2584,12 @@ check_static_begin(flat_bitset_test_invalid_sudoku) { ,{0,6,0, 0,0,0, 2,8,0} ,{0,0,0, 4,1,9, 0,0,5} - ,{0,0,0, 0,8,0, 0,7,9}}; + ,{0,0,0, 0,8,0, 0,7,9},}; /* clang-format on */ - Flat_bitset row_check = flat_bitset_with_storage(9L * 9L, (Bit[9L * 9L]){}); - Flat_bitset col_check = flat_bitset_with_storage(9L * 9L, (Bit[9L * 9L]){}); + Flat_bitset row_check + = flat_bitset_with_storage(9L * 9L, (CCC_Tribool[9L * 9L]){}); + Flat_bitset col_check + = flat_bitset_with_storage(9L * 9L, (CCC_Tribool[9L * 9L]){}); size_t const box_step = 3; CCC_Tribool pass = CCC_TRUE; for (size_t row = 0; row < 9; row += box_step) { diff --git a/tests/flat_buffer/test_flat_buffer_erase.c b/tests/flat_buffer/test_flat_buffer_erase.c index 637e9d942..3a65f88f2 100644 --- a/tests/flat_buffer/test_flat_buffer_erase.c +++ b/tests/flat_buffer/test_flat_buffer_erase.c @@ -114,7 +114,7 @@ destroy_element(CCC_Arguments const arguments) { check_static_begin(flat_buffer_test_clear_with_destructor) { Flat_buffer b = flat_buffer_with_storage(0, (int[8]){}); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[8]){}); + Flat_bitset is_destroyed = flat_bitset_with_storage(0, (CCC_Tribool[8]){}); int i = 0; while (!flat_buffer_is_full(&b)) { CCC_Result const bit_push = flat_bitset_push_back( @@ -153,7 +153,7 @@ check_static_begin(flat_buffer_test_clear_and_free_with_destructor) { .context = &stack_allocator_for((int[8]){}), }; Flat_buffer b = flat_buffer_with_capacity(int, allocator, 8); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[8]){}); + Flat_bitset is_destroyed = flat_bitset_with_storage(0, (CCC_Tribool[8]){}); int i = 0; while (!flat_buffer_is_full(&b)) { CCC_Result const bit_push = flat_bitset_push_back( diff --git a/tests/flat_double_ended_queue/test_flat_double_ended_queue_iterate.c b/tests/flat_double_ended_queue/test_flat_double_ended_queue_iterate.c index d4b7e8a13..fadd0bf1f 100644 --- a/tests/flat_double_ended_queue/test_flat_double_ended_queue_iterate.c +++ b/tests/flat_double_ended_queue/test_flat_double_ended_queue_iterate.c @@ -66,7 +66,8 @@ check_static_begin(flat_double_ended_queue_test_clear_destructor) { 3, } ); - Flat_bitset is_destroyed = flat_bitset_with_storage(COUNT, (Bit[COUNT]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(COUNT, (CCC_Tribool[COUNT]){}); check(CCC_flat_double_ended_queue_capacity(&q).count >= COUNT, CCC_TRUE); check(CCC_flat_double_ended_queue_count(&q).count, COUNT); check( @@ -145,7 +146,8 @@ check_static_begin(flat_double_ended_queue_test_clear_and_free_destructor) { 3, } ); - Flat_bitset is_destroyed = flat_bitset_with_storage(COUNT, (Bit[COUNT]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(COUNT, (CCC_Tribool[COUNT]){}); check(CCC_flat_double_ended_queue_capacity(&q).count >= COUNT, CCC_TRUE); check(CCC_flat_double_ended_queue_count(&q).count, COUNT); check( diff --git a/tests/flat_hash_map/test_flat_hash_map_iterator.c b/tests/flat_hash_map/test_flat_hash_map_iterator.c index 6d66f76c0..c01b5483c 100644 --- a/tests/flat_hash_map/test_flat_hash_map_iterator.c +++ b/tests/flat_hash_map/test_flat_hash_map_iterator.c @@ -236,7 +236,8 @@ check_static_begin(flat_hash_map_test_clear_with_destructor) { }), (struct Val[MIN_CAP]){} ); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[MIN_CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(0, (CCC_Tribool[MIN_CAP]){}); int i = 0; for (;;) { CCC_Entry const *const e = flat_hash_map_try_insert_with( @@ -293,7 +294,8 @@ check_static_begin(flat_hash_map_test_clear_and_free_with_destructor) { allocator, MIN_CAP ); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[MIN_CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(0, (CCC_Tribool[MIN_CAP]){}); int i = 0; for (;;) { struct Val const *const v = unwrap(flat_hash_map_insert_or_assign_with( diff --git a/tests/flat_priority_queue/test_flat_priority_queue_erase.c b/tests/flat_priority_queue/test_flat_priority_queue_erase.c index f9da4d9fa..bfc30f7fd 100644 --- a/tests/flat_priority_queue/test_flat_priority_queue_erase.c +++ b/tests/flat_priority_queue/test_flat_priority_queue_erase.c @@ -401,7 +401,8 @@ check_static_begin(flat_priority_queue_test_clear_destructor) { ); check(CCC_flat_priority_queue_clear(&pq, NULL), CCC_RESULT_ARGUMENT_ERROR); int i = 0; - Flat_bitset is_destroyed = flat_bitset_with_storage(CAP, (Bit[CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(CAP, (CCC_Tribool[CAP]){}); while (i < CAP) { struct Val const *const v = CCC_flat_priority_queue_push( &pq, &i, &(int){}, &(CCC_Allocator){} @@ -451,7 +452,8 @@ check_static_begin(flat_priority_queue_test_clear_and_free_destructor) { ); check(CCC_flat_priority_queue_reserve(&pq, CAP, &allocator), CCC_RESULT_OK); int i = 0; - Flat_bitset is_destroyed = flat_bitset_with_storage(CAP, (Bit[CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(CAP, (CCC_Tribool[CAP]){}); while (i < CAP) { struct Val const *const v = CCC_flat_priority_queue_push( &pq, &i, &(int){}, &(CCC_Allocator){} diff --git a/tests/singly_linked_list/test_singly_linked_list_iterate.c b/tests/singly_linked_list/test_singly_linked_list_iterate.c index 7047a58bf..74538111e 100644 --- a/tests/singly_linked_list/test_singly_linked_list_iterate.c +++ b/tests/singly_linked_list/test_singly_linked_list_iterate.c @@ -158,7 +158,8 @@ check_static_begin(singly_linked_list_test_clear_with_destructor) { CCC_singly_linked_list_clear(&list, &(CCC_Destructor){}, NULL), CCC_RESULT_ARGUMENT_ERROR ); - Flat_bitset is_destroyed = flat_bitset_with_storage(CAP, (Bit[CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(CAP, (CCC_Tribool[CAP]){}); check( CCC_singly_linked_list_clear( &list, diff --git a/tests/specialized/adaptive_map/test_adaptive_map_erase.c b/tests/specialized/adaptive_map/test_adaptive_map_erase.c index 1874105b3..27b15582f 100644 --- a/tests/specialized/adaptive_map/test_adaptive_map_erase.c +++ b/tests/specialized/adaptive_map/test_adaptive_map_erase.c @@ -31,7 +31,7 @@ check_static_begin(adaptive_map_test_prime_shuffle) { reduce the shuffle range so it will repeat some values. */ size_t shuffled_index = prime % (size - less); - Flat_bitset repeats = flat_bitset_with_storage(50, (CCC_Bit[50]){}); + Flat_bitset repeats = flat_bitset_with_storage(50, (CCC_Tribool[50]){}); for (size_t i = 0; i < size; ++i) { if (occupied(adaptive_map_insert_or_assign_wrap( &s, @@ -167,7 +167,7 @@ check_static_begin(adaptive_map_test_weak_srand) { struct Val, elem, key, (CCC_Key_comparator){.compare = id_order} ); Flat_bitset repeats - = flat_bitset_with_storage(SRAND_CAP, (CCC_Bit[SRAND_CAP]){}); + = flat_bitset_with_storage(SRAND_CAP, (CCC_Tribool[SRAND_CAP]){}); for (int i = 0; i < SRAND_CAP; ++i) { if (occupied(adaptive_map_insert_or_assign_wrap( &s, @@ -211,7 +211,7 @@ check_static_begin(adaptive_map_test_insert_erase_cycles) { }; int keys[CYCLES_TEST_CAP] = {}; Flat_bitset repeats = flat_bitset_with_storage( - CYCLES_TEST_CAP, (CCC_Bit[CYCLES_TEST_CAP]){} + CYCLES_TEST_CAP, (CCC_Tribool[CYCLES_TEST_CAP]){} ); for (int i = 0; i < CYCLES_TEST_CAP; ++i) { keys[i] = (int)rand(); /* NOLINT */ diff --git a/tests/specialized/adaptive_map/test_adaptive_map_iterator.c b/tests/specialized/adaptive_map/test_adaptive_map_iterator.c index 2029c1c7b..c2d721941 100644 --- a/tests/specialized/adaptive_map/test_adaptive_map_iterator.c +++ b/tests/specialized/adaptive_map/test_adaptive_map_iterator.c @@ -523,7 +523,8 @@ check_static_begin(adaptive_map_test_clear_with_destructor) { CCC_Adaptive_map map = adaptive_map_default( struct Val, elem, key, (CCC_Key_comparator){.compare = id_order} ); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[MIN_CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(0, (CCC_Tribool[MIN_CAP]){}); int i = 0; for (;;) { CCC_Entry const *const e = adaptive_map_try_insert_with( diff --git a/tests/specialized/array_adaptive_map/test_array_adaptive_map_erase.c b/tests/specialized/array_adaptive_map/test_array_adaptive_map_erase.c index b4a4d7418..61748ce79 100644 --- a/tests/specialized/array_adaptive_map/test_array_adaptive_map_erase.c +++ b/tests/specialized/array_adaptive_map/test_array_adaptive_map_erase.c @@ -71,7 +71,7 @@ check_static_begin(array_adaptive_map_test_prime_shuffle) { reduce the shuffle range so it will repeat some values. */ size_t shuffled_index = PRIME % (SHUFFLE_CAP - LESS); Flat_bitset repeats - = flat_bitset_with_storage(SHUFFLE_CAP, (CCC_Bit[SHUFFLE_CAP]){}); + = flat_bitset_with_storage(SHUFFLE_CAP, (CCC_Tribool[SHUFFLE_CAP]){}); for (size_t i = 0; i < SHUFFLE_CAP; ++i) { if (occupied(array_adaptive_map_try_insert_wrap( &s, @@ -111,7 +111,7 @@ check_static_begin(array_adaptive_map_test_weak_srand) { }; int id_keys[SRAND_CAP]; Flat_bitset repeats - = flat_bitset_with_storage(SRAND_CAP, (CCC_Bit[SRAND_CAP]){}); + = flat_bitset_with_storage(SRAND_CAP, (CCC_Tribool[SRAND_CAP]){}); for (int i = 0; i < SRAND_CAP; ++i) { int const rand_i = (int)rand(); /* NOLINT */ if (occupied(array_adaptive_map_try_insert_wrap( @@ -156,7 +156,7 @@ check_static_begin(array_adaptive_map_test_insert_erase_cycles_no_allocate) { ); int id_keys[CYCLES_TEST_CAP]; Flat_bitset repeats = flat_bitset_with_storage( - CYCLES_TEST_CAP, (CCC_Bit[CYCLES_TEST_CAP]){} + CYCLES_TEST_CAP, (CCC_Tribool[CYCLES_TEST_CAP]){} ); for (int i = 0; i < CYCLES_TEST_CAP; ++i) { int const rand_i = (int)rand(); /* NOLINT */ @@ -210,7 +210,7 @@ check_static_begin(array_adaptive_map_test_insert_erase_cycles_allocate) { ); int id_keys[CYCLES_TEST_CAP]; CCC_Flat_bitset repeats = CCC_flat_bitset_with_storage( - CYCLES_TEST_CAP, (CCC_Bit[CYCLES_TEST_CAP]){} + CYCLES_TEST_CAP, (CCC_Tribool[CYCLES_TEST_CAP]){} ); for (int i = 0; i < CYCLES_TEST_CAP; ++i) { int const rand_i = (int)rand(); /* NOLINT */ diff --git a/tests/specialized/array_adaptive_map/test_array_adaptive_map_iterator.c b/tests/specialized/array_adaptive_map/test_array_adaptive_map_iterator.c index 96261f11c..5b666a592 100644 --- a/tests/specialized/array_adaptive_map/test_array_adaptive_map_iterator.c +++ b/tests/specialized/array_adaptive_map/test_array_adaptive_map_iterator.c @@ -499,12 +499,13 @@ destroy_element(CCC_Arguments const arguments) { check_static_begin(array_adaptive_map_test_clear_with_destructor) { enum : size_t { - MIN_CAP = 16 + MIN_CAP = 16, }; CCC_Array_adaptive_map map = array_adaptive_map_with_storage( id, (CCC_Key_comparator){.compare = id_order}, (struct Val[MIN_CAP]){} ); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[MIN_CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(0, (CCC_Tribool[MIN_CAP]){}); int i = 0; for (;;) { CCC_Handle const *const e = array_adaptive_map_try_insert_with( @@ -544,7 +545,7 @@ check_static_begin(array_adaptive_map_test_clear_with_destructor) { check_static_begin(array_adaptive_map_test_clear_and_free_with_destructor) { enum : size_t { - MIN_CAP = 16 + MIN_CAP = 16, }; CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, @@ -559,7 +560,8 @@ check_static_begin(array_adaptive_map_test_clear_and_free_with_destructor) { allocator, MIN_CAP ); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[MIN_CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(0, (CCC_Tribool[MIN_CAP]){}); int i = 0; for (;;) { CCC_Handle const *const e = array_adaptive_map_try_insert_with( diff --git a/tests/specialized/priority_queue/test_priority_queue_erase.c b/tests/specialized/priority_queue/test_priority_queue_erase.c index 2b801257d..9e587f391 100644 --- a/tests/specialized/priority_queue/test_priority_queue_erase.c +++ b/tests/specialized/priority_queue/test_priority_queue_erase.c @@ -343,7 +343,7 @@ check_static_begin(priority_queue_test_clear_destructor) { ); int i = 0; Flat_bitset is_destroyed - = flat_bitset_with_storage(STANDARD_CAP, (Bit[STANDARD_CAP]){}); + = flat_bitset_with_storage(STANDARD_CAP, (CCC_Tribool[STANDARD_CAP]){}); while (i < STANDARD_CAP) { struct Val const *const v = CCC_priority_queue_push( &queue, &(struct Val){.id = i, .val = i}.elem, &allocator diff --git a/tests/tree_map/test_tree_map_erase.c b/tests/tree_map/test_tree_map_erase.c index ee7155358..ff9dd6156 100644 --- a/tests/tree_map/test_tree_map_erase.c +++ b/tests/tree_map/test_tree_map_erase.c @@ -117,7 +117,7 @@ check_static_begin(tree_map_test_prime_shuffle) { size_t shuffled_index = PRIME % (SHUFFLE_CAP - LESS); struct Val vals[SHUFFLE_CAP]; Flat_bitset repeats - = flat_bitset_with_storage(SHUFFLE_CAP, (CCC_Bit[SHUFFLE_CAP]){}); + = flat_bitset_with_storage(SHUFFLE_CAP, (CCC_Tribool[SHUFFLE_CAP]){}); for (size_t i = 0; i < SHUFFLE_CAP; ++i) { vals[i].val = (int)shuffled_index; vals[i].key = (int)shuffled_index; @@ -154,7 +154,7 @@ check_static_begin(tree_map_test_weak_srand) { }; struct Val vals[SRAND_CAP]; Flat_bitset repeats - = flat_bitset_with_storage(SRAND_CAP, (CCC_Bit[SRAND_CAP]){}); + = flat_bitset_with_storage(SRAND_CAP, (CCC_Tribool[SRAND_CAP]){}); for (int i = 0; i < SRAND_CAP; ++i) { vals[i].key = (int)rand(); // NOLINT vals[i].val = i; @@ -193,7 +193,7 @@ check_static_begin(tree_map_test_insert_erase_cycles) { }; int keys[CYCLES_TEST_CAP] = {}; CCC_Flat_bitset repeats = CCC_flat_bitset_with_storage( - CYCLES_TEST_CAP, (CCC_Bit[CYCLES_TEST_CAP]){} + CYCLES_TEST_CAP, (CCC_Tribool[CYCLES_TEST_CAP]){} ); for (int i = 0; i < CYCLES_TEST_CAP; ++i) { keys[i] = (int)rand(); /* NOLINT */ diff --git a/tests/tree_map/test_tree_map_iterator.c b/tests/tree_map/test_tree_map_iterator.c index 041716cd0..1ea87257d 100644 --- a/tests/tree_map/test_tree_map_iterator.c +++ b/tests/tree_map/test_tree_map_iterator.c @@ -524,7 +524,7 @@ destroy_element(CCC_Arguments const arguments) { check_static_begin(tree_map_test_clear_with_destructor) { enum : size_t { - MIN_CAP = 16 + MIN_CAP = 16, }; CCC_Allocator const allocator = { .allocate = stack_allocator_allocate, @@ -533,7 +533,8 @@ check_static_begin(tree_map_test_clear_with_destructor) { CCC_Tree_map map = tree_map_default( struct Val, elem, key, (CCC_Key_comparator){.compare = id_order} ); - Flat_bitset is_destroyed = flat_bitset_with_storage(0, (Bit[MIN_CAP]){}); + Flat_bitset is_destroyed + = flat_bitset_with_storage(0, (CCC_Tribool[MIN_CAP]){}); int i = 0; for (;;) { CCC_Entry const *const e = tree_map_try_insert_with(