Skip to content

BitVec

BitVec

Description

Bit vector definition. This is a specialized container for efficiently storing boolean values as bits.

Each bit represents a boolean value, with 8 bits packed into each byte. This provides significant memory savings over storing booleans as separate bytes.

Fields

Name Description
length Number of bits currently in bitvector (always <= capacity)
capacity Max number of bits this bitvector can hold before doing a resize
data Bit data stored as bytes. Don’t access directly. Use BitVecGet/Set
byte_size Size of data array in bytes

Usage example (from documentation)

  BitVec flags;       // Bit vector for boolean flags

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    void _write_BitVec(Str *o, FmtInfo *fmt_info, BitVec *bv) {
        if (!o || !fmt_info || !bv) {
            LOG_FATAL("Invalid arguments");
    }
    
    const char *_read_BitVec(const char *i, FmtInfo *fmt_info, BitVec *bv) {
        (void)fmt_info; // Unused parameter
        if (!i || !bv) {
    
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    #include <string.h>
    static Int  int_from_str_radix_strict(const char *digits, u8 radix);
    
    static Int int_wrap(BitVec bits) {
        Int value;
    /// Bit vector implementation - efficient storage for boolean values
    
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Memory.h>
    #define BYTES_FOR_BITS(bits) (((bits) + BITS_PER_BYTE - 1) / BITS_PER_BYTE)
    
    void BitVecDeinit(BitVec *bitvec) {
        ValidateBitVec(bitvec);
        if (bitvec->data) {
    }
    
    void BitVecClear(BitVec *bitvec) {
        ValidateBitVec(bitvec);
        bitvec->length = 0;
    }
    
    void BitVecResize(BitVec *bitvec, u64 new_size) {
        ValidateBitVec(bitvec);
        if (new_size > bitvec->capacity) {
    }
    
    void BitVecReserve(BitVec *bitvec, u64 n) {
        ValidateBitVec(bitvec);
        if (n <= bitvec->capacity)
    }
    
    void BitVecShrinkToFit(BitVec *bv) {
        ValidateBitVec(bv);
        if (bv->length == 0) {
    
    
    void BitVecSwap(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    BitVec BitVecClone(BitVec *bv) {
        ValidateBitVec(bv);
        ValidateBitVec(bv);
    
        BitVec clone = BitVecInit();
        if (bv->length == 0) {
            return clone;
    }
    
    bool BitVecGet(BitVec *bitvec, u64 idx) {
        ValidateBitVec(bitvec);
        if (idx >= bitvec->length) {
    }
    
    void BitVecSet(BitVec *bitvec, u64 idx, bool value) {
        ValidateBitVec(bitvec);
        if (idx >= bitvec->length) {
    }
    
    void BitVecFlip(BitVec *bitvec, u64 idx) {
        ValidateBitVec(bitvec);
        if (idx >= bitvec->length) {
    }
    
    void BitVecPush(BitVec *bitvec, bool value) {
        ValidateBitVec(bitvec);
        if (bitvec->length >= bitvec->capacity) {
    }
    
    bool BitVecPop(BitVec *bitvec) {
        ValidateBitVec(bitvec);
        if (bitvec->length == 0) {
    }
    
    void BitVecInsert(BitVec *bitvec, u64 idx, bool value) {
        ValidateBitVec(bitvec);
        if (idx > bitvec->length) {
    }
    
    void BitVecInsertRange(BitVec *bv, u64 idx, u64 count, bool value) {
        ValidateBitVec(bv);
        if (idx > bv->length) {
    }
    
    void BitVecInsertMultiple(BitVec *bv, u64 idx, BitVec *other) {
        ValidateBitVec(bv);
        ValidateBitVec(other);
    }
    
    void BitVecInsertPattern(BitVec *bv, u64 idx, u8 pattern, u64 pattern_bits) {
        ValidateBitVec(bv);
        if (idx > bv->length) {
    }
    
    bool BitVecRemove(BitVec *bv, u64 idx) {
        ValidateBitVec(bv);
        if (idx >= bv->length) {
    }
    
    void BitVecRemoveRange(BitVec *bv, u64 idx, u64 count) {
        ValidateBitVec(bv);
        if (idx >= bv->length) {
    }
    
    bool BitVecRemoveFirst(BitVec *bv, bool value) {
        ValidateBitVec(bv);
    }
    
    bool BitVecRemoveLast(BitVec *bv, bool value) {
        ValidateBitVec(bv);
    }
    
    u64 BitVecRemoveAll(BitVec *bv, bool value) {
        ValidateBitVec(bv);
    }
    
    u64 BitVecCountOnes(BitVec *bitvec) {
        ValidateBitVec(bitvec);
        if (!bitvec->data)
    }
    
    u64 BitVecCountZeros(BitVec *bitvec) {
        ValidateBitVec(bitvec);
        return bitvec->length - BitVecCountOnes(bitvec);
    }
    
    void BitVecAnd(BitVec *result, BitVec *a, BitVec *b) {
        ValidateBitVec(result);
        ValidateBitVec(a);
    }
    
    void BitVecOr(BitVec *result, BitVec *a, BitVec *b) {
        ValidateBitVec(result);
        ValidateBitVec(a);
    }
    
    void BitVecXor(BitVec *result, BitVec *a, BitVec *b) {
        ValidateBitVec(result);
        ValidateBitVec(a);
    }
    
    void BitVecNot(BitVec *result, BitVec *bitvec) {
        ValidateBitVec(result);
        ValidateBitVec(bitvec);
    
    // Comparison functions
    bool BitVecEquals(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    bool BitVecEqualsRange(BitVec *bv1, u64 start1, BitVec *bv2, u64 start2, u64 len) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    int BitVecCompare(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    int BitVecCompareRange(BitVec *bv1, u64 start1, BitVec *bv2, u64 start2, u64 len) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    
    
    int BitVecNumericalCompare(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    int BitVecWeightCompare(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    int BitVecSignedCompare(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    bool BitVecIsSubset(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    bool BitVecIsSuperset(BitVec *bv1, BitVec *bv2) {
        return BitVecIsSubset(bv2, bv1);
    }
    }
    
    bool BitVecDisjoint(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    bool BitVecOverlaps(BitVec *bv1, BitVec *bv2) {
        return !BitVecDisjoint(bv1, bv2);
    }
    
    
    bool BitVecIsSorted(BitVec *bv) {
        ValidateBitVec(bv);
    
    // Conversion functions
    Str BitVecToStr(BitVec *bv) {
        ValidateBitVec(bv);
    }
    
    BitVec BitVecFromStr(const char *str) {
        if (!str) {
            LOG_FATAL("str is NULL");
        }
    
        BitVec result = BitVecInit();
    
        u64 str_len = strlen(str);
    }
    
    u64 BitVecToBytes(BitVec *bv, u8 *bytes, u64 max_len) {
        ValidateBitVec(bv);
        if (!bytes) {
    }
    
    BitVec BitVecFromBytes(const u8 *bytes, u64 bit_len) {
        if (!bytes) {
            LOG_FATAL("bytes is NULL");
        }
    
        BitVec result = BitVecInit();
    
        // Handle empty bitvector case
    }
    
    u64 BitVecToInteger(BitVec *bv) {
        ValidateBitVec(bv);
        if (bv->length == 0) {
    }
    
    BitVec BitVecFromInteger(u64 value, u64 bits) {
        BitVec result = BitVecInit();
        if (bits == 0) {
    
    BitVec BitVecFromInteger(u64 value, u64 bits) {
        BitVec result = BitVecInit();
        if (bits == 0) {
            return result;
    
    // Shift operations
    void BitVecShiftLeft(BitVec *bv, u64 positions) {
        ValidateBitVec(bv);
        if (positions == 0 || bv->length == 0) {
    }
    
    void BitVecShiftRight(BitVec *bv, u64 positions) {
        ValidateBitVec(bv);
        if (positions == 0 || bv->length == 0) {
    }
    
    void BitVecRotateLeft(BitVec *bv, u64 positions) {
        ValidateBitVec(bv);
        if (positions == 0 || bv->length == 0) {
    
        // Create a temporary copy
        BitVec temp = BitVecClone(bv);
    
        // Rotate left
    }
    
    void BitVecRotateRight(BitVec *bv, u64 positions) {
        ValidateBitVec(bv);
        if (positions == 0 || bv->length == 0) {
    
        // Create a temporary copy
        BitVec temp = BitVecClone(bv);
    
        // Rotate right
    }
    
    void BitVecReverse(BitVec *bv) {
        ValidateBitVec(bv);
        if (bv->length <= 1) {
    // Missing Access functions implementation
    
    u64 BitVecFind(BitVec *bv, bool value) {
        ValidateBitVec(bv);
    }
    
    u64 BitVecFindLast(BitVec *bv, bool value) {
        ValidateBitVec(bv);
    }
    
    bool BitVecAll(BitVec *bv, bool value) {
        ValidateBitVec(bv);
    }
    
    bool BitVecAny(BitVec *bv, bool value) {
        ValidateBitVec(bv);
        return BitVecFind(bv, value) != SIZE_MAX;
    }
    
    bool BitVecNone(BitVec *bv, bool value) {
        return !BitVecAny(bv, value);
    }
    }
    
    u64 BitVecLongestRun(BitVec *bv, bool value) {
        ValidateBitVec(bv);
    
    // Pattern search functions
    u64 BitVecFindPattern(BitVec *bv, BitVec *pattern) {
        ValidateBitVec(bv);
        ValidateBitVec(pattern);
    }
    
    u64 BitVecFindLastPattern(BitVec *bv, BitVec *pattern) {
        ValidateBitVec(bv);
        ValidateBitVec(pattern);
    }
    
    u64 BitVecFindAllPattern(BitVec *bv, BitVec *pattern, size *results, u64 max_results) {
        ValidateBitVec(bv);
        ValidateBitVec(pattern);
    // Foreach functions
    
    u64 BitVecRunLengths(BitVec *bv, u64 *runs, bool *values, u64 max_runs) {
        ValidateBitVec(bv);
        if (!runs || !values || max_runs == 0) {
    // Math functions implementation
    
    u64 BitVecHammingDistance(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    double BitVecJaccardSimilarity(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    double BitVecCosineSimilarity(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    u64 BitVecDotProduct(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    u64 BitVecEditDistance(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    double BitVecCorrelation(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    double BitVecEntropy(BitVec *bv) {
        ValidateBitVec(bv);
    }
    
    int BitVecAlignmentScore(BitVec *bv1, BitVec *bv2, int match, int mismatch) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    }
    
    u64 BitVecBestAlignment(BitVec *bv1, BitVec *bv2) {
        ValidateBitVec(bv1);
        ValidateBitVec(bv2);
    // Missing Pattern functions implementation
    
    bool BitVecStartsWith(BitVec *bv, BitVec *prefix) {
        ValidateBitVec(bv);
        ValidateBitVec(prefix);
    }
    
    bool BitVecEndsWith(BitVec *bv, BitVec *suffix) {
        ValidateBitVec(bv);
        ValidateBitVec(suffix);
    
    
    bool BitVecContainsAt(BitVec *bv, BitVec *pattern, u64 idx) {
        ValidateBitVec(bv);
        ValidateBitVec(pattern);
    }
    
    u64 BitVecCountPattern(BitVec *bv, BitVec *pattern) {
        ValidateBitVec(bv);
        ValidateBitVec(pattern);
    }
    
    u64 BitVecRFindPattern(BitVec *bv, BitVec *pattern, u64 start) {
        ValidateBitVec(bv);
        ValidateBitVec(pattern);
    }
    
    bool BitVecReplace(BitVec *bv, BitVec *old_pattern, BitVec *new_pattern) {
        ValidateBitVec(bv);
        ValidateBitVec(old_pattern);
    }
    
    u64 BitVecReplaceAll(BitVec *bv, BitVec *old_pattern, BitVec *new_pattern) {
        ValidateBitVec(bv);
        ValidateBitVec(old_pattern);
    }
    
    bool BitVecMatches(BitVec *bv, BitVec *pattern, BitVec *wildcard) {
        ValidateBitVec(bv);
        ValidateBitVec(pattern);
    }
    
    u64 BitVecFuzzyMatch(BitVec *bv, BitVec *pattern, u64 max_errors) {
        ValidateBitVec(bv);
        ValidateBitVec(pattern);
    }
    
    bool BitVecRegexMatch(BitVec *bv, const char *pattern) {
        ValidateBitVec(bv);
        if (!pattern) {
    }
    
    u64 BitVecPrefixMatch(BitVec *bv, BitVecs *patterns) {
        ValidateBitVec(bv);
        if (!patterns) {
    }
    
    u64 BitVecSuffixMatch(BitVec *bv, BitVecs *patterns) {
        ValidateBitVec(bv);
        if (!patterns) {
    }
    
    void ValidateBitVec(const BitVec *bv) {
        if (!(bv)) {
            LOG_FATAL("Invalid bitvec object: NULL.");
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
        WriteFmt("Testing BitVecFindPattern(NULL, pattern) - should fatal\n");
    
        BitVec pattern = BitVecInit();
        BitVecPush(&pattern, true);
        WriteFmt("Testing BitVecFindPattern(source, NULL) - should fatal\n");
    
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecPush(&source, false);
        WriteFmt("Testing BitVecFindLastPattern(NULL, pattern) - should fatal\n");
    
        BitVec pattern = BitVecInit();
        BitVecPush(&pattern, true);
        WriteFmt("Testing BitVecFindLastPattern(source, NULL) - should fatal\n");
    
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecPush(&source, false);
    
        // Don't create pattern BitVec since we're testing NULL source validation
        BitVecFindAllPattern(NULL, (BitVec *)0x1, results, 10); // Should cause LOG_FATAL
    
        return true;
        WriteFmt("Testing BitVecFindAllPattern(source, NULL, results, 10) - should fatal\n");
    
        BitVec source = BitVecInit();
        size   results[10];
        BitVecPush(&source, true);
        WriteFmt("Testing BitVecFindAllPattern(source, pattern, NULL, 10) - should fatal\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        BitVecPush(&source, true);
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        BitVecPush(&source, true);
        BitVecPush(&source, false);
        WriteFmt("Testing BitVecFindAllPattern(source, pattern, results, 0) - should fatal\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        size   results[10];
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        size   results[10];
        BitVecPush(&source, true);
    bool test_bitvec_starts_with_null_source(void) {
        WriteFmt("Testing BitVecStartsWith(NULL, prefix) - should fatal\n");
        BitVec prefix = BitVecInit();
        BitVecPush(&prefix, true);
        BitVecStartsWith(NULL, &prefix);
    bool test_bitvec_starts_with_null_prefix(void) {
        WriteFmt("Testing BitVecStartsWith(source, NULL) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecStartsWith(&source, NULL);
    bool test_bitvec_ends_with_null_source(void) {
        WriteFmt("Testing BitVecEndsWith(NULL, suffix) - should fatal\n");
        BitVec suffix = BitVecInit();
        BitVecPush(&suffix, true);
        BitVecEndsWith(NULL, &suffix);
    bool test_bitvec_ends_with_null_suffix(void) {
        WriteFmt("Testing BitVecEndsWith(source, NULL) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecEndsWith(&source, NULL);
    bool test_bitvec_contains_at_null_source(void) {
        WriteFmt("Testing BitVecContainsAt(NULL, pattern, 0) - should fatal\n");
        BitVec pattern = BitVecInit();
        BitVecPush(&pattern, true);
        BitVecContainsAt(NULL, &pattern, 0);
    bool test_bitvec_contains_at_null_pattern(void) {
        WriteFmt("Testing BitVecContainsAt(source, NULL, 0) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecContainsAt(&source, NULL, 0);
    
        // Don't create BitVecs since we're testing NULL source validation
        BitVecReplace(NULL, (BitVec *)0x1, (BitVec *)0x1);
        return true;
    }
    bool test_bitvec_matches_null_source(void) {
        WriteFmt("Testing BitVecMatches(NULL, pattern, wildcard) - should fatal\n");
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
        BitVecPush(&pattern, true);
        WriteFmt("Testing BitVecMatches(NULL, pattern, wildcard) - should fatal\n");
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
        BitVecPush(&pattern, true);
        BitVecPush(&wildcard, false);
    bool test_bitvec_regex_match_null_pattern(void) {
        WriteFmt("Testing BitVecRegexMatch(source, NULL) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecRegexMatch(&source, NULL);
    bool test_bitvec_prefix_match_null_patterns(void) {
        WriteFmt("Testing BitVecPrefixMatch(source, NULL, 1) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecPrefixMatch(&source, NULL);
    bool test_bitvec_suffix_match_null_patterns(void) {
        WriteFmt("Testing BitVecSuffixMatch(source, NULL, 1) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecSuffixMatch(&source, NULL);
    // Main function that runs all deadend tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Pattern.Deadend tests\n\n");
    
        // Deadend tests that would cause program termination
    
        // Run all deadend tests using the centralized test driver
        return run_test_suite(NULL, 0, deadend_tests, total_deadend_tests, "BitVec.Pattern.Deadend");
    }
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Io.h>
    #include <Misra/Std/Log.h>
    // Test BitVec reading
    bool test_bitvec_reading(void) {
        WriteFmt("Testing BitVec reading\n");
    
        const char *z = NULL;
    
        // Test 1: Reading binary string
        BitVec bv1 = BitVecInit();
        z          = "10110";
        StrReadFmt(z, "{}", bv1);
    
        // Test 2: Reading hex format
        BitVec bv2 = BitVecInit();
        z          = "0xDEAD";
        StrReadFmt(z, "{}", bv2);
    
        // Test 3: Reading octal format
        BitVec bv3 = BitVecInit();
        z          = "0o755";
        StrReadFmt(z, "{}", bv3);
    
        // Test 4: Reading with whitespace
        BitVec bv4 = BitVecInit();
        z          = "   1101";
        StrReadFmt(z, "{}", bv4);
    
        // Test 5: Reading zero values
        BitVec bv5 = BitVecInit();
        z          = "0";
        StrReadFmt(z, "{}", bv5);
        BitVecDeinit(&bv5);
    
        WriteFmt("Overall BitVec reading success: {}\n", success ? "true" : "false");
        return success;
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
        WriteFmt("Testing BitVecGet\n");
    
        BitVec bv = BitVecInit();
    
        // Push some bits
        WriteFmt("Testing BitVecSet\n");
    
        BitVec bv = BitVecInit();
    
        // Reserve space and set bits
        WriteFmt("Testing BitVecFlip\n");
    
        BitVec bv = BitVecInit();
    
        // Push some bits
        WriteFmt("Testing BitVecLength and BitVecCapacity\n");
    
        BitVec bv = BitVecInit();
    
        // Initially empty
        WriteFmt("Testing BitVecCount operations\n");
    
        BitVec bv = BitVecInit();
    
        // Push a pattern: true, false, true, false, true
        WriteFmt("Testing BitVecGet edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecSet edge cases\n");
    
        BitVec bv = BitVecInit();
    
        // Set first bit
        WriteFmt("Testing BitVecFlip edge cases\n");
    
        BitVec bv = BitVecInit();
    
        // Test flipping single bit
        WriteFmt("Testing BitVecCount edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Test multiple operations together
    bool test_bitvec_access_multiple_operations(void) {
        WriteFmt("Testing BitVec multiple access operations\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec multiple access operations\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Test with large patterns
    bool test_bitvec_access_large_patterns(void) {
        WriteFmt("Testing BitVec access with large patterns\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec access with large patterns\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Test macro functions
    bool test_bitvec_macro_functions(void) {
        WriteFmt("Testing BitVec macro functions\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec macro functions\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Stress test for access operations
    bool test_bitvec_access_stress_test(void) {
        WriteFmt("Testing BitVec access stress test\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec access stress test\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Comprehensive bit pattern testing
    bool test_bitvec_bit_patterns_comprehensive(void) {
        WriteFmt("Testing BitVec comprehensive bit patterns\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec comprehensive bit patterns\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecFind functions\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Test BitVec predicate functions (All, Any, None)
    bool test_bitvec_predicate_functions(void) {
        WriteFmt("Testing BitVec predicate functions\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec predicate functions\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecLongestRun\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecFind edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Edge case tests for predicate functions
    bool test_bitvec_predicate_edge_cases(void) {
        WriteFmt("Testing BitVec predicate edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec predicate edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecLongestRun edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Access.Simple tests\n\n");
    
        // Array of test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, NULL, 0, "BitVec.Access.Simple");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
        WriteFmt("Testing BitVecForeachIdx macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true, false
        WriteFmt("Testing BitVecForeach macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true
        WriteFmt("Testing BitVecForeachReverseIdx macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true, false
        WriteFmt("Testing BitVecForeachReverse macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true
        WriteFmt("Testing BitVecForeachInRangeIdx macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true, false, true
        WriteFmt("Testing BitVecForeachInRange macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: false, true, true, false, true
    // Edge case tests
    bool test_bitvec_foreach_edge_cases(void) {
        WriteFmt("Testing BitVec foreach edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec foreach edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        int    count  = 0;
    
    bool test_bitvec_foreach_idx_edge_cases(void) {
        WriteFmt("Testing BitVec foreach idx edge cases\n");
    
        BitVec bv       = BitVecInit();
        WriteFmt("Testing BitVec foreach idx edge cases\n");
    
        BitVec bv       = BitVecInit();
        bool   result   = true;
        u64    last_idx = SIZE_MAX;
    
    bool test_bitvec_foreach_reverse_edge_cases(void) {
        WriteFmt("Testing BitVec foreach reverse edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec foreach reverse edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_foreach_range_edge_cases(void) {
        WriteFmt("Testing BitVec foreach range edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec foreach range edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_foreach_stress_test(void) {
        WriteFmt("Testing BitVec foreach stress test\n");
    
        bool result = true;
    
        for (int sz = 0; sz < 100; sz += 10) {
            BitVec bv = BitVecInit();
    
            // Create bitvec of varying sz
        WriteFmt("Testing BitVecRunLengths basic functionality\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
        // Test 1: Empty bitvector
        BitVec empty_bv = BitVecInit();
        u64    runs[5];
        bool   values[5];
    
        // Test 2: Single bit (true)
        BitVec single_bv = BitVecInit();
        BitVecPush(&single_bv, true);
        count  = BitVecRunLengths(&single_bv, runs, values, 5);
    
        // Test 3: Single bit (false)
        BitVec single_false_bv = BitVecInit();
        BitVecPush(&single_false_bv, false);
        count  = BitVecRunLengths(&single_false_bv, runs, values, 5);
    
        // Test 4: All same bits (all true)
        BitVec all_true_bv = BitVecInit();
        for (int i = 0; i < 10; i++) {
            BitVecPush(&all_true_bv, true);
    
        // Test 5: Alternating bits (0101010)
        BitVec alternating_bv = BitVecInit();
        for (int i = 0; i < 7; i++) {
            BitVecPush(&alternating_bv, i % 2 == 0);
        WriteFmt("Testing BitVecRunLengths boundary conditions\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
        // Test with large bitvector
        BitVec large_bv = BitVecInit();
    
        // Create pattern that results in many runs
        WriteFmt("Testing BitVecRunLengths with NULL runs array\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        bool values[5];
        WriteFmt("Testing BitVecRunLengths with NULL values array\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        u64 runs[5];
        WriteFmt("Testing BitVecRunLengths with zero max_runs\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        u64  runs[5];
    
    bool test_bitvec_foreach_invalid_usage(void) {
        WriteFmt("Testing BitVec foreach with invalid bitvec\n");
    
        // Test foreach with invalid bitvec (length > 0 but data is NULL)
    
        // Test foreach with invalid bitvec (length > 0 but data is NULL)
        BitVec bv = {.length = 5, .capacity = 10, .data = NULL, .byte_size = 0};
    
        // This should abort due to ValidateBitVec check
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Foreach tests\n\n");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Foreach");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    
    bool test_bitvec_predicate_deadend_tests(void) {
        WriteFmt("Testing BitVec predicate deadend scenarios\n");
    
        // This should cause LOG_FATAL and terminate the program
    // Deadend tests
    bool test_bitvec_access_null_failures(void) {
        WriteFmt("Testing BitVec access NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_set_null_failures(void) {
        WriteFmt("Testing BitVec set NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_flip_null_failures(void) {
        WriteFmt("Testing BitVec flip NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_get_bounds_failures(void) {
        WriteFmt("Testing BitVec get bounds checking\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec get bounds checking\n");
    
        BitVec bv = BitVecInit();
    
        // Test get from empty bitvec - should abort
    
    bool test_bitvec_set_bounds_failures(void) {
        WriteFmt("Testing BitVec set bounds checking\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec set bounds checking\n");
    
        BitVec bv = BitVecInit();
    
        // Test set on empty bitvec - should abort
    
    bool test_bitvec_flip_bounds_failures(void) {
        WriteFmt("Testing BitVec flip bounds checking\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec flip bounds checking\n");
    
        BitVec bv = BitVecInit();
    
        // Test flip on empty bitvec - should abort
    // NEW: More specific bounds checking deadend tests
    bool test_bitvec_get_large_index_failures(void) {
        WriteFmt("Testing BitVec get with large out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec get with large out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        BitVecPush(&bv, false);
    
    bool test_bitvec_set_large_index_failures(void) {
        WriteFmt("Testing BitVec set with large out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec set with large out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        BitVecPush(&bv, false);
    
    bool test_bitvec_flip_edge_index_failures(void) {
        WriteFmt("Testing BitVec flip with edge case out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec flip with edge case out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        for (int i = 0; i < 10; i++) {
            BitVecPush(&bv, i % 2 == 0);
    
    bool test_bitvec_count_null_failures(void) {
        WriteFmt("Testing BitVec count operations with NULL pointer\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_get_max_index_failures(void) {
        WriteFmt("Testing BitVec get with maximum index value\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec get with maximum index value\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
    // Main function that runs all deadend tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Access.Deadend tests\n\n");
    
        // Deadend tests that would cause program termination
    
        // Run all deadend tests using the centralized test driver
        return run_test_suite(NULL, 0, deadend_tests, total_deadend_tests, "BitVec.Access.Deadend");
    }
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Io.h>
    #include <Misra/Std/Log.h>
    // Test BitVec formatting
    bool test_bitvec_formatting(void) {
        WriteFmt("Testing BitVec formatting\n");
    
        Str  output  = StrInit();
    
        // Test 1: Basic binary formatting
        BitVec bv1 = BitVecFromStr("10110");
        StrWriteFmt(&output, "{}", bv1);
        success = success && (ZstrCompare(output.data, "10110") == 0);
    
        // Test 2: Empty BitVec
        BitVec bv_empty = BitVecInit();
        StrWriteFmt(&output, "{}", bv_empty);
        success = success && (output.length == 0);
    
        // Test 3: Hex formatting
        BitVec bv2 = BitVecFromInteger(0xABCD, 16);
        StrWriteFmt(&output, "{x}", bv2);
        success = success && (ZstrCompare(output.data, "0xabcd") == 0);
    
        // Test 5: Octal formatting
        BitVec bv3 = BitVecFromInteger(0755, 10);
        StrWriteFmt(&output, "{o}", bv3);
        success = success && (ZstrCompare(output.data, "0o755") == 0);
    
        // Test 7: Zero value
        BitVec bv_zero = BitVecFromInteger(0, 1);
        StrWriteFmt(&output, "{x}", bv_zero);
        success = success && (ZstrCompare(output.data, "0x0") == 0);
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
        WriteFmt("Testing BitVecForeachIdx macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true, false
        WriteFmt("Testing BitVecForeach macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true
        WriteFmt("Testing BitVecForeachReverseIdx macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true, false
        WriteFmt("Testing BitVecForeachReverse macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true
        WriteFmt("Testing BitVecForeachInRangeIdx macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: true, false, true, false, true
        WriteFmt("Testing BitVecForeachInRange macro\n");
    
        BitVec bv = BitVecInit();
    
        // Add test pattern: false, true, true, false, true
    // Edge case tests
    bool test_bitvec_foreach_edge_cases(void) {
        WriteFmt("Testing BitVec foreach edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec foreach edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        int    count  = 0;
    
    bool test_bitvec_foreach_idx_edge_cases(void) {
        WriteFmt("Testing BitVec foreach idx edge cases\n");
    
        BitVec bv       = BitVecInit();
        WriteFmt("Testing BitVec foreach idx edge cases\n");
    
        BitVec bv       = BitVecInit();
        bool   result   = true;
        u64    last_idx = SIZE_MAX;
    
    bool test_bitvec_foreach_reverse_edge_cases(void) {
        WriteFmt("Testing BitVec foreach reverse edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec foreach reverse edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_foreach_range_edge_cases(void) {
        WriteFmt("Testing BitVec foreach range edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec foreach range edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_foreach_stress_test(void) {
        WriteFmt("Testing BitVec foreach stress test\n");
    
        bool result = true;
    
        for (int sz = 0; sz < 100; sz += 10) {
            BitVec bv = BitVecInit();
    
            // Create bitvec of varying sz
        WriteFmt("Testing BitVecRunLengths basic functionality\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
        // Test 1: Empty bitvector
        BitVec empty_bv = BitVecInit();
        u64    runs[5];
        bool   values[5];
    
        // Test 2: Single bit (true)
        BitVec single_bv = BitVecInit();
        BitVecPush(&single_bv, true);
        count  = BitVecRunLengths(&single_bv, runs, values, 5);
    
        // Test 3: Single bit (false)
        BitVec single_false_bv = BitVecInit();
        BitVecPush(&single_false_bv, false);
        count  = BitVecRunLengths(&single_false_bv, runs, values, 5);
    
        // Test 4: All same bits (all true)
        BitVec all_true_bv = BitVecInit();
        for (int i = 0; i < 10; i++) {
            BitVecPush(&all_true_bv, true);
    
        // Test 5: Alternating bits (0101010)
        BitVec alternating_bv = BitVecInit();
        for (int i = 0; i < 7; i++) {
            BitVecPush(&alternating_bv, i % 2 == 0);
        WriteFmt("Testing BitVecRunLengths boundary conditions\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
        // Test with large bitvector
        BitVec large_bv = BitVecInit();
    
        // Create pattern that results in many runs
    // Main function that runs all simple tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Foreach.Simple tests\n\n");
    
        // Array of normal test functions
    
        // Run simple tests using the centralized test driver
        return run_test_suite(tests, total_tests, NULL, 0, "BitVec.Foreach.Simple");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
        WriteFmt("Testing BitVecPop\n");
    
        BitVec bv = BitVecInit();
    
        // Add some bits
        WriteFmt("Testing BitVecRemove (single bit)\n");
    
        BitVec bv = BitVecInit();
    
        // Add some bits: true, false, true, false, true
        WriteFmt("Testing BitVecRemoveRange\n");
    
        BitVec bv = BitVecInit();
    
        // Add some bits: true, false, true, true, false, true
        WriteFmt("Testing BitVecRemoveFirst\n");
    
        BitVec bv = BitVecInit();
    
        // Add some bits: true, false, true, false, true
        WriteFmt("Testing BitVecRemoveLast\n");
    
        BitVec bv = BitVecInit();
    
        // Add some bits: true, false, true, false, true
        WriteFmt("Testing BitVecRemoveAll\n");
    
        BitVec bv = BitVecInit();
    
        // Add some bits: true, false, true, false, true, false
        WriteFmt("Testing BitVecPop edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecRemove edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecRemoveRange edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecRemoveFirst/Last edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecRemoveAll edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Deadend tests
    bool test_bitvec_remove_null_failures(void) {
        WriteFmt("Testing BitVec remove NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_remove_range_null_failures(void) {
        WriteFmt("Testing BitVec remove range NULL handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_remove_invalid_range_failures(void) {
        WriteFmt("Testing BitVec remove invalid range handling\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec remove invalid range handling\n");
    
        BitVec bv = BitVecInit();
    
        // Test removing beyond capacity limit - should abort
    
    bool test_bitvec_pop_bounds_failures(void) {
        WriteFmt("Testing BitVec pop bounds checking\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec pop bounds checking\n");
    
        BitVec bv = BitVecInit();
    
        // Test pop from empty bitvec - should abort
    
    bool test_bitvec_remove_bounds_failures(void) {
        WriteFmt("Testing BitVec remove bounds checking\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec remove bounds checking\n");
    
        BitVec bv = BitVecInit();
    
        // Test remove from empty bitvec - should abort
    
    bool test_bitvec_remove_range_bounds_failures(void) {
        WriteFmt("Testing BitVec remove range bounds checking\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec remove range bounds checking\n");
    
        BitVec bv = BitVecInit();
    
        // Test remove range from empty bitvec - should abort
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Remove tests\n\n");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Remove");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
        WriteFmt("Testing BitVecHammingDistance basic functionality\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecHammingDistance edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecJaccardSimilarity basic functionality\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecJaccardSimilarity edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecCosineSimilarity basic functionality\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecCosineSimilarity edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecDotProduct basic functionality\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecDotProduct edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecEditDistance basic functionality\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecEditDistance edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecCorrelation basic functionality\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecCorrelation edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecEntropy basic functionality\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecEntropy edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecAlignmentScore basic functionality\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecAlignmentScore edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecBestAlignment basic functionality\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecBestAlignment edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    // Stress test for Math functions
    bool test_bitvec_math_stress_tests(void) {
        WriteFmt("Testing BitVec Math stress tests\n");
    
        BitVec bv1    = BitVecInit();
        WriteFmt("Testing BitVec Math stress tests\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        // Test edit distance with smaller vectors (expensive operation)
        BitVec small1 = BitVecInit();
        BitVec small2 = BitVecInit();
        for (int i = 0; i < 50; i++) {
        // Test edit distance with smaller vectors (expensive operation)
        BitVec small1 = BitVecInit();
        BitVec small2 = BitVecInit();
        for (int i = 0; i < 50; i++) {
            BitVecPush(&small1, i % 2 == 0);
    bool test_bitvec_hamming_distance_null_bv1(void) {
        WriteFmt("Testing BitVecHammingDistance(NULL, bv2) - should fatal\n");
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv2, true);
        BitVecHammingDistance(NULL, &bv2);
    bool test_bitvec_hamming_distance_null_bv2(void) {
        WriteFmt("Testing BitVecHammingDistance(bv1, NULL) - should fatal\n");
        BitVec bv1 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecHammingDistance(&bv1, NULL);
    bool test_bitvec_jaccard_similarity_null_bv1(void) {
        WriteFmt("Testing BitVecJaccardSimilarity(NULL, bv2) - should fatal\n");
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv2, true);
        BitVecJaccardSimilarity(NULL, &bv2);
    bool test_bitvec_jaccard_similarity_null_bv2(void) {
        WriteFmt("Testing BitVecJaccardSimilarity(bv1, NULL) - should fatal\n");
        BitVec bv1 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecJaccardSimilarity(&bv1, NULL);
    bool test_bitvec_cosine_similarity_null_bv1(void) {
        WriteFmt("Testing BitVecCosineSimilarity(NULL, bv2) - should fatal\n");
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv2, true);
        BitVecCosineSimilarity(NULL, &bv2);
    bool test_bitvec_cosine_similarity_null_bv2(void) {
        WriteFmt("Testing BitVecCosineSimilarity(bv1, NULL) - should fatal\n");
        BitVec bv1 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecCosineSimilarity(&bv1, NULL);
    bool test_bitvec_dot_product_null_bv1(void) {
        WriteFmt("Testing BitVecDotProduct(NULL, bv2) - should fatal\n");
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv2, true);
        BitVecDotProduct(NULL, &bv2);
    bool test_bitvec_dot_product_null_bv2(void) {
        WriteFmt("Testing BitVecDotProduct(bv1, NULL) - should fatal\n");
        BitVec bv1 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecDotProduct(&bv1, NULL);
    bool test_bitvec_edit_distance_null_bv1(void) {
        WriteFmt("Testing BitVecEditDistance(NULL, bv2) - should fatal\n");
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv2, true);
        BitVecEditDistance(NULL, &bv2);
    bool test_bitvec_edit_distance_null_bv2(void) {
        WriteFmt("Testing BitVecEditDistance(bv1, NULL) - should fatal\n");
        BitVec bv1 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecEditDistance(&bv1, NULL);
    bool test_bitvec_correlation_null_bv1(void) {
        WriteFmt("Testing BitVecCorrelation(NULL, bv2) - should fatal\n");
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv2, true);
        BitVecCorrelation(NULL, &bv2);
    bool test_bitvec_correlation_null_bv2(void) {
        WriteFmt("Testing BitVecCorrelation(bv1, NULL) - should fatal\n");
        BitVec bv1 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecCorrelation(&bv1, NULL);
    bool test_bitvec_alignment_score_null_bv1(void) {
        WriteFmt("Testing BitVecAlignmentScore(NULL, bv2, 1, -1) - should fatal\n");
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv2, true);
        BitVecAlignmentScore(NULL, &bv2, 1, -1);
    bool test_bitvec_alignment_score_null_bv2(void) {
        WriteFmt("Testing BitVecAlignmentScore(bv1, NULL, 1, -1) - should fatal\n");
        BitVec bv1 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecAlignmentScore(&bv1, NULL, 1, -1);
    bool test_bitvec_best_alignment_null_bv1(void) {
        WriteFmt("Testing BitVecBestAlignment(NULL, bv2) - should fatal\n");
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv2, true);
        BitVecBestAlignment(NULL, &bv2);
    bool test_bitvec_best_alignment_null_bv2(void) {
        WriteFmt("Testing BitVecBestAlignment(bv1, NULL) - should fatal\n");
        BitVec bv1 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecBestAlignment(&bv1, NULL);
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Math tests\n\n");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Math");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
        WriteFmt("Testing BitVecEquals\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVec bv3 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVec bv3 = BitVecInit();
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVec bv3 = BitVecInit();
    
        // Test equal empty bitvectors
        WriteFmt("Testing BitVecCompare\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Test equal bitvectors
        WriteFmt("Testing BitVecLexCompare\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Test lexicographic comparison
        WriteFmt("Testing BitVecNumericalCompare\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Create bitvectors representing different numbers
        WriteFmt("Testing BitVecWeightCompare\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // bv1: 111 (3 ones)
        WriteFmt("Testing BitVecIsSubset\n");
    
        BitVec subset   = BitVecInit();
        BitVec superset = BitVecInit();
    
        BitVec subset   = BitVecInit();
        BitVec superset = BitVecInit();
    
        // Create superset: 1111
        WriteFmt("Testing BitVecSignedCompare\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Test positive vs negative (MSB is sign bit)
    
        // Test equal signed values
        BitVec bv3 = BitVecClone(&bv1);
        result     = result && (BitVecSignedCompare(&bv1, &bv3) == 0);
        WriteFmt("Testing BitVecIsSuperset\n");
    
        BitVec superset = BitVecInit();
        BitVec subset   = BitVecInit();
    
        BitVec superset = BitVecInit();
        BitVec subset   = BitVecInit();
    
        // Create superset: 1111
        WriteFmt("Testing BitVecOverlaps\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Create overlapping bitvectors
        WriteFmt("Testing BitVecDisjoint and BitVecIntersects\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Create disjoint bitvectors
        WriteFmt("Testing BitVecEqualsRange\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Create test patterns
        WriteFmt("Testing BitVecCompareRange\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Create test patterns
        WriteFmt("Testing BitVecIsLexicographicallyLess and BitVecIsNumericallyLess\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Test lexicographic comparison
    
        // Test equal cases
        BitVec bv3 = BitVecClone(&bv1);
        result     = result && !(BitVecCompare(&bv1, &bv3) < 0);
        result     = result && !(BitVecNumericalCompare(&bv1, &bv3) < 0);
        WriteFmt("Testing BitVecIsSorted\n");
    
        BitVec bv = BitVecInit();
    
        // Test empty bitvector (should be sorted)
    // Edge case tests
    bool test_bitvec_compare_edge_cases(void) {
        WriteFmt("Testing BitVec compare edge cases\n");
    
        BitVec bv1    = BitVecInit();
        WriteFmt("Testing BitVec compare edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_set_operations_edge_cases(void) {
        WriteFmt("Testing BitVec set operations edge cases\n");
    
        BitVec bv1    = BitVecInit();
        WriteFmt("Testing BitVec set operations edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    // Comprehensive comparison testing with cross-validation
    bool test_bitvec_comprehensive_comparison(void) {
        WriteFmt("Testing BitVec comprehensive comparison operations\n");
    
        BitVec bv1    = BitVecInit();
        WriteFmt("Testing BitVec comprehensive comparison operations\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        // Test transitivity: if A < B and B < C, then A < C
        BitVec bv3 = BitVecInit();
        // bv3: larger than bv2
        for (int i = 0; i < 8; i++) {
    
        // Test subset/superset consistency
        BitVec subset   = BitVecInit();
        BitVec superset = BitVecInit();
        // Test subset/superset consistency
        BitVec subset   = BitVecInit();
        BitVec superset = BitVecInit();
    
        // Create actual subset/superset relationship
    // Large-scale testing with stress patterns
    bool test_bitvec_large_scale_comparison(void) {
        WriteFmt("Testing BitVec large-scale comparison operations\n");
    
        BitVec large1 = BitVecInit();
        WriteFmt("Testing BitVec large-scale comparison operations\n");
    
        BitVec large1 = BitVecInit();
        BitVec large2 = BitVecInit();
        bool   result = true;
    
        BitVec large1 = BitVecInit();
        BitVec large2 = BitVecInit();
        bool   result = true;
    
        // Verify signed vs unsigned comparison differences
        BitVec pos = BitVecInit();
        BitVec neg = BitVecInit();
        // Verify signed vs unsigned comparison differences
        BitVec pos = BitVecInit();
        BitVec neg = BitVecInit();
    
        // Positive number (MSB = 0): 01111111
    // Deadend tests
    bool test_bitvec_compare_null_failures(void) {
        WriteFmt("Testing BitVec compare NULL pointer handling\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec compare NULL pointer handling\n");
    
        BitVec bv = BitVecInit();
    
        // Test NULL pointer - should abort
    
    bool test_bitvec_subset_null_failures(void) {
        WriteFmt("Testing BitVec subset NULL handling\n");
    
        // Test NULL pointer - should abort
    
    bool test_bitvec_range_null_failures(void) {
        WriteFmt("Testing BitVec range operations NULL handling\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec range operations NULL handling\n");
    
        BitVec bv = BitVecInit();
    
        // Test NULL pointer in range operations - should abort
    
    bool test_bitvec_range_bounds_failures(void) {
        WriteFmt("Testing BitVec range operations bounds checking\n");
    
        BitVec bv1 = BitVecInit();
        WriteFmt("Testing BitVec range operations bounds checking\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Create small bitvectors
    
    bool test_bitvec_sorted_null_failures(void) {
        WriteFmt("Testing BitVec sorted operations NULL handling\n");
    
        // Test NULL pointer - should abort
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Compare tests\n\n");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Compare");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
    
        // Test basic initialization
        BitVec bv = BitVecInit();
    
        // Check initial state
        WriteFmt("Testing BitVecDeinit\n");
    
        BitVec bv = BitVecInit();
    
        // Add some data to make sure deinitialization works with allocated memory
        WriteFmt("Testing BitVecReserve\n");
    
        BitVec bv = BitVecInit();
    
        // Reserve space for 50 bits
        WriteFmt("Testing BitVecClear\n");
    
        BitVec bv = BitVecInit();
    
        // Add some data
        WriteFmt("Testing BitVecResize\n");
    
        BitVec bv = BitVecInit();
    
        // Add some initial data
    
        // Test multiple initializations
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVec bv3 = BitVecInit();
        // Test multiple initializations
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVec bv3 = BitVecInit();
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVec bv3 = BitVecInit();
    
        bool result = (bv1.length == 0) && (bv2.length == 0) && (bv3.length == 0);
        WriteFmt("Testing BitVecReserve edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecReu64 edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecClear edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_multiple_cycles(void) {
        WriteFmt("Testing BitVec multiple init/deinit cycles\n");
    
        bool result = true;
        // Test multiple init/deinit cycles
        for (int cycle = 0; cycle < 100; cycle++) {
            BitVec bv = BitVecInit();
    
            // Add some data
    // Deadend tests - verify expected failures occur gracefully
    bool test_bitvec_null_pointer_failures(void) {
        WriteFmt("Testing BitVec NULL pointer handling\n");
    
        // Test NULL pointer passed to functions that should validate
    
    bool test_bitvec_invalid_operations(void) {
        WriteFmt("Testing BitVec invalid operations\n");
    
        // Test operation that should trigger validation failure
        // Test operation that should trigger validation failure
        // Try to reserve an impossibly large amount that should fail
        BitVec bv = BitVecInit();
    
        // This should trigger an abort if validation is working
    
    bool test_bitvec_set_operations_failures(void) {
        WriteFmt("Testing BitVec set operations on invalid indices\n");
    
        // Test operation that should trigger validation failure
        // Test operation that should trigger validation failure
        // Try to reu64 to impossibly large size
        BitVec bv = BitVecInit();
    
        // This should trigger an abort if validation is working
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Init tests\n\n");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Init");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    // Deadend tests
    bool test_bitvec_bitwise_null_failures(void) {
        WriteFmt("Testing BitVec bitwise NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_bitwise_ops_null_failures(void) {
        WriteFmt("Testing BitVec bitwise operations NULL handling\n");
    
        BitVec bv  = BitVecInit();
        WriteFmt("Testing BitVec bitwise operations NULL handling\n");
    
        BitVec bv  = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv  = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Test NULL pointer - should abort
    
    bool test_bitvec_reverse_null_failures(void) {
        WriteFmt("Testing BitVec reverse NULL handling\n");
    
        // Test NULL pointer - should abort
    // NEW: Additional deadend tests
    bool test_bitvec_shift_ops_null_failures(void) {
        WriteFmt("Testing BitVec shift operations NULL handling\n");
    
        // Test NULL pointer for shift right - should abort
    
    bool test_bitvec_rotate_ops_null_failures(void) {
        WriteFmt("Testing BitVec rotate operations NULL handling\n");
    
        // Test NULL pointer for rotate - should abort
    
    bool test_bitvec_and_result_null_failures(void) {
        WriteFmt("Testing BitVec AND with NULL result handling\n");
    
        BitVec bv1 = BitVecInit();
        WriteFmt("Testing BitVec AND with NULL result handling\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv1, true);
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecPush(&bv2, false);
    
    bool test_bitvec_or_operand_null_failures(void) {
        WriteFmt("Testing BitVec OR with NULL operand handling\n");
    
        BitVec result = BitVecInit();
        WriteFmt("Testing BitVec OR with NULL operand handling\n");
    
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
    
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
    
        // Test NULL operand - should abort
    
    bool test_bitvec_xor_second_operand_null_failures(void) {
        WriteFmt("Testing BitVec XOR with NULL second operand handling\n");
    
        BitVec result = BitVecInit();
        WriteFmt("Testing BitVec XOR with NULL second operand handling\n");
    
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
    
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
    
        // Test NULL second operand - should abort
    
    bool test_bitvec_not_null_failures(void) {
        WriteFmt("Testing BitVec NOT with NULL handling\n");
    
        BitVec result = BitVecInit();
        WriteFmt("Testing BitVec NOT with NULL handling\n");
    
        BitVec result = BitVecInit();
    
        // Test NULL operand - should abort
    // Main function that runs all deadend tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.BitWise.Deadend tests\n\n");
    
        // Array of deadend test functions
    
        // Run all deadend tests using the centralized test driver
        return run_test_suite(NULL, 0, deadend_tests, total_deadend_tests, "BitVec.BitWise.Deadend");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
        WriteFmt("Testing BitVecAnd\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        // Set up first bitvector: 1101
        WriteFmt("Testing BitVecOr\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        // Set up first bitvector: 1100
        WriteFmt("Testing BitVecXor\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        // Set up first bitvector: 1100
        WriteFmt("Testing BitVecNot\n");
    
        BitVec bv     = BitVecInit();
        BitVec result = BitVecInit();
    
        BitVec bv     = BitVecInit();
        BitVec result = BitVecInit();
    
        // Set up bitvector: 1010
        WriteFmt("Testing BitVecShiftLeft\n");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011 (indices 0,1,2,3)
        WriteFmt("Testing BitVecShiftRight\n");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011
        WriteFmt("Testing BitVecRotateLeft\n");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011
        WriteFmt("Testing BitVecRotateRight\n");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011
        WriteFmt("Testing BitVecReverse\n");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011
    // Edge case tests
    bool test_bitvec_shift_edge_cases(void) {
        WriteFmt("Testing BitVec shift edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec shift edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_rotate_edge_cases(void) {
        WriteFmt("Testing BitVec rotate edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec rotate edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_bitwise_ops_edge_cases(void) {
        WriteFmt("Testing BitVec bitwise operations edge cases\n");
    
        BitVec bv1    = BitVecInit();
        WriteFmt("Testing BitVec bitwise operations edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        // Test operations on empty bitvecs
        BitVec result_bv = BitVecInit();
        BitVecAnd(&result_bv, &bv1, &bv2);
        result = result && (result_bv.length == 0);
        WriteFmt("Testing BitVecReverse edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // NEW: Comprehensive bitwise operations testing
    bool test_bitvec_bitwise_comprehensive(void) {
        WriteFmt("Testing BitVec comprehensive bitwise operations\n");
    
        BitVec bv1         = BitVecInit();
        WriteFmt("Testing BitVec comprehensive bitwise operations\n");
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
    // NEW: Comprehensive shift testing
    bool test_bitvec_shift_comprehensive(void) {
        WriteFmt("Testing BitVec comprehensive shift operations\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec comprehensive shift operations\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
        // Test various shift amounts
        BitVec original = BitVecClone(&bv);
    
        // Shift left by 1, then right by 1 - should NOT restore original (data loss)
    // NEW: Comprehensive rotate testing
    bool test_bitvec_rotate_comprehensive(void) {
        WriteFmt("Testing BitVec comprehensive rotate operations\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec comprehensive rotate operations\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        }
    
        BitVec original = BitVecClone(&bv);
    
        // Rotate left by 3, then right by 3
    // NEW: Identity operations testing
    bool test_bitvec_bitwise_identity_operations(void) {
        WriteFmt("Testing BitVec bitwise identity operations\n");
    
        BitVec bv1         = BitVecInit();
        WriteFmt("Testing BitVec bitwise identity operations\n");
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
    // NEW: Commutative properties testing
    bool test_bitvec_bitwise_commutative_properties(void) {
        WriteFmt("Testing BitVec bitwise commutative properties\n");
    
        BitVec bv1         = BitVecInit();
        WriteFmt("Testing BitVec bitwise commutative properties\n");
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result1     = BitVecInit();
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result1     = BitVecInit();
        BitVec result2     = BitVecInit();
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result1     = BitVecInit();
        BitVec result2     = BitVecInit();
        bool   test_result = true;
        BitVec bv2         = BitVecInit();
        BitVec result1     = BitVecInit();
        BitVec result2     = BitVecInit();
        bool   test_result = true;
    // NEW: Large pattern testing
    bool test_bitvec_bitwise_large_patterns(void) {
        WriteFmt("Testing BitVec bitwise operations with large patterns\n");
    
        BitVec bv1         = BitVecInit();
        WriteFmt("Testing BitVec bitwise operations with large patterns\n");
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.BitWise tests\n\n");
    
        // Array of normal test functions
    
        // Run simple tests using the centralized test driver
        return run_test_suite(tests, total_tests, NULL, 0, "BitVec.BitWise.Simple");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    // Test basic BitVec type functionality
    bool test_bitvec_type_basic(void) {
        WriteFmt("Testing basic BitVec type functionality\n");
    
        // Create a bitvector
    
        // Create a bitvector
        BitVec bitvec = BitVecInit();
    
        // Check initial state
    
        // Create a valid bitvector
        BitVec bitvec = BitVecInit();
    
        // This should not abort
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Type tests\n\n");
    
        // Array of test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, NULL, 0, "BitVec.Type");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
        WriteFmt("Testing BitVecRunLengths with NULL runs array\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        bool values[5];
        WriteFmt("Testing BitVecRunLengths with NULL values array\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        u64 runs[5];
        WriteFmt("Testing BitVecRunLengths with zero max_runs\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        u64  runs[5];
    
    bool test_bitvec_foreach_invalid_usage(void) {
        WriteFmt("Testing BitVec foreach with invalid bitvec\n");
    
        // Test foreach with invalid bitvec (length > 0 but data is NULL)
    
        // Test foreach with invalid bitvec (length > 0 but data is NULL)
        BitVec bv   = BitVecInit();
        bv.length   = 5;
        bv.capacity = 10;
    // Main function that runs all deadend tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Foreach.Deadend tests\n\n");
    
        // Array of deadend test functions
    
        // Run all deadend tests using the centralized test driver
        return run_test_suite(NULL, 0, deadend_tests, total_deadend_tests, "BitVec.Foreach.Deadend");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
        WriteFmt("Testing BitVecShrinkToFit\n");
    
        BitVec bv = BitVecInit();
    
        // Add some bits
        WriteFmt("Testing BitVecReserve\n");
    
        BitVec bv = BitVecInit();
    
        // Add some bits
        WriteFmt("Testing BitVecSwap\n");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Set up first bitvector
        WriteFmt("Testing BitVecClone\n");
    
        BitVec original = BitVecInit();
    
        // Set up original bitvector
    
        // Clone the bitvector
        BitVec clone = BitVecClone(&original);
    
        // Check that clone has same content as original
        WriteFmt("Testing BitVecShrinkToFit edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecReserve edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecSwap edge cases\n");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecClone edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
        // Test clone empty bitvec
        BitVec clone1 = BitVecClone(&bv);
        result        = result && (clone1.length == 0);
        BitVecDeinit(&clone1);
        // Test clone single element
        BitVecPush(&bv, true);
        BitVec clone2 = BitVecClone(&bv);
        result        = result && (clone2.length == 1);
        result        = result && (BitVecGet(&clone2, 0) == true);
        }
    
        BitVec clone3 = BitVecClone(&bv);
        result        = result && (clone3.length == 1000);
    
    bool test_bitvec_memory_stress_test(void) {
        WriteFmt("Testing BitVec memory stress test\n");
    
        bool result = true;
        // Test multiple clone/swap/reu64 cycles
        for (int cycle = 0; cycle < 10; cycle++) {
            BitVec bv1 = BitVecInit();
            BitVec bv2 = BitVecInit();
        for (int cycle = 0; cycle < 10; cycle++) {
            BitVec bv1 = BitVecInit();
            BitVec bv2 = BitVecInit();
    
            // Add random-sized data
    
            // Clone and swap
            BitVec clone = BitVecClone(&bv1);
            BitVecSwap(&bv1, &bv2);
    // Deadend tests
    bool test_bitvec_memory_null_failures(void) {
        WriteFmt("Testing BitVec memory NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_swap_null_failures(void) {
        WriteFmt("Testing BitVec swap NULL handling\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec swap NULL handling\n");
    
        BitVec bv = BitVecInit();
    
        // Test NULL pointer - should abort
    
    bool test_bitvec_clone_null_failures(void) {
        WriteFmt("Testing BitVec clone NULL handling\n");
    
        // Test NULL pointer - should abort
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Memory tests\n\n");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Memory");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Log.h>
        WriteFmt("Testing BitVecToStr\n");
    
        BitVec bv = BitVecInit();
    
        // Create pattern: 1011
        // Convert from string
        const char *str = "1011";
        BitVec      bv  = BitVecFromStr(str);
    
        // Check result
    
        // Test with empty string
        BitVec empty_bv = BitVecFromStr("");
        result          = result && (empty_bv.length == 0);
        WriteFmt("Testing BitVecToBytes\n");
    
        BitVec bv = BitVecInit();
    
        // Create pattern: 10110011 (0xB3)
        // Create byte array
        u8     bytes[] = {0xB3};                    // 10110011 in binary
        BitVec bv      = BitVecFromBytes(bytes, 8); // 8 bits from the byte
    
        // Check result (8 bits from 1 byte)
        WriteFmt("Testing BitVecToInteger\n");
    
        BitVec bv = BitVecInit();
    
        // Create pattern: 1011 (decimal 11 if MSB first, 13 if LSB first)
    
        // Test with larger pattern
        BitVec bv2 = BitVecInit();
        for (int i = 0; i < 8; i++) {
            BitVecPush(&bv2, (i % 2 == 0)); // Alternating pattern
        // Convert from integer
        u64    value = 11; // 1011 in binary
        BitVec bv    = BitVecFromInteger(value, 4);
    
        // Check result
    
        // Test with zero
        BitVec zero_bv = BitVecFromInteger(0, 8);
        result         = result && (zero_bv.length == 8);
    // Edge case tests
    bool test_bitvec_convert_edge_cases(void) {
        WriteFmt("Testing BitVec convert edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec convert edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
        // Test empty string
        BitVec bv1 = BitVecFromStr("");
        result     = result && (bv1.length == 0);
        BitVecDeinit(&bv1);
    
        // Test single character
        BitVec bv2 = BitVecFromStr("1");
        result     = result && (bv2.length == 1);
        result     = result && (BitVecGet(&bv2, 0) == true);
        long_str[1000] = '\0';
    
        BitVec bv3 = BitVecFromStr(long_str);
        result     = result && (bv3.length == 1000);
        result     = result && (BitVecGet(&bv3, 0) == true);
    
    bool test_bitvec_bytes_conversion_edge_cases(void) {
        WriteFmt("Testing BitVec bytes conversion edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec bytes conversion edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        // Test bytes to bitvec with 0 bits (should return empty bitvector)
        u8     empty_bytes[1] = {0x05};
        BitVec bv2            = BitVecFromBytes(empty_bytes, 0); // 0 bits
        result                = result && (bv2.length == 0);
        BitVecDeinit(&bv2);
        // Test single byte
        u8     single_byte[1] = {0xFF};
        BitVec bv3            = BitVecFromBytes(single_byte, 8); // 8 bits from 1 byte
        result                = result && (bv3.length == 8);
        BitVecDeinit(&bv3);
    
    bool test_bitvec_integer_conversion_edge_cases(void) {
        WriteFmt("Testing BitVec integer conversion edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec integer conversion edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
        // Test integer to bitvec with 0
        BitVec bv2 = BitVecFromInteger(0, 8);     // 8 bits for zero
        result     = result && (bv2.length == 8); // Should be 8 bits
        BitVecDeinit(&bv2);
    
        // Test large integer
        BitVec bv3 = BitVecFromInteger(UINT64_MAX, 64); // 64 bits for max value
        result     = result && (bv3.length == 64);
        BitVecDeinit(&bv3);
    // Round-trip conversion tests
    bool test_bitvec_round_trip_conversions(void) {
        WriteFmt("Testing BitVec round-trip conversions\n");
    
        bool result = true;
    
        for (size_t i = 0; i < sizeof(patterns) / sizeof(patterns[0]); i++) {
            BitVec bv  = BitVecFromStr(patterns[i]);
            Str    str = BitVecToStr(&bv);
                value    &= mask;
    
                BitVec bv        = BitVecFromInteger(value, bits);
                u64    recovered = BitVecToInteger(&bv);
    
        for (size_t i = 0; i < sizeof(test_bytes); i++) {
            BitVec bv             = BitVecFromBytes(&test_bytes[i], 8);
            u8     recovered_byte = 0;
            u64    written        = BitVecToBytes(&bv, &recovered_byte, 1);
    // Bounds checking tests
    bool test_bitvec_conversion_bounds_checking(void) {
        WriteFmt("Testing BitVec conversion bounds checking\n");
    
        bool result = true;
    
        // Test large integer conversion (should cap at 64 bits)
        BitVec large_bv = BitVecFromInteger(0xFFFFFFFFFFFFFFFF, 64);
        result          = result && (large_bv.length == 64);
    
        // Test oversized bitvec to integer (should handle gracefully)
        BitVec oversized = BitVecInit();
        for (int i = 0; i < 100; i++) { // 100 bits > 64 bit limit
            BitVecPush(&oversized, i % 2 == 0);
    
        // Test zero-length conversions
        BitVec empty = BitVecInit();
    
        Str empty_str = BitVecToStr(&empty);
    // Comprehensive conversion validation
    bool test_bitvec_conversion_comprehensive(void) {
        WriteFmt("Testing BitVec comprehensive conversion validation\n");
    
        bool result = true;
    
        for (size_t i = 0; i < sizeof(test_cases) / sizeof(test_cases[0]); i++) {
            BitVec bv = BitVecFromStr(test_cases[i].pattern);
    
            // Test string conversion consistency
    
        // Test cross-format validation
        BitVec bv1 = BitVecFromStr("11010110");
        BitVec bv2 = BitVecFromInteger(0xD6, 8); // Assuming MSB-first: 11010110 = 0xD6
        BitVec bv3 = BitVecFromBytes((u8[]) {0xD6}, 8);
        // Test cross-format validation
        BitVec bv1 = BitVecFromStr("11010110");
        BitVec bv2 = BitVecFromInteger(0xD6, 8); // Assuming MSB-first: 11010110 = 0xD6
        BitVec bv3 = BitVecFromBytes((u8[]) {0xD6}, 8);
        BitVec bv1 = BitVecFromStr("11010110");
        BitVec bv2 = BitVecFromInteger(0xD6, 8); // Assuming MSB-first: 11010110 = 0xD6
        BitVec bv3 = BitVecFromBytes((u8[]) {0xD6}, 8);
    
        // All three should produce the same result when converted back
    // Large-scale conversion tests
    bool test_bitvec_large_scale_conversions(void) {
        WriteFmt("Testing BitVec large-scale conversions\n");
    
        bool result = true;
    
        // Test with very large bitvectors
        BitVec large_bv = BitVecInit();
    
        // Create a 1000-bit pattern
    
        // Test round-trip from bytes
        BitVec recovered_bv = BitVecFromBytes(large_bytes, 1000);
        result              = result && (recovered_bv.length == 1000);
        large_pattern[2000] = '\0';
    
        BitVec large_from_str = BitVecFromStr(large_pattern);
        result                = result && (large_from_str.length == 2000);
    // Enhanced deadend tests
    bool test_bitvec_bytes_bounds_failures(void) {
        WriteFmt("Testing BitVec bytes bounds failures\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec bytes bounds failures\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        // Test fromBytes with 0 bit length - should return empty bitvec
        u8     dummy_bytes[1] = {0xFF};
        BitVec empty_bv       = BitVecFromBytes(dummy_bytes, 0);
        bool   result         = (empty_bv.length == 0);
        BitVecDeinit(&empty_bv);
    
    bool test_bitvec_integer_bounds_failures(void) {
        WriteFmt("Testing BitVec integer bounds failures\n");
    
        // Test BitVecToInteger with NULL pointer - should abort
    // Deadend tests
    bool test_bitvec_convert_null_failures(void) {
        WriteFmt("Testing BitVec convert NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_from_string_null_failures(void) {
        WriteFmt("Testing BitVec from string NULL handling\n");
    
        // Test NULL string - should abort
    
    bool test_bitvec_bytes_null_failures(void) {
        WriteFmt("Testing BitVec bytes NULL handling\n");
    
        // Test NULL bytes - should abort
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Convert tests\n\n");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Convert");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
        WriteFmtLn("Testing BitVecAnd");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        // Set up first bitvector: 1101
        WriteFmtLn("Testing BitVecOr");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        // Set up first bitvector: 1100
        WriteFmtLn("Testing BitVecXor");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        BitVec result = BitVecInit();
    
        // Set up first bitvector: 1100
        WriteFmtLn("Testing BitVecNot");
    
        BitVec bv     = BitVecInit();
        BitVec result = BitVecInit();
    
        BitVec bv     = BitVecInit();
        BitVec result = BitVecInit();
    
        // Set up bitvector: 1010
        WriteFmtLn("Testing BitVecShiftLeft");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011 (indices 0,1,2,3)
        WriteFmtLn("Testing BitVecShiftRight");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011
        WriteFmtLn("Testing BitVecRotateLeft");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011
        WriteFmtLn("Testing BitVecRotateRight");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011
        WriteFmtLn("Testing BitVecReverse");
    
        BitVec bv = BitVecInit();
    
        // Set up bitvector: 1011
    // Edge case tests
    bool test_bitvec_shift_edge_cases(void) {
        WriteFmtLn("Testing BitVec shift edge cases");
    
        BitVec bv     = BitVecInit();
        WriteFmtLn("Testing BitVec shift edge cases");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_rotate_edge_cases(void) {
        WriteFmtLn("Testing BitVec rotate edge cases");
    
        BitVec bv     = BitVecInit();
        WriteFmtLn("Testing BitVec rotate edge cases");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_bitwise_ops_edge_cases(void) {
        WriteFmtLn("Testing BitVec bitwise operations edge cases");
    
        BitVec bv1    = BitVecInit();
        WriteFmtLn("Testing BitVec bitwise operations edge cases");
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        BitVec bv1    = BitVecInit();
        BitVec bv2    = BitVecInit();
        bool   result = true;
    
        // Test operations on empty bitvecs
        BitVec result_bv = BitVecInit();
        BitVecAnd(&result_bv, &bv1, &bv2);
        result = result && (result_bv.length == 0);
        WriteFmtLn("Testing BitVecReverse edge cases");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // NEW: Comprehensive bitwise operations testing
    bool test_bitvec_bitwise_comprehensive(void) {
        WriteFmtLn("Testing BitVec comprehensive bitwise operations");
    
        BitVec bv1         = BitVecInit();
        WriteFmtLn("Testing BitVec comprehensive bitwise operations");
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
    // NEW: Comprehensive shift testing
    bool test_bitvec_shift_comprehensive(void) {
        WriteFmtLn("Testing BitVec comprehensive shift operations");
    
        BitVec bv     = BitVecInit();
        WriteFmtLn("Testing BitVec comprehensive shift operations");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
        // Test various shift amounts
        BitVec original = BitVecClone(&bv);
    
        // Shift left by 1, then right by 1 - should NOT restore original (data loss)
    // NEW: Comprehensive rotate testing
    bool test_bitvec_rotate_comprehensive(void) {
        WriteFmtLn("Testing BitVec comprehensive rotate operations");
    
        BitVec bv     = BitVecInit();
        WriteFmtLn("Testing BitVec comprehensive rotate operations");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        }
    
        BitVec original = BitVecClone(&bv);
    
        // Rotate left by 3, then right by 3
    // NEW: Identity operations testing
    bool test_bitvec_bitwise_identity_operations(void) {
        WriteFmtLn("Testing BitVec bitwise identity operations");
    
        BitVec bv1         = BitVecInit();
        WriteFmtLn("Testing BitVec bitwise identity operations");
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
    // NEW: Commutative properties testing
    bool test_bitvec_bitwise_commutative_properties(void) {
        WriteFmtLn("Testing BitVec bitwise commutative properties");
    
        BitVec bv1         = BitVecInit();
        WriteFmtLn("Testing BitVec bitwise commutative properties");
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result1     = BitVecInit();
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result1     = BitVecInit();
        BitVec result2     = BitVecInit();
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result1     = BitVecInit();
        BitVec result2     = BitVecInit();
        bool   test_result = true;
        BitVec bv2         = BitVecInit();
        BitVec result1     = BitVecInit();
        BitVec result2     = BitVecInit();
        bool   test_result = true;
    // NEW: Large pattern testing
    bool test_bitvec_bitwise_large_patterns(void) {
        WriteFmtLn("Testing BitVec bitwise operations with large patterns");
    
        BitVec bv1         = BitVecInit();
        WriteFmtLn("Testing BitVec bitwise operations with large patterns");
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
    
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
        BitVec bv1         = BitVecInit();
        BitVec bv2         = BitVecInit();
        BitVec result      = BitVecInit();
        bool   test_result = true;
    // Deadend tests
    bool test_bitvec_bitwise_null_failures(void) {
        WriteFmtLn("Testing BitVec bitwise NULL pointer handling");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_bitwise_ops_null_failures(void) {
        WriteFmtLn("Testing BitVec bitwise operations NULL handling");
    
        BitVec bv  = BitVecInit();
        WriteFmtLn("Testing BitVec bitwise operations NULL handling");
    
        BitVec bv  = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        BitVec bv  = BitVecInit();
        BitVec bv2 = BitVecInit();
    
        // Test NULL pointer - should abort
    
    bool test_bitvec_reverse_null_failures(void) {
        WriteFmtLn("Testing BitVec reverse NULL handling");
    
        // Test NULL pointer - should abort
    // NEW: Additional deadend tests
    bool test_bitvec_shift_ops_null_failures(void) {
        WriteFmtLn("Testing BitVec shift operations NULL handling");
    
        // Test NULL pointer for shift right - should abort
    
    bool test_bitvec_rotate_ops_null_failures(void) {
        WriteFmtLn("Testing BitVec rotate operations NULL handling");
    
        // Test NULL pointer for rotate - should abort
    
    bool test_bitvec_and_result_null_failures(void) {
        WriteFmtLn("Testing BitVec AND with NULL result handling");
    
        BitVec bv1 = BitVecInit();
        WriteFmtLn("Testing BitVec AND with NULL result handling");
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv1, true);
    
        BitVec bv1 = BitVecInit();
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv1, true);
        BitVecPush(&bv2, false);
    
    bool test_bitvec_or_operand_null_failures(void) {
        WriteFmtLn("Testing BitVec OR with NULL operand handling");
    
        BitVec result = BitVecInit();
        WriteFmtLn("Testing BitVec OR with NULL operand handling");
    
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
    
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
    
        // Test NULL operand - should abort
    
    bool test_bitvec_xor_second_operand_null_failures(void) {
        WriteFmtLn("Testing BitVec XOR with NULL second operand handling");
    
        BitVec result = BitVecInit();
        WriteFmtLn("Testing BitVec XOR with NULL second operand handling");
    
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
    
        BitVec result = BitVecInit();
        BitVec bv1    = BitVecInit();
    
        // Test NULL second operand - should abort
    
    bool test_bitvec_not_null_failures(void) {
        WriteFmtLn("Testing BitVec NOT with NULL handling");
    
        BitVec result = BitVecInit();
        WriteFmtLn("Testing BitVec NOT with NULL handling");
    
        BitVec result = BitVecInit();
    
        // Test NULL operand - should abort
    // Main function that runs all tests
    int main(void) {
        WriteFmtLn("[INFO] Starting BitVec.BitWise tests");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.BitWise");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
        WriteFmt("Testing BitVecPush\n");
    
        BitVec bv = BitVecInit();
    
        // Push some bits
        WriteFmt("Testing BitVecInsert (single bit)\n");
    
        BitVec bv = BitVecInit();
    
        // Insert at index 0 (empty bitvector)
        WriteFmt("Testing BitVecInsertRange\n");
    
        BitVec bv = BitVecInit();
    
        // Create target bitvector
        WriteFmt("Testing BitVecInsertMultiple\n");
    
        BitVec bv     = BitVecInit();
        BitVec source = BitVecInit();
    
        BitVec bv     = BitVecInit();
        BitVec source = BitVecInit();
    
        // Start with some bits
        WriteFmt("Testing BitVecInsertPattern\n");
    
        BitVec bv = BitVecInit();
    
        // Start with some bits
    
        // Test with different pattern - 0x05 (0101 in binary) using only 3 bits
        BitVec bv2 = BitVecInit();
        BitVecPush(&bv2, true);
        WriteFmt("Testing BitVecInsertRange edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecInsertMultiple edge cases\n");
    
        BitVec bv     = BitVecInit();
        BitVec empty  = BitVecInit();
        BitVec source = BitVecInit();
    
        BitVec bv     = BitVecInit();
        BitVec empty  = BitVecInit();
        BitVec source = BitVecInit();
        bool   result = true;
        BitVec bv     = BitVecInit();
        BitVec empty  = BitVecInit();
        BitVec source = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecInsertPattern edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Deadend tests
    bool test_bitvec_insert_null_failures(void) {
        WriteFmt("Testing BitVec insert NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_insert_invalid_range_failures(void) {
        WriteFmt("Testing BitVec insert invalid range handling\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec insert invalid range handling\n");
    
        BitVec bv = BitVecInit();
    
        // Test inserting beyond capacity limit - should abort
    
    bool test_bitvec_insert_pattern_null_failures(void) {
        WriteFmt("Testing BitVec insert pattern NULL handling\n");
    
        // Test NULL bitvec - should abort
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Insert tests\n\n");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Insert");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
        WriteFmt("Testing BitVecGet\n");
    
        BitVec bv = BitVecInit();
    
        // Add a pattern: 1010
        WriteFmt("Testing BitVecSet\n");
    
        BitVec bv = BitVecInit();
    
        // Initialize with some bits
        WriteFmt("Testing BitVecFlip\n");
    
        BitVec bv = BitVecInit();
    
        // Initialize with pattern: 101
    // Test length and capacity operations
    bool test_bitvec_length_capacity(void) {
        WriteFmt("Testing BitVec length and capacity operations\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec length and capacity operations\n");
    
        BitVec bv = BitVecInit();
    
        // Initially should be empty
    // Test count operations
    bool test_bitvec_count_operations(void) {
        WriteFmt("Testing BitVec count operations\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec count operations\n");
    
        BitVec bv = BitVecInit();
    
        // Create pattern: 1101000
        WriteFmt("Testing BitVecGet edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecSet edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecFlip edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_count_edge_cases(void) {
        WriteFmt("Testing BitVec count edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec count edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_access_multiple_operations(void) {
        WriteFmt("Testing BitVec multiple access operations\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec multiple access operations\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // NEW: Test large bit patterns and complex access patterns
    bool test_bitvec_access_large_patterns(void) {
        WriteFmt("Testing BitVec large pattern access\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec large pattern access\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // NEW: Test macro functions comprehensively
    bool test_bitvec_macro_functions(void) {
        WriteFmt("Testing BitVec macro functions\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec macro functions\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // NEW: Stress test for access operations
    bool test_bitvec_access_stress_test(void) {
        WriteFmt("Testing BitVec access stress test\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec access stress test\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // NEW: Comprehensive bit pattern testing
    bool test_bitvec_bit_patterns_comprehensive(void) {
        WriteFmt("Testing BitVec comprehensive bit patterns\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec comprehensive bit patterns\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Deadend tests
    bool test_bitvec_access_null_failures(void) {
        WriteFmt("Testing BitVec access NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_set_null_failures(void) {
        WriteFmt("Testing BitVec set NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_flip_null_failures(void) {
        WriteFmt("Testing BitVec flip NULL pointer handling\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_get_bounds_failures(void) {
        WriteFmt("Testing BitVec get bounds checking\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec get bounds checking\n");
    
        BitVec bv = BitVecInit();
    
        // Test get from empty bitvec - should abort
    
    bool test_bitvec_set_bounds_failures(void) {
        WriteFmt("Testing BitVec set bounds checking\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec set bounds checking\n");
    
        BitVec bv = BitVecInit();
    
        // Test set on empty bitvec - should abort
    
    bool test_bitvec_flip_bounds_failures(void) {
        WriteFmt("Testing BitVec flip bounds checking\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec flip bounds checking\n");
    
        BitVec bv = BitVecInit();
    
        // Test flip on empty bitvec - should abort
    // NEW: More specific bounds checking deadend tests
    bool test_bitvec_get_large_index_failures(void) {
        WriteFmt("Testing BitVec get with large out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec get with large out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        BitVecPush(&bv, false);
    
    bool test_bitvec_set_large_index_failures(void) {
        WriteFmt("Testing BitVec set with large out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec set with large out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        BitVecPush(&bv, false);
    
    bool test_bitvec_flip_edge_index_failures(void) {
        WriteFmt("Testing BitVec flip with edge case out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec flip with edge case out-of-bounds index\n");
    
        BitVec bv = BitVecInit();
        for (int i = 0; i < 10; i++) {
            BitVecPush(&bv, i % 2 == 0);
    
    bool test_bitvec_count_null_failures(void) {
        WriteFmt("Testing BitVec count operations with NULL pointer\n");
    
        // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_get_max_index_failures(void) {
        WriteFmt("Testing BitVec get with maximum index value\n");
    
        BitVec bv = BitVecInit();
        WriteFmt("Testing BitVec get with maximum index value\n");
    
        BitVec bv = BitVecInit();
        BitVecPush(&bv, true);
        WriteFmt("Testing BitVecFind and BitVecFindLast functions\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecAll, BitVecAny, BitVecNone functions\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecLongestRun function\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecFind edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    // Edge case tests for predicate functions
    bool test_bitvec_predicate_edge_cases(void) {
        WriteFmt("Testing BitVec predicate edge cases\n");
    
        BitVec bv     = BitVecInit();
        WriteFmt("Testing BitVec predicate edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecLongestRun edge cases\n");
    
        BitVec bv     = BitVecInit();
        bool   result = true;
    
    bool test_bitvec_predicate_deadend_tests(void) {
        WriteFmt("Testing BitVec predicate deadend scenarios\n");
    
        // This should cause LOG_FATAL and terminate the program
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Access tests\n\n");
    
        // Array of test functions (adding new tests to existing ones)
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Access");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    // Test basic pattern matching functions
    bool test_bitvec_basic_pattern_functions(void) {
        WriteFmt("Testing basic BitVec pattern functions\n");
    
        BitVec source  = BitVecInit();
        WriteFmt("Testing basic BitVec pattern functions\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecFindPattern function\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecFindLastPattern function\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecFindAllPattern function\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    // Test edge cases for pattern functions
    bool test_bitvec_pattern_edge_cases(void) {
        WriteFmt("Testing BitVec pattern edge cases\n");
    
        BitVec source  = BitVecInit();
        WriteFmt("Testing BitVec pattern edge cases\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    // Stress tests with large data
    bool test_bitvec_pattern_stress_tests(void) {
        WriteFmt("Testing BitVec pattern stress tests\n");
    
        BitVec source  = BitVecInit();
        WriteFmt("Testing BitVec pattern stress tests\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecFindPattern(NULL, pattern) - should fatal\n");
    
        BitVec pattern = BitVecInit();
        BitVecPush(&pattern, true);
        WriteFmt("Testing BitVecFindPattern(source, NULL) - should fatal\n");
    
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecPush(&source, false);
        WriteFmt("Testing BitVecFindLastPattern(NULL, pattern) - should fatal\n");
    
        BitVec pattern = BitVecInit();
        BitVecPush(&pattern, true);
        WriteFmt("Testing BitVecFindLastPattern(source, NULL) - should fatal\n");
    
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecPush(&source, false);
    
        // Don't create pattern BitVec since we're testing NULL source validation
        BitVecFindAllPattern(NULL, (BitVec *)0x1, results, 10); // Should cause LOG_FATAL
    
        return true;
        WriteFmt("Testing BitVecFindAllPattern(source, NULL, results, 10) - should fatal\n");
    
        BitVec source = BitVecInit();
        size   results[10];
        BitVecPush(&source, true);
        WriteFmt("Testing BitVecFindAllPattern(source, pattern, NULL, 10) - should fatal\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        BitVecPush(&source, true);
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        BitVecPush(&source, true);
        BitVecPush(&source, false);
        WriteFmt("Testing BitVecFindAllPattern(source, pattern, results, 0) - should fatal\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        size   results[10];
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        size   results[10];
        BitVecPush(&source, true);
        WriteFmt("Testing BitVecStartsWith basic functionality\n");
    
        BitVec source = BitVecInit();
        BitVec prefix = BitVecInit();
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec prefix = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecStartsWith edge cases\n");
    
        BitVec source = BitVecInit();
        BitVec prefix = BitVecInit();
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec prefix = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecEndsWith basic functionality\n");
    
        BitVec source = BitVecInit();
        BitVec suffix = BitVecInit();
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec suffix = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecEndsWith edge cases\n");
    
        BitVec source = BitVecInit();
        BitVec suffix = BitVecInit();
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec suffix = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecContains basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecContainsAt basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecContainsAt edge cases\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecCountPattern basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecRFindPattern basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecReplace basic functionality\n");
    
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
    
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
        bool   result      = true;
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
        bool   result      = true;
        WriteFmt("Testing BitVecReplaceAll basic functionality\n");
    
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
    
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
        bool   result      = true;
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
        bool   result      = true;
        WriteFmt("Testing BitVecMatches basic functionality\n");
    
        BitVec source   = BitVecInit();
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
    
        BitVec source   = BitVecInit();
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
        bool   result   = true;
        BitVec source   = BitVecInit();
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
        bool   result   = true;
        WriteFmt("Testing BitVecFuzzyMatch basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecRegexMatch basic functionality\n");
    
        BitVec source = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecPrefixMatch basic functionality\n");
    
        BitVec source = BitVecInit();
        BitVec patterns[3];
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec patterns[3];
        bool   result = true;
        WriteFmt("Testing BitVecSuffixMatch basic functionality\n");
    
        BitVec source = BitVecInit();
        BitVec patterns[3];
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec patterns[3];
        bool   result = true;
    bool test_bitvec_starts_with_null_source(void) {
        WriteFmt("Testing BitVecStartsWith(NULL, prefix) - should fatal\n");
        BitVec prefix = BitVecInit();
        BitVecPush(&prefix, true);
        BitVecStartsWith(NULL, &prefix);
    bool test_bitvec_starts_with_null_prefix(void) {
        WriteFmt("Testing BitVecStartsWith(source, NULL) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecStartsWith(&source, NULL);
    bool test_bitvec_ends_with_null_source(void) {
        WriteFmt("Testing BitVecEndsWith(NULL, suffix) - should fatal\n");
        BitVec suffix = BitVecInit();
        BitVecPush(&suffix, true);
        BitVecEndsWith(NULL, &suffix);
    bool test_bitvec_ends_with_null_suffix(void) {
        WriteFmt("Testing BitVecEndsWith(source, NULL) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecEndsWith(&source, NULL);
    bool test_bitvec_contains_at_null_source(void) {
        WriteFmt("Testing BitVecContainsAt(NULL, pattern, 0) - should fatal\n");
        BitVec pattern = BitVecInit();
        BitVecPush(&pattern, true);
        BitVecContainsAt(NULL, &pattern, 0);
    bool test_bitvec_contains_at_null_pattern(void) {
        WriteFmt("Testing BitVecContainsAt(source, NULL, 0) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecContainsAt(&source, NULL, 0);
    
        // Don't create BitVecs since we're testing NULL source validation
        BitVecReplace(NULL, (BitVec *)0x1, (BitVec *)0x1);
        return true;
    }
    bool test_bitvec_matches_null_source(void) {
        WriteFmt("Testing BitVecMatches(NULL, pattern, wildcard) - should fatal\n");
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
        BitVecPush(&pattern, true);
        WriteFmt("Testing BitVecMatches(NULL, pattern, wildcard) - should fatal\n");
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
        BitVecPush(&pattern, true);
        BitVecPush(&wildcard, false);
    bool test_bitvec_regex_match_null_pattern(void) {
        WriteFmt("Testing BitVecRegexMatch(source, NULL) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecRegexMatch(&source, NULL);
    bool test_bitvec_prefix_match_null_source(void) {
        WriteFmt("Testing BitVecPrefixMatch(NULL, patterns, 1) - should fatal\n");
        BitVec patterns[1] = {BitVecInit()};
        BitVecPush(&patterns[0], true);
        BitVecPrefixMatch(NULL, patterns, 1);
    bool test_bitvec_prefix_match_null_patterns(void) {
        WriteFmt("Testing BitVecPrefixMatch(source, NULL, 1) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecPrefixMatch(&source, NULL, 1);
    bool test_bitvec_suffix_match_null_source(void) {
        WriteFmt("Testing BitVecSuffixMatch(NULL, patterns, 1) - should fatal\n");
        BitVec patterns[1] = {BitVecInit()};
        BitVecPush(&patterns[0], true);
        BitVecSuffixMatch(NULL, patterns, 1);
    bool test_bitvec_suffix_match_null_patterns(void) {
        WriteFmt("Testing BitVecSuffixMatch(source, NULL, 1) - should fatal\n");
        BitVec source = BitVecInit();
        BitVecPush(&source, true);
        BitVecSuffixMatch(&source, NULL, 1);
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Pattern tests\n\n");
    
        // Array of test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "BitVec.Pattern");
    }
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    // Test basic pattern matching functions
    bool test_bitvec_basic_pattern_functions(void) {
        WriteFmt("Testing basic BitVec pattern functions\n");
    
        BitVec source  = BitVecInit();
        WriteFmt("Testing basic BitVec pattern functions\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecFindPattern function\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecFindLastPattern function\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecFindAllPattern function\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    // Test edge cases for pattern functions
    bool test_bitvec_pattern_edge_cases(void) {
        WriteFmt("Testing BitVec pattern edge cases\n");
    
        BitVec source  = BitVecInit();
        WriteFmt("Testing BitVec pattern edge cases\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    // Stress tests with large data
    bool test_bitvec_pattern_stress_tests(void) {
        WriteFmt("Testing BitVec pattern stress tests\n");
    
        BitVec source  = BitVecInit();
        WriteFmt("Testing BitVec pattern stress tests\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecStartsWith basic functionality\n");
    
        BitVec source = BitVecInit();
        BitVec prefix = BitVecInit();
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec prefix = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecStartsWith edge cases\n");
    
        BitVec source = BitVecInit();
        BitVec prefix = BitVecInit();
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec prefix = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecEndsWith basic functionality\n");
    
        BitVec source = BitVecInit();
        BitVec suffix = BitVecInit();
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec suffix = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecEndsWith edge cases\n");
    
        BitVec source = BitVecInit();
        BitVec suffix = BitVecInit();
        bool   result = true;
    
        BitVec source = BitVecInit();
        BitVec suffix = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecFindPattern basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecContainsAt basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecContainsAt edge cases\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecCountPattern basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecRFindPattern basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecReplace basic functionality\n");
    
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
    
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
        bool   result      = true;
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
        bool   result      = true;
        WriteFmt("Testing BitVecReplaceAll basic functionality\n");
    
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
    
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
        bool   result      = true;
        BitVec source      = BitVecInit();
        BitVec old_pattern = BitVecInit();
        BitVec new_pattern = BitVecInit();
        bool   result      = true;
        WriteFmt("Testing BitVecMatches basic functionality\n");
    
        BitVec source   = BitVecInit();
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
    
        BitVec source   = BitVecInit();
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
        bool   result   = true;
        BitVec source   = BitVecInit();
        BitVec pattern  = BitVecInit();
        BitVec wildcard = BitVecInit();
        bool   result   = true;
        WriteFmt("Testing BitVecFuzzyMatch basic functionality\n");
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
    
        BitVec source  = BitVecInit();
        BitVec pattern = BitVecInit();
        bool   result  = true;
        WriteFmt("Testing BitVecRegexMatch basic functionality\n");
    
        BitVec source = BitVecInit();
        bool   result = true;
        WriteFmt("Testing BitVecPrefixMatch basic functionality\n");
    
        BitVec  source   = BitVecInit();
        BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit);
        bool    result   = true;
        BitVecPush(&source, true);
    
        BitVec *p0 = VecPtrAt(&patterns, 0);
        BitVec *p1 = VecPtrAt(&patterns, 1);
        BitVec *p2 = VecPtrAt(&patterns, 2);
    
        BitVec *p0 = VecPtrAt(&patterns, 0);
        BitVec *p1 = VecPtrAt(&patterns, 1);
        BitVec *p2 = VecPtrAt(&patterns, 2);
        BitVec *p0 = VecPtrAt(&patterns, 0);
        BitVec *p1 = VecPtrAt(&patterns, 1);
        BitVec *p2 = VecPtrAt(&patterns, 2);
    
        *p0 = BitVecInit();
        WriteFmt("Testing BitVecSuffixMatch basic functionality\n");
    
        BitVec  source   = BitVecInit();
        BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit);
        bool    result   = true;
        BitVecPush(&source, true);
    
        BitVec *p0 = VecPtrAt(&patterns, 0);
        BitVec *p1 = VecPtrAt(&patterns, 1);
        BitVec *p2 = VecPtrAt(&patterns, 2);
    
        BitVec *p0 = VecPtrAt(&patterns, 0);
        BitVec *p1 = VecPtrAt(&patterns, 1);
        BitVec *p2 = VecPtrAt(&patterns, 2);
        BitVec *p0 = VecPtrAt(&patterns, 0);
        BitVec *p1 = VecPtrAt(&patterns, 1);
        BitVec *p2 = VecPtrAt(&patterns, 2);
    
        *p0 = BitVecInit();
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting BitVec.Pattern.Simple tests\n\n");
    
        // Array of test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, NULL, 0, "BitVec.Pattern.Simple");
    }
                Float: TO_TYPE_SPECIFIC_IO(Float, &(x)),                                                                   \
                Int: TO_TYPE_SPECIFIC_IO(Int, &(x)),                                                                       \
                BitVec: TO_TYPE_SPECIFIC_IO(BitVec, &(x)),                                                                 \
                const char *: TO_TYPE_SPECIFIC_IO(Zstr, &(x)),                                                             \
                char *: TO_TYPE_SPECIFIC_IO(Zstr, &(x)),                                                                   \
                Float: TO_TYPE_SPECIFIC_IO(Float, (void *)&(x)),                                                           \
                Int: TO_TYPE_SPECIFIC_IO(Int, (void *)&(x)),                                                               \
                BitVec: TO_TYPE_SPECIFIC_IO(BitVec, (void *)&(x)),                                                         \
                const char *: TO_TYPE_SPECIFIC_IO(Zstr, (void *)&(x)),                                                     \
                char *: TO_TYPE_SPECIFIC_IO(Zstr, (void *)&(x)),                                                           \
    void _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);
    void _write_Float(Str *o, FmtInfo *fmt_info, Float *value);
    void _write_BitVec(Str *o, FmtInfo *fmt_info, BitVec *bv);
    void _write_Int(Str *o, FmtInfo *fmt_info, Int *value);
    const char *_read_f64(const char *i, FmtInfo *fmt_info, f64 *v);
    const char *_read_Float(const char *i, FmtInfo *fmt_info, Float *value);
    const char *_read_BitVec(const char *i, FmtInfo *fmt_info, BitVec *bv);
    const char *_read_Int(const char *i, FmtInfo *fmt_info, Int *value);
    #include <Misra/Std/Container/List.h>
    #include <Misra/Std/Container/Map.h>
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Container/Float.h>
    #define MISRA_STD_CONTAINER_BITVEC_H
    
    #include "BitVec/Type.h"
    #include "BitVec/Init.h"
    #include "BitVec/Access.h"
    
    #include "BitVec/Type.h"
    #include "BitVec/Init.h"
    #include "BitVec/Access.h"
    #include "BitVec/BitWise.h"
    #include "BitVec/Type.h"
    #include "BitVec/Init.h"
    #include "BitVec/Access.h"
    #include "BitVec/BitWise.h"
    #include "BitVec/Insert.h"
    #include "BitVec/Init.h"
    #include "BitVec/Access.h"
    #include "BitVec/BitWise.h"
    #include "BitVec/Insert.h"
    #include "BitVec/Remove.h"
    #include "BitVec/Access.h"
    #include "BitVec/BitWise.h"
    #include "BitVec/Insert.h"
    #include "BitVec/Remove.h"
    #include "BitVec/Memory.h"
    #include "BitVec/BitWise.h"
    #include "BitVec/Insert.h"
    #include "BitVec/Remove.h"
    #include "BitVec/Memory.h"
    #include "BitVec/Convert.h"
    #include "BitVec/Insert.h"
    #include "BitVec/Remove.h"
    #include "BitVec/Memory.h"
    #include "BitVec/Convert.h"
    #include "BitVec/Pattern.h"
    #include "BitVec/Remove.h"
    #include "BitVec/Memory.h"
    #include "BitVec/Convert.h"
    #include "BitVec/Pattern.h"
    #include "BitVec/Compare.h"
    #include "BitVec/Memory.h"
    #include "BitVec/Convert.h"
    #include "BitVec/Pattern.h"
    #include "BitVec/Compare.h"
    #include "BitVec/Math.h"
    #include "BitVec/Convert.h"
    #include "BitVec/Pattern.h"
    #include "BitVec/Compare.h"
    #include "BitVec/Math.h"
    #include "BitVec/Foreach.h"
    #include "BitVec/Pattern.h"
    #include "BitVec/Compare.h"
    #include "BitVec/Math.h"
    #include "BitVec/Foreach.h"
    #include "BitVec/Compare.h"
    #include "BitVec/Math.h"
    #include "BitVec/Foreach.h"
    
    #endif // MISRA_STD_CONTAINER_BITVEC_H
        /// TAGS: BitVec, Math, Hamming, Distance
        ///
        u64 BitVecHammingDistance(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Math, Jaccard, Similarity
        ///
        double BitVecJaccardSimilarity(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Math, Cosine, Similarity
        ///
        double BitVecCosineSimilarity(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Math, DotProduct, Intersection
        ///
        u64 BitVecDotProduct(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Math, EditDistance, Transform
        ///
        u64 BitVecEditDistance(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Math, Correlation, Statistics
        ///
        double BitVecCorrelation(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Math, Entropy, Information
        ///
        double BitVecEntropy(BitVec *bv);
    
        ///
        /// TAGS: BitVec, Math, Alignment, Bioinformatics
        ///
        int BitVecAlignmentScore(BitVec *bv1, BitVec *bv2, int match, int mismatch);
    
        ///
        /// TAGS: BitVec, Math, Alignment, Overlap
        ///
        u64 BitVecBestAlignment(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, RunLength, Analysis, Pattern
        ///
        u64 BitVecRunLengths(BitVec *bv, u64 *runs, bool *values, u64 max_runs);
    
    #ifdef __cplusplus
        /// TAGS: BitVec, Convert, String, Export
        ///
        Str BitVecToStr(BitVec *bv);
    
        ///
        /// TAGS: BitVec, Convert, String, Import
        ///
        BitVec BitVecFromStr(const char *str);
    
        ///
        /// TAGS: BitVec, Convert, Bytes, Export
        ///
        u64 BitVecToBytes(BitVec *bv, u8 *bytes, u64 max_len);
    
        ///
        /// TAGS: BitVec, Convert, Bytes, Import
        ///
        BitVec BitVecFromBytes(const u8 *bytes, u64 bit_len);
    
        ///
        /// TAGS: BitVec, Convert, Integer, Export
        ///
        u64 BitVecToInteger(BitVec *bv);
    
        ///
        /// TAGS: BitVec, Convert, Integer, Import
        ///
        BitVec BitVecFromInteger(u64 value, u64 bits);
    
    #ifdef __cplusplus
        /// TAGS: BitVec, Compare, Range, Equal
        ///
        bool BitVecEqualsRange(BitVec *bv1, u64 start1, BitVec *bv2, u64 start2, u64 len);
    
        ///
        /// TAGS: BitVec, Compare, Range, Lexicographic
        ///
        int BitVecCompareRange(BitVec *bv1, u64 start1, BitVec *bv2, u64 start2, u64 len);
    
        ///
        /// TAGS: BitVec, Compare, Subset, Set
        ///
        bool BitVecIsSubset(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Compare, Superset, Set
        ///
        bool BitVecIsSuperset(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Compare, Disjoint, Set
        ///
        bool BitVecDisjoint(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Compare, Overlaps, Set
        ///
        bool BitVecOverlaps(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Equals, Compare, Test
        ///
        bool BitVecEquals(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Compare, Lexicographic
        ///
        int BitVecCompare(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Compare, Numerical, Integer
        ///
        int BitVecNumericalCompare(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Compare, Weight, Population
        ///
        int BitVecWeightCompare(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Compare, Signed, Integer
        ///
        int BitVecSignedCompare(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Sorted, Order, Check
        ///
        bool BitVecIsSorted(BitVec *bv);
    
    #ifdef __cplusplus
        /// TAGS: BitVec, And, Bitwise, Operation
        ///
        void BitVecAnd(BitVec *result, BitVec *a, BitVec *b);
    
        ///
        /// TAGS: BitVec, Or, Bitwise, Operation
        ///
        void BitVecOr(BitVec *result, BitVec *a, BitVec *b);
    
        ///
        /// TAGS: BitVec, Xor, Bitwise, Operation
        ///
        void BitVecXor(BitVec *result, BitVec *a, BitVec *b);
    
        ///
        /// TAGS: BitVec, Not, Bitwise, Operation
        ///
        void BitVecNot(BitVec *result, BitVec *bv);
    
        ///
        /// TAGS: BitVec, Shift, Left, Operation
        ///
        void BitVecShiftLeft(BitVec *bv, u64 positions);
    
        ///
        /// TAGS: BitVec, Shift, Right, Operation
        ///
        void BitVecShiftRight(BitVec *bv, u64 positions);
    
        ///
        /// TAGS: BitVec, Rotate, Left, Circular
        ///
        void BitVecRotateLeft(BitVec *bv, u64 positions);
    
        ///
        /// TAGS: BitVec, Rotate, Right, Circular
        ///
        void BitVecRotateRight(BitVec *bv, u64 positions);
    
        ///
        /// TAGS: BitVec, Reverse, Order
        ///
        void BitVecReverse(BitVec *bv);
    
    #ifdef __cplusplus
        /// TAGS: Remove, BitVec, Range, Multiple
        ///
        void BitVecRemoveRange(BitVec *bv, u64 idx, u64 count);
    
        ///
        /// TAGS: Remove, BitVec, First, Value
        ///
        bool BitVecRemoveFirst(BitVec *bv, bool value);
    
        ///
        /// TAGS: Remove, BitVec, Last, Value
        ///
        bool BitVecRemoveLast(BitVec *bv, bool value);
    
        ///
        /// TAGS: Remove, BitVec, All, Value
        ///
        u64 BitVecRemoveAll(BitVec *bv, bool value);
    
        ///
        /// TAGS: BitVec, Pop, Remove, Last
        ///
        bool BitVecPop(BitVec *bv);
    
        ///
        /// TAGS: BitVec, Remove, Shift, Single
        ///
        bool BitVecRemove(BitVec *bv, u64 idx);
    
    #ifdef __cplusplus
    #ifdef __cplusplus
    #    define BitVecInit()                                                                                               \
            (BitVec {.length = 0, .capacity = 0, .data = NULL, .byte_size = 0, .__magic = MISRA_BITVEC_MAGIC})
    #else
    #    define BitVecInit()                                                                                               \
    #else
    #    define BitVecInit()                                                                                               \
            ((BitVec) {.length = 0, .capacity = 0, .data = NULL, .byte_size = 0, .__magic = MISRA_BITVEC_MAGIC})
    #endif
    #ifdef __cplusplus
    #    define BitVecInitWithCapacity(cap)                                                                                \
            (BitVec {                                                                                                      \
                .length    = 0,                                                                                            \
                .capacity  = (cap),                                                                                        \
    #else
    #    define BitVecInitWithCapacity(cap)                                                                                \
            ((BitVec) {.length    = 0,                                                                                     \
                       .capacity  = (cap),                                                                                 \
                       .data      = (u8 *)calloc(BITVEC_BYTES_FOR_BITS(cap), 1),                                           \
        /// TAGS: Deinit, BitVec, Cleanup, Memory
        ///
        void BitVecDeinit(BitVec *bv);
    
        ///
        /// TAGS: Clear, BitVec, Reset
        ///
        void BitVecClear(BitVec *bv);
    
        ///
        /// TAGS: BitVec, Reserve, Capacity, Memory
        ///
        void BitVecReserve(BitVec *bv, u64 n);
    
        ///
        /// TAGS: BitVec, Resize, Length
        ///
        void BitVecResize(BitVec *bv, u64 n);
    
    #ifdef __cplusplus
        /// TAGS: BitVec, Pattern, StartsWith, Match
        ///
        bool BitVecStartsWith(BitVec *bv, BitVec *prefix);
    
        ///
        /// TAGS: BitVec, Pattern, EndsWith, Match
        ///
        bool BitVecEndsWith(BitVec *bv, BitVec *suffix);
    
        ///
        /// TAGS: BitVec, Pattern, ContainsAt, Position
        ///
        bool BitVecContainsAt(BitVec *bv, BitVec *pattern, u64 idx);
    
        ///
        /// TAGS: BitVec, Pattern, Find, Search
        ///
        u64 BitVecFindPattern(BitVec *bv, BitVec *pattern);
    
        ///
        /// TAGS: BitVec, Pattern, FindLast, Search
        ///
        u64 BitVecFindLastPattern(BitVec *bv, BitVec *pattern);
    
        ///
        /// TAGS: BitVec, Pattern, FindAll, Search
        ///
        u64 BitVecFindAllPattern(BitVec *bv, BitVec *pattern, size *results, u64 max_results);
    
        ///
        /// TAGS: BitVec, Pattern, Count, Search
        ///
        u64 BitVecCountPattern(BitVec *bv, BitVec *pattern);
    
        ///
        /// TAGS: BitVec, Pattern, RFind, Reverse
        ///
        u64 BitVecRFindPattern(BitVec *bv, BitVec *pattern, u64 start);
    
        ///
        /// TAGS: BitVec, Pattern, Replace, Modify
        ///
        bool BitVecReplace(BitVec *bv, BitVec *old_pattern, BitVec *new_pattern);
    
        ///
        /// TAGS: BitVec, Pattern, ReplaceAll, Modify
        ///
        u64 BitVecReplaceAll(BitVec *bv, BitVec *old_pattern, BitVec *new_pattern);
    
        ///
        /// TAGS: BitVec, Pattern, Match, Wildcard
        ///
        bool BitVecMatches(BitVec *bv, BitVec *pattern, BitVec *wildcard);
    
        ///
        /// TAGS: BitVec, Pattern, Fuzzy, Approximate
        ///
        u64 BitVecFuzzyMatch(BitVec *bv, BitVec *pattern, u64 max_errors);
    
        ///
        /// TAGS: BitVec, Pattern, Regex, Match
        ///
        bool BitVecRegexMatch(BitVec *bv, const char *pattern);
    
        ///
        /// TAGS: BitVec, Pattern, Prefix, Multiple
        ///
        u64 BitVecPrefixMatch(BitVec *bv, BitVecs *patterns);
    
        ///
        /// TAGS: BitVec, Pattern, Suffix, Multiple
        ///
        u64 BitVecSuffixMatch(BitVec *bv, BitVecs *patterns);
    
    #ifdef __cplusplus
        /// TAGS: BitVec, Memory, Shrink, Optimize
        ///
        void BitVecShrinkToFit(BitVec *bv);
    
        /// TAGS: BitVec, Memory, Swap, Efficient
        ///
        void BitVecSwap(BitVec *bv1, BitVec *bv2);
    
        ///
        /// TAGS: BitVec, Memory, Clone, Copy
        ///
        BitVec BitVecClone(BitVec *bv);
    
    #ifdef __cplusplus
        /// TAGS: BitVec, Access, Get, Boolean
        ///
        bool BitVecGet(BitVec *bv, u64 idx);
    
        ///
        /// TAGS: BitVec, Access, Set, Boolean
        ///
        void BitVecSet(BitVec *bv, u64 idx, bool value);
    
        ///
        /// TAGS: BitVec, Access, Flip, Toggle
        ///
        void BitVecFlip(BitVec *bv, u64 idx);
    
    ///
        /// TAGS: BitVec, Count, Ones, Population
        ///
        u64 BitVecCountOnes(BitVec *bv);
    
        ///
        /// TAGS: BitVec, Count, Zeros
        ///
        u64 BitVecCountZeros(BitVec *bv);
    
        ///
        /// TAGS: BitVec, Find, Search, Access
        ///
        u64 BitVecFind(BitVec *bv, bool value);
    
        ///
        /// TAGS: BitVec, FindLast, Search, Access
        ///
        u64 BitVecFindLast(BitVec *bv, bool value);
    
        ///
        /// TAGS: BitVec, All, Check, Predicate
        ///
        bool BitVecAll(BitVec *bv, bool value);
    
        ///
        /// TAGS: BitVec, Any, Check, Predicate
        ///
        bool BitVecAny(BitVec *bv, bool value);
    
        ///
        /// TAGS: BitVec, None, Check, Predicate
        ///
        bool BitVecNone(BitVec *bv, bool value);
    
        ///
        /// TAGS: BitVec, LongestRun, Analysis, Sequence
        ///
        u64 BitVecLongestRun(BitVec *bv, bool value);
    
    #ifdef __cplusplus
        u64 byte_size; // Size of data array in bytes
        u64 __magic;   // private, must not be modified
    } BitVec;
    
    typedef Vec(BitVec) BitVecs;
    } BitVec;
    
    typedef Vec(BitVec) BitVecs;
    
    #define MISRA_BITVEC_MAGIC MISRA_MAKE_NEW_MAGIC_VALUE("bitvectr")
    /// FAILURE: `abort`
    ///
    void ValidateBitVec(const BitVec *bv);
    
    #endif // MISRA_STD_CONTAINER_BITVEC_TYPE_H
        /// TAGS: Insert, BitVec, Range, Multiple
        ///
        void BitVecInsertRange(BitVec *bv, u64 idx, u64 count, bool value);
    
        ///
        /// TAGS: Insert, BitVec, Multiple, Copy
        ///
        void BitVecInsertMultiple(BitVec *bv, u64 idx, BitVec *other);
    
        ///
        /// TAGS: Insert, BitVec, Pattern, Byte
        ///
        void BitVecInsertPattern(BitVec *bv, u64 idx, u8 pattern, u64 pattern_bits);
    
        ///
        /// TAGS: BitVec, Push, Append, Insert
        ///
        void BitVecPush(BitVec *bv, bool value);
    
        ///
        /// TAGS: BitVec, Insert, Shift, Single
        ///
        void BitVecInsert(BitVec *bv, u64 idx, bool value);
    
    #ifdef __cplusplus
    
    #include "Type.h"
    #include <Misra/Std/Container/BitVec/Init.h>
    
    ///
    #define MISRA_STD_CONTAINER_INT_TYPE_H
    
    #include <Misra/Std/Container/BitVec/Type.h>
    
    ///
    ///
    typedef struct {
        BitVec bits;
    } Int;
Last updated on