Skip to content

BitVecDeinit

Description

Release all storage owned by bv and reset it to the zeroed state.

Parameters

Name Direction Description
bv in,out Bitvector to deinitialize. Must not be used until reinitialized.

Success

Backing buffer freed; bv left with NULL data, zero length, zero capacity.

Failure

Function cannot fail; aborts on a corrupted magic via the validator.

Usage example (Cross-references)

Usage examples (Cross-references)
    /// TAGS: Int, Deinit, Memory
    ///
    #define IntDeinit(value) BitVecDeinit(&(value)->bits)
    
    ///
    }
    
    void BitVecDeinit(BitVec *bitvec) {
        ValidateBitVec(bitvec);
        if (bitvec->data) {
    
        if (!BitVecReserve(out, bv->length) || !BitVecResize(out, bv->length)) {
            BitVecDeinit(out);
            *out = BitVecInit(bv->allocator);
            return false;
            if (str[i] == '1') {
                if (!BitVecPush(out, true)) {
                    BitVecDeinit(out);
                    *out = BitVecInit(alloc);
                    return false;
            } else if (str[i] == '0') {
                if (!BitVecPush(out, false)) {
                    BitVecDeinit(out);
                    *out = BitVecInit(alloc);
                    return false;
    
        if (!BitVecReserve(out, bit_len) || !BitVecResize(out, bit_len)) {
            BitVecDeinit(out);
            *out = BitVecInit(alloc);
            return false;
    
        if (!BitVecReserve(out, bits) || !BitVecResize(out, bits)) {
            BitVecDeinit(out);
            *out = BitVecInit(alloc);
            return false;
        BitVec temp = BitVecClone(bv);
        if (temp.length != bv->length) {
            BitVecDeinit(&temp);
            return;
        }
        }
    
        BitVecDeinit(&temp);
    }
        BitVec temp = BitVecClone(bv);
        if (temp.length != bv->length) {
            BitVecDeinit(&temp);
            return;
        }
        }
    
        BitVecDeinit(&temp);
    }
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
        result      = result && (BitVecLen(&bv) == 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecByteSize(&bv) == 8);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&original);
        BitVecDeinit(&clone);
        // Clean up
        BitVecDeinit(&original);
        BitVecDeinit(&clone);
    
        DefaultAllocatorDeinit(&alloc);
                      BitVecGet(&clone, 0) == true && BitVecGet(&clone, 1) == false && BitVecGet(&clone, 2) == true;
    
        BitVecDeinit(&original);
        BitVecDeinit(&clone);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&original);
        BitVecDeinit(&clone);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecLen(&bv) == 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecCapacity(&bv) >= 10000);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecLen(&bv1) == 2);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVec clone1 = BitVecClone(&bv);
        result        = result && (BitVecLen(&clone1) == 0);
        BitVecDeinit(&clone1);
    
        // Test clone single element
        result        = result && (BitVecLen(&clone2) == 1);
        result        = result && (BitVecGet(&clone2, 0) == true);
        BitVecDeinit(&clone2);
    
        // Test clone large data
        result = result && (BitVecGet(&clone3, 0) != BitVecGet(&bv, 0));
    
        BitVecDeinit(&clone3);
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&clone3);
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
            }
    
            BitVecDeinit(&bv1);
            BitVecDeinit(&bv2);
            BitVecDeinit(&clone);
    
            BitVecDeinit(&bv1);
            BitVecDeinit(&bv2);
            BitVecDeinit(&clone);
        }
            BitVecDeinit(&bv1);
            BitVecDeinit(&bv2);
            BitVecDeinit(&clone);
        }
        BitVecSwap(NULL, &bv);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        result      = result && (BitVecGet(&bv, 7) == false);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (BitVecLen(&bv) == 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (BitVecCountOnes(&bv) == BitVecCountOnes(&bv));
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (BitVecGet(&small, 0) == true);
    
        BitVecDeinit(&small);
        BitVecDeinit(&large);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&small);
        BitVecDeinit(&large);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
        DefaultAllocator alloc = DefaultAllocatorInit();
    
        WriteFmt("Testing BitVecDeinit\n");
    
        BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
    
        // Deinitialize
        BitVecDeinit(&bv);
    
        // After deinitialization, the bitvector should be in a safe state
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up all
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        // Clean up all
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
    
        DefaultAllocatorDeinit(&alloc);
        result = result && (BitVecCapacity(&bv) == cap_before);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecLen(&bv) == 10);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecLen(&bv) == 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
            result = result && (BitVecLen(&bv) == (size)(cycle % 10));
            BitVecDeinit(&bv);
        }
    
        // Test NULL bitvec pointer - should abort
        BitVecDeinit(NULL);
    
        // If we reach here, validation didn't work as expected
    
        // If we reach here, validation didn't work as expected
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
    
        // If we reach here, validation didn't work as expected
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecGet(&bv, 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecSet(&bv, 0, true);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecFlip(&bv, 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecGet(&bv, 1000);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecSet(&bv, 500, true);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecFlip(&bv, 10);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecGet(&bv, SIZE_MAX);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&subset);
        BitVecDeinit(&superset);
        // Clean up
        BitVecDeinit(&subset);
        BitVecDeinit(&superset);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&superset);
        BitVecDeinit(&subset);
        // Clean up
        BitVecDeinit(&superset);
        BitVecDeinit(&subset);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
        result = result && BitVecIsSubset(&bv1, &bv2); // Empty is subset of empty
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && BitVecOverlaps(&bv1, &bv2);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&subset);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&subset);
        BitVecDeinit(&superset);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&subset);
        BitVecDeinit(&superset);
        BitVecDeinit(&bv3);
        BitVecDeinit(&subset);
        BitVecDeinit(&superset);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&large1);
        BitVecDeinit(&large2);
        BitVecDeinit(&pos);
        // Clean up
        BitVecDeinit(&large1);
        BitVecDeinit(&large2);
        BitVecDeinit(&pos);
        BitVecDeinit(&neg);
        BitVecDeinit(&large1);
        BitVecDeinit(&large2);
        BitVecDeinit(&pos);
        BitVecDeinit(&neg);
        BitVecDeinit(&large2);
        BitVecDeinit(&pos);
        BitVecDeinit(&neg);
    
        DefaultAllocatorDeinit(&alloc);
        BitVecEquals(NULL, &bv);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecEqualsRange(NULL, 0, &bv, 0, 1);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecEqualsRange(&bv1, 0, &bv2, 0, 5); // Range exceeds length
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return false;
        result      = result && (bitvec_hash(&empty1, 0) == bitvec_hash(&empty2, 0));
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&empty1);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&empty1);
        BitVecDeinit(&empty2);
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&empty1);
        BitVecDeinit(&empty2);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&b);
        BitVecDeinit(&empty1);
        BitVecDeinit(&empty2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (bitvec_hash(&a, 0) != bitvec_hash(&c, 0));
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&c);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&c);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&c);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (MapPairCount(&counts) == 2);
    
        BitVecDeinit(&k1);
        BitVecDeinit(&k2);
        BitVecDeinit(&probe);
    
        BitVecDeinit(&k1);
        BitVecDeinit(&k2);
        BitVecDeinit(&probe);
        BitVecDeinit(&missing);
        BitVecDeinit(&k1);
        BitVecDeinit(&k2);
        BitVecDeinit(&probe);
        BitVecDeinit(&missing);
        MapDeinit(&counts);
        BitVecDeinit(&k2);
        BitVecDeinit(&probe);
        BitVecDeinit(&missing);
        MapDeinit(&counts);
        DefaultAllocatorDeinit(&alloc);
        result      = result && (cmp(&a, &a) == 0);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&c);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&c);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&c);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVecEquals(&bv1, &bad);
    
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecEqualsRange(&bv1, 0, &bad, 0, 0);
    
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return false;
        bool result = (bitvec_hash(&a, 0) != bitvec_hash(&b, 0));
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (bitvec_hash(&a, 0) != bitvec_hash(&b, 0));
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (bitvec_hash(&a, 0) != bitvec_hash(&b, 0));
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVecCompare(NULL, &bv); // must abort
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecCompare(&bv, NULL); // must abort
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecCompareRange(NULL, 0, &bv, 0, 1); // must abort
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecCompareRange(&bv, 0, NULL, 0, 1); // must abort
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecNumericalCompare(NULL, &bv); // must abort
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        bool result = (BitVecNumericalCompare(&bv1, &bv2) > 0);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecSignedCompare(&neg, &empty) < 0);
    
        BitVecDeinit(&neg);
        BitVecDeinit(&empty);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&neg);
        BitVecDeinit(&empty);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecSignedCompare(&empty, &neg) > 0);
    
        BitVecDeinit(&empty);
        BitVecDeinit(&neg);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&empty);
        BitVecDeinit(&neg);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecSignedCompare(&neg, &pos) < 0);
    
        BitVecDeinit(&neg);
        BitVecDeinit(&pos);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&neg);
        BitVecDeinit(&pos);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecSignedCompare(&empty, &neg) > 0);
    
        BitVecDeinit(&empty);
        BitVecDeinit(&neg);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&empty);
        BitVecDeinit(&neg);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecSignedCompare(&neg, &empty) < 0);
    
        BitVecDeinit(&neg);
        BitVecDeinit(&empty);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&neg);
        BitVecDeinit(&empty);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecSignedCompare(&a, &b) == 0);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecSignedCompare(&a, &b) < 0);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVecNumericalCompare(&bv, NULL); // must abort
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecSignedCompare(NULL, &bv); // must abort
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecSignedCompare(&bv, NULL); // must abort
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecIsSubset(NULL, &bv); // must abort
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        bool result = (BitVecIsSubset(&bv1, &bv2) == false);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecIsSubset(&bv1, &bv2) == true);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecIsSubset(&bv1, &bv2) == true);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecDisjoint(&bv1, &bv2) == false);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVecIsSubset(&bv1, NULL);
    
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecDisjoint(NULL, &bv2);
    
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecDisjoint(&bv1, NULL);
    
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return false;
        bool result = (ha == exp_a) && (hb == exp_b);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&source);
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&source);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
        result = result && (BitVecGet(&bv, 999) == true);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&bv, 500) == false);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&empty);
        BitVecDeinit(&source);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&empty);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&bv);
        BitVecDeinit(&empty);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&bv, 1) == true);  // Second bit
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVecInsertRange(&bv, SIZE_MAX, 1, true);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        result      = result && (BitVecGet(&bv, 5) == true);  // shifted orig[3]
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (BitVecGet(&bv, 4) == true);  // shifted orig[2]
    
        BitVecDeinit(&bv);
        BitVecDeinit(&other);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&other);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        // If we reach here, validation did not abort.
        BitVecDeinit(&other);
        DefaultAllocatorDeinit(&alloc);
        return false;
    
        // If we reach here, validation did not abort.
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecFindPattern(NULL, &pattern); // Should cause LOG_FATAL
    
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecFindPattern(&source, NULL); // Should cause LOG_FATAL
    
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecFindLastPattern(NULL, &pattern); // Should cause LOG_FATAL
    
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecFindLastPattern(&source, NULL); // Should cause LOG_FATAL
    
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecFindAllPattern(&source, NULL, results, 10); // Should cause LOG_FATAL
    
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecFindAllPattern(&source, &pattern, NULL, 10); // Should cause LOG_FATAL
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecFindAllPattern(&source, &pattern, results, 0); // Should cause LOG_FATAL
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&prefix, true);
        BitVecStartsWith(NULL, &prefix);
        BitVecDeinit(&prefix);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&source, true);
        BitVecStartsWith(&source, NULL);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&suffix, true);
        BitVecEndsWith(NULL, &suffix);
        BitVecDeinit(&suffix);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&source, true);
        BitVecEndsWith(&source, NULL);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&pattern, true);
        BitVecContainsAt(NULL, &pattern, 0);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&source, true);
        BitVecContainsAt(&source, NULL, 0);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&wildcard, false);
        BitVecMatches(NULL, &pattern, &wildcard);
        BitVecDeinit(&pattern);
        BitVecDeinit(&wildcard);
        DefaultAllocatorDeinit(&alloc);
        BitVecMatches(NULL, &pattern, &wildcard);
        BitVecDeinit(&pattern);
        BitVecDeinit(&wildcard);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&source, true);
        BitVecRegexMatch(&source, (Zstr)NULL);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        DefaultAllocator alloc = DefaultAllocatorInit();
        WriteFmt("Testing BitVecPrefixMatch(NULL, patterns, 1) - should fatal\n");
        BitVecs vp = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
        BitVecPush(VecPtrAt(&vp, 0), true);
        BitVecPrefixMatch(NULL, &vp);
        BitVecPush(&source, true);
        BitVecPrefixMatch(&source, NULL);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        DefaultAllocator alloc = DefaultAllocatorInit();
        WriteFmt("Testing BitVecSuffixMatch(NULL, patterns, 1) - should fatal\n");
        BitVecs vp = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
        BitVecPush(VecPtrAt(&vp, 0), true);
        BitVecSuffixMatch(NULL, &vp);
        BitVecPush(&source, true);
        BitVecSuffixMatch(&source, NULL);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecCountPattern(NULL, &pattern); // Should LOG_FATAL
    
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecCountPattern(&source, NULL); // Should LOG_FATAL
    
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecRFindPattern(NULL, &pattern, 0); // Should LOG_FATAL
    
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecRFindPattern(&source, NULL, 0); // Should LOG_FATAL
    
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecReplace(&source, &old_pattern, NULL); // real: LOG_FATAL
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecReplaceAll(&bad, &old_pattern, &new_pattern); // real: LOG_FATAL
    
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecReplaceAll(&source, NULL, &new_pattern); // real: LOG_FATAL
    
        BitVecDeinit(&source);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecReplaceAll(&source, &old_pattern, NULL); // real: LOG_FATAL
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecMatches(&source, NULL, &wildcard); // must abort
    
        BitVecDeinit(&source);
        BitVecDeinit(&wildcard);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&wildcard);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecMatches(&source, &pattern, NULL); // must abort
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecFuzzyMatch(NULL, &pattern, 0); // must abort
    
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecFuzzyMatch(&source, NULL, 0); // must abort
    
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return false;
        WriteFmt("Testing BitVecPrefixMatch(NULL, empty) - should fatal\n");
    
        BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
    
        // Empty patterns: with validation present this aborts on the NULL bv;
        WriteFmt("Testing BitVecSuffixMatch(NULL, empty) - should fatal\n");
    
        BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
    
        // Empty patterns: with validation present this aborts on the NULL bv;
        BitVecRunLengths(&bv, NULL, values, 5);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return true; // Should never reach here
        BitVecRunLengths(&bv, runs, NULL, 5);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return true; // Should never reach here
        BitVecRunLengths(&bv, runs, values, 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return true; // Should never reach here
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
        result = result && (count == 1000);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (count == 2); // Should iterate over indices 8,9
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
            result = result && (count4 == sz);
    
            BitVecDeinit(&bv);
        }
        }
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        VecDeinit(&runs);
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        u64    count = BitVecRunLengths(&empty_bv, runs, values, 5);
        result       = result && (count == 0);
        BitVecDeinit(&empty_bv);
    
        // Test 2: Single bit (true)
        result = result && (count == 1);
        result = result && (runs[0] == 1 && values[0] == true);
        BitVecDeinit(&single_bv);
    
        // Test 3: Single bit (false)
        result = result && (count == 1);
        result = result && (runs[0] == 1 && values[0] == false);
        BitVecDeinit(&single_false_bv);
    
        // Test 4: All same bits (all true)
        result = result && (count == 1);
        result = result && (runs[0] == 10 && values[0] == true);
        BitVecDeinit(&all_true_bv);
    
        // Test 5: Alternating bits (0101010)
            result = result && (alt_values[i] == (i % 2 == 0));
        }
        BitVecDeinit(&alternating_bv);
    
        DefaultAllocatorDeinit(&alloc);
        result = result && (count == 8);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
    
        BitVecDeinit(&large_bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        // Clean up
        BitVecDeinit(&bitvec);
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bitvec);
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        // Clean up
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&result);
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&result);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
        result = result && (BitVecLen(&bv) == 1000);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecLen(&bv) == 2);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&result_bv, 0) == false);
    
        BitVecDeinit(&result_bv);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&result_bv);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&bv, 1) == false);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        return test_result;
        result = result && (BitVecGet(&bv, 2) == true);  // original bit 0
    
        BitVecDeinit(&bv);
        BitVecDeinit(&original);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&original);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&bv, 4) == false);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&original);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&original);
        DefaultAllocatorDeinit(&alloc);
        return result;
        test_result = test_result && or_ones;
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        return test_result;
        test_result = test_result && xor_commutative;
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result1);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result1);
        BitVecDeinit(&result2);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result1);
        BitVecDeinit(&result2);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result1);
        BitVecDeinit(&result2);
        DefaultAllocatorDeinit(&alloc);
        return test_result;
        }
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        return test_result;
        ok      = ok && (BitVecGet(&result, 3) == false);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&result);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        ok      = ok && (BitVecGet(&result, 3) == false);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&result);
    
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&a);
        BitVecDeinit(&b);
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        bool result = (BitVecLen(&bv) == 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (BitVecGet(&bv, 7) == false);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        ok      = ok && (BitVecGet(&bv, 3) == true);
    
        BitVecDeinit(&bv);
    
        // Real code frees the temp clone inside rotate; with the Deinit
        ok      = ok && (BitVecGet(&bv, 3) == false);
    
        BitVecDeinit(&bv);
    
        // Real code frees the temp clone inside rotate; with the Deinit
        BitVecAnd(NULL, &bv, &bv2);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecAnd(NULL, &bv1, &bv2);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecOr(&result, &bv1, NULL);
    
        BitVecDeinit(&result);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&result);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecXor(&result, NULL, &bv1);
    
        BitVecDeinit(&result);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&result);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecNot(&result, NULL);
    
        BitVecDeinit(&result);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecAnd(&result, &a, &bad);
    
        BitVecDeinit(&result);
        BitVecDeinit(&a);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&result);
        BitVecDeinit(&a);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecAnd(&result, &bad, &b);
    
        BitVecDeinit(&result);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&result);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecOr(&result, &bad, &b);
    
        BitVecDeinit(&result);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&result);
        BitVecDeinit(&b);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecXor(&result, &a, &bad);
    
        BitVecDeinit(&result);
        BitVecDeinit(&a);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&result);
        BitVecDeinit(&a);
        DefaultAllocatorDeinit(&alloc);
        return false;
        result    = result && (index == 1); // Should find pattern at index 1 (101...)
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        // Depending on the exact source pattern, adjust this test
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (index == 2); // Only occurrence at index 2
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (count == 3); // Should find at 0, 3, 6
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        VecDeinit(&matches);
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        VecDeinit(&matches);
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result    = result && (results[0] == 0);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && !BitVecStartsWith(&source, &prefix);
    
        BitVecDeinit(&source);
        BitVecDeinit(&prefix);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&prefix);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && BitVecStartsWith(&source, &prefix);
    
        BitVecDeinit(&source);
        BitVecDeinit(&prefix);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&prefix);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && !BitVecEndsWith(&source, &suffix);
    
        BitVecDeinit(&source);
        BitVecDeinit(&suffix);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&suffix);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && !BitVecEndsWith(&source, &suffix);
    
        BitVecDeinit(&source);
        BitVecDeinit(&suffix);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&suffix);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecFindPattern(&source, &pattern) == SIZE_MAX);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && BitVecContainsAt(&source, &pattern, 3);  // Should match
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && !BitVecContainsAt(&source, &pattern, 0); // Pattern too long
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (count == 3);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (pos == 3); // Should find at position 3
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&source, 2) == true);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecLen(&source) == 6); // 3 * 2 = 6
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && BitVecMatches(&source, &pattern, &wildcard);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        BitVecDeinit(&wildcard);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        BitVecDeinit(&wildcard);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        BitVecDeinit(&wildcard);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (pos == 0); // Should match 110 with 1 error
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && !BitVecRegexMatch(&source, "111");
    
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        BitVec  source   = BitVecInit(ALLOCATOR_OF(&alloc));
        BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
        bool    result   = true;
    
        VecDeinit(&patterns);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        BitVec  source   = BitVecInit(ALLOCATOR_OF(&alloc));
        BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
        bool    result   = true;
    
        VecDeinit(&patterns);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result    = result && (index == 0);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        VecDeinit(&matches);
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        VecDeinit(&matches);
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = BitVecEndsWith(&source, &suffix);
    
        BitVecDeinit(&source);
        BitVecDeinit(&suffix);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&suffix);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecCountPattern(&source, &pattern) == 1);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecRFindPattern(&source, &pattern, 2) == 0);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (pos == SIZE_MAX);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (pos == SIZE_MAX);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (pos == SIZE_MAX);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (pos == 6);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (pos == SIZE_MAX);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result           = result && (BitVecGet(&source, 3) == false);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result           = result && (BitVecLen(&source) == 4); // 5 - 3 + 2
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&source);
        BitVecDeinit(&old_pattern);
        BitVecDeinit(&new_pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
            result = result && (BitVecGet(&source, i) == false);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old);
        BitVecDeinit(&neww);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old);
        BitVecDeinit(&neww);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&source);
        BitVecDeinit(&old);
        BitVecDeinit(&neww);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&source, 1) == true);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old);
        BitVecDeinit(&neww);
    
        BitVecDeinit(&source);
        BitVecDeinit(&old);
        BitVecDeinit(&neww);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&source);
        BitVecDeinit(&old);
        BitVecDeinit(&neww);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecMatches(&source, &pattern, &wild_all) == true);
    
        BitVecDeinit(&wild_all);
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
    
        BitVecDeinit(&wild_all);
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        BitVecDeinit(&wildcard);
        BitVecDeinit(&wild_all);
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        BitVecDeinit(&wildcard);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        BitVecDeinit(&wildcard);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecFuzzyMatch(&source, &pattern, 0) == 0);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecFuzzyMatch(&source, &pattern, 0) == 5);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecFuzzyMatch(&source, &pattern, 0) == SIZE_MAX);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&source);
        BitVecDeinit(&pattern);
        DefaultAllocatorDeinit(&alloc);
        return result;
        StrDeinit(&pat_no);
        StrDeinit(&pat_yes);
        BitVecDeinit(&source);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool ok      = (matched == true);
    
        BitVecDeinit(&bv);
    
        // The rendered bv_str borrows bv's DebugAllocator. Real code frees it;
    
        StrDeinit(&pattern);
        BitVecDeinit(&bv);
    
        // bv_str (the render of bv) borrows bv's DebugAllocator. Real code
        result   = result && (distance == 1);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result   = result && (distance == 2); // Length of bv1
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result     = result && (F64Abs(similarity - 0.5) < 0.001);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result     = result && (F64Abs(similarity - 1.0) < 0.001);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result     = result && (F64Abs(similarity - 0.0) < 0.001);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result     = result && (similarity == 0.0);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (product == 0);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (product == 1); // Only first position counts
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result   = result && (distance == 1);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result   = result && (distance == 2);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (F64Abs(correlation + 1.0) < 0.001);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (correlation == 0.0); // No variance
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (entropy == 0.0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (entropy == 0.0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (score == -3); // 3 mismatches * -1
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (score == 2); // 2 matches
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result       = result && (best_pos == 0 || best_pos == 4);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result   = result && (best_pos == 0);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (edit_dist < 100);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&small1);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&small1);
        BitVecDeinit(&small2);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&small1);
        BitVecDeinit(&small2);
        DefaultAllocatorDeinit(&alloc);
        BitVecDeinit(&bv2);
        BitVecDeinit(&small1);
        BitVecDeinit(&small2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVecPush(&bv2, true);
        BitVecHammingDistance(NULL, &bv2);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv1, true);
        BitVecHammingDistance(&bv1, NULL);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv2, true);
        BitVecJaccardSimilarity(NULL, &bv2);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv1, true);
        BitVecJaccardSimilarity(&bv1, NULL);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv2, true);
        BitVecCosineSimilarity(NULL, &bv2);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv1, true);
        BitVecCosineSimilarity(&bv1, NULL);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv2, true);
        BitVecDotProduct(NULL, &bv2);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv1, true);
        BitVecDotProduct(&bv1, NULL);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv2, true);
        BitVecEditDistance(NULL, &bv2);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv1, true);
        BitVecEditDistance(&bv1, NULL);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv2, true);
        BitVecCorrelation(NULL, &bv2);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv1, true);
        BitVecCorrelation(&bv1, NULL);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv2, true);
        BitVecAlignmentScore(NULL, &bv2, 1, -1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv1, true);
        BitVecAlignmentScore(&bv1, NULL, 1, -1);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv2, true);
        BitVecBestAlignment(NULL, &bv2);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return true;
        BitVecPush(&bv1, true);
        BitVecBestAlignment(&bv1, NULL);
        BitVecDeinit(&bv1);
        DefaultAllocatorDeinit(&alloc);
        return true;
        result    = result && (F64Abs(s2 - 0.0) < 0.001);
    
        BitVecDeinit(&empty);
        BitVecDeinit(&one);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&empty);
        BitVecDeinit(&one);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool   result = (F64Abs(s - 1.0) < 0.001);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool   result = (F64Abs(s - 1.0) < 0.001);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool   result = (F64Abs(s - 0.0) < 0.001);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (dist == 1);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (dist == 1);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
        (void)BitVecEditDistance(&warm_a, &warm_b);
        BitVecDeinit(&warm_a);
        BitVecDeinit(&warm_b);
        (void)BitVecEditDistance(&warm_a, &warm_b);
        BitVecDeinit(&warm_a);
        BitVecDeinit(&warm_b);
    
        BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
        bool result = (dist == 5);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
        (void)BitVecEditDistance(&warm_a, &warm_b);
        BitVecDeinit(&warm_a);
        BitVecDeinit(&warm_b);
        (void)BitVecEditDistance(&warm_a, &warm_b);
        BitVecDeinit(&warm_a);
        BitVecDeinit(&warm_b);
    
        BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
        bool result = (dist == 4);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (dist == 2);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVecJaccardSimilarity(&empty, &bad);
    
        BitVecDeinit(&empty);
        DefaultAllocatorDeinit(&alloc);
        return false;
        result             = result && (correlation >= -1.0 && correlation <= 1.0);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result             = result && (correlation >= -1.0 && correlation <= 1.0);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (F64Abs(entropy - 0.811278) < 0.01);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result          = result && (best_offset == 3);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result            = result && (F64Abs(similarity - 1.0) < 0.001);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result         = result && (F64Abs(entropy - 0.8112782517394319) < 0.001);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result         = result && (F64Abs(entropy - 0.8112781245) < 0.001);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecBestAlignment(&bv1, &bv2) == 2);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecBestAlignment(&bv1, &bv2) == 1);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecBestAlignment(&bv1, &bv2) == 0);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecBestAlignment(&bv1, &bv2) == 2);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecBestAlignment(&bv1, &bv2) == 2);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
        }
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result  = result && (BitVecLen(&bv) == 999);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecLen(&bv) == 5); // Should have 5 elements left
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (found == true) && (BitVecLen(&bv) == 999);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (count == 500) && (BitVecLen(&bv) == 500);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVecRemoveRange(&bv, SIZE_MAX, 1);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecPop(&bv);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecRemove(&bv, 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        BitVecRemoveRange(&bv, 0, 1);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        result      = result && (BitVecGet(&bv, 1) == true);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (BitVecGet(&bv, 1) == true);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && (BitVecGet(&bv, 6) == false); // orig[9]
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        // If we reach here, validation did not abort.
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return false;
        // Clean up
        StrDeinit(&str);
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&empty_bv);
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&empty_bv);
    
        DefaultAllocatorDeinit(&alloc);
            result = result && (bytes[0] == 0xCD);
        }
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&bv2);
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&bv2);
    
        DefaultAllocatorDeinit(&alloc);
    
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&zero_bv);
        // Clean up
        BitVecDeinit(&bv);
        BitVecDeinit(&zero_bv);
    
        DefaultAllocatorDeinit(&alloc);
    
        StrDeinit(&str);
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVec empty_bv       = BitVecFromBytes(dummy_bytes, 0, ALLOCATOR_OF(&alloc));
        bool   result         = (BitVecLen(&empty_bv) == 0);
        BitVecDeinit(&empty_bv);
    
        DefaultAllocatorDeinit(&alloc);
        StrDeinit(&str_obj);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVec bv1 = BitVecFromStr("", ALLOCATOR_OF(&alloc));
        result     = result && (BitVecLen(&bv1) == 0);
        BitVecDeinit(&bv1);
    
        // Test single character
        result     = result && (BitVecLen(&bv2) == 1);
        result     = result && (BitVecGet(&bv2, 0) == true);
        BitVecDeinit(&bv2);
    
        // Test long string
        result     = result && (BitVecGet(&bv3, 0) == true);
        result     = result && (BitVecGet(&bv3, 1) == false);
        BitVecDeinit(&bv3);
    
        DefaultAllocatorDeinit(&alloc);
        BitVec bv2            = BitVecFromBytes(empty_bytes, 0, ALLOCATOR_OF(&alloc)); // 0 bits
        result                = result && (BitVecLen(&bv2) == 0);
        BitVecDeinit(&bv2);
    
        // Test single byte
        BitVec bv3            = BitVecFromBytes(single_byte, 8, ALLOCATOR_OF(&alloc)); // 8 bits from 1 byte
        result                = result && (BitVecLen(&bv3) == 8);
        BitVecDeinit(&bv3);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&bv3);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        BitVec bv2 = BitVecFromInteger(0, 8, ALLOCATOR_OF(&alloc)); // 8 bits for zero
        result     = result && (BitVecLen(&bv2) == 8);              // Should be 8 bits
        BitVecDeinit(&bv2);
    
        // Test large integer
        BitVec bv3 = BitVecFromInteger(UINT64_MAX, 64, ALLOCATOR_OF(&alloc)); // 64 bits for max value
        result     = result && (BitVecLen(&bv3) == 64);
        BitVecDeinit(&bv3);
    
        BitVecDeinit(&bv);
        BitVecDeinit(&bv3);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
            StrDeinit(&str);
            BitVecDeinit(&bv);
        }
                result = result && (recovered == value);
    
                BitVecDeinit(&bv);
            }
        }
            result = result && (recovered_byte == test_bytes[i]);
    
            BitVecDeinit(&bv);
        }
        u64 large_value = BitVecToInteger(&large_bv);
        result          = result && (large_value == 0xFFFFFFFFFFFFFFFF);
        BitVecDeinit(&large_bv);
    
        // Test oversized bitvec to integer (should handle gracefully)
        // Should return some value or 0, but not crash
        result = result && (oversized_value >= 0); // Always true for u64, but documents intent
        BitVecDeinit(&oversized);
    
        // Test zero-length conversions
        result             = result && (empty_bytes[0] == 0xFF); // Should be unchanged
    
        BitVecDeinit(&empty);
    
        DefaultAllocatorDeinit(&alloc);
            }
    
            BitVecDeinit(&bv);
        }
        StrDeinit(&str2);
        StrDeinit(&str3);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        StrDeinit(&str3);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
    
        DefaultAllocatorDeinit(&alloc);
        result = result && recovered_pattern_correct;
    
        BitVecDeinit(&large_bv);
        BitVecDeinit(&recovered_bv);
    
        BitVecDeinit(&large_bv);
        BitVecDeinit(&recovered_bv);
    
        // Test string to bitvec with large patterns
        result = result && large_pattern_correct;
    
        BitVecDeinit(&large_from_str);
    
        DefaultAllocatorDeinit(&alloc);
        BitVecToBytes(&bv, small_buffer, 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        bool result = ok && (BitVecLen(&bv) == 64);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (written == 1) && (bytes[0] == 0x0D);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        bool result = (written == 1) && (bytes[1] == 0xEE);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        }
    
        BitVecDeinit(&bv);
        StrDeinit(&s);
        DefaultAllocatorDeinit(&alloc);
                      (BitVecGet(&bv, 3) == false);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
                      (BitVecGet(&bv, 3) == false);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
                      (BitVecGet(&bv, 3) == false);   // unchanged
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecCapacity(&bv) >= 100);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        bool result = (BitVecCountOnes(&bv) == 3) && (BitVecCountZeros(&bv) == 2);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&bv, 63) == false); // 63 % 2 == 1, so i%2==0 is false for i=63
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&bv, 0) == false);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecGet(&bv, 0) == false);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecCountZeros(&bv) == 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecCountZeros(&bv) == 0);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecCountZeros(&bv) == 500);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecCountZeros(&bv) == 1);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        }
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecFindLast(&bv, false) == SIZE_MAX);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && !BitVecNone(&bv, false);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecLongestRun(&bv, false) == 1);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecFindLast(&bv, true) == 999);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && BitVecAny(&bv, false);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result = result && (BitVecLongestRun(&bv, false) == 1);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return result;
        StrClear(&output);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv_empty);
        BitVecDeinit(&bv2);
    
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv_empty);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&bv1);
        BitVecDeinit(&bv_empty);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&bv_zero);
        BitVecDeinit(&bv_empty);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&bv_zero);
        StrDeinit(&output);
        BitVecDeinit(&bv2);
        BitVecDeinit(&bv3);
        BitVecDeinit(&bv_zero);
        StrDeinit(&output);
        DefaultAllocatorDeinit(&alloc);
        bool ok = (BitVecToInteger(&bv) == 1) && (BitVecLen(&bv) == 4);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = (BitVecToInteger(&bv) == 0xDEAD) && (BitVecLen(&bv) == 16);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = (BitVecToInteger(&bv) == 0xDEAD) && (*z == '\0');
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = (BitVecToInteger(&bv) == 1) && (BitVecLen(&bv) == 3);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = (BitVecToInteger(&bv) == 8) && (*z == '\0');
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = (BitVecToInteger(&bv) == 0755) && (BitVecLen(&bv) == 9);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = (BitVecLen(&bv) == 10) && (BitVecToInteger(&bv) == 0x3ff);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = (BitVecLen(&bv) == 8) && (BitVecToInteger(&bv) == 0xff);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = (BitVecLen(&bv) == 17) && (BitVecToInteger(&bv) == 0x10000);
    
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = (StrLen(&out) == 7) && (ZstrCompare(StrBegin(&out), "    XX1") == 0);
    
        BitVecDeinit(&bv);
        StrDeinit(&out);
        DefaultAllocatorDeinit(&alloc);
        StrAppendFmt(&out, "{}", bv);
        bool ok = (ZstrCompare(StrBegin(&out), "10110") == 0);
        BitVecDeinit(&bv);
        return ok && dbg_no_leak(&dbg, &out);
    }
        StrAppendFmt(&out, "{6}", bv);
        ok = ok && (ZstrCompare(StrBegin(&out), "   101") == 0);
        BitVecDeinit(&bv);
        StrDeinit(&out);
        DefaultAllocatorDeinit(&alloc);
        ok = ok && (DebugAllocatorLiveCount(&dbg) == 0) && (DebugAllocatorLiveBytes(&dbg) == 0);
        DebugAllocatorDeinit(&dbg);
        BitVecDeinit(&v);
        HeapAllocatorDeinit(&va);
        return ok;
        );
        StrDeinit(&result1);
        BitVecDeinit(&bv1);
    
        BitVec bv2 = BitVecInit(alloc_base);
        success    = success && (value2 == 0xDEAD);
        WriteFmt("Test 2 - Hex: {}, Success: {}\n", value2, (value2 == 0xDEAD) ? "true" : "false");
        BitVecDeinit(&bv2);
    
        BitVec bv3 = BitVecInit(alloc_base);
        success    = success && (value3 == 0755);
        WriteFmt("Test 3 - Octal: {}, Success: {}\n", value3, (value3 == 0755) ? "true" : "false");
        BitVecDeinit(&bv3);
    
        BitVec bv4 = BitVecInit(alloc_base);
        );
        StrDeinit(&result4);
        BitVecDeinit(&bv4);
    
        BitVec bv5 = BitVecInit(alloc_base);
        );
        StrDeinit(&result5);
        BitVecDeinit(&bv5);
    
        WriteFmt("Overall BitVec reading success: {}\n", success ? "true" : "false");
        StrReadFmt(z, "{}", bv);
        bool ok = (BitVecToInteger(&bv) == 1) && (BitVecLen(&bv) == 4); // min-width clamp
        BitVecDeinit(&bv);
        ok = ok && (DebugAllocatorLiveCount(&dbg) == 0);
        DebugAllocatorDeinit(&dbg);
        StrReadFmt(z, "{}", bv);
        bool ok = (BitVecToInteger(&bv) == 0xDEAD) && (BitVecLen(&bv) == 16);
        BitVecDeinit(&bv);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        StrReadFmt(z, "{}", bv);
        bool ok = (BitVecToInteger(&bv) == 1) && (BitVecLen(&bv) == 3);
        BitVecDeinit(&bv);
        ok = ok && (DebugAllocatorLiveCount(&dbg) == 0);
        DebugAllocatorDeinit(&dbg);
        StrReadFmt(z, "{}", bv);
        bool ok = (BitVecLen(&bv) == 5) && (BitVecToInteger(&bv) == 13);
        BitVecDeinit(&bv);
        ok = ok && (DebugAllocatorLiveCount(&dbg) == 0);
        DebugAllocatorDeinit(&dbg);
        Zstr           p   = input;
        StrReadFmt(p, "{}", bv);
        BitVecDeinit(&bv);
        bool ok = (DebugAllocatorLiveCount(&dbg) == 0) && (DebugAllocatorLiveBytes(&dbg) == 0);
        DebugAllocatorDeinit(&dbg);
Last updated on