ALLOCATOR_OF
Description
Convert any allocator pointer to Allocator *. The argument may be:
- a typed allocator pointer (
HeapAllocator *,PageAllocator *,
ArenaAllocator *, SlabAllocator *, BudgetAllocator *, DebugAllocator *), in which case the macro typecasts the whole pointer to Allocator *. The cast is safe because every typed allocator carries Allocator base at offset zero — the C-style inheritance contract.
- a raw
Allocator *, which is returned unchanged.
Any other pointer type triggers a _Generic mismatch at compile time, which is the type-safety check the macro layer provides.
Callers do not write &heap.base or (Allocator *)&heap by hand — every macro that takes an allocator pointer routes it through this macro first.
Usage example (from documentation)
HeapAllocator heap = HeapAllocatorInit();
Vec(int) v = VecInit(&heap); // macro internally does ALLOCATOR_OF(&heap)
void library_helper(Vec *v, Allocator *alloc) {
Vec(int) scratch = VecInit(alloc); // raw Allocator* also accepted
}
Adding a new typed allocator requires adding it to this whitelist
(and forward-declaring it above).
Note for new code: the conventions doc (CODING-CONVENTIONS.md,
"_Generic dispatch") asks each macro to inline its own _Generic
instead of going through a shared "convert type X to Y" helper.
`ALLOCATOR_OF` is the project-wide exception: it's the single
canonical erasure point used by every container init macro and
every parser/sys backend that needs to take an `Allocator *`
from a typed-allocator handle. Folding it inline at every
call site would explode the dispatch surface; keeping the
shared name makes the type-erasure step searchable.Success
Expands to an Allocator * referring to the same instance.
Failure
Compile-time _Generic mismatch on any pointer type that is not Allocator * or one of the listed typed allocator pointers.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Zstr.h:170:
#define ZstrDupN(...) OVERLOAD(ZstrDupN, __VA_ARGS__)
#define ZstrDupN_2(src, n) zstr_dup_n((src), (n), MisraScope)
#define ZstrDupN_3(src, n, alloc) zstr_dup_n((src), (n), ALLOCATOR_OF(alloc))
///
- In
Zstr.h:184:
#define ZstrDup(...) OVERLOAD(ZstrDup, __VA_ARGS__)
#define ZstrDup_1(src) zstr_dup((src), MisraScope)
#define ZstrDup_2(src, alloc) zstr_dup((src), ALLOCATOR_OF(alloc))
///
- In
ArgParse.h:166:
(( \
ArgParse \
) {.alloc = ALLOCATOR_OF(alloc_ptr), .name = (prog_name), .about = (prog_about), .specs = VecInit_1(alloc_ptr)})
///
- In
File.h:359:
#define FileOpenTemp(...) OVERLOAD(FileOpenTemp, __VA_ARGS__)
#define FileOpenTemp_1(out_path) file_open_temp((out_path), MisraScope)
#define FileOpenTemp_2(out_path, alloc) file_open_temp((out_path), ALLOCATOR_OF(alloc))
#endif // MISRA_STD_FILE_H
- In
Allocator.h:174:
/// TAGS: Allocator, Stats, Accessor
///
# define AllocatorBytesRequested(a) ((void)0, ALLOCATOR_OF(a)->stats.bytes_requested)
# define AllocatorBytesInUse(a) ((void)0, ALLOCATOR_OF(a)->stats.bytes_in_use)
# define AllocatorPeakBytesInUse(a) ((void)0, ALLOCATOR_OF(a)->stats.peak_bytes_in_use)- In
Allocator.h:175:
///
# define AllocatorBytesRequested(a) ((void)0, ALLOCATOR_OF(a)->stats.bytes_requested)
# define AllocatorBytesInUse(a) ((void)0, ALLOCATOR_OF(a)->stats.bytes_in_use)
# define AllocatorPeakBytesInUse(a) ((void)0, ALLOCATOR_OF(a)->stats.peak_bytes_in_use)
# define AllocatorAllocations(a) ((void)0, ALLOCATOR_OF(a)->stats.allocations)- In
Allocator.h:176:
# define AllocatorBytesRequested(a) ((void)0, ALLOCATOR_OF(a)->stats.bytes_requested)
# define AllocatorBytesInUse(a) ((void)0, ALLOCATOR_OF(a)->stats.bytes_in_use)
# define AllocatorPeakBytesInUse(a) ((void)0, ALLOCATOR_OF(a)->stats.peak_bytes_in_use)
# define AllocatorAllocations(a) ((void)0, ALLOCATOR_OF(a)->stats.allocations)
# define AllocatorReallocations(a) ((void)0, ALLOCATOR_OF(a)->stats.reallocations)- In
Allocator.h:177:
# define AllocatorBytesInUse(a) ((void)0, ALLOCATOR_OF(a)->stats.bytes_in_use)
# define AllocatorPeakBytesInUse(a) ((void)0, ALLOCATOR_OF(a)->stats.peak_bytes_in_use)
# define AllocatorAllocations(a) ((void)0, ALLOCATOR_OF(a)->stats.allocations)
# define AllocatorReallocations(a) ((void)0, ALLOCATOR_OF(a)->stats.reallocations)
# define AllocatorDeallocations(a) ((void)0, ALLOCATOR_OF(a)->stats.deallocations)- In
Allocator.h:178:
# define AllocatorPeakBytesInUse(a) ((void)0, ALLOCATOR_OF(a)->stats.peak_bytes_in_use)
# define AllocatorAllocations(a) ((void)0, ALLOCATOR_OF(a)->stats.allocations)
# define AllocatorReallocations(a) ((void)0, ALLOCATOR_OF(a)->stats.reallocations)
# define AllocatorDeallocations(a) ((void)0, ALLOCATOR_OF(a)->stats.deallocations)
# define AllocatorFailedAllocations(a) ((void)0, ALLOCATOR_OF(a)->stats.failed_allocations)- In
Allocator.h:179:
# define AllocatorAllocations(a) ((void)0, ALLOCATOR_OF(a)->stats.allocations)
# define AllocatorReallocations(a) ((void)0, ALLOCATOR_OF(a)->stats.reallocations)
# define AllocatorDeallocations(a) ((void)0, ALLOCATOR_OF(a)->stats.deallocations)
# define AllocatorFailedAllocations(a) ((void)0, ALLOCATOR_OF(a)->stats.failed_allocations)- In
Allocator.h:180:
# define AllocatorReallocations(a) ((void)0, ALLOCATOR_OF(a)->stats.reallocations)
# define AllocatorDeallocations(a) ((void)0, ALLOCATOR_OF(a)->stats.deallocations)
# define AllocatorFailedAllocations(a) ((void)0, ALLOCATOR_OF(a)->stats.failed_allocations)
///
- In
Allocator.h:546:
/// TAGS: Allocator, Memory, Observability
///
#define AllocatorFootprintBytes(a) ((void)0, ALLOCATOR_OF(a)->footprint_bytes)
///
- In
Allocator.h:562:
/// TAGS: Allocator, Alignment, Accessor
///
#define AllocatorAlignment(a) ((void)0, ALLOCATOR_OF(a)->alignment)
// Typed allocator headers (PageAllocator, HeapAllocator, ArenaAllocator,
- In
Io.h:400:
float_try_to_decimal_str((out), (value), (precision), (has_precision), MisraScope)
# define FloatTryToDecimalStr_5(out, value, precision, has_precision, alloc) \
float_try_to_decimal_str((out), (value), (precision), (has_precision), ALLOCATOR_OF(alloc))
///
- In
Io.h:432:
float_try_to_scientific_str((out), (value), (precision), (has_precision), (uppercase), MisraScope)
# define FloatTryToScientificStr_6(out, value, precision, has_precision, uppercase, alloc) \
float_try_to_scientific_str((out), (value), (precision), (has_precision), (uppercase), ALLOCATOR_OF(alloc))
#endif // FEATURE_FLOAT
- In
Init.h:86:
.pending_delete_count = 0, \
.mutation_epoch = 0, \
.allocator = ALLOCATOR_OF(typed_alloc_ptr), \
.__magic = GRAPH_MAGIC | MAGIC_VALIDATED_BIT}- In
Convert.h:45:
_Generic((value), Int *: float_from_int, unsigned char: float_from_u64, unsigned short: float_from_u64, unsigned int: float_from_u64, unsigned long: float_from_u64, unsigned long long: float_from_u64, signed char: float_from_i64, signed short: float_from_i64, signed int: float_from_i64, signed long: float_from_i64, signed long long: float_from_i64, float: float_from_f32, double: float_from_f64)( \
(value), \
ALLOCATOR_OF(allocator_ptr) \
)
#endif- In
Convert.h:115:
_Generic((text), Str *: float_from_str_str, Zstr: float_from_str_zstr, char *: float_from_str_zstr)( \
(text), \
ALLOCATOR_OF(alloc) \
)- In
Init.h:45:
.copy_deinit = NULL, \
.data = NULL, \
.allocator = ALLOCATOR_OF(allocator_ptr), \
.__magic = VEC_MAGIC | MAGIC_VALIDATED_BIT}- In
Init.h:81:
.copy_deinit = (GenericCopyDeinit)(cd), \
.data = NULL, \
.allocator = ALLOCATOR_OF(allocator_ptr), \
.__magic = VEC_MAGIC | MAGIC_VALIDATED_BIT}- In
Convert.h:71:
(out), \
(str), \
ALLOCATOR_OF(alloc) \
)- In
Convert.h:96:
_Generic((str), Str *: bitvec_from_str_str, Zstr: bitvec_from_str_zstr, char *: bitvec_from_str_zstr)( \
(str), \
ALLOCATOR_OF(alloc) \
)- In
Convert.h:138:
#define BitVecTryFromBytes_3(out, bytes, bit_len) bitvec_try_from_bytes((out), (bytes), (bit_len), MisraScope)
#define BitVecTryFromBytes_4(out, bytes, bit_len, alloc) \
bitvec_try_from_bytes((out), (bytes), (bit_len), ALLOCATOR_OF(alloc))
///
- In
Convert.h:155:
#define BitVecFromBytes(...) OVERLOAD(BitVecFromBytes, __VA_ARGS__)
#define BitVecFromBytes_2(bytes, bit_len) bitvec_from_bytes((bytes), (bit_len), MisraScope)
#define BitVecFromBytes_3(bytes, bit_len, alloc) bitvec_from_bytes((bytes), (bit_len), ALLOCATOR_OF(alloc))
///
- In
Convert.h:193:
#define BitVecTryFromInteger_3(out, value, bits) bitvec_try_from_integer((out), (value), (bits), MisraScope)
#define BitVecTryFromInteger_4(out, value, bits, alloc) \
bitvec_try_from_integer((out), (value), (bits), ALLOCATOR_OF(alloc))
///
- In
Convert.h:210:
#define BitVecFromInteger(...) OVERLOAD(BitVecFromInteger, __VA_ARGS__)
#define BitVecFromInteger_2(value, bits) bitvec_from_integer((value), (bits), MisraScope)
#define BitVecFromInteger_3(value, bits, alloc) bitvec_from_integer((value), (bits), ALLOCATOR_OF(alloc))
#ifdef __cplusplus- In
Init.h:71:
.data = NULL, \
.byte_size = 0, \
.allocator = ALLOCATOR_OF(allocator_ptr), \
.__magic = BITVEC_MAGIC | MAGIC_VALIDATED_BIT \
})- In
Init.h:80:
.data = NULL, \
.byte_size = 0, \
.allocator = ALLOCATOR_OF(allocator_ptr), \
.__magic = BITVEC_MAGIC | MAGIC_VALIDATED_BIT})
#endif- In
Convert.h:41:
_Generic((value), unsigned char: int_from_u64, unsigned short: int_from_u64, unsigned int: int_from_u64, unsigned long: int_from_u64, unsigned long long: int_from_u64, signed char: int_from_i64, signed short: int_from_i64, signed int: int_from_i64, signed long: int_from_i64, signed long long: int_from_i64)( \
(value), \
ALLOCATOR_OF(alloc) \
)
#endif- In
Convert.h:95:
#define IntFromBytesLE(...) OVERLOAD(IntFromBytesLE, __VA_ARGS__)
#define IntFromBytesLE_2(bytes, len) int_from_bytes_le((bytes), (len), MisraScope)
#define IntFromBytesLE_3(bytes, len, alloc) int_from_bytes_le((bytes), (len), ALLOCATOR_OF(alloc))
///
- In
Convert.h:139:
#define IntFromBytesBE(...) OVERLOAD(IntFromBytesBE, __VA_ARGS__)
#define IntFromBytesBE_2(bytes, len) int_from_bytes_be((bytes), (len), MisraScope)
#define IntFromBytesBE_3(bytes, len, alloc) int_from_bytes_be((bytes), (len), ALLOCATOR_OF(alloc))
///
- In
Convert.h:215:
(digits), \
(radix), \
ALLOCATOR_OF(alloc) \
)- In
Convert.h:288:
_Generic((decimal), Str *: int_from_str_str, Zstr: int_from_str_zstr, char *: int_from_str_zstr)( \
(decimal), \
ALLOCATOR_OF(alloc) \
)- In
Convert.h:359:
_Generic((binary), Str *: int_from_binary_str, Zstr: int_from_binary_zstr, char *: int_from_binary_zstr)( \
(binary), \
ALLOCATOR_OF(alloc) \
)- In
Convert.h:430:
_Generic((octal), Str *: int_from_oct_str_str, Zstr: int_from_oct_str_zstr, char *: int_from_oct_str_zstr)( \
(octal), \
ALLOCATOR_OF(alloc) \
)- In
Convert.h:503:
_Generic((hex), Str *: int_from_hex_str_str, Zstr: int_from_hex_str_zstr, char *: int_from_hex_str_zstr)( \
(hex), \
ALLOCATOR_OF(alloc) \
)- In
Init.h:76:
///
#define StrTryInitFromCstr(out, cstr, len, allocator_ptr) \
str_try_init_from_cstr((out), (cstr), (len), ALLOCATOR_OF(allocator_ptr))
///
- In
Init.h:93:
#define StrInitFromCstr(...) OVERLOAD(StrInitFromCstr, __VA_ARGS__)
#define StrInitFromCstr_2(cstr, len) str_init_from_cstr((cstr), (len), MisraScope)
#define StrInitFromCstr_3(cstr, len, alloc) str_init_from_cstr((cstr), (len), ALLOCATOR_OF(alloc))
///
- In
Init.h:45:
.copy_deinit = (GenericCopyDeinit)(cd), \
.length = 0, \
.allocator = ALLOCATOR_OF(typed_alloc_ptr), \
.__magic = LIST_MAGIC | MAGIC_VALIDATED_BIT}- In
Init.h:44:
.states = NULL, \
.policy = validate_map_policy_copy((policy_value)), \
.allocator = ALLOCATOR_OF(typed_alloc_ptr), \
.__magic = MAP_MAGIC | MAGIC_VALIDATED_BIT}- In
Socket.h:184:
#define SocketAddrFormat(...) OVERLOAD(SocketAddrFormat, __VA_ARGS__)
#define SocketAddrFormat_1(addr) socket_addr_format((addr), MisraScope)
#define SocketAddrFormat_2(addr, alloc) socket_addr_format((addr), ALLOCATOR_OF(alloc))
// --- Listener (server side) -------------------------------------------------
- In
Dir.h:126:
_Generic( \
(path), \
Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Dir.h:127:
(path), \
Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
Dir.h:128:
Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
PdbCache.h:61:
#define PdbCacheInit(...) OVERLOAD(PdbCacheInit, __VA_ARGS__)
#define PdbCacheInit_0() PdbCacheInit_1(MisraScope)
#define PdbCacheInit_1(alloc_ptr) ((PdbCache) {.allocator = ALLOCATOR_OF(alloc_ptr), .entries = VecInit_1(alloc_ptr)})
///
- In
Proc.h:102:
#define ProcInit(...) OVERLOAD(ProcInit, __VA_ARGS__)
#define ProcInit_3(path, argv, envp) proc_init((path), (argv), (envp), MisraScope)
#define ProcInit_4(path, argv, envp, alloc) proc_init((path), (argv), (envp), ALLOCATOR_OF(alloc))
///
#define SymbolResolverInit(...) OVERLOAD(SymbolResolverInit, __VA_ARGS__)
#define SymbolResolverInit_1(out) symbol_resolver_init((out), MisraScope)
#define SymbolResolverInit_2(out, alloc) symbol_resolver_init((out), ALLOCATOR_OF(alloc))
///
- In
Dns.h:86:
#define DnsResolverInit(...) OVERLOAD(DnsResolverInit, __VA_ARGS__)
#define DnsResolverInit_1(out) dns_resolver_init((out), MisraScope)
#define DnsResolverInit_2(out, alloc) dns_resolver_init((out), ALLOCATOR_OF(alloc))
///
- In
MachoCache.h:65:
#define MachoCacheInit(...) OVERLOAD(MachoCacheInit, __VA_ARGS__)
#define MachoCacheInit_0() MachoCacheInit_1(MisraScope)
#define MachoCacheInit_1(alloc_ptr) ((MachoCache) {.allocator = ALLOCATOR_OF(alloc_ptr), .entries = VecInit_1(alloc_ptr)})
///
- In
Http.h:247:
#define HttpRequestInit_0() HttpRequestInit_1(MisraScope)
#define HttpRequestInit_1(alloc_ptr) \
((HttpRequest) {.allocator = ALLOCATOR_OF(alloc_ptr), \
.method = HTTP_REQUEST_METHOD_UNKNOWN, \
.url = StrInit_1(alloc_ptr), \- In
Http.h:312:
#define HttpResponseInit_0() HttpResponseInit_1(MisraScope)
#define HttpResponseInit_1(alloc_ptr) \
((HttpResponse) {.allocator = ALLOCATOR_OF(alloc_ptr), \
.content_type = HTTP_CONTENT_TYPE_INVALID, \
.status_code = HTTP_RESPONSE_CODE_INVALID, \- In
Http.h:378:
#define HttpResponseSerialize(...) OVERLOAD(HttpResponseSerialize, __VA_ARGS__)
#define HttpResponseSerialize_1(response) http_response_serialize((response), MisraScope)
#define HttpResponseSerialize_2(response, alloc) http_response_serialize((response), ALLOCATOR_OF(alloc))
///
- In
Pdb.h:141:
_Generic( \
(path), \
Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Pdb.h:142:
(path), \
Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
Pdb.h:143:
Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
Pdb.h:184:
#define PdbOpenFromMemoryCopy_3(out, data, data_size) pdb_open_from_memory_copy((out), (data), (data_size), MisraScope)
#define PdbOpenFromMemoryCopy_4(out, data, data_size, alloc) \
pdb_open_from_memory_copy((out), (data), (data_size), ALLOCATOR_OF(alloc))
///
- In
Dwarf.h:99:
#define DwarfLinesBuildFromElf(...) OVERLOAD(DwarfLinesBuildFromElf, __VA_ARGS__)
#define DwarfLinesBuildFromElf_2(out, elf) dwarf_lines_build_from_elf((out), (elf), MisraScope)
#define DwarfLinesBuildFromElf_3(out, elf, alloc) dwarf_lines_build_from_elf((out), (elf), ALLOCATOR_OF(alloc))
///
- In
Dwarf.h:201:
#define DwarfCfiBuildFromElf(...) OVERLOAD(DwarfCfiBuildFromElf, __VA_ARGS__)
#define DwarfCfiBuildFromElf_2(out, elf) dwarf_cfi_build_from_elf((out), (elf), MisraScope)
#define DwarfCfiBuildFromElf_3(out, elf, alloc) dwarf_cfi_build_from_elf((out), (elf), ALLOCATOR_OF(alloc))
///
- In
Dwarf.h:363:
#define DwarfFunctionsBuildFromElf(...) OVERLOAD(DwarfFunctionsBuildFromElf, __VA_ARGS__)
#define DwarfFunctionsBuildFromElf_2(out, elf) dwarf_functions_build_from_elf((out), (elf), MisraScope)
#define DwarfFunctionsBuildFromElf_3(out, elf, alloc) dwarf_functions_build_from_elf((out), (elf), ALLOCATOR_OF(alloc))
///
- In
Elf.h:269:
_Generic( \
(path), \
Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Elf.h:270:
(path), \
Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
Elf.h:271:
Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
Elf.h:329:
#define ElfOpenFromMemoryCopy_3(out, data, data_size) elf_open_from_memory_copy((out), (data), (data_size), MisraScope)
#define ElfOpenFromMemoryCopy_4(out, data, data_size, alloc) \
elf_open_from_memory_copy((out), (data), (data_size), ALLOCATOR_OF(alloc))
///
- In
Pe.h:146:
_Generic( \
(path), \
Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Pe.h:147:
(path), \
Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
Pe.h:148:
Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
Pe.h:189:
#define PeOpenFromMemoryCopy_3(out, data, data_size) pe_open_from_memory_copy((out), (data), (data_size), MisraScope)
#define PeOpenFromMemoryCopy_4(out, data, data_size, alloc) \
pe_open_from_memory_copy((out), (data), (data_size), ALLOCATOR_OF(alloc))
///
- In
MachO.h:167:
_Generic( \
(path), \
Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
MachO.h:168:
(path), \
Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
MachO.h:169:
Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
)- In
MachO.h:212:
macho_open_from_memory_copy((out), (data), (data_size), MisraScope)
#define MachoOpenFromMemoryCopy_4(out, data, data_size, alloc) \
macho_open_from_memory_copy((out), (data), (data_size), ALLOCATOR_OF(alloc))
///
- In
ProcMaps.h:71:
#define ProcMapsLoad(...) OVERLOAD(ProcMapsLoad, __VA_ARGS__)
#define ProcMapsLoad_1(out) proc_maps_load((out), MisraScope)
#define ProcMapsLoad_2(out, alloc) proc_maps_load((out), ALLOCATOR_OF(alloc))
///
- In
ProcMaps.h:109:
_Generic( \
(src), \
File *: proc_maps_load_from_file((out), (File *)(src), ALLOCATOR_OF(alloc)), \
Str *: proc_maps_load_from_bytes( \
(out), \
- In
ProcMaps.h:114:
(const u8 *)StrBegin((Str *)(src)), \
StrLen((Str *)(src)), \
ALLOCATOR_OF(alloc) \
), \
Buf *: proc_maps_load_from_bytes((out), BufData((Buf *)(src)), BufLength((Buf *)(src)), ALLOCATOR_OF(alloc)) \
- In
ProcMaps.h:116:
ALLOCATOR_OF(alloc) \
), \
Buf *: proc_maps_load_from_bytes((out), BufData((Buf *)(src)), BufLength((Buf *)(src)), ALLOCATOR_OF(alloc)) \
)
#define ProcMapsLoadFrom_4(out, bytes, len, alloc) \- In
ProcMaps.h:119:
)
#define ProcMapsLoadFrom_4(out, bytes, len, alloc) \
proc_maps_load_from_bytes((out), (const u8 *)(bytes), (len), ALLOCATOR_OF(alloc))
///
- In
Log.c:70:
// FormatStackTrace takes `Allocator *` -- legitimate erasure
// boundary; pass at the call site, no intermediate variable.
FormatStackTrace(&trace, frames, n, ALLOCATOR_OF(&h));
(void)FileWrite(&out, StrBegin(&trace), StrLen(&trace));
StrDeinit(&trace);- In
Debug.c:186:
// intentional bypass: Debug allocator swap; no public MapSetAllocator mutator.
if (!self->live.allocator) {
((DebugAllocator *)(void *)self)->live.allocator = ALLOCATOR_OF(&((DebugAllocator *)(void *)self)->meta);
}
if (!self->freed.allocator) {- In
Debug.c:189:
}
if (!self->freed.allocator) {
((DebugAllocator *)(void *)self)->freed.allocator = ALLOCATOR_OF(&((DebugAllocator *)(void *)self)->meta);
}
if (!(self->base.__magic & MAGIC_VALIDATED_BIT)) {- In
Debug.c:327:
(u64)fe->requested_size
);
debug_emit_trace(fe->alloc_trace, fe->alloc_trace_n, "alloc", ALLOCATOR_OF(&self->meta));
debug_emit_trace(fe->free_trace, fe->free_trace_n, "first-free", ALLOCATOR_OF(&self->meta));
LOG_FATAL("DebugAllocator: double-free of {x}", (u64)ptr);- In
Debug.c:328:
);
debug_emit_trace(fe->alloc_trace, fe->alloc_trace_n, "alloc", ALLOCATOR_OF(&self->meta));
debug_emit_trace(fe->free_trace, fe->free_trace_n, "first-free", ALLOCATOR_OF(&self->meta));
LOG_FATAL("DebugAllocator: double-free of {x}", (u64)ptr);
return 0;- In
Debug.c:353:
(u64)live_rec->requested_size
);
debug_emit_trace(live_rec->alloc_trace, live_rec->alloc_trace_n, "alloc", ALLOCATOR_OF(&self->meta));
}
}- In
Debug.c:473:
MapForeachPairPtr(&self->live, key_ptr, val_ptr) {
LOG_ERROR(" leaked {x} ({} bytes)", (u64)*key_ptr, (u64)val_ptr->requested_size);
debug_emit_trace(val_ptr->alloc_trace, val_ptr->alloc_trace_n, "alloc", ALLOCATOR_OF(&self->meta));
}
}- In
Debug.c:540:
if (val_ptr->alloc_trace_n > 0) {
#if !defined(LOG_NO_BACKTRACE) || !LOG_NO_BACKTRACE
FormatStackTrace(out, val_ptr->alloc_trace, val_ptr->alloc_trace_n, ALLOCATOR_OF(&self->meta));
#else
for (size i = 0; i < val_ptr->alloc_trace_n; ++i) {- In
Dir.c:540:
// by both typed and erased callers) -- legitimate erasure boundary;
// pass at the call site, no intermediate variable.
DirContents dc = dir_get_contents(path, ALLOCATOR_OF(&ha));
bool ok = true;- In
Dns.c:540:
// DnsParseResponse takes `Allocator *` -- legitimate erasure
// boundary; pass at the call site, no intermediate variable.
bool ok = DnsParseResponse(&resp, resp_buf, (u64)got, ALLOCATOR_OF(&scratch));
if (!ok || resp.id != id || resp.rcode != DNS_RCODE_NOERROR) {
DnsResponseDeinit(&resp);- In
Clock.c:113:
DefaultAllocator alloc = DefaultAllocatorInit();
i32 offset = 0;
bool ok = TzifLocalOffsetSeconds((i64)(ns / 1000000000ull), &offset, ALLOCATOR_OF(&alloc));
DefaultAllocatorDeinit(&alloc);
if (ok)- In
PageProtect.c:8:
bool test_page_protect_roundtrip(void) {
PageAllocator page = PageAllocatorInit();
Allocator *base = ALLOCATOR_OF(&page);
size page_bytes = PageAllocatorPageSize(&page);- In
File.c:34:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:68:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:106:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:139:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:172:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:215:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:250:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:285:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:320:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
// Need a path on disk; create+remove a temp to mint a unique name,
- In
File.c:355:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
// Mint a unique name then remove it so the path is guaranteed absent.
- In
File.c:387:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:414:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:450:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:508:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:550:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:576:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:606:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:635:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:668:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:704:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:740:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:773:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:810:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
// Build a 10000-byte payload (> FILE_READ_CHUNK=4096) on disk.
- In
File.c:857:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:890:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:920:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:955:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:993:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:1022:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str p1;- In
File.c:1066:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:1098:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;- In
File.c:1152:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
// Seed a temp path that exists on disk (so the open succeeds).
- In
File.c:1191:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
// Open file A and keep a second file B open so A's fd slot sits in the
- In
AllocDebug.c:31:
bool test_debug_normal_alloc_free(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p1 = AllocatorAlloc(adbg, 64, true);- In
AllocDebug.c:55:
bool test_debug_zero_byte_alloc(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 0, false);- In
AllocDebug.c:66:
bool test_debug_null_free_is_noop(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
AllocatorFree(adbg, NULL); // no-op, must not crash
- In
AllocDebug.c:83:
bool test_debug_catches_overflow(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
u8 *buf = (u8 *)AllocatorAlloc(adbg, 16, true);- In
AllocDebug.c:99:
bool test_debug_leak_count(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
(void)AllocatorAlloc(adbg, 32, true);- In
AllocDebug.c:113:
bool test_debug_report_leaks_emits_traces(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p1 = AllocatorAlloc(adbg, 24, true);- In
AllocDebug.c:147:
bool test_debug_alloc_trace_captured(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 64, false);- In
AllocDebug.c:169:
bool test_debug_freed_history_grows_on_free(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
bool ok = (DebugAllocatorFreedCount(&dbg) == 0);- In
AllocDebug.c:201:
cfg.track_freed_history = false;
DebugAllocator dbg = DebugAllocatorInitWith(cfg);
Allocator *adbg = ALLOCATOR_OF(&dbg);
bool ok = true;- In
AllocDebug.c:224:
bool test_debug_remap_grows(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
u8 *p = (u8 *)AllocatorAlloc(adbg, 16, true);- In
AllocDebug.c:246:
bool test_debug_remap_to_zero_frees(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 24, false);- In
AllocDebug.c:259:
bool test_debug_remap_from_null_allocates(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorRealloc(adbg, NULL, 32);- In
AllocDebug.c:277:
cfg.force_page_backing = true;
DebugAllocator dbg = DebugAllocatorInitWith(cfg);
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 64, true);- In
AllocDebug.c:296:
bool test_debug_double_free_aborts(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 32, true);- In
AllocDebug.c:309:
// foreign pointer.
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
u8 junk[64];- In
AllocDebug.c:332:
bool test_ad1_canary_detects_non_first_byte(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
u8 *buf = (u8 *)AllocatorAlloc(adbg, 16, true);- In
AllocDebug.c:368:
bool test_ad1_freed_alloc_trace_n_copied(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 48, false);- In
AllocDebug.c:394:
bool test_ad1_freed_alloc_trace_bytes_copied(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 48, false);- In
AllocDebug.c:431:
cfg.capture_traces = false;
DebugAllocator dbg = DebugAllocatorInitWith(cfg);
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 32, false);- In
AllocDebug.c:457:
cfg.trace_depth = 2;
DebugAllocator dbg = DebugAllocatorInitWith(cfg);
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 32, false);- In
AllocDebug.c:482:
cfg.trace_depth = 20;
DebugAllocator dbg = DebugAllocatorInitWith(cfg);
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 32, false);- In
AllocDebug.c:502:
bool test_ad1_stats_deallocations_increment(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 32, false);- In
AllocDebug.c:523:
bool test_ad1_stats_bytes_in_use_partial_free(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *a = AllocatorAlloc(adbg, 64, false);- In
AllocDebug.c:546:
bool test_ad1_clean_roundtrip_no_false_overflow(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
u8 *buf = (u8 *)AllocatorAlloc(adbg, 32, false);- In
AllocDebug.c:567:
bool test_ad1_double_free_aborts(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 32, true);- In
AllocDebug.c:580:
bool test_ad1_foreign_free_aborts(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
u8 junk[64];- In
AllocDebug.c:611:
bool test_ad2_alloc_bumps_live_bytes(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 100, false);- In
AllocDebug.c:630:
bool test_ad2_alloc_increments_allocations(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p1 = AllocatorAlloc(adbg, 16, false);- In
AllocDebug.c:649:
bool test_ad2_alloc_accumulates_bytes_requested(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p1 = AllocatorAlloc(adbg, 30, false);- In
AllocDebug.c:671:
bool test_ad2_alloc_bumps_stats_bytes_in_use(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 256, false);- In
AllocDebug.c:688:
bool test_ad2_alloc_tracks_peak_value(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 512, false);- In
AllocDebug.c:710:
bool test_ad2_peak_advances_on_first_alloc(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 333, false);- In
AllocDebug.c:729:
bool test_ad2_peak_holds_historical_max(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *big = AllocatorAlloc(adbg, 1000, false);- In
AllocDebug.c:755:
bool test_ad2_failed_alloc_counter(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
// Absurd size: the heap cannot serve it and returns NULL.
- In
AllocDebug.c:779:
bool test_ad2_trace_count_within_bounds(void) {
DebugAllocator dbg = DebugAllocatorInit(); // capture_traces, trace_depth=8
Allocator *adbg = ALLOCATOR_OF(&dbg);
// 30 levels of recursion guarantee the stack is deeper than the
- In
AllocDebug.c:804:
cfg.trace_depth = 4; // below MAX_TRACE
DebugAllocator dbg = DebugAllocatorInitWith(cfg);
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = deep_alloc(adbg, 64, false, 30);- In
AllocDebug.c:830:
cfg.trace_depth = 32; // above MAX_TRACE -> must clamp to 16
DebugAllocator dbg = DebugAllocatorInitWith(cfg);
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = deep_alloc(adbg, 64, false, 40);- In
AllocDebug.c:855:
bool test_ad2_full_width_write_is_clean(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
size n = 48;- In
AllocDebug.c:874:
bool test_ad2_zeroed_region_is_zero_and_sized(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
size n = 200;- In
AllocDebug.c:901:
bool test_ad2_hash_tracks_many_allocations(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
enum {- In
AllocDebug.c:945:
bool test_ad2_resize_refuses_in_place(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 64, false);- In
AllocDebug.c:974:
bool test_ad2_overflow_one_past_detected(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
size n = 32;- In
AllocDebug.c:995:
bool test_ad2_resize_validates_self(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 16, false); bool test_ad3_remap_grow_preserves_full_old_width(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
u8 *p = (u8 *)AllocatorAlloc(adbg, 64, true); bool test_ad3_remap_shrink_copy_is_min_not_max(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
u8 *p = (u8 *)AllocatorAlloc(adbg, 64, true); bool test_ad3_remap_unknown_ptr_aborts(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
u8 junk[64]; bool test_ad3_report_leaks_includes_trace_frames(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 24, true); // point; the validated bit is still set, so structural runs.
dbg.heap.base.__magic = 0xdeadbeefULL;
Allocator *adbg = ALLOCATOR_OF(&dbg);
(void)AllocatorAlloc(adbg, 32, true); // structural -> bad heap magic LOG_FATAL
return false; // unreachable
bool test_ad3_structural_skipped_after_first_op(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
// First op clears the validated bit.
// entry runs structural and exercises the pow2 check.
dbg.base.alignment = 4;
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 32, true); // real: 4 is pow2 -> accepted
bool test_ad3_structural_allows_live_allocation(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 48, true); // count=1, bytes_in_use=48
// self->page, so only structural can catch this.
dbg.page.base.__magic = 0xdeadbeefULL;
Allocator *adbg = ALLOCATOR_OF(&dbg);
(void)AllocatorAlloc(adbg, 32, true); // structural -> bad page magic LOG_FATAL
return false; // unreachable
cfg.trace_depth = 32; // above DEBUG_ALLOCATOR_MAX_TRACE (16)
DebugAllocator dbg = DebugAllocatorInitWith(cfg);
Allocator *adbg = ALLOCATOR_OF(&dbg);
af_deep_free(adbg, 25); // alloc+free ~25 frames deep
bool test_blind_stats_bytes_in_use_underflow_clamps_zero(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 64, false); bool test_blind_report_leaks_emits_all_frames(void) {
DebugAllocator dbg = DebugAllocatorInit(); // capture_traces on, depth 8
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 24, true); bool test_blind_report_leaks_no_extra_frame(void) {
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
void *p = AllocatorAlloc(adbg, 24, true);- In
ArgParse.c:1924:
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
ArgParse p = ArgParseInit("prog", "an about line", adbg);- In
Convert.c:53:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = float_from_u64(42, ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:70:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = float_from_i64(-42, ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:87:
DefaultAllocator alloc = DefaultAllocatorInit();
Int integer = IntFromStr("12345678901234567890", ALLOCATOR_OF(&alloc));
Float value = float_from_int(&integer, ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:88:
Int integer = IntFromStr("12345678901234567890", ALLOCATOR_OF(&alloc));
Float value = float_from_int(&integer, ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:105:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("1234500e-2", ALLOCATOR_OF(&alloc));
Int result_value = IntInit(ALLOCATOR_OF(&alloc));
Str text = StrInit(ALLOCATOR_OF(&alloc));- In
Convert.c:106:
Float value = FloatFromStr("1234500e-2", ALLOCATOR_OF(&alloc));
Int result_value = IntInit(ALLOCATOR_OF(&alloc));
Str text = StrInit(ALLOCATOR_OF(&alloc));- In
Convert.c:107:
Float value = FloatFromStr("1234500e-2", ALLOCATOR_OF(&alloc));
Int result_value = IntInit(ALLOCATOR_OF(&alloc));
Str text = StrInit(ALLOCATOR_OF(&alloc));
bool result = FloatToInt(&result_value, &value);- In
Convert.c:125:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("123.45", ALLOCATOR_OF(&alloc));
Int result_value = IntFrom(99, ALLOCATOR_OF(&alloc));- In
Convert.c:126:
Float value = FloatFromStr("123.45", ALLOCATOR_OF(&alloc));
Int result_value = IntFrom(99, ALLOCATOR_OF(&alloc));
bool result = !FloatToInt(&result_value, &value);- In
Convert.c:142:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("-42", ALLOCATOR_OF(&alloc));
Int result_value = IntFrom(99, ALLOCATOR_OF(&alloc));- In
Convert.c:143:
Float value = FloatFromStr("-42", ALLOCATOR_OF(&alloc));
Int result_value = IntFrom(99, ALLOCATOR_OF(&alloc));
bool result = !FloatToInt(&result_value, &value);- In
Convert.c:159:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("-123.45", ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:183:
alloc.base.retry_limit = 5;
Float value = FloatFromStr("-123.45", ALLOCATOR_OF(&alloc));
ok = float_try_to_str(&text, &value, ALLOCATOR_OF(&alloc));- In
Convert.c:185:
Float value = FloatFromStr("-123.45", ALLOCATOR_OF(&alloc));
ok = float_try_to_str(&text, &value, ALLOCATOR_OF(&alloc));
bool result = ok && (ZstrCompare(StrBegin(&text), "-123.45") == 0) &&- In
Convert.c:202:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:218:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("1.2300e3", ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:234:
DefaultAllocator alloc = DefaultAllocatorInit();
Float parsed = FloatFromStr("12.3.4", ALLOCATOR_OF(&alloc));
Float value = FloatInit(ALLOCATOR_OF(&alloc));
bool result = !FloatTryFromStr(&value, "12.3.4");- In
Convert.c:235:
Float parsed = FloatFromStr("12.3.4", ALLOCATOR_OF(&alloc));
Float value = FloatInit(ALLOCATOR_OF(&alloc));
bool result = !FloatTryFromStr(&value, "12.3.4");- In
Convert.c:252:
DefaultAllocator alloc = DefaultAllocatorInit();
FloatFromStr((Zstr)NULL, ALLOCATOR_OF(&alloc));
DefaultAllocatorDeinit(&alloc);
return false;- In
Convert.c:262:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(ALLOCATOR_OF(&alloc));
FloatTryFromStr(&value, (Zstr)NULL);
FloatDeinit(&value);- In
Complex.c:26:
g_fixture_heap_ready = true;
}
return ALLOCATOR_OF(&g_fixture_heap);
}- In
Memory.c:41:
WriteFmt("Testing BitVecShrinkToFit\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add some bits
- In
Memory.c:81:
WriteFmt("Testing BitVecReserve\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add some bits
- In
Memory.c:120:
DefaultAllocator alloc = DefaultAllocatorInit();
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecReserve(&bv, 64);- In
Memory.c:136:
DefaultAllocator alloc = DefaultAllocatorInit();
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecReserve(&bv, 64);- In
Memory.c:152:
WriteFmt("Testing BitVecSwap\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Memory.c:153:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up first bitvector
- In
Memory.c:200:
WriteFmt("Testing BitVecClone\n");
BitVec original = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up original bitvector
- In
Memory.c:254:
alloc.base.retry_limit = 9;
BitVec original = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&original, true);- In
Memory.c:285:
WriteFmt("Testing BitVecShrinkToFit edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Memory.c:319:
WriteFmt("Testing BitVecReserve edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Memory.c:354:
WriteFmt("Testing BitVecSwap edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Memory.c:355:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Memory.c:398:
WriteFmt("Testing BitVecClone edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Memory.c:445:
for (int cycle = 0; cycle < 10; cycle++) {
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Memory.c:446:
for (int cycle = 0; cycle < 10; cycle++) {
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Add random-sized data
- In
Memory.c:492:
WriteFmt("Testing BitVec swap NULL handling\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Test NULL pointer - should abort
- In
Memory.c:525:
WriteFmt("Testing resize-grow clears stale tail bits\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Fill a full byte with ones so bits 5,6,7 are set in the backing byte.
- In
Memory.c:560:
WriteFmt("Testing BitVecReserve with zero capacity returns true\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = (BitVecReserve(&bv, 0) == true);- In
Memory.c:603:
WriteFmt("Testing BitVecShrinkToFit preserves bits on a large vector\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// 400 bits => doubling growth yields capacity 512, byte_size 64,
- In
Memory.c:635:
WriteFmt("Testing BitVecShrinkToFit keeps the vector structurally valid\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 400; i++) {- In
Memory.c:663:
WriteFmt("Testing BitVecSwap keeps a swapped-in large vector valid\n");
BitVec small = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec large = BitVecInit(ALLOCATOR_OF(&alloc));- In
Memory.c:664:
BitVec small = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec large = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&small, true);- In
Memory.c:698:
WriteFmt("Testing BitVecSwap aborts on an invalid second argument\n");
BitVec good = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&good, true);- In
Memory.c:718:
WriteFmt("Testing BitVecTryClone aborts on an invalid source\n");
BitVec out = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0}; // magic 0 => invalid bitvec
- In
Init.c:29:
// Test basic initialization
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Check initial state
- In
Init.c:51:
WriteFmt("Testing BitVecDeinit\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add some data to make sure deinitialization works with allocated memory
- In
Init.c:83:
WriteFmt("Testing BitVecReserve\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Reserve space for 50 bits
- In
Init.c:120:
WriteFmt("Testing BitVecClear\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add some data
- In
Init.c:159:
WriteFmt("Testing BitVecResize\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add some initial data
- In
Init.c:205:
// Test multiple initializations
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv3 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Init.c:206:
// Test multiple initializations
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv3 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Init.c:207:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv3 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = (BitVecLen(&bv1) == 0) && (BitVecLen(&bv2) == 0) && (BitVecLen(&bv3) == 0);- In
Init.c:227:
WriteFmt("Testing BitVecReserve edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Init.c:258:
WriteFmt("Testing BitVecReu64 edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Init.c:297:
WriteFmt("Testing BitVecClear edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Init.c:335:
// Test multiple init/deinit cycles
for (int cycle = 0; cycle < 100; cycle++) {
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add some data
- In
Init.c:373:
// failure rather than aborting. The Must variant aborts, so use it here
// to validate the deadend abort path.
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecMustReserve(&bv, SIZE_MAX);- In
Init.c:391:
// failure rather than aborting. The Must variant aborts, so use it here
// to validate the deadend abort path.
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecMustResize(&bv, SIZE_MAX); WriteFmt("Testing BitVec get bounds checking\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Test get from empty bitvec - should abort
WriteFmt("Testing BitVec set bounds checking\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Test set on empty bitvec - should abort
WriteFmt("Testing BitVec flip bounds checking\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Test flip on empty bitvec - should abort
WriteFmt("Testing BitVec get with large out-of-bounds index\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv, true);
BitVecPush(&bv, false); WriteFmt("Testing BitVec set with large out-of-bounds index\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv, true);
BitVecPush(&bv, false); WriteFmt("Testing BitVec flip with edge case out-of-bounds index\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 10; i++) {
BitVecPush(&bv, i % 2 == 0); WriteFmt("Testing BitVec get with maximum index value\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv, true);- In
Compare.c:54:
WriteFmt("Testing BitVecEquals\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv3 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:55:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv3 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:56:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv3 = BitVecInit(ALLOCATOR_OF(&alloc));
// Test equal empty bitvectors
- In
Compare.c:101:
WriteFmt("Testing BitVecCompare\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:102:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Test equal bitvectors
- In
Compare.c:141:
WriteFmt("Testing BitVecLexCompare\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:142:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Test lexicographic comparison
- In
Compare.c:179:
WriteFmt("Testing BitVecNumericalCompare\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:180:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Create bitvectors representing different numbers
- In
Compare.c:219:
WriteFmt("Testing BitVecWeightCompare\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:220:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// bv1: 111 (3 ones)
- In
Compare.c:259:
WriteFmt("Testing BitVecIsSubset\n");
BitVec subset = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec superset = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:260:
BitVec subset = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec superset = BitVecInit(ALLOCATOR_OF(&alloc));
// Create superset: 1111
- In
Compare.c:306:
WriteFmt("Testing BitVecSignedCompare\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:307:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Test positive vs negative (MSB is sign bit)
- In
Compare.c:353:
WriteFmt("Testing BitVecIsSuperset\n");
BitVec superset = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec subset = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:354:
BitVec superset = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec subset = BitVecInit(ALLOCATOR_OF(&alloc));
// Create superset: 1111
- In
Compare.c:400:
WriteFmt("Testing BitVecOverlaps\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:401:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Create overlapping bitvectors
- In
Compare.c:445:
WriteFmt("Testing BitVecDisjoint and BitVecIntersects\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:446:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Create disjoint bitvectors
- In
Compare.c:493:
WriteFmt("Testing BitVecEqualsRange\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:494:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Create test patterns
- In
Compare.c:539:
WriteFmt("Testing BitVecCompareRange\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:540:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Create test patterns
- In
Compare.c:590:
WriteFmt("Testing BitVecIsLexicographicallyLess and BitVecIsNumericallyLess\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:591:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Test lexicographic comparison
- In
Compare.c:634:
WriteFmt("Testing BitVecIsSorted\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Test empty bitvector (should be sorted)
- In
Compare.c:682:
WriteFmt("Testing BitVec compare edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Compare.c:683:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Compare.c:721:
WriteFmt("Testing BitVec set operations edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Compare.c:722:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Compare.c:756:
WriteFmt("Testing BitVec comprehensive comparison operations\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Compare.c:757:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Compare.c:787:
// Test transitivity: if A < B and B < C, then A < C
BitVec bv3 = BitVecInit(ALLOCATOR_OF(&alloc));
// bv3: larger than bv2
for (int i = 0; i < 8; i++) {- In
Compare.c:798:
// Test subset/superset consistency
BitVec subset = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec superset = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:799:
// Test subset/superset consistency
BitVec subset = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec superset = BitVecInit(ALLOCATOR_OF(&alloc));
// Create actual subset/superset relationship
- In
Compare.c:831:
WriteFmt("Testing BitVec large-scale comparison operations\n");
BitVec large1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec large2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Compare.c:832:
BitVec large1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec large2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Compare.c:859:
// Verify signed vs unsigned comparison differences
BitVec pos = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec neg = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:860:
// Verify signed vs unsigned comparison differences
BitVec pos = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec neg = BitVecInit(ALLOCATOR_OF(&alloc));
// Positive number (MSB = 0): 01111111
- In
Compare.c:898:
WriteFmt("Testing BitVec compare NULL pointer handling\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Test NULL pointer - should abort
- In
Compare.c:922:
WriteFmt("Testing BitVec range operations NULL handling\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Test NULL pointer in range operations - should abort
- In
Compare.c:937:
WriteFmt("Testing BitVec range operations bounds checking\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:938:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Create small bitvectors
- In
Compare.c:969:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec a = BitVecInit(base);- In
Compare.c:998:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec a = BitVecInit(base);- In
Compare.c:1035:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
Map(BitVec, u64) counts = MapInit(bitvec_hash, bitvec_compare, &alloc);- In
Compare.c:1082:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec a = BitVecInit(base);- In
Compare.c:1120:
WriteFmt("Testing BitVecEquals rejects bad second operand\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0};- In
Compare.c:1140:
WriteFmt("Testing BitVecEqualsRange rejects bad second operand\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0};- In
Compare.c:1156:
static bool test_hash_xor_byte_distinguishes(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec a = BitVecInit(base); // byte 0x00
- In
Compare.c:1184:
static bool test_hash_length_mix_mul_distinguishes(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec a = BitVecInit(base); // 10101010
- In
Compare.c:1209:
static bool test_hash_all_bytes_folded(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec a = BitVecInit(base); // byte0 = 0xFF, byte1 = 0x00
- In
Compare.c:1241:
static bool test_compare_null_lhs_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv = BitVecInit(base);- In
Compare.c:1256:
static bool test_compare_null_rhs_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv = BitVecInit(base);- In
Compare.c:1271:
static bool test_compare_range_null_lhs_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv = BitVecInit(base);- In
Compare.c:1286:
static bool test_compare_range_null_rhs_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv = BitVecInit(base);- In
Compare.c:1302:
static bool test_numerical_compare_null_lhs_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv = BitVecInit(base);- In
Compare.c:1321:
static bool test_numerical_high_bit_not_truncated(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv1 = BitVecInit(base);- In
Compare.c:1346:
static bool test_signed_neg_vs_empty(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec neg = BitVecInit(base);- In
Compare.c:1366:
static bool test_signed_empty_vs_neg(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec empty = BitVecInit(base);- In
Compare.c:1386:
static bool test_signed_sign1_le_mutant(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec neg = BitVecInit(base);- In
Compare.c:1409:
static bool test_signed_sign1_ge_no_abort(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec empty = BitVecInit(base);- In
Compare.c:1430:
static bool test_signed_sign2_ge_no_abort(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec neg = BitVecInit(base);- In
Compare.c:1450:
static bool test_signed_two_equal_negatives(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec a = BitVecInit(base);- In
Compare.c:1475:
static bool test_signed_two_negatives_magnitude_flip(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec a = BitVecInit(base);- In
Compare.c:1501:
static bool test_numerical_null_bv2(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv = BitVecInit(base);- In
Compare.c:1517:
static bool test_signed_null_bv1(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv = BitVecInit(base);- In
Compare.c:1533:
static bool test_signed_null_bv2(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv = BitVecInit(base);- In
Compare.c:1549:
static bool test_subset_null_bv1(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec bv = BitVecInit(base);- In
Compare.c:1567:
bool test_subset_skips_high_positions(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecIsSubset scans past index 42\n");- In
Compare.c:1594:
bool test_subset_bv1_short_no_abort(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecIsSubset with shorter bv1 stays in bounds\n");- In
Compare.c:1625:
bool test_subset_bv2_short_no_abort(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecIsSubset with shorter bv2 stays in bounds\n");- In
Compare.c:1656:
bool test_disjoint_scans_all_positions(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecDisjoint scans beyond position 0\n");- In
Compare.c:1685:
bool test_subset_null_bv2_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecIsSubset rejects NULL bv2\n");- In
Compare.c:1704:
bool test_disjoint_null_bv1_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecDisjoint rejects NULL bv1\n");- In
Compare.c:1723:
bool test_disjoint_null_bv2_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecDisjoint rejects NULL bv2\n");- In
Compare.c:1748:
DefaultAllocator alloc = DefaultAllocatorInit();
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 256; i++) {- In
Compare.c:1749:
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 256; i++) {
BitVecPush(&a, false);- In
Insert.c:33:
WriteFmt("Testing BitVecPush\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Push some bits
- In
Insert.c:66:
WriteFmt("Testing BitVecInsert (single bit)\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Insert at index 0 (empty bitvector)
- In
Insert.c:105:
WriteFmt("Testing BitVecInsertRange\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Create target bitvector
- In
Insert.c:136:
WriteFmt("Testing BitVecInsertMultiple\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));- In
Insert.c:137:
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
// Start with some bits
- In
Insert.c:174:
WriteFmt("Testing BitVecInsertPattern\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Start with some bits
- In
Insert.c:195:
// Test with different pattern - 0x05 (0101 in binary) using only 3 bits
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv2, true);- In
Insert.c:223:
WriteFmt("Testing BitVecInsertRange edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Insert.c:254:
WriteFmt("Testing BitVecInsertMultiple edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec empty = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));- In
Insert.c:255:
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec empty = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Insert.c:256:
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec empty = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Insert.c:290:
WriteFmt("Testing BitVecInsertPattern edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Insert.c:328:
WriteFmt("Testing BitVec insert invalid range handling\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Test inserting beyond capacity limit - should abort
- In
Insert.c:355:
WriteFmt("Testing BitVecInsertRange shifts existing tail bits\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Original: [1, 0, 1, 1]
- In
Insert.c:386:
WriteFmt("Testing BitVecInsertMultiple shifts existing tail bits\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec other = BitVecInit(ALLOCATOR_OF(&alloc));- In
Insert.c:387:
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec other = BitVecInit(ALLOCATOR_OF(&alloc));
// bv: [1, 0, 1]
- In
Insert.c:431:
WriteFmt("Testing BitVecInsertMultiple NULL bv validation\n");
BitVec other = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&other, true);- In
Insert.c:448:
WriteFmt("Testing BitVecInsertMultiple NULL other validation\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv, true); WriteFmt("Testing BitVecFindPattern(NULL, pattern) - should fatal\n");
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&pattern, true); WriteFmt("Testing BitVecFindPattern(source, NULL) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVecPush(&source, false); WriteFmt("Testing BitVecFindLastPattern(NULL, pattern) - should fatal\n");
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&pattern, true); WriteFmt("Testing BitVecFindLastPattern(source, NULL) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVecPush(&source, false); WriteFmt("Testing BitVecFindAllPattern(source, NULL, results, 10) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
size results[10];
BitVecPush(&source, true); WriteFmt("Testing BitVecFindAllPattern(source, pattern, NULL, 10) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVecPush(&source, false); WriteFmt("Testing BitVecFindAllPattern(source, pattern, results, 0) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
size results[10];
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
size results[10];
BitVecPush(&source, true);
WriteFmt("Testing BitVecStartsWith(NULL, prefix) - should fatal\n");
BitVec prefix = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&prefix, true);
BitVecStartsWith(NULL, &prefix);
WriteFmt("Testing BitVecStartsWith(source, NULL) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVecStartsWith(&source, NULL);
WriteFmt("Testing BitVecEndsWith(NULL, suffix) - should fatal\n");
BitVec suffix = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&suffix, true);
BitVecEndsWith(NULL, &suffix);
WriteFmt("Testing BitVecEndsWith(source, NULL) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVecEndsWith(&source, NULL);
WriteFmt("Testing BitVecContainsAt(NULL, pattern, 0) - should fatal\n");
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&pattern, true);
BitVecContainsAt(NULL, &pattern, 0);
WriteFmt("Testing BitVecContainsAt(source, NULL, 0) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVecContainsAt(&source, NULL, 0);
WriteFmt("Testing BitVecMatches(NULL, pattern, wildcard) - should fatal\n");
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec wildcard = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&pattern, true); WriteFmt("Testing BitVecMatches(NULL, pattern, wildcard) - should fatal\n");
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec wildcard = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&pattern, true);
BitVecPush(&wildcard, false);
WriteFmt("Testing BitVecRegexMatch(source, NULL) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVecRegexMatch(&source, (Zstr)NULL); DefaultAllocator alloc = DefaultAllocatorInit();
WriteFmt("Testing BitVecPrefixMatch(NULL, patterns, 1) - should fatal\n");
BitVecs vp = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
BitVecPush(VecPtrAt(&vp, 0), true);
BitVecPrefixMatch(NULL, &vp);
WriteFmt("Testing BitVecPrefixMatch(source, NULL, 1) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVecPrefixMatch(&source, NULL); DefaultAllocator alloc = DefaultAllocatorInit();
WriteFmt("Testing BitVecSuffixMatch(NULL, patterns, 1) - should fatal\n");
BitVecs vp = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
BitVecPush(VecPtrAt(&vp, 0), true);
BitVecSuffixMatch(NULL, &vp);
WriteFmt("Testing BitVecSuffixMatch(source, NULL, 1) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true);
BitVecSuffixMatch(&source, NULL); bool test_find_all_pattern_vec_null_bv_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecFindAllPattern (vec) with NULL bitvector\n"); bool test_find_all_pattern_vec_null_pattern_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecFindAllPattern (vec) with NULL pattern\n"); DefaultAllocator alloc = DefaultAllocatorInit();
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&pattern, true); DefaultAllocator alloc = DefaultAllocatorInit();
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true); DefaultAllocator alloc = DefaultAllocatorInit();
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&pattern, true); DefaultAllocator alloc = DefaultAllocatorInit();
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&source, true); WriteFmt("Testing BitVecReplace(src, old, NULL) with old absent - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&source, "0000");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&source, "0000");
push_bits(&old_pattern, "111"); // not present in source
BitVec bad = {0}; // magic mismatch -> ValidateBitVec aborts
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&old_pattern, "1"); BitVec bad = {0}; // magic mismatch -> ValidateBitVec aborts
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&old_pattern, "1");
push_bits(&new_pattern, "0"); WriteFmt("Testing BitVecReplaceAll(empty, NULL, new) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&new_pattern, "0");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&new_pattern, "0"); WriteFmt("Testing BitVecReplaceAll(empty, old, NULL) - should fatal\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&old_pattern, "1");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&old_pattern, "1"); static bool test_matches_null_pattern_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); static bool test_matches_null_wildcard_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); static bool test_fuzzy_null_source_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec pattern = BitVecInit(base); static bool test_fuzzy_null_pattern_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); WriteFmt("Testing BitVecPrefixMatch(NULL, empty) - should fatal\n");
BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
// Empty patterns: with validation present this aborts on the NULL bv;
WriteFmt("Testing BitVecSuffixMatch(NULL, empty) - should fatal\n");
BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
// Empty patterns: with validation present this aborts on the NULL bv;
WriteFmt("Testing BitVecRunLengths with NULL runs array\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv, true);
bool values[5]; WriteFmt("Testing BitVecRunLengths with NULL values array\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv, true);
u64 runs[5]; WriteFmt("Testing BitVecRunLengths with zero max_runs\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv, true);
u64 runs[5]; // no public setter exists -- the whole point of this test is to plant
// length>0 with data==NULL so ValidateBitVec aborts in the foreach prologue.
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bv.length = 5;
bv.capacity = 10; bool test_run_lengths_vec_null_bv_aborts(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecRunLengths (vec) with NULL bitvector\n"); DefaultAllocator alloc = DefaultAllocatorInit();
typedef List(int) LI;
LI li = ListInit(ALLOCATOR_OF(&alloc));
ListForeach(&li, i) {
(void)i; WriteFmt("Testing BitVecForeachIdx macro\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add test pattern: true, false, true, false
WriteFmt("Testing BitVecForeach macro\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add test pattern: true, false, true
WriteFmt("Testing BitVecForeachReverseIdx macro\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add test pattern: true, false, true, false
WriteFmt("Testing BitVecForeachReverse macro\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add test pattern: true, false, true
WriteFmt("Testing BitVecForeachInRangeIdx macro\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add test pattern: true, false, true, false, true
WriteFmt("Testing BitVecForeachInRange macro\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Add test pattern: false, true, true, false, true
WriteFmt("Testing BitVec foreach edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
int count = 0; WriteFmt("Testing BitVec foreach idx edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
u64 last_idx = SIZE_MAX; WriteFmt("Testing BitVec foreach reverse edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVec foreach range edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
for (int sz = 0; sz < 100; sz += 10) {
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Create bitvec of varying sz
WriteFmt("Testing BitVecRunLengths basic functionality\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; bool test_bitvec_run_lengths_vec(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecRunLengths Vec form\n");
// Test 1: Empty bitvector
BitVec empty_bv = BitVecInit(ALLOCATOR_OF(&alloc));
u64 runs[5];
bool values[5];
// Test 2: Single bit (true)
BitVec single_bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&single_bv, true);
count = BitVecRunLengths(&single_bv, runs, values, 5);
// Test 3: Single bit (false)
BitVec single_false_bv = BitVecInit(ALLOCATOR_OF(&alloc));
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(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 10; i++) {
BitVecPush(&all_true_bv, true);
// Test 5: Alternating bits (0101010)
BitVec alternating_bv = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 7; i++) {
BitVecPush(&alternating_bv, i % 2 == 0); WriteFmt("Testing BitVecRunLengths boundary conditions\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
// Test with large bitvector
BitVec large_bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Create pattern that results in many runs
- In
Type.c:23:
// Create a bitvector
BitVec bitvec = BitVecInit(ALLOCATOR_OF(&alloc));
// Check initial state
- In
Type.c:44:
// Create a valid bitvector
BitVec bitvec = BitVecInit(ALLOCATOR_OF(&alloc));
// This should not abort
WriteFmt("Testing BitVecAnd\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc)); BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up first bitvector: 1101
WriteFmt("Testing BitVecOr\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc)); BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up first bitvector: 1100
WriteFmt("Testing BitVecXor\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc)); BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up first bitvector: 1100
WriteFmt("Testing BitVecNot\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up bitvector: 1010
WriteFmt("Testing BitVecShiftLeft\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up bitvector: 1011 (indices 0,1,2,3)
WriteFmt("Testing BitVecShiftRight\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up bitvector: 1011
WriteFmt("Testing BitVecRotateLeft\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up bitvector: 1011
WriteFmt("Testing BitVecRotateRight\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up bitvector: 1011
WriteFmt("Testing BitVecReverse\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
// Set up bitvector: 1011
WriteFmt("Testing BitVec shift edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVec rotate edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVec bitwise operations edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
// Test operations on empty bitvecs
BitVec result_bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecAnd(&result_bv, &bv1, &bv2);
result = result && (BitVecLen(&result_bv) == 0); WriteFmt("Testing BitVecReverse edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVec comprehensive bitwise operations\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
bool test_result = true; BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
bool test_result = true; WriteFmt("Testing BitVec comprehensive shift operations\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVec comprehensive rotate operations\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVec bitwise identity operations\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
bool test_result = true; BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
bool test_result = true; WriteFmt("Testing BitVec bitwise commutative properties\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result2 = BitVecInit(ALLOCATOR_OF(&alloc)); BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool test_result = true; BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool test_result = true; WriteFmt("Testing BitVec bitwise operations with large patterns\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
bool test_result = true; BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
bool test_result = true; WriteFmt("Testing BitVecOr widens past shorter operand a\n");
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc)); BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
// a = 10 (len 2)
WriteFmt("Testing BitVecXor widens past shorter operand a\n");
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc)); BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
// a = 10 (len 2)
DefaultAllocator alloc = DefaultAllocatorInit();
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 8; i++) {
BitVecPush(&bv, true); DefaultAllocator alloc = DefaultAllocatorInit();
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv, true); // bit 0
BitVecPush(&bv, true); // bit 1
bool test_blind_rotate_right_exact(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool pat[5] = {true, false, false, true, true};
DebugAllocator dbg = DebugAllocatorInit();
Allocator *adbg = ALLOCATOR_OF(&dbg);
BitVec bv = BitVecInit(adbg);
DebugAllocator dbg = DebugAllocatorInitWith(lean_dbg_cfg());
Allocator *adbg = ALLOCATOR_OF(&dbg);
BitVec bv = BitVecInit(adbg); WriteFmt("Testing BitVec bitwise operations NULL handling\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Test NULL pointer - should abort
WriteFmt("Testing BitVec AND with NULL result handling\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVecPush(&bv2, false); WriteFmt("Testing BitVec OR with NULL operand handling\n");
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
// Test NULL operand - should abort
WriteFmt("Testing BitVec XOR with NULL second operand handling\n");
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
// Test NULL second operand - should abort
WriteFmt("Testing BitVec NOT with NULL handling\n");
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
// Test NULL operand - should abort
WriteFmt("Testing BitVecAnd rejects bad third operand\n");
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0};
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0}; WriteFmt("Testing BitVecAnd rejects bad second operand\n");
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0};
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0}; WriteFmt("Testing BitVecOr rejects bad second operand\n");
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0};
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec b = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0}; WriteFmt("Testing BitVecXor rejects bad third operand\n");
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0};
BitVec result = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0}; WriteFmt("Testing basic BitVec pattern functions\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecFindPattern function\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecFindLastPattern function\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecFindAllPattern function\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; bool test_bitvec_find_all_pattern_vec(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecFindAllPattern Vec form\n"); WriteFmt("Testing BitVec pattern edge cases\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVec pattern stress tests\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecStartsWith basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec prefix = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec prefix = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecStartsWith edge cases\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec prefix = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec prefix = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecEndsWith basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec suffix = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec suffix = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecEndsWith edge cases\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec suffix = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec suffix = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecFindPattern basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecContainsAt basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecContainsAt edge cases\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecCountPattern basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecRFindPattern basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecReplace basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecReplaceAll basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecMatches basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec wildcard = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec wildcard = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec wildcard = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecFuzzyMatch basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecRegexMatch basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecPrefixMatch basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
bool result = true; BitVec *p2 = VecPtrAt(&patterns, 2);
*p0 = BitVecInit(ALLOCATOR_OF(&alloc));
*p1 = BitVecInit(ALLOCATOR_OF(&alloc));
*p2 = BitVecInit(ALLOCATOR_OF(&alloc));
*p0 = BitVecInit(ALLOCATOR_OF(&alloc));
*p1 = BitVecInit(ALLOCATOR_OF(&alloc));
*p2 = BitVecInit(ALLOCATOR_OF(&alloc)); *p0 = BitVecInit(ALLOCATOR_OF(&alloc));
*p1 = BitVecInit(ALLOCATOR_OF(&alloc));
*p2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Pattern 0: 111 (should not match)
WriteFmt("Testing BitVecSuffixMatch basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecs patterns = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
bool result = true; BitVec *p2 = VecPtrAt(&patterns, 2);
*p0 = BitVecInit(ALLOCATOR_OF(&alloc));
*p1 = BitVecInit(ALLOCATOR_OF(&alloc));
*p2 = BitVecInit(ALLOCATOR_OF(&alloc));
*p0 = BitVecInit(ALLOCATOR_OF(&alloc));
*p1 = BitVecInit(ALLOCATOR_OF(&alloc));
*p2 = BitVecInit(ALLOCATOR_OF(&alloc)); *p0 = BitVecInit(ALLOCATOR_OF(&alloc));
*p1 = BitVecInit(ALLOCATOR_OF(&alloc));
*p2 = BitVecInit(ALLOCATOR_OF(&alloc));
// Pattern 0: 111 (should not match)
bool test_find_last_pattern_exact_length_match(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); bool test_find_all_pattern_vec_exact_length_match(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); DefaultAllocator alloc = DefaultAllocatorInit();
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec suffix = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&source, "101");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec suffix = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&source, "101");
push_bits(&suffix, "101"); DefaultAllocator alloc = DefaultAllocatorInit();
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&source, "101");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&source, "101");
push_bits(&pattern, "101"); DefaultAllocator alloc = DefaultAllocatorInit();
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&source, "101");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
push_bits(&source, "101");
push_bits(&pattern, "101"); WriteFmt("Testing BitVecRFindPattern window-condition (ge_to_lt)\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecRFindPattern window-condition (add_to_sub)\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecRFindPattern window-value (add_to_sub)\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecRFindPattern loop-seed (add_to_sub)\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecRFindPattern loop-guard (gt_to_ge)\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecReplaceAll found-flag init\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; WriteFmt("Testing BitVecReplaceAll forward-scan direction\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec old_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec new_pattern = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true; static bool test_replace_all_absent_no_change(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); static bool test_replace_all_inserts_new_bits(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); static bool test_matches_mismatch_returns_false(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); static bool test_fuzzy_equal_length_match(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); static bool test_fuzzy_match_position(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); static bool test_fuzzy_no_match_completes_loop(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *base = ALLOCATOR_OF(&alloc);
BitVec source = BitVecInit(base); WriteFmt("Testing bitvec_regex_match_str returns false on non-match\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;
DebugAllocator dbg = DebugAllocatorInitWith(lean_dbg_cfg());
Allocator *adbg = ALLOCATOR_OF(&dbg);
BitVec bv = BitVecInit(adbg);
DebugAllocator dbg = DebugAllocatorInitWith(lean_dbg_cfg());
Allocator *adbg = ALLOCATOR_OF(&dbg);
DefaultAllocator palloc = DefaultAllocatorInit();
DefaultAllocator palloc = DefaultAllocatorInit();
Allocator *pbase = ALLOCATOR_OF(&palloc);
BitVec bv = BitVecInit(adbg);- In
Math.c:81:
WriteFmt("Testing BitVecHammingDistance basic functionality\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:82:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:126:
WriteFmt("Testing BitVecHammingDistance edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:127:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:159:
WriteFmt("Testing BitVecJaccardSimilarity basic functionality\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:160:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:211:
WriteFmt("Testing BitVecJaccardSimilarity edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:212:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:240:
WriteFmt("Testing BitVecCosineSimilarity basic functionality\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:241:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:278:
WriteFmt("Testing BitVecCosineSimilarity edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:279:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:311:
WriteFmt("Testing BitVecDotProduct basic functionality\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:312:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:351:
WriteFmt("Testing BitVecDotProduct edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:352:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:381:
WriteFmt("Testing BitVecEditDistance basic functionality\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:382:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:428:
WriteFmt("Testing BitVecEditDistance edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:429:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:459:
WriteFmt("Testing BitVecCorrelation basic functionality\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:460:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:498:
WriteFmt("Testing BitVecCorrelation edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:499:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:529:
WriteFmt("Testing BitVecEntropy basic functionality\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:561:
WriteFmt("Testing BitVecEntropy edge cases\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:584:
WriteFmt("Testing BitVecAlignmentScore basic functionality\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:585:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:620:
WriteFmt("Testing BitVecAlignmentScore edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:621:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:650:
WriteFmt("Testing BitVecBestAlignment basic functionality\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:651:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:683:
WriteFmt("Testing BitVecBestAlignment edge cases\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:684:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:711:
WriteFmt("Testing BitVec Math stress tests\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:712:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:732:
// Test edit distance with smaller vectors (expensive operation)
BitVec small1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec small2 = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 50; i++) {- In
Math.c:733:
// Test edit distance with smaller vectors (expensive operation)
BitVec small1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec small2 = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 50; i++) {
BitVecPush(&small1, i % 2 == 0);- In
Math.c:768:
WriteFmt("Testing BitVecHammingDistance(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv2, true);
BitVecHammingDistance(NULL, &bv2);- In
Math.c:780:
WriteFmt("Testing BitVecHammingDistance(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVecHammingDistance(&bv1, NULL);- In
Math.c:792:
WriteFmt("Testing BitVecJaccardSimilarity(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv2, true);
BitVecJaccardSimilarity(NULL, &bv2);- In
Math.c:804:
WriteFmt("Testing BitVecJaccardSimilarity(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVecJaccardSimilarity(&bv1, NULL);- In
Math.c:816:
WriteFmt("Testing BitVecCosineSimilarity(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv2, true);
BitVecCosineSimilarity(NULL, &bv2);- In
Math.c:828:
WriteFmt("Testing BitVecCosineSimilarity(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVecCosineSimilarity(&bv1, NULL);- In
Math.c:840:
WriteFmt("Testing BitVecDotProduct(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv2, true);
BitVecDotProduct(NULL, &bv2);- In
Math.c:852:
WriteFmt("Testing BitVecDotProduct(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVecDotProduct(&bv1, NULL);- In
Math.c:864:
WriteFmt("Testing BitVecEditDistance(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv2, true);
BitVecEditDistance(NULL, &bv2);- In
Math.c:876:
WriteFmt("Testing BitVecEditDistance(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVecEditDistance(&bv1, NULL);- In
Math.c:888:
WriteFmt("Testing BitVecCorrelation(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv2, true);
BitVecCorrelation(NULL, &bv2);- In
Math.c:900:
WriteFmt("Testing BitVecCorrelation(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVecCorrelation(&bv1, NULL);- In
Math.c:918:
WriteFmt("Testing BitVecAlignmentScore(NULL, bv2, 1, -1) - should fatal\n");
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv2, true);
BitVecAlignmentScore(NULL, &bv2, 1, -1);- In
Math.c:930:
WriteFmt("Testing BitVecAlignmentScore(bv1, NULL, 1, -1) - should fatal\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVecAlignmentScore(&bv1, NULL, 1, -1);- In
Math.c:942:
WriteFmt("Testing BitVecBestAlignment(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv2, true);
BitVecBestAlignment(NULL, &bv2);- In
Math.c:954:
WriteFmt("Testing BitVecBestAlignment(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);
BitVecBestAlignment(&bv1, NULL);- In
Math.c:972:
WriteFmt("Testing BitVecJaccardSimilarity guard only fires when both empty\n");
BitVec empty = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec one = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&one, true);- In
Math.c:973:
BitVec empty = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec one = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&one, true);- In
Math.c:1001:
WriteFmt("Testing BitVecJaccardSimilarity with bv1 shorter than bv2\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Math.c:1002:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// bv1 = {1}, bv2 = {1, 0}. Intersection 1 (pos 0), union 1 -> 1.0.
- In
Math.c:1027:
WriteFmt("Testing BitVecJaccardSimilarity with bv2 shorter than bv1\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Math.c:1028:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// bv1 = {1, 0}, bv2 = {1}. Intersection 1 (pos 0), union 1 -> 1.0.
- In
Math.c:1054:
WriteFmt("Testing BitVecJaccardSimilarity reads bv2 bits in valid region\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Math.c:1055:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
// bv1 = {0, 0}, bv2 = {1, 1}. Intersection 0, union 2 -> 0.0.
- In
Math.c:1081:
WriteFmt("Testing BitVecEditDistance column-0 base case\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Math.c:1082:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, false);- In
Math.c:1106:
WriteFmt("Testing BitVecEditDistance deletion term\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Math.c:1107:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, false);- In
Math.c:1140:
// exact size the empty->5 distance will recycle, guaranteeing the stale
// (large) values land in prev_row[len2].
BitVec warm_a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec warm_b = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 5; i++) {- In
Math.c:1141:
// (large) values land in prev_row[len2].
BitVec warm_a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec warm_b = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 5; i++) {
BitVecPush(&warm_a, (i % 2) == 0);- In
Math.c:1150:
BitVecDeinit(&warm_b);
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 5; i++) {- In
Math.c:1151:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 5; i++) {
BitVecPush(&bv2, true);- In
Math.c:1178:
// the empty->4 distance recycles, so the unfilled prev_row[len2] holds a
// stale large value rather than a coincidental 4.
BitVec warm_a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec warm_b = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 4; i++) {- In
Math.c:1179:
// stale large value rather than a coincidental 4.
BitVec warm_a = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec warm_b = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 4; i++) {
BitVecPush(&warm_a, (i % 2) == 1);- In
Math.c:1188:
BitVecDeinit(&warm_b);
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 4; i++) {- In
Math.c:1189:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc)); // empty
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
for (int i = 0; i < 4; i++) {
BitVecPush(&bv2, false);- In
Math.c:1214:
WriteFmt("Testing BitVecEditDistance insertion term\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Math.c:1215:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVecPush(&bv1, true);- In
Math.c:1241:
WriteFmt("Testing BitVecJaccardSimilarity rejects bad second operand\n");
BitVec empty = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bad = {0};- In
Math.c:1261:
WriteFmt("Testing BitVecCorrelation with bv1 shorter than bv2 (no OOB)\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:1262:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:1291:
WriteFmt("Testing BitVecCorrelation with bv2 shorter than bv1 (no OOB)\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:1292:
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:1323:
WriteFmt("Testing BitVecEntropy on an unbalanced (3 ones, 1 zero) vector\n");
BitVec bv = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;- In
Math.c:1357:
WriteFmt("Testing BitVecBestAlignment all-mismatch best offset == 3\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));
BitVec bv2 = BitVecInit(ALLOCATOR_OF(&alloc));
bool result = true;