WriteFmt
- Macro
- October 8, 2025
Table of Contents
WriteFmt
WriteFmt
Description
Write formatted output to the standard output stream (stdout
). This is a convenience macro calling FWriteFmt with stdout
.
Parameters
Name | Direction | Description |
---|---|---|
fmtstr | in | Format string with {} placeholders. should be wrapped with variable . |
Success
Placeholders in fmtstr
are replaced by the passed arguments, and the resulting formatted string is written to stdout
.
Failure
Failure might occur during memory allocation for the temporary string or during the write operation to stdout
(handled by fputs
). Errors from StrWriteFmtInternal
(logging messages) might also occur.
Usage example (Cross-references)
- In
Vec.Foreach.c:30
:
// Test VecForeach macro
bool test_vec_foreach(void) {
WriteFmt("Testing VecForeach\n");
// Create a vector of integers
- In
Vec.Foreach.c:69
:
// Test VecForeachIdx macro
bool test_vec_foreach_idx(void) {
WriteFmt("Testing VecForeachIdx\n");
// Create a vector of integers
// Test VecForeachPtr macro
bool test_vec_foreach_ptr(void) {
WriteFmt("Testing VecForeachPtr\n");
// Create a vector of integers
// Test VecForeachPtrIdx macro
bool test_vec_foreach_ptr_idx(void) {
WriteFmt("Testing VecForeachPtrIdx\n");
// Create a vector of integers
// Test VecForeachReverse macro
bool test_vec_foreach_reverse(void) {
WriteFmt("Testing VecForeachReverse\n");
// Create a vector of integers
// Test VecForeachReverseIdx macro
bool test_vec_foreach_reverse_idx(void) {
WriteFmt("Testing VecForeachReverseIdx\n");
// Create a vector of integers
// Test VecForeachPtrReverse macro
bool test_vec_foreach_ptr_reverse(void) {
WriteFmt("Testing VecForeachPtrReverse\n");
// Create a vector of integers
// Test VecForeachPtrReverseIdx macro
bool test_vec_foreach_ptr_reverse_idx(void) {
WriteFmt("Testing VecForeachPtrReverseIdx\n");
// Create a vector of integers
// Make idx go out of bounds during VecForeach by modifying vector during iteration
bool test_vec_foreach_out_of_bounds_access(void) {
WriteFmt("Testing VecForeach where modification causes out of bounds access (should crash)\n");
typedef Vec(int) IntVec;
int iteration_count = 0;
VecForeach(&vec, val) {
WriteFmt("Iteration {} (vec.length={}): {}\n", iteration_count, vec.length, val);
// After 2nd iteration, shrink the vector dramatically
if (iteration_count == 2) {
VecResize(&vec, 2); // Shrink to only 2 elements
WriteFmt("Vector resized to length {} during foreach iteration...\n", vec.length);
}
// Make idx go out of bounds in VecForeachIdx by modifying vector during iteration
bool test_vec_foreach_idx_out_of_bounds_access(void) {
WriteFmt("Testing VecForeachIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
// VecForeachIdx has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
VecForeachIdx(&vec, val, idx) {
WriteFmt("Accessing idx {} (vec.length={}): {}\n", idx, vec.length, val);
// When we reach idx=2, drastically shrink the vector to make the current idx invalid
if (idx == 2) {
VecResize(&vec, 2); // Shrink so that idx=2 becomes out of bounds (valid indices: 0,1)
WriteFmt("Vector resized to length {}, current idx={} is now out of bounds...\n", vec.length, idx);
}
// Make idx go out of bounds in VecForeachReverseIdx by modifying vector during iteration
bool test_vec_foreach_reverse_idx_out_of_bounds_access(void) {
WriteFmt("Testing VecForeachReverseIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
// VecForeachReverseIdx has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
VecForeachReverseIdx(&vec, val, idx) {
WriteFmt("Accessing idx {} (vec.length={}): {}\n", idx, vec.length, val);
// When we reach idx=4, drastically shrink the vector
if (idx == 4) {
VecResize(&vec, 2); // Shrink to only 2 elements
WriteFmt("Vector resized to length {} during reverse iteration...\n", vec.length);
}
// Make idx go out of bounds in VecForeachPtrIdx by modifying vector during iteration
bool test_vec_foreach_ptr_idx_out_of_bounds_access(void) {
WriteFmt("Testing VecForeachPtrIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
// VecForeachPtrIdx has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
VecForeachPtrIdx(&vec, val_ptr, idx) {
WriteFmt("Accessing idx {} (vec.length={}): {}\n", idx, vec.length, *val_ptr);
// When we reach idx=3, shrink the vector to make the CURRENT idx invalid
if (idx == 3) {
VecResize(&vec, 3); // Shrink so that idx=3 becomes out of bounds (valid indices: 0,1,2)
WriteFmt("Vector resized to length {}, current idx={} is now out of bounds...\n", vec.length, idx);
}
// Make idx go out of bounds in VecForeachPtrReverseIdx by modifying vector during iteration
bool test_vec_foreach_ptr_reverse_idx_out_of_bounds_access(void) {
WriteFmt("Testing VecForeachPtrReverseIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
// VecForeachPtrReverseIdx has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
VecForeachPtrReverseIdx(&vec, val_ptr, idx) {
WriteFmt("Accessing idx {} (vec.length={}): {}\n", idx, vec.length, *val_ptr);
// When we reach idx=5, shrink the vector significantly
if (idx == 5) {
VecResize(&vec, 3); // Shrink to only 3 elements
WriteFmt("Vector resized to length {} during reverse ptr iteration...\n", vec.length);
}
// Make idx go out of bounds in VecForeachPtrInRangeIdx by modifying vector during iteration
bool test_vec_foreach_ptr_in_range_idx_out_of_bounds_access(void) {
WriteFmt("Testing VecForeachPtrInRangeIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
size original_length = vec.length; // Capture this as 9
VecForeachPtrInRangeIdx(&vec, val_ptr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (vec.length={}): {}\n", idx, vec.length, *val_ptr);
// When we reach idx=3, delete several elements
if (idx == 3) {
VecDeleteRange(&vec, 0, 6); // Remove first 6 elements
WriteFmt("Deleted first 6 elements, new length={}, idx = {}\n", vec.length, original_length, idx);
}
// Make idx go out of bounds in basic VecForeachIdx by modifying vector during iteration
bool test_vec_foreach_idx_basic_out_of_bounds_access(void) {
WriteFmt("Testing basic VecForeachIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
// Basic VecForeachIdx now has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
VecForeachIdx(&vec, val, idx) {
WriteFmt("Accessing idx {} (vec.length={}): {}\n", idx, vec.length, val);
// When we reach idx=2, drastically shrink the vector
if (idx == 2) {
VecResize(&vec, 1); // Shrink to only 1 element
WriteFmt("Vector resized to length {}, current index={}\n", vec.length, idx);
}
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Foreach.Simple tests\n\n");
// Array of normal test functions
- In
Vec.Type.c:21
:
// Test basic Vec type functionality
bool test_vec_type_basic(void) {
WriteFmt("Testing basic Vec type functionality\n");
// Define a vector of integers
- In
Vec.Type.c:51
:
// Test ValidateVec macro
bool test_vec_validate(void) {
WriteFmt("Testing ValidateVec macro\n");
// Create a valid vector
- In
Vec.Type.c:71
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Type tests\n\n");
// Array of test functions
// Test BitVecPop function
bool test_bitvec_pop(void) {
WriteFmt("Testing BitVecPop\n");
BitVec bv = BitVecInit();
// Test BitVecRemove single bit function
bool test_bitvec_remove_single(void) {
WriteFmt("Testing BitVecRemove (single bit)\n");
BitVec bv = BitVecInit();
// Test BitVecRemoveRange function
bool test_bitvec_remove_range(void) {
WriteFmt("Testing BitVecRemoveRange\n");
BitVec bv = BitVecInit();
// Test BitVecRemoveFirst function
bool test_bitvec_remove_first(void) {
WriteFmt("Testing BitVecRemoveFirst\n");
BitVec bv = BitVecInit();
// Test BitVecRemoveLast function
bool test_bitvec_remove_last(void) {
WriteFmt("Testing BitVecRemoveLast\n");
BitVec bv = BitVecInit();
// Test BitVecRemoveAll function
bool test_bitvec_remove_all(void) {
WriteFmt("Testing BitVecRemoveAll\n");
BitVec bv = BitVecInit();
// Edge case tests
bool test_bitvec_pop_edge_cases(void) {
WriteFmt("Testing BitVecPop edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_remove_single_edge_cases(void) {
WriteFmt("Testing BitVecRemove edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_remove_range_edge_cases(void) {
WriteFmt("Testing BitVecRemoveRange edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_remove_first_last_edge_cases(void) {
WriteFmt("Testing BitVecRemoveFirst/Last edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_remove_all_edge_cases(void) {
WriteFmt("Testing BitVecRemoveAll edge cases\n");
BitVec bv = BitVecInit();
// Deadend tests
bool test_bitvec_remove_null_failures(void) {
WriteFmt("Testing BitVec remove NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_remove_range_null_failures(void) {
WriteFmt("Testing BitVec remove range NULL handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_remove_invalid_range_failures(void) {
WriteFmt("Testing BitVec remove invalid range handling\n");
BitVec bv = BitVecInit();
bool test_bitvec_pop_bounds_failures(void) {
WriteFmt("Testing BitVec pop bounds checking\n");
BitVec bv = BitVecInit();
bool test_bitvec_remove_bounds_failures(void) {
WriteFmt("Testing BitVec remove bounds checking\n");
BitVec bv = BitVecInit();
bool test_bitvec_remove_range_bounds_failures(void) {
WriteFmt("Testing BitVec remove range bounds checking\n");
BitVec bv = BitVecInit();
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Remove tests\n\n");
// Array of normal test functions
// Test BitVecEquals function
bool test_bitvec_equals(void) {
WriteFmt("Testing BitVecEquals\n");
BitVec bv1 = BitVecInit();
// Test BitVecCompare function
bool test_bitvec_compare(void) {
WriteFmt("Testing BitVecCompare\n");
BitVec bv1 = BitVecInit();
// Test BitVecLexCompare function
bool test_bitvec_lex_compare(void) {
WriteFmt("Testing BitVecLexCompare\n");
BitVec bv1 = BitVecInit();
// Test BitVecNumericalCompare function
bool test_bitvec_numerical_compare(void) {
WriteFmt("Testing BitVecNumericalCompare\n");
BitVec bv1 = BitVecInit();
// Test BitVecWeightCompare function
bool test_bitvec_weight_compare(void) {
WriteFmt("Testing BitVecWeightCompare\n");
BitVec bv1 = BitVecInit();
// Test BitVecIsSubset function
bool test_bitvec_is_subset(void) {
WriteFmt("Testing BitVecIsSubset\n");
BitVec subset = BitVecInit();
// Test BitVecSignedCompare function
bool test_bitvec_signed_compare(void) {
WriteFmt("Testing BitVecSignedCompare\n");
BitVec bv1 = BitVecInit();
// Test BitVecIsSuperset function
bool test_bitvec_is_superset(void) {
WriteFmt("Testing BitVecIsSuperset\n");
BitVec superset = BitVecInit();
// Test BitVecOverlaps function
bool test_bitvec_overlaps(void) {
WriteFmt("Testing BitVecOverlaps\n");
BitVec bv1 = BitVecInit();
// Test BitVecDisjoint and BitVecIntersects functions
bool test_bitvec_disjoint_intersects(void) {
WriteFmt("Testing BitVecDisjoint and BitVecIntersects\n");
BitVec bv1 = BitVecInit();
// Test BitVecEqualsRange function
bool test_bitvec_equals_range(void) {
WriteFmt("Testing BitVecEqualsRange\n");
BitVec bv1 = BitVecInit();
// Test BitVecCompareRange function
bool test_bitvec_compare_range(void) {
WriteFmt("Testing BitVecCompareRange\n");
BitVec bv1 = BitVecInit();
// Test BitVecIsLexicographicallyLess and BitVecIsNumericallyLess
bool test_bitvec_less_than_functions(void) {
WriteFmt("Testing BitVecIsLexicographicallyLess and BitVecIsNumericallyLess\n");
BitVec bv1 = BitVecInit();
// Test BitVecIsSorted function
bool test_bitvec_is_sorted(void) {
WriteFmt("Testing BitVecIsSorted\n");
BitVec bv = BitVecInit();
// Edge case tests
bool test_bitvec_compare_edge_cases(void) {
WriteFmt("Testing BitVec compare edge cases\n");
BitVec bv1 = BitVecInit();
bool test_bitvec_set_operations_edge_cases(void) {
WriteFmt("Testing BitVec set operations edge cases\n");
BitVec bv1 = BitVecInit();
// Comprehensive comparison testing with cross-validation
bool test_bitvec_comprehensive_comparison(void) {
WriteFmt("Testing BitVec comprehensive comparison operations\n");
BitVec bv1 = BitVecInit();
// Large-scale testing with stress patterns
bool test_bitvec_large_scale_comparison(void) {
WriteFmt("Testing BitVec large-scale comparison operations\n");
BitVec large1 = BitVecInit();
// Deadend tests
bool test_bitvec_compare_null_failures(void) {
WriteFmt("Testing BitVec compare NULL pointer handling\n");
BitVec bv = BitVecInit();
bool test_bitvec_subset_null_failures(void) {
WriteFmt("Testing BitVec subset NULL handling\n");
// Test NULL pointer - should abort
bool test_bitvec_range_null_failures(void) {
WriteFmt("Testing BitVec range operations NULL handling\n");
BitVec bv = BitVecInit();
bool test_bitvec_range_bounds_failures(void) {
WriteFmt("Testing BitVec range operations bounds checking\n");
BitVec bv1 = BitVecInit();
bool test_bitvec_sorted_null_failures(void) {
WriteFmt("Testing BitVec sorted operations NULL handling\n");
// Test NULL pointer - should abort
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Compare tests\n\n");
// Array of normal test functions
// Test BitVecForeachIdx macro
bool test_bitvec_foreach_idx(void) {
WriteFmt("Testing BitVecForeachIdx macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeach macro
bool test_bitvec_foreach(void) {
WriteFmt("Testing BitVecForeach macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeachReverseIdx macro
bool test_bitvec_foreach_reverse_idx(void) {
WriteFmt("Testing BitVecForeachReverseIdx macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeachReverse macro
bool test_bitvec_foreach_reverse(void) {
WriteFmt("Testing BitVecForeachReverse macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeachInRangeIdx macro
bool test_bitvec_foreach_in_range_idx(void) {
WriteFmt("Testing BitVecForeachInRangeIdx macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeachInRange macro
bool test_bitvec_foreach_in_range(void) {
WriteFmt("Testing BitVecForeachInRange macro\n");
BitVec bv = BitVecInit();
// Edge case tests
bool test_bitvec_foreach_edge_cases(void) {
WriteFmt("Testing BitVec foreach edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_idx_edge_cases(void) {
WriteFmt("Testing BitVec foreach idx edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_reverse_edge_cases(void) {
WriteFmt("Testing BitVec foreach reverse edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_range_edge_cases(void) {
WriteFmt("Testing BitVec foreach range edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_stress_test(void) {
WriteFmt("Testing BitVec foreach stress test\n");
bool result = true;
bool test_bitvec_run_lengths_basic(void) {
WriteFmt("Testing BitVecRunLengths basic functionality\n");
BitVec bv = BitVecInit();
bool test_bitvec_run_lengths_edge_cases(void) {
WriteFmt("Testing BitVecRunLengths edge cases\n");
bool result = true;
bool test_bitvec_run_lengths_boundary_conditions(void) {
WriteFmt("Testing BitVecRunLengths boundary conditions\n");
BitVec bv = BitVecInit();
bool test_bitvec_run_lengths_stress_test(void) {
WriteFmt("Testing BitVecRunLengths stress test\n");
bool result = true;
// Main function that runs all simple tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Foreach.Simple tests\n\n");
// Array of normal test functions
- In
Str.Convert.c:29
:
// Test StrFromU64 function
bool test_str_from_u64(void) {
WriteFmt("Testing StrFromU64\n");
Str s = StrInit();
- In
Str.Convert.c:38
:
bool result = (ZstrCompare(s.data, "12345") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '12345', got '{}'\n", s);
}
- In
Str.Convert.c:47
:
result = result && (ZstrCompare(s.data, "0xabcd") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0xabcd', got '{}'\n", s);
}
- In
Str.Convert.c:56
:
result = result && (ZstrCompare(s.data, "0xABCD") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0xABCD', got '{}'\n", s);
}
- In
Str.Convert.c:65
:
result = result && (ZstrCompare(s.data, "0b101010") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0b101010', got '{}'\n", s);
}
- In
Str.Convert.c:74
:
result = result && (ZstrCompare(s.data, "0o52") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0o52', got '{}'\n", s);
}
- In
Str.Convert.c:83
:
result = result && (ZstrCompare(s.data, "0") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0', got '{}'\n", s);
}
- In
Str.Convert.c:92
:
// Test StrFromI64 function
bool test_str_from_i64(void) {
WriteFmt("Testing StrFromI64\n");
Str s = StrInit();
bool result = (ZstrCompare(s.data, "12345") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '12345', got '{}'\n", s.data);
}
result = result && (ZstrCompare(s.data, "-12345") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '-12345', got '{}'\n", s.data);
}
result = result && (ZstrCompareN(s.data, "0x", 2) == 0);
if (!result) {
WriteFmt(" FAIL: Expected hex prefix '0x', got '{}'\n", s.data);
}
result = result && (ZstrCompare(s.data, "0") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0', got '{}'\n", s.data);
}
result = result && (ZstrCompare(s.data, "0b101010") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0b101010', got '{}'\n", s.data);
}
// Test StrFromF64 function
bool test_str_from_f64(void) {
WriteFmt("Testing StrFromF64\n");
Str s = StrInit();
bool result = (ZstrCompare(s.data, "123.00") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '123.00', got '{}'\n", s.data);
}
result = result && (ZstrCompare(s.data, "123.456") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '123.456', got '{}'\n", s.data);
}
// Test StrToU64 function
bool test_str_to_u64(void) {
WriteFmt("Testing StrToU64\n");
// Test decimal conversion
// Test StrToI64 function
bool test_str_to_i64(void) {
WriteFmt("Testing StrToI64\n");
// Test positive decimal conversion
// Test StrToF64 function
bool test_str_to_f64(void) {
WriteFmt("Testing StrToF64\n");
// Test integer conversion
// Round-trip conversion tests
bool test_str_round_trip_conversions(void) {
WriteFmt("Testing Str round-trip conversions\n");
bool result = true;
// Edge case conversion tests
bool test_str_edge_case_conversions(void) {
WriteFmt("Testing Str edge case conversions\n");
bool result = true;
// Precision limits testing
bool test_str_precision_limits(void) {
WriteFmt("Testing Str precision limits\n");
bool result = true;
// Large-scale conversion tests
bool test_str_all_base_support(void) {
WriteFmt("Testing Str all bases 2-36 support\n");
bool result = true;
bool test_str_large_scale_conversions(void) {
WriteFmt("Testing Str large-scale conversions\n");
bool result = true;
// Deadend tests for NULL pointer handling
bool test_str_conversion_null_failures(void) {
WriteFmt("Testing Str conversion NULL pointer handling\n");
// Test NULL string pointer - should abort
bool test_str_conversion_bounds_failures(void) {
WriteFmt("Testing Str conversion bounds failures\n");
// Test StrFromI64 with NULL pointer - should abort
bool test_str_conversion_invalid_input_failures(void) {
WriteFmt("Testing Str conversion invalid input failures\n");
// Test StrFromF64 with NULL pointer - should abort
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Str.Convert tests\n\n");
// Array of normal test functions
- In
Io.Read.c:44
:
// Test decimal integer reading
bool test_integer_decimal_reading(void) {
WriteFmt("Testing integer decimal reading\n");
const char *z = NULL;
- In
Io.Read.c:145
:
// Test hexadecimal integer reading
bool test_integer_hex_reading(void) {
WriteFmt("Testing integer hexadecimal reading\n");
const char *z = NULL;
- In
Io.Read.c:182
:
// Test binary integer reading
bool test_integer_binary_reading(void) {
WriteFmt("Testing integer binary reading\n");
const char *z = NULL;
- In
Io.Read.c:209
:
// Test octal integer reading
bool test_integer_octal_reading(void) {
WriteFmt("Testing integer octal reading\n");
const char *z = NULL;
- In
Io.Read.c:241
:
// Test basic float reading
bool test_float_basic_reading(void) {
WriteFmt("Testing basic float reading\n");
const char *z = NULL;
- In
Io.Read.c:286
:
// Test scientific notation reading
bool test_float_scientific_reading(void) {
WriteFmt("Testing scientific notation reading\n");
const char *z = NULL;
- In
Io.Read.c:333
:
// Test string reading
bool test_string_reading(void) {
WriteFmt("Testing string reading\n");
const char *z = NULL;
- In
Io.Read.c:364
:
// Test reading multiple arguments
bool test_multiple_arguments_reading(void) {
WriteFmt("Testing multiple arguments reading\n");
const char *z = NULL;
- In
Io.Read.c:400
:
// Test error handling
bool test_error_handling_reading(void) {
WriteFmt("Testing error handling for reading\n");
const char *z = NULL;
- In
Io.Read.c:432
:
// Test character ordinal reading with :c format specifier
bool test_character_ordinal_reading(void) {
WriteFmt("Testing character ordinal reading with :c format specifier\n");
const char *z = NULL;
- In
Io.Read.c:442
:
z = "A";
StrReadFmt(z, "{c}", u8_val);
WriteFmt("u8_val = {}, expected = {}, pass = {}\n", u8_val, 'A', (u8_val == 'A') ? "true" : "false");
success = success && (u8_val == 'A');
- In
Io.Read.c:448
:
z = "z";
StrReadFmt(z, "{c}", u8_val);
WriteFmt("u8_val = {}, expected = {}, pass = {}\n", u8_val, 'z', (u8_val == 'z') ? "true" : "false");
success = success && (u8_val == 'z');
- In
Io.Read.c:455
:
z = "B";
StrReadFmt(z, "{c}", i8_val);
WriteFmt("i8_val = {}, expected = {}, pass = {}\n", i8_val, 'B', (i8_val == 'B') ? "true" : "false");
success = success && (i8_val == 'B');
- In
Io.Read.c:461
:
z = "C";
StrReadFmt(z, "{c}", i16_val);
WriteFmt("i16_val = {}, expected = {}, pass = {}\n", i16_val, 'C', (i16_val == 'C') ? "true" : "false");
success = success && (i16_val == 'C');
- In
Io.Read.c:467
:
z = "D";
StrReadFmt(z, "{c}", i32_val);
WriteFmt("i32_val = {}, expected = {}, pass = {}\n", i32_val, 'D', (i32_val == 'D') ? "true" : "false");
success = success && (i32_val == 'D');
- In
Io.Read.c:473
:
z = "E";
StrReadFmt(z, "{c}", i64_val);
WriteFmt("i64_val = {}, expected = {}, pass = {}\n", i64_val, 'E', (i64_val == 'E') ? "true" : "false");
success = success && (i64_val == 'E');
- In
Io.Read.c:480
:
z = "F";
StrReadFmt(z, "{c}", u16_val);
WriteFmt("u16_val = {}, expected = {}, pass = {}\n", u16_val, 'F', (u16_val == 'F') ? "true" : "false");
success = success && (u16_val == 'F');
- In
Io.Read.c:486
:
z = "G";
StrReadFmt(z, "{c}", u32_val);
WriteFmt("u32_val = {}, expected = {}, pass = {}\n", u32_val, 'G', (u32_val == 'G') ? "true" : "false");
success = success && (u32_val == 'G');
- In
Io.Read.c:492
:
z = "H";
StrReadFmt(z, "{c}", u64_val);
WriteFmt("u64_val = {}, expected = {}, pass = {}\n", u64_val, 'H', (u64_val == 'H') ? "true" : "false");
success = success && (u64_val == 'H');
- In
Io.Read.c:500
:
StrReadFmt(z, "{c}", u16_val);
bool u16_multi_pass = (ZstrCompareN((const char *)&u16_val, "AB", 2) == 0);
WriteFmt("u16_val multi-char test: comparing memory with 'AB', pass = {}\n", u16_multi_pass ? "true" : "false");
WriteFmt(
"DEBUG: u16_val bytes: [{}, {}], expected 'AB' bytes: [{}, {}]\n",
- In
Io.Read.c:501
:
bool u16_multi_pass = (ZstrCompareN((const char *)&u16_val, "AB", 2) == 0);
WriteFmt("u16_val multi-char test: comparing memory with 'AB', pass = {}\n", u16_multi_pass ? "true" : "false");
WriteFmt(
"DEBUG: u16_val bytes: [{}, {}], expected 'AB' bytes: [{}, {}]\n",
(int)((u8 *)&u16_val)[0],
- In
Io.Read.c:514
:
StrReadFmt(z, "{c}", i16_val);
bool i16_multi_pass = (ZstrCompareN((const char *)&i16_val, "CD", 2) == 0);
WriteFmt("i16_val multi-char test: comparing memory with 'CD', pass = {}\n", i16_multi_pass ? "true" : "false");
success = success && i16_multi_pass;
- In
Io.Read.c:521
:
StrReadFmt(z, "{c}", u32_val);
bool u32_multi_pass = (ZstrCompareN((const char *)&u32_val, "EFGH", 4) == 0);
WriteFmt("u32_val multi-char test: comparing memory with 'EFGH', pass = {}\n", u32_multi_pass ? "true" : "false");
success = success && u32_multi_pass;
- In
Io.Read.c:528
:
StrReadFmt(z, "{c}", i32_val);
bool i32_multi_pass = (ZstrCompareN((const char *)&i32_val, "IJKL", 4) == 0);
WriteFmt("i32_val multi-char test: comparing memory with 'IJKL', pass = {}\n", i32_multi_pass ? "true" : "false");
success = success && i32_multi_pass;
- In
Io.Read.c:535
:
StrReadFmt(z, "{c}", u64_val);
bool u64_multi_pass = (ZstrCompareN((const char *)&u64_val, "MNOPQRST", 8) == 0);
WriteFmt(
"u64_val multi-char test: comparing memory with 'MNOPQRST', pass = {}\n",
u64_multi_pass ? "true" : "false"
- In
Io.Read.c:545
:
StrReadFmt(z, "{c}", i64_val);
bool i64_multi_pass = (ZstrCompareN((const char *)&i64_val, "UVWXYZab", 8) == 0);
WriteFmt(
"i64_val multi-char test: comparing memory with 'UVWXYZab', pass = {}\n",
i64_multi_pass ? "true" : "false"
- In
Io.Read.c:555
:
StrReadFmt(z, "{c}", f32_val);
bool f32_pass = (f32_val == (f32)'A');
WriteFmt("f32_val = {}, expected = {}, pass = {}\n", f32_val, (f32)'A', f32_pass ? "true" : "false");
success = success && f32_pass;
- In
Io.Read.c:562
:
StrReadFmt(z, "{c}", f64_val);
bool f64_pass = (f64_val == (f64)'B');
WriteFmt("f64_val = {}, expected = {}, pass = {}\n", f64_val, (f64)'B', f64_pass ? "true" : "false");
success = success && f64_pass;
- In
Io.Read.c:569
:
StrReadFmt(z, "{c}", u8_val);
bool tilde_pass = (u8_val == '~');
WriteFmt("u8_val = {}, expected = {} (~), pass = {}\n", u8_val, '~', tilde_pass ? "true" : "false");
success = success && tilde_pass;
- In
Io.Read.c:576
:
StrReadFmt(z, "{c}", u32_val);
bool xy_pass = (ZstrCompareN((const char *)&u32_val, "XY", 2) == 0);
WriteFmt("u32_val partial test: comparing memory with 'XY', pass = {}\n", xy_pass ? "true" : "false");
success = success && xy_pass;
- In
Io.Read.c:583
:
StrReadFmt(z, "{c}", u64_val);
bool abc_pass = (ZstrCompareN((const char *)&u64_val, "abc", 3) == 0);
WriteFmt("u64_val partial test: comparing memory with 'abc', pass = {}\n", abc_pass ? "true" : "false");
success = success && abc_pass;
- In
Io.Read.c:591
:
Str expected = StrInitFromZstr("Hello");
bool str_pass = (StrCmp(&str_val, &expected) == 0);
WriteFmt("str_val test: comparing with 'Hello', pass = {}\n", str_pass ? "true" : "false");
success = success && str_pass;
StrDeinit(&expected);
- In
Io.Read.c:601
:
expected = StrInitFromZstr("World");
bool quoted_str_pass = (StrCmp(&str_val, &expected) == 0);
WriteFmt("quoted str_val test: comparing with 'World', pass = {}\n", quoted_str_pass ? "true" : "false");
success = success && quoted_str_pass;
StrDeinit(&expected);
- In
Io.Read.c:606
:
StrDeinit(&str_val);
WriteFmt("Overall success: {}\n", success ? "true" : "false");
return success;
}
- In
Io.Read.c:612
:
// Test string case conversion with :a and :A format specifiers
bool test_string_case_conversion_reading(void) {
WriteFmt("Testing string case conversion with :a and :A format specifiers\n");
const char *z = NULL;
- In
Io.Read.c:626
:
StrReadFmt(z, "{a}", result);
WriteFmt("Test 1 - :a (lowercase)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
- In
Io.Read.c:627
:
WriteFmt("Test 1 - :a (lowercase)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
- In
Io.Read.c:629
:
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
- In
Io.Read.c:631
:
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
// Should read "hello" (stops at first space)
- In
Io.Read.c:636
:
Str expected = StrInitFromZstr("hello world");
bool test1_pass = (StrCmp(&result, &expected) == 0);
WriteFmt("Expected: 'hello', Pass: {}\n\n", test1_pass ? "true" : "false");
success = success && test1_pass;
- In
Io.Read.c:651
:
StrReadFmt(z, "{as}", result);
WriteFmt("Test 1.1 - :as (lowercase string single word)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
- In
Io.Read.c:652
:
WriteFmt("Test 1.1 - :as (lowercase string single word)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
- In
Io.Read.c:654
:
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
- In
Io.Read.c:656
:
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
// Should read "hello" (stops at first space)
- In
Io.Read.c:661
:
Str expected = StrInitFromZstr("hello");
bool test1_pass = (StrCmp(&result, &expected) == 0);
WriteFmt("Expected: 'hello', Pass: {}\n\n", test1_pass ? "true" : "false");
success = success && test1_pass;
- In
Io.Read.c:676
:
StrReadFmt(z, "{A}", result);
WriteFmt("Test 2 - :A (uppercase)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
- In
Io.Read.c:677
:
WriteFmt("Test 2 - :A (uppercase)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
- In
Io.Read.c:679
:
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
- In
Io.Read.c:681
:
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
// Should read "HELLO" (stops at first space)
- In
Io.Read.c:686
:
Str expected = StrInitFromZstr("HELLO WORLD");
bool test2_pass = (StrCmp(&result, &expected) == 0);
WriteFmt("Expected: 'HELLO', Pass: {}\n\n", test2_pass ? "true" : "false");
success = success && test2_pass;
- In
Io.Read.c:702
:
StrReadFmt(z, "{A} {A}", result1, result2);
WriteFmt("Test 2 - :A (uppercase with split format)\n");
WriteFmt("Input: '{}', Output: '{} {}'", in, result1, result2);
- In
Io.Read.c:703
:
WriteFmt("Test 2 - :A (uppercase with split format)\n");
WriteFmt("Input: '{}', Output: '{} {}'", in, result1, result2);
bool test2_pass = (StrCmpZstr(&result1, "HELLO") == 0);
- In
Io.Read.c:707
:
bool test2_pass = (StrCmpZstr(&result1, "HELLO") == 0);
test2_pass &= (StrCmpZstr(&result2, "WORLD") == 0);
WriteFmt("Expected: 'HELLO WORLD', Pass: {}\n\n", test2_pass ? "true" : "false");
success = success && test2_pass;
- In
Io.Read.c:725
:
// result2 must consume the space after hello and then everything after it
WriteFmt("Test 2 - :A (uppercase with split format)\n");
WriteFmt("Input: '{}', Output: '{}{}'", in, result1, result2);
- In
Io.Read.c:726
:
WriteFmt("Test 2 - :A (uppercase with split format)\n");
WriteFmt("Input: '{}', Output: '{}{}'", in, result1, result2);
bool test2_pass = (StrCmpZstr(&result1, "HELLO") == 0);
- In
Io.Read.c:730
:
bool test2_pass = (StrCmpZstr(&result1, "HELLO") == 0);
test2_pass &= (StrCmpZstr(&result2, " WORLD MIGHTY MISRA") == 0); // notice the extra space
WriteFmt("Expected: 'HELLO WORLD MIGHTY MISRA', Pass: {}\n\n", test2_pass ? "true" : "false");
success = success && test2_pass;
- In
Io.Read.c:745
:
StrReadFmt(z, "{as}", result);
WriteFmt("Test 3 - :a with quoted string\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
- In
Io.Read.c:746
:
WriteFmt("Test 3 - :a with quoted string\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
- In
Io.Read.c:748
:
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
- In
Io.Read.c:750
:
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
// Should read "mixed case" (converts the entire quoted string)
- In
Io.Read.c:755
:
Str expected = StrInitFromZstr("mixed case");
bool test3_pass = (StrCmp(&result, &expected) == 0);
WriteFmt("Expected: 'mixed case', Pass: {}\n\n", test3_pass ? "true" : "false");
success = success && test3_pass;
- In
Io.Read.c:770
:
StrReadFmt(z, "{As}", result);
WriteFmt("Test 4 - :A with mixed alphanumeric\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
- In
Io.Read.c:771
:
WriteFmt("Test 4 - :A with mixed alphanumeric\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
- In
Io.Read.c:773
:
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
- In
Io.Read.c:775
:
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
// Should read "ABC123XYZ" (only letters are converted, numbers unchanged)
- In
Io.Read.c:780
:
Str expected = StrInitFromZstr("ABC123XYZ");
bool test4_pass = (StrCmp(&result, &expected) == 0);
WriteFmt("Expected: 'ABC123XYZ', Pass: {}\n\n", test4_pass ? "true" : "false");
success = success && test4_pass;
- In
Io.Read.c:795
:
StrReadFmt(z, "{c}", result);
WriteFmt("Test 5 - :c (no case conversion)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
- In
Io.Read.c:796
:
WriteFmt("Test 5 - :c (no case conversion)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
- In
Io.Read.c:798
:
WriteFmt("Input: '{}', Output: '", in);
for (size_t i = 0; i < result.length; i++) {
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
- In
Io.Read.c:800
:
WriteFmt("{c}", result.data[i]);
}
WriteFmt("'\n");
// Should read "Hello" (stops at first space, no case conversion)
- In
Io.Read.c:805
:
Str expected = StrInitFromZstr("Hello World");
bool test5_pass = (StrCmp(&result, &expected) == 0);
WriteFmt("Expected: 'Hello World', Pass: {}\n\n", test5_pass ? "true" : "false");
success = success && test5_pass;
- In
Io.Read.c:812
:
}
WriteFmt("Overall case conversion success: {}\n", success ? "true" : "false");
return success;
}
- In
Io.Read.c:818
:
// Test BitVec reading
bool test_bitvec_reading(void) {
WriteFmt("Testing BitVec reading\n");
const char *z = NULL;
- In
Io.Read.c:830
:
Str result1 = BitVecToStr(&bv1);
success = success && (ZstrCompare(result1.data, "10110") == 0);
WriteFmt(
"Test 1 - Binary: {}, Success: {}\n",
result1,
- In
Io.Read.c:844
:
u64 value2 = BitVecToInteger(&bv2);
success = success && (value2 == 0xDEAD);
WriteFmt("Test 2 - Hex: {}, Success: {}\n", value2, (value2 == 0xDEAD) ? "true" : "false");
BitVecDeinit(&bv2);
- In
Io.Read.c:853
:
u64 value3 = BitVecToInteger(&bv3);
success = success && (value3 == 0755);
WriteFmt("Test 3 - Octal: {}, Success: {}\n", value3, (value3 == 0755) ? "true" : "false");
BitVecDeinit(&bv3);
- In
Io.Read.c:862
:
Str result4 = BitVecToStr(&bv4);
success = success && (ZstrCompare(result4.data, "1101") == 0);
WriteFmt(
"Test 4 - Whitespace: {}, Success: {}\n",
result4,
- In
Io.Read.c:876
:
Str result5 = BitVecToStr(&bv5);
success = success && (ZstrCompare(result5.data, "0") == 0);
WriteFmt("Test 5 - Zero: {}, Success: {}\n", result5, (ZstrCompare(result5.data, "0") == 0) ? "true" : "false");
StrDeinit(&result5);
BitVecDeinit(&bv5);
- In
Io.Read.c:880
:
BitVecDeinit(&bv5);
WriteFmt("Overall BitVec reading success: {}\n", success ? "true" : "false");
return success;
}
- In
Io.Read.c:886
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting format reader tests\n\n");
// Array of test functions
- In
Vec.Memory.c:17
:
// Test VecTryReduceSpace function
bool test_vec_try_reduce_space(void) {
WriteFmt("Testing VecTryReduceSpace\n");
// Create a vector of integers
- In
Vec.Memory.c:54
:
// Test VecResize function
bool test_vec_resize(void) {
WriteFmt("Testing VecResize\n");
// Create a vector of integers
- In
Vec.Memory.c:99
:
// Test VecReserve function
bool test_vec_reserve(void) {
WriteFmt("Testing VecReserve\n");
// Create a vector of integers
- In
Vec.Memory.c:143
:
// Test VecClear function
bool test_vec_clear(void) {
WriteFmt("Testing VecClear\n");
// Create a vector of integers
- In
Vec.Memory.c:181
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Memory tests\n\n");
// Array of test functions
// Test BitVecAnd function
bool test_bitvec_and(void) {
WriteFmt("Testing BitVecAnd\n");
BitVec bv1 = BitVecInit();
// Test BitVecOr function
bool test_bitvec_or(void) {
WriteFmt("Testing BitVecOr\n");
BitVec bv1 = BitVecInit();
// Test BitVecXor function
bool test_bitvec_xor(void) {
WriteFmt("Testing BitVecXor\n");
BitVec bv1 = BitVecInit();
// Test BitVecNot function
bool test_bitvec_not(void) {
WriteFmt("Testing BitVecNot\n");
BitVec bv = BitVecInit();
// Test BitVecShiftLeft function - CORRECTED EXPECTATIONS
bool test_bitvec_shift_left(void) {
WriteFmt("Testing BitVecShiftLeft\n");
BitVec bv = BitVecInit();
// Test BitVecShiftRight function - CORRECTED EXPECTATIONS
bool test_bitvec_shift_right(void) {
WriteFmt("Testing BitVecShiftRight\n");
BitVec bv = BitVecInit();
// Test BitVecRotateLeft function
bool test_bitvec_rotate_left(void) {
WriteFmt("Testing BitVecRotateLeft\n");
BitVec bv = BitVecInit();
// Test BitVecRotateRight function
bool test_bitvec_rotate_right(void) {
WriteFmt("Testing BitVecRotateRight\n");
BitVec bv = BitVecInit();
// Test BitVecReverse function
bool test_bitvec_reverse(void) {
WriteFmt("Testing BitVecReverse\n");
BitVec bv = BitVecInit();
// Edge case tests
bool test_bitvec_shift_edge_cases(void) {
WriteFmt("Testing BitVec shift edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_rotate_edge_cases(void) {
WriteFmt("Testing BitVec rotate edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_bitwise_ops_edge_cases(void) {
WriteFmt("Testing BitVec bitwise operations edge cases\n");
BitVec bv1 = BitVecInit();
bool test_bitvec_reverse_edge_cases(void) {
WriteFmt("Testing BitVecReverse edge cases\n");
BitVec bv = BitVecInit();
// NEW: Comprehensive bitwise operations testing
bool test_bitvec_bitwise_comprehensive(void) {
WriteFmt("Testing BitVec comprehensive bitwise operations\n");
BitVec bv1 = BitVecInit();
// NEW: Comprehensive shift testing
bool test_bitvec_shift_comprehensive(void) {
WriteFmt("Testing BitVec comprehensive shift operations\n");
BitVec bv = BitVecInit();
// NEW: Comprehensive rotate testing
bool test_bitvec_rotate_comprehensive(void) {
WriteFmt("Testing BitVec comprehensive rotate operations\n");
BitVec bv = BitVecInit();
// NEW: Identity operations testing
bool test_bitvec_bitwise_identity_operations(void) {
WriteFmt("Testing BitVec bitwise identity operations\n");
BitVec bv1 = BitVecInit();
// NEW: Commutative properties testing
bool test_bitvec_bitwise_commutative_properties(void) {
WriteFmt("Testing BitVec bitwise commutative properties\n");
BitVec bv1 = BitVecInit();
// NEW: Large pattern testing
bool test_bitvec_bitwise_large_patterns(void) {
WriteFmt("Testing BitVec bitwise operations with large patterns\n");
BitVec bv1 = BitVecInit();
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.BitWise tests\n\n");
// Array of normal test functions
- In
Str.Type.c:22
:
// Test Str type definition
bool test_str_type(void) {
WriteFmt("Testing Str type definition\n");
// Create a Str object
- In
Str.Type.c:42
:
// Test Strs type definition
bool test_strs_type(void) {
WriteFmt("Testing Strs type definition\n");
// Create a Strs object (vector of strings)
- In
Str.Type.c:72
:
// Test ValidateStr macro
bool test_validate_str(void) {
WriteFmt("Testing ValidateStr macro\n");
// Create a valid Str
- In
Str.Type.c:92
:
// Test ValidateStrs macro
bool test_validate_strs(void) {
WriteFmt("Testing ValidateStrs macro\n");
// Create a valid Strs
- In
Str.Type.c:111
:
// Deadend test: Test ValidateStr with invalid string (should crash/abort)
bool test_validate_invalid_str(void) {
WriteFmt("Testing ValidateStr with invalid string (should abort)\n");
// Create an invalid Str by corrupting its fields
- In
Str.Type.c:130
:
// Deadend test: Test ValidateStrs with invalid Strs (should crash/abort)
bool test_validate_invalid_strs(void) {
WriteFmt("Testing ValidateStrs with invalid Strs (should abort)\n");
// Create an invalid Strs by corrupting its fields
- In
Str.Type.c:149
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Str.Type tests\n\n");
// Array of normal test functions
// Test BitVecForeachIdx macro
bool test_bitvec_foreach_idx(void) {
WriteFmt("Testing BitVecForeachIdx macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeach macro
bool test_bitvec_foreach(void) {
WriteFmt("Testing BitVecForeach macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeachReverseIdx macro
bool test_bitvec_foreach_reverse_idx(void) {
WriteFmt("Testing BitVecForeachReverseIdx macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeachReverse macro
bool test_bitvec_foreach_reverse(void) {
WriteFmt("Testing BitVecForeachReverse macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeachInRangeIdx macro
bool test_bitvec_foreach_in_range_idx(void) {
WriteFmt("Testing BitVecForeachInRangeIdx macro\n");
BitVec bv = BitVecInit();
// Test BitVecForeachInRange macro
bool test_bitvec_foreach_in_range(void) {
WriteFmt("Testing BitVecForeachInRange macro\n");
BitVec bv = BitVecInit();
// Edge case tests
bool test_bitvec_foreach_edge_cases(void) {
WriteFmt("Testing BitVec foreach edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_idx_edge_cases(void) {
WriteFmt("Testing BitVec foreach idx edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_reverse_edge_cases(void) {
WriteFmt("Testing BitVec foreach reverse edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_range_edge_cases(void) {
WriteFmt("Testing BitVec foreach range edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_stress_test(void) {
WriteFmt("Testing BitVec foreach stress test\n");
bool result = true;
bool test_bitvec_run_lengths_basic(void) {
WriteFmt("Testing BitVecRunLengths basic functionality\n");
BitVec bv = BitVecInit();
bool test_bitvec_run_lengths_edge_cases(void) {
WriteFmt("Testing BitVecRunLengths edge cases\n");
bool result = true;
bool test_bitvec_run_lengths_boundary_conditions(void) {
WriteFmt("Testing BitVecRunLengths boundary conditions\n");
BitVec bv = BitVecInit();
bool test_bitvec_run_lengths_stress_test(void) {
WriteFmt("Testing BitVecRunLengths stress test\n");
bool result = true;
bool test_bitvec_run_lengths_null_bv(void) {
WriteFmt("Testing BitVecRunLengths with NULL bitvector\n");
u64 runs[5];
bool test_bitvec_run_lengths_null_runs(void) {
WriteFmt("Testing BitVecRunLengths with NULL runs array\n");
BitVec bv = BitVecInit();
bool test_bitvec_run_lengths_null_values(void) {
WriteFmt("Testing BitVecRunLengths with NULL values array\n");
BitVec bv = BitVecInit();
bool test_bitvec_run_lengths_zero_max_runs(void) {
WriteFmt("Testing BitVecRunLengths with zero max_runs\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_invalid_usage(void) {
WriteFmt("Testing BitVec foreach with invalid bitvec\n");
// Test foreach with invalid bitvec (length > 0 but data is NULL)
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Foreach tests\n\n");
// Array of normal test functions
// Deadend tests - testing NULL pointers and invalid conditions that should cause fatal errors
bool test_bitvec_find_deadend_tests(void) {
WriteFmt("Testing BitVecFind deadend scenarios\n");
// This should cause LOG_FATAL and terminate the program
bool test_bitvec_predicate_deadend_tests(void) {
WriteFmt("Testing BitVec predicate deadend scenarios\n");
// This should cause LOG_FATAL and terminate the program
bool test_bitvec_longest_run_deadend_tests(void) {
WriteFmt("Testing BitVecLongestRun deadend scenarios\n");
// This should cause LOG_FATAL and terminate the program
// Deadend tests
bool test_bitvec_access_null_failures(void) {
WriteFmt("Testing BitVec access NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_set_null_failures(void) {
WriteFmt("Testing BitVec set NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_flip_null_failures(void) {
WriteFmt("Testing BitVec flip NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_get_bounds_failures(void) {
WriteFmt("Testing BitVec get bounds checking\n");
BitVec bv = BitVecInit();
bool test_bitvec_set_bounds_failures(void) {
WriteFmt("Testing BitVec set bounds checking\n");
BitVec bv = BitVecInit();
bool test_bitvec_flip_bounds_failures(void) {
WriteFmt("Testing BitVec flip bounds checking\n");
BitVec bv = BitVecInit();
// NEW: More specific bounds checking deadend tests
bool test_bitvec_get_large_index_failures(void) {
WriteFmt("Testing BitVec get with large out-of-bounds index\n");
BitVec bv = BitVecInit();
bool test_bitvec_set_large_index_failures(void) {
WriteFmt("Testing BitVec set with large out-of-bounds index\n");
BitVec bv = BitVecInit();
bool test_bitvec_flip_edge_index_failures(void) {
WriteFmt("Testing BitVec flip with edge case out-of-bounds index\n");
BitVec bv = BitVecInit();
bool test_bitvec_count_null_failures(void) {
WriteFmt("Testing BitVec count operations with NULL pointer\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_get_max_index_failures(void) {
WriteFmt("Testing BitVec get with maximum index value\n");
BitVec bv = BitVecInit();
// Main function that runs all deadend tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Access.Deadend tests\n\n");
// Deadend tests that would cause program termination
- In
Io.Write.c:31
:
// Test basic formatting features
bool test_basic_formatting(void) {
WriteFmt("Testing basic formatting\n");
Str output = StrInit();
- In
Io.Write.c:61
:
// Test string formatting
bool test_string_formatting(void) {
WriteFmt("Testing string formatting\n");
Str output = StrInit();
- In
Io.Write.c:103
:
// Test decimal integer formatting
bool test_integer_decimal_formatting(void) {
WriteFmt("Testing integer decimal formatting\n");
Str output = StrInit();
- In
Io.Write.c:176
:
// Test hexadecimal formatting
bool test_integer_hex_formatting(void) {
WriteFmt("Testing integer hexadecimal formatting\n");
Str output = StrInit();
- In
Io.Write.c:195
:
// Test binary formatting
bool test_integer_binary_formatting(void) {
WriteFmt("Testing integer binary formatting\n");
Str output = StrInit();
- In
Io.Write.c:210
:
// Test octal formatting
bool test_integer_octal_formatting(void) {
WriteFmt("Testing integer octal formatting\n");
Str output = StrInit();
- In
Io.Write.c:225
:
// Test basic floating point formatting
bool test_float_basic_formatting(void) {
WriteFmt("Testing basic floating point formatting\n");
Str output = StrInit();
- In
Io.Write.c:245
:
// Test floating point precision
bool test_float_precision_formatting(void) {
WriteFmt("Testing floating point precision formatting\n");
Str output = StrInit();
- In
Io.Write.c:270
:
// Test special floating point values
bool test_float_special_values(void) {
WriteFmt("Testing special floating point values\n");
Str output = StrInit();
- In
Io.Write.c:297
:
// Test width and alignment formatting
bool test_width_alignment_formatting(void) {
WriteFmt("Testing width and alignment formatting\n");
Str output = StrInit();
- In
Io.Write.c:335
:
// Test multiple arguments
bool test_multiple_arguments(void) {
WriteFmt("Testing multiple arguments\n");
Str output = StrInit();
- In
Io.Write.c:358
:
// Test character formatting specifiers
bool test_char_formatting(void) {
WriteFmt("Testing character formatting specifiers\n");
Str output = StrInit();
- In
Io.Write.c:550
:
// Test BitVec formatting
bool test_bitvec_formatting(void) {
WriteFmt("Testing BitVec formatting\n");
Str output = StrInit();
- In
Io.Write.c:637
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting format writer tests\n\n");
// Array of test functions
// Deadend tests
bool test_bitvec_bitwise_null_failures(void) {
WriteFmt("Testing BitVec bitwise NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_bitwise_ops_null_failures(void) {
WriteFmt("Testing BitVec bitwise operations NULL handling\n");
BitVec bv = BitVecInit();
bool test_bitvec_reverse_null_failures(void) {
WriteFmt("Testing BitVec reverse NULL handling\n");
// Test NULL pointer - should abort
// NEW: Additional deadend tests
bool test_bitvec_shift_ops_null_failures(void) {
WriteFmt("Testing BitVec shift operations NULL handling\n");
// Test NULL pointer for shift right - should abort
bool test_bitvec_rotate_ops_null_failures(void) {
WriteFmt("Testing BitVec rotate operations NULL handling\n");
// Test NULL pointer for rotate - should abort
bool test_bitvec_and_result_null_failures(void) {
WriteFmt("Testing BitVec AND with NULL result handling\n");
BitVec bv1 = BitVecInit();
bool test_bitvec_or_operand_null_failures(void) {
WriteFmt("Testing BitVec OR with NULL operand handling\n");
BitVec result = BitVecInit();
bool test_bitvec_xor_second_operand_null_failures(void) {
WriteFmt("Testing BitVec XOR with NULL second operand handling\n");
BitVec result = BitVecInit();
bool test_bitvec_not_null_failures(void) {
WriteFmt("Testing BitVec NOT with NULL handling\n");
BitVec result = BitVecInit();
// Main function that runs all deadend tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.BitWise.Deadend tests\n\n");
// Array of deadend test functions
- In
Str.Access.c:20
:
// Test StrFirst function
bool test_str_first(void) {
WriteFmt("Testing StrFirst\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Access.c:36
:
// Test StrLast function
bool test_str_last(void) {
WriteFmt("Testing StrLast\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Access.c:52
:
// Test StrBegin function
bool test_str_begin(void) {
WriteFmt("Testing StrBegin\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Access.c:68
:
// Test StrEnd function
bool test_str_end(void) {
WriteFmt("Testing StrEnd\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Access.c:84
:
// Test StrCharAt function
bool test_str_char_at(void) {
WriteFmt("Testing StrCharAt\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Access.c:105
:
// Test StrCharPtrAt function
bool test_str_char_ptr_at(void) {
WriteFmt("Testing StrCharPtrAt\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Access.c:129
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Str.Access tests\n\n");
// Array of test functions
// Test basic pattern matching functions
bool test_bitvec_basic_pattern_functions(void) {
WriteFmt("Testing basic BitVec pattern functions\n");
BitVec source = BitVecInit();
// Test BitVecFindPattern function comprehensively
bool test_bitvec_find_pattern(void) {
WriteFmt("Testing BitVecFindPattern function\n");
BitVec source = BitVecInit();
// Test BitVecFindLastPattern function
bool test_bitvec_find_last_pattern(void) {
WriteFmt("Testing BitVecFindLastPattern function\n");
BitVec source = BitVecInit();
// Test BitVecFindAllPattern function
bool test_bitvec_find_all_pattern(void) {
WriteFmt("Testing BitVecFindAllPattern function\n");
BitVec source = BitVecInit();
// Test edge cases for pattern functions
bool test_bitvec_pattern_edge_cases(void) {
WriteFmt("Testing BitVec pattern edge cases\n");
BitVec source = BitVecInit();
// Stress tests with large data
bool test_bitvec_pattern_stress_tests(void) {
WriteFmt("Testing BitVec pattern stress tests\n");
BitVec source = BitVecInit();
// Deadend test 1: BitVecFindPattern with NULL source
bool test_bitvec_find_pattern_null_source(void) {
WriteFmt("Testing BitVecFindPattern(NULL, pattern) - should fatal\n");
BitVec pattern = BitVecInit();
// Deadend test 2: BitVecFindPattern with NULL pattern
bool test_bitvec_find_pattern_null_pattern(void) {
WriteFmt("Testing BitVecFindPattern(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
// Deadend test 3: BitVecFindLastPattern with NULL source
bool test_bitvec_find_last_pattern_null_source(void) {
WriteFmt("Testing BitVecFindLastPattern(NULL, pattern) - should fatal\n");
BitVec pattern = BitVecInit();
// Deadend test 4: BitVecFindLastPattern with NULL pattern
bool test_bitvec_find_last_pattern_null_pattern(void) {
WriteFmt("Testing BitVecFindLastPattern(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
// Deadend test 5: BitVecFindAllPattern with NULL source
bool test_bitvec_find_all_pattern_null_source(void) {
WriteFmt("Testing BitVecFindAllPattern(NULL, pattern, results, 10) - should fatal\n");
size results[10];
// Deadend test 6: BitVecFindAllPattern with NULL pattern
bool test_bitvec_find_all_pattern_null_pattern(void) {
WriteFmt("Testing BitVecFindAllPattern(source, NULL, results, 10) - should fatal\n");
BitVec source = BitVecInit();
// Deadend test 7: BitVecFindAllPattern with NULL results
bool test_bitvec_find_all_pattern_null_results(void) {
WriteFmt("Testing BitVecFindAllPattern(source, pattern, NULL, 10) - should fatal\n");
BitVec source = BitVecInit();
// Deadend test 8: BitVecFindAllPattern with zero max_results
bool test_bitvec_find_all_pattern_zero_max_results(void) {
WriteFmt("Testing BitVecFindAllPattern(source, pattern, results, 0) - should fatal\n");
BitVec source = BitVecInit();
// BitVecStartsWith tests
bool test_bitvec_starts_with_basic(void) {
WriteFmt("Testing BitVecStartsWith basic functionality\n");
BitVec source = BitVecInit();
bool test_bitvec_starts_with_edge_cases(void) {
WriteFmt("Testing BitVecStartsWith edge cases\n");
BitVec source = BitVecInit();
// BitVecEndsWith tests
bool test_bitvec_ends_with_basic(void) {
WriteFmt("Testing BitVecEndsWith basic functionality\n");
BitVec source = BitVecInit();
bool test_bitvec_ends_with_edge_cases(void) {
WriteFmt("Testing BitVecEndsWith edge cases\n");
BitVec source = BitVecInit();
// BitVecContains tests
bool test_bitvec_contains_basic(void) {
WriteFmt("Testing BitVecContains basic functionality\n");
BitVec source = BitVecInit();
// BitVecContainsAt tests
bool test_bitvec_contains_at_basic(void) {
WriteFmt("Testing BitVecContainsAt basic functionality\n");
BitVec source = BitVecInit();
bool test_bitvec_contains_at_edge_cases(void) {
WriteFmt("Testing BitVecContainsAt edge cases\n");
BitVec source = BitVecInit();
// BitVecCountPattern tests
bool test_bitvec_count_pattern_basic(void) {
WriteFmt("Testing BitVecCountPattern basic functionality\n");
BitVec source = BitVecInit();
// BitVecRFindPattern tests
bool test_bitvec_rfind_pattern_basic(void) {
WriteFmt("Testing BitVecRFindPattern basic functionality\n");
BitVec source = BitVecInit();
// BitVecReplace tests
bool test_bitvec_replace_basic(void) {
WriteFmt("Testing BitVecReplace basic functionality\n");
BitVec source = BitVecInit();
// BitVecReplaceAll tests
bool test_bitvec_replace_all_basic(void) {
WriteFmt("Testing BitVecReplaceAll basic functionality\n");
BitVec source = BitVecInit();
// BitVecMatches tests
bool test_bitvec_matches_basic(void) {
WriteFmt("Testing BitVecMatches basic functionality\n");
BitVec source = BitVecInit();
// BitVecFuzzyMatch tests
bool test_bitvec_fuzzy_match_basic(void) {
WriteFmt("Testing BitVecFuzzyMatch basic functionality\n");
BitVec source = BitVecInit();
// BitVecRegexMatch tests
bool test_bitvec_regex_match_basic(void) {
WriteFmt("Testing BitVecRegexMatch basic functionality\n");
BitVec source = BitVecInit();
// BitVecPrefixMatch tests
bool test_bitvec_prefix_match_basic(void) {
WriteFmt("Testing BitVecPrefixMatch basic functionality\n");
BitVec source = BitVecInit();
// BitVecSuffixMatch tests
bool test_bitvec_suffix_match_basic(void) {
WriteFmt("Testing BitVecSuffixMatch basic functionality\n");
BitVec source = BitVecInit();
bool test_bitvec_starts_with_null_source(void) {
WriteFmt("Testing BitVecStartsWith(NULL, prefix) - should fatal\n");
BitVec prefix = BitVecInit();
BitVecPush(&prefix, true);
bool test_bitvec_starts_with_null_prefix(void) {
WriteFmt("Testing BitVecStartsWith(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_ends_with_null_source(void) {
WriteFmt("Testing BitVecEndsWith(NULL, suffix) - should fatal\n");
BitVec suffix = BitVecInit();
BitVecPush(&suffix, true);
bool test_bitvec_ends_with_null_suffix(void) {
WriteFmt("Testing BitVecEndsWith(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_contains_at_null_source(void) {
WriteFmt("Testing BitVecContainsAt(NULL, pattern, 0) - should fatal\n");
BitVec pattern = BitVecInit();
BitVecPush(&pattern, true);
bool test_bitvec_contains_at_null_pattern(void) {
WriteFmt("Testing BitVecContainsAt(source, NULL, 0) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_replace_null_source(void) {
WriteFmt("Testing BitVecReplace(NULL, old, new) - should fatal\n");
// Don't create BitVecs since we're testing NULL source validation
bool test_bitvec_matches_null_source(void) {
WriteFmt("Testing BitVecMatches(NULL, pattern, wildcard) - should fatal\n");
BitVec pattern = BitVecInit();
BitVec wildcard = BitVecInit();
bool test_bitvec_regex_match_null_source(void) {
WriteFmt("Testing BitVecRegexMatch(NULL, pattern) - should fatal\n");
BitVecRegexMatch(NULL, "101");
return true;
bool test_bitvec_regex_match_null_pattern(void) {
WriteFmt("Testing BitVecRegexMatch(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_prefix_match_null_source(void) {
WriteFmt("Testing BitVecPrefixMatch(NULL, patterns, 1) - should fatal\n");
BitVec patterns[1] = {BitVecInit()};
BitVecPush(&patterns[0], true);
bool test_bitvec_prefix_match_null_patterns(void) {
WriteFmt("Testing BitVecPrefixMatch(source, NULL, 1) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_suffix_match_null_source(void) {
WriteFmt("Testing BitVecSuffixMatch(NULL, patterns, 1) - should fatal\n");
BitVec patterns[1] = {BitVecInit()};
BitVecPush(&patterns[0], true);
bool test_bitvec_suffix_match_null_patterns(void) {
WriteFmt("Testing BitVecSuffixMatch(source, NULL, 1) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Pattern tests\n\n");
// Array of test functions
- In
BitVec.Math.c:53
:
// Test BitVecHammingDistance basic functionality
bool test_bitvec_hamming_distance_basic(void) {
WriteFmt("Testing BitVecHammingDistance basic functionality\n");
BitVec bv1 = BitVecInit();
- In
BitVec.Math.c:95
:
// Test BitVecHammingDistance edge cases
bool test_bitvec_hamming_distance_edge_cases(void) {
WriteFmt("Testing BitVecHammingDistance edge cases\n");
BitVec bv1 = BitVecInit();
// Test BitVecJaccardSimilarity basic functionality
bool test_bitvec_jaccard_similarity_basic(void) {
WriteFmt("Testing BitVecJaccardSimilarity basic functionality\n");
BitVec bv1 = BitVecInit();
// Test BitVecJaccardSimilarity edge cases
bool test_bitvec_jaccard_similarity_edge_cases(void) {
WriteFmt("Testing BitVecJaccardSimilarity edge cases\n");
BitVec bv1 = BitVecInit();
// Test BitVecCosineSimilarity basic functionality
bool test_bitvec_cosine_similarity_basic(void) {
WriteFmt("Testing BitVecCosineSimilarity basic functionality\n");
BitVec bv1 = BitVecInit();
// Test BitVecCosineSimilarity edge cases
bool test_bitvec_cosine_similarity_edge_cases(void) {
WriteFmt("Testing BitVecCosineSimilarity edge cases\n");
BitVec bv1 = BitVecInit();
// Test BitVecDotProduct basic functionality
bool test_bitvec_dot_product_basic(void) {
WriteFmt("Testing BitVecDotProduct basic functionality\n");
BitVec bv1 = BitVecInit();
// Test BitVecDotProduct edge cases
bool test_bitvec_dot_product_edge_cases(void) {
WriteFmt("Testing BitVecDotProduct edge cases\n");
BitVec bv1 = BitVecInit();
// Test BitVecEditDistance basic functionality
bool test_bitvec_edit_distance_basic(void) {
WriteFmt("Testing BitVecEditDistance basic functionality\n");
BitVec bv1 = BitVecInit();
// Test BitVecEditDistance edge cases
bool test_bitvec_edit_distance_edge_cases(void) {
WriteFmt("Testing BitVecEditDistance edge cases\n");
BitVec bv1 = BitVecInit();
// Test BitVecCorrelation basic functionality
bool test_bitvec_correlation_basic(void) {
WriteFmt("Testing BitVecCorrelation basic functionality\n");
BitVec bv1 = BitVecInit();
// Test BitVecCorrelation edge cases
bool test_bitvec_correlation_edge_cases(void) {
WriteFmt("Testing BitVecCorrelation edge cases\n");
BitVec bv1 = BitVecInit();
// Test BitVecEntropy basic functionality
bool test_bitvec_entropy_basic(void) {
WriteFmt("Testing BitVecEntropy basic functionality\n");
BitVec bv = BitVecInit();
// Test BitVecEntropy edge cases
bool test_bitvec_entropy_edge_cases(void) {
WriteFmt("Testing BitVecEntropy edge cases\n");
BitVec bv = BitVecInit();
// Test BitVecAlignmentScore basic functionality
bool test_bitvec_alignment_score_basic(void) {
WriteFmt("Testing BitVecAlignmentScore basic functionality\n");
BitVec bv1 = BitVecInit();
// Test BitVecAlignmentScore edge cases
bool test_bitvec_alignment_score_edge_cases(void) {
WriteFmt("Testing BitVecAlignmentScore edge cases\n");
BitVec bv1 = BitVecInit();
// Test BitVecBestAlignment basic functionality
bool test_bitvec_best_alignment_basic(void) {
WriteFmt("Testing BitVecBestAlignment basic functionality\n");
BitVec bv1 = BitVecInit();
// Test BitVecBestAlignment edge cases
bool test_bitvec_best_alignment_edge_cases(void) {
WriteFmt("Testing BitVecBestAlignment edge cases\n");
BitVec bv1 = BitVecInit();
// Stress test for Math functions
bool test_bitvec_math_stress_tests(void) {
WriteFmt("Testing BitVec Math stress tests\n");
BitVec bv1 = BitVecInit();
bool test_bitvec_hamming_distance_null_bv1(void) {
WriteFmt("Testing BitVecHammingDistance(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit();
BitVecPush(&bv2, true);
bool test_bitvec_hamming_distance_null_bv2(void) {
WriteFmt("Testing BitVecHammingDistance(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit();
BitVecPush(&bv1, true);
bool test_bitvec_jaccard_similarity_null_bv1(void) {
WriteFmt("Testing BitVecJaccardSimilarity(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit();
BitVecPush(&bv2, true);
bool test_bitvec_jaccard_similarity_null_bv2(void) {
WriteFmt("Testing BitVecJaccardSimilarity(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit();
BitVecPush(&bv1, true);
bool test_bitvec_cosine_similarity_null_bv1(void) {
WriteFmt("Testing BitVecCosineSimilarity(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit();
BitVecPush(&bv2, true);
bool test_bitvec_cosine_similarity_null_bv2(void) {
WriteFmt("Testing BitVecCosineSimilarity(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit();
BitVecPush(&bv1, true);
bool test_bitvec_dot_product_null_bv1(void) {
WriteFmt("Testing BitVecDotProduct(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit();
BitVecPush(&bv2, true);
bool test_bitvec_dot_product_null_bv2(void) {
WriteFmt("Testing BitVecDotProduct(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit();
BitVecPush(&bv1, true);
bool test_bitvec_edit_distance_null_bv1(void) {
WriteFmt("Testing BitVecEditDistance(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit();
BitVecPush(&bv2, true);
bool test_bitvec_edit_distance_null_bv2(void) {
WriteFmt("Testing BitVecEditDistance(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit();
BitVecPush(&bv1, true);
bool test_bitvec_correlation_null_bv1(void) {
WriteFmt("Testing BitVecCorrelation(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit();
BitVecPush(&bv2, true);
bool test_bitvec_correlation_null_bv2(void) {
WriteFmt("Testing BitVecCorrelation(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit();
BitVecPush(&bv1, true);
bool test_bitvec_entropy_null(void) {
WriteFmt("Testing BitVecEntropy(NULL) - should fatal\n");
BitVecEntropy(NULL);
return true;
bool test_bitvec_alignment_score_null_bv1(void) {
WriteFmt("Testing BitVecAlignmentScore(NULL, bv2, 1, -1) - should fatal\n");
BitVec bv2 = BitVecInit();
BitVecPush(&bv2, true);
bool test_bitvec_alignment_score_null_bv2(void) {
WriteFmt("Testing BitVecAlignmentScore(bv1, NULL, 1, -1) - should fatal\n");
BitVec bv1 = BitVecInit();
BitVecPush(&bv1, true);
bool test_bitvec_best_alignment_null_bv1(void) {
WriteFmt("Testing BitVecBestAlignment(NULL, bv2) - should fatal\n");
BitVec bv2 = BitVecInit();
BitVecPush(&bv2, true);
bool test_bitvec_best_alignment_null_bv2(void) {
WriteFmt("Testing BitVecBestAlignment(bv1, NULL) - should fatal\n");
BitVec bv1 = BitVecInit();
BitVecPush(&bv1, true);
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Math tests\n\n");
// Array of normal test functions
// Test BitVecPush function
bool test_bitvec_push(void) {
WriteFmt("Testing BitVecPush\n");
BitVec bv = BitVecInit();
// Test BitVecInsert single bit function
bool test_bitvec_insert_single(void) {
WriteFmt("Testing BitVecInsert (single bit)\n");
BitVec bv = BitVecInit();
// Test BitVecInsertRange function
bool test_bitvec_insert_range(void) {
WriteFmt("Testing BitVecInsertRange\n");
BitVec bv = BitVecInit();
// Test BitVecInsertMultiple function
bool test_bitvec_insert_multiple(void) {
WriteFmt("Testing BitVecInsertMultiple\n");
BitVec bv = BitVecInit();
// Test BitVecInsertPattern function
bool test_bitvec_insert_pattern(void) {
WriteFmt("Testing BitVecInsertPattern\n");
BitVec bv = BitVecInit();
// Edge case tests
bool test_bitvec_insert_range_edge_cases(void) {
WriteFmt("Testing BitVecInsertRange edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_insert_multiple_edge_cases(void) {
WriteFmt("Testing BitVecInsertMultiple edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_insert_pattern_edge_cases(void) {
WriteFmt("Testing BitVecInsertPattern edge cases\n");
BitVec bv = BitVecInit();
// Deadend tests
bool test_bitvec_insert_null_failures(void) {
WriteFmt("Testing BitVec insert NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_insert_invalid_range_failures(void) {
WriteFmt("Testing BitVec insert invalid range handling\n");
BitVec bv = BitVecInit();
bool test_bitvec_insert_pattern_null_failures(void) {
WriteFmt("Testing BitVec insert pattern NULL handling\n");
// Test NULL bitvec - should abort
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Insert tests\n\n");
// Array of normal test functions
// Test initialization with complex structure
bool test_complex_vec_init(void) {
WriteFmt("Testing vector initialization with complex structure\n");
// Create a vector of ComplexItem with deep copy functions
// Test push operations with complex structure
bool test_complex_vec_push(void) {
WriteFmt("Testing push operations with complex structure\n");
// Create a vector of ComplexItem with deep copy functions
// Test insert operations with complex structure
bool test_complex_vec_insert(void) {
WriteFmt("Testing insert operations with complex structure\n");
// Create a vector of ComplexItem with deep copy functions
// Test merge operations with complex structure
bool test_complex_vec_merge(void) {
WriteFmt("Testing merge operations with complex structure\n");
// Create two vectors of ComplexItem with deep copy functions
// Test L-value operations
bool test_lvalue_operations(void) {
WriteFmt("Testing L-value operations\n");
// Create a vector of integers
// Test fast operations
bool test_fast_operations(void) {
WriteFmt("Testing fast operations\n");
// Create a vector of integers
// Test delete operations
bool test_delete_operations(void) {
WriteFmt("Testing delete operations\n");
// Create a vector of integers
// Test edge cases
bool test_edge_cases(void) {
WriteFmt("Testing edge cases\n");
// Create a vector of integers
// Test VecPushBackL memset behavior with complex structures
bool test_lvalue_memset_pushback(void) {
WriteFmt("Testing VecPushBackL memset with complex structures\n");
// Create a test item
// Test VecInsertL memset behavior with complex structures
bool test_lvalue_memset_insert(void) {
WriteFmt("Testing VecInsertL memset with complex structures\n");
// Create a test item
// Test VecInsertFastL memset behavior with complex structures
bool test_lvalue_memset_fast_insert(void) {
WriteFmt("Testing VecInsertFastL memset with complex structures\n");
bool result = true;
// Test VecPushFrontL memset behavior with complex structures
bool test_lvalue_memset_pushfront(void) {
WriteFmt("Testing VecPushFrontL memset with complex structures\n");
// Create a test item
// Test VecMergeL memset behavior with complex structures
bool test_lvalue_memset_merge(void) {
WriteFmt("Testing VecMergeL memset with complex structures\n");
// Create a vector with no copy_init but with copy_deinit for proper cleanup
// Test array operations with L-value semantics
bool test_lvalue_memset_array_ops(void) {
WriteFmt("Testing array operations with L-value semantics\n");
// Create a vector with no copy_init but with copy_deinit for proper cleanup
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Complex tests\n\n");
// Array of test functions
- In
Str.Remove.c:21
:
// Test StrPopBack function
bool test_str_pop_back(void) {
WriteFmt("Testing StrPopBack\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Remove.c:45
:
// Test StrPopFront function
bool test_str_pop_front(void) {
WriteFmt("Testing StrPopFront\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Remove.c:69
:
// Test StrRemove function
bool test_str_remove(void) {
WriteFmt("Testing StrRemove\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Remove.c:93
:
// Test StrRemoveRange function
bool test_str_remove_range(void) {
WriteFmt("Testing StrRemoveRange\n");
Str s = StrInitFromZstr("Hello World");
- In
Str.Remove.c:120
:
// Test StrDeleteLastChar function
bool test_str_delete_last_char(void) {
WriteFmt("Testing StrDeleteLastChar\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Remove.c:142
:
// Test StrDelete function
bool test_str_delete(void) {
WriteFmt("Testing StrDelete\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Remove.c:164
:
// Test StrDeleteRange function
bool test_str_delete_range(void) {
WriteFmt("Testing StrDeleteRange\n");
Str s = StrInitFromZstr("Hello World");
- In
Str.Remove.c:186
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Str.Remove tests\n\n");
// Array of test functions
- In
Str.Foreach.c:34
:
// Test StrForeachIdx macro
bool test_str_foreach_idx(void) {
WriteFmt("Testing StrForeachIdx\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Foreach.c:54
:
// Test StrForeachReverseIdx macro
bool test_str_foreach_reverse_idx(void) {
WriteFmt("Testing StrForeachReverseIdx\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Foreach.c:67
:
bool success = (ZstrCompare(result.data, "o4l3l2e1H0") == 0);
WriteFmt(" (Index 0 was processed)\n");
StrDeinit(&s);
- In
Str.Foreach.c:76
:
// Test StrForeachPtrIdx macro
bool test_str_foreach_ptr_idx(void) {
WriteFmt("Testing StrForeachPtrIdx\n");
Str s = StrInitFromZstr("Hello");
// Test StrForeachReversePtrIdx macro
bool test_str_foreach_reverse_ptr_idx(void) {
WriteFmt("Testing StrForeachReversePtrIdx\n");
Str s = StrInitFromZstr("Hello");
success = (ZstrCompare(result.data, "o4l3l2e1H0") == 0);
success = success && (ZstrCompare(s.data, "HELLO") == 0); // All uppercase
WriteFmt(" (Index 0 was processed)\n");
StrDeinit(&s);
// Test StrForeach macro
bool test_str_foreach(void) {
WriteFmt("Testing StrForeach\n");
Str s = StrInitFromZstr("Hello");
// Test StrForeachReverse macro
bool test_str_foreach_reverse(void) {
WriteFmt("Testing StrForeachReverse\n");
Str s = StrInitFromZstr("Hello");
if (char_count == s.length) {
success = (ZstrCompare(result.data, "olleH") == 0);
WriteFmt(" (All characters were processed)\n");
} else {
success = (ZstrCompare(result.data, "olle") == 0);
} else {
success = (ZstrCompare(result.data, "olle") == 0);
WriteFmt(" (First character was NOT processed - bug in macro)\n");
}
// Test StrForeachPtr macro
bool test_str_foreach_ptr(void) {
WriteFmt("Testing StrForeachPtr\n");
Str s = StrInitFromZstr("Hello");
// Test StrForeachPtrReverse macro
bool test_str_foreach_ptr_reverse(void) {
WriteFmt("Testing StrForeachPtrReverse\n");
Str s = StrInitFromZstr("Hello");
success = (ZstrCompare(result.data, "olleH") == 0);
success = success && (ZstrCompare(s.data, "HELLO") == 0); // All uppercase
WriteFmt(" (All characters were processed)\n");
} else {
success = (ZstrCompare(result.data, "olle") == 0);
success = (ZstrCompare(result.data, "olle") == 0);
success = success && (ZstrCompare(s.data, "HELLo") == 0); // All uppercase except first char
WriteFmt(" (First character was NOT processed - bug in macro)\n");
}
// Test StrForeachInRangeIdx macro
bool test_str_foreach_in_range_idx(void) {
WriteFmt("Testing StrForeachInRangeIdx\n");
Str s = StrInitFromZstr("Hello World");
// Test StrForeachInRange macro
bool test_str_foreach_in_range(void) {
WriteFmt("Testing StrForeachInRange\n");
Str s = StrInitFromZstr("Hello World");
// Test StrForeachPtrInRangeIdx macro
bool test_str_foreach_ptr_in_range_idx(void) {
WriteFmt("Testing StrForeachPtrInRangeIdx\n");
Str s = StrInitFromZstr("Hello World");
// Test StrForeachPtrInRange macro
bool test_str_foreach_ptr_in_range(void) {
WriteFmt("Testing StrForeachPtrInRange\n");
Str s = StrInitFromZstr("Hello World");
// Make idx go out of bounds in StrForeachInRangeIdx by shrinking string during iteration
bool test_str_foreach_out_of_bounds_access(void) {
WriteFmt("Testing StrForeachInRangeIdx where idx goes out of bounds\n");
Str s = StrInitFromZstr("Hello World!"); // 12 characters
size original_length = s.length; // Capture this as 12
StrForeachInRangeIdx(&s, chr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, s.length, chr);
// When we reach idx=4, drastically shrink the string to length 3
if (idx == 4) {
StrResize(&s, 3); // Shrink to only 3 characters
WriteFmt("String resized to length {}, idx={}...\n", s.length, idx);
}
// Make idx go out of bounds in StrForeachInRangeIdx by deleting characters
bool test_str_foreach_idx_out_of_bounds_access(void) {
WriteFmt("Testing StrForeachInRangeIdx with character deletion where idx goes out of bounds\n");
Str s = StrInitFromZstr("Programming"); // 11 characters
size original_length = s.length; // Capture this as 11
StrForeachInRangeIdx(&s, chr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, s.length, chr);
// When we reach idx=3, delete several characters from the beginning
if (idx == 3) {
StrDeleteRange(&s, 0, 6); // Remove first 6 characters
WriteFmt("Deleted first 6 characters, new length={}, idx={}...\n", s.length, idx);
}
// Make idx go out of bounds in StrForeachReverseIdx by modifying string during iteration
bool test_str_foreach_reverse_idx_out_of_bounds_access(void) {
WriteFmt("Testing StrForeachReverseIdx where idx goes out of bounds\n");
Str s = StrInitFromZstr("Beautiful Weather"); // 17 characters
// StrForeachReverseIdx (VecForeachReverseIdx) has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
StrForeachReverseIdx(&s, chr, idx) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, s.length, chr);
// When we reach idx=10, drastically shrink the string
if (idx == 10) {
StrResize(&s, 4); // Shrink to only 4 characters
WriteFmt("String resized to length {} during reverse iteration... idx = {}\n", s.length, idx);
}
// Make idx go out of bounds in StrForeachPtrIdx by modifying string during iteration
bool test_str_foreach_ptr_idx_out_of_bounds_access(void) {
WriteFmt("Testing StrForeachPtrIdx where idx goes out of bounds\n");
Str s = StrInitFromZstr("Programming Test"); // 16 characters
// StrForeachPtrIdx (VecForeachPtrIdx) has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
StrForeachPtrIdx(&s, chr_ptr, idx) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, s.length, *chr_ptr);
// When we reach idx=4, delete most characters from the string
if (idx == 4) {
StrResize(&s, 4); // Shrink to only 4 characters (valid indices: 0,1,2,3)
WriteFmt("String resized to length {}, current idx={} is now out of bounds...\n", s.length, idx);
}
// Make idx go out of bounds in StrForeachReversePtrIdx by modifying string during iteration
bool test_str_foreach_reverse_ptr_idx_out_of_bounds_access(void) {
WriteFmt("Testing StrForeachReversePtrIdx where idx goes out of bounds\n");
Str s = StrInitFromZstr("Excellent Example"); // 17 characters
// StrForeachReversePtrIdx (VecForeachPtrReverseIdx) has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
StrForeachReversePtrIdx(&s, chr_ptr, idx) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, s.length, *chr_ptr);
// When we reach idx=12, shrink the string significantly
if (idx == 12) {
StrResize(&s, 5); // Shrink to only 5 characters
WriteFmt("String resized to length {} during reverse ptr iteration... idx = {}\n", s.length, idx);
}
// Make idx go out of bounds in StrForeachPtrInRangeIdx by modifying string during iteration
bool test_str_foreach_ptr_in_range_idx_out_of_bounds_access(void) {
WriteFmt("Testing StrForeachPtrInRangeIdx where idx goes out of bounds\n");
Str s = StrInitFromZstr("Comprehensive Testing Framework"); // 31 characters
size original_length = s.length; // Capture this as 32
StrForeachPtrInRangeIdx(&s, chr_ptr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, s.length, *chr_ptr);
// When we reach idx=8, delete several characters
if (idx == 8) {
StrDeleteRange(&s, 0, 20); // Remove first 20 characters
WriteFmt("Deleted first 20 characters, new length={}, idx = {}...\n", s.length, idx);
}
// Make idx go out of bounds in basic StrForeachIdx by modifying string during iteration
bool test_str_foreach_idx_basic_out_of_bounds_access(void) {
WriteFmt("Testing basic StrForeachIdx where idx goes out of bounds\n");
Str s = StrInitFromZstr("Testing Basic"); // 13 characters
// Basic StrForeachIdx (VecForeachIdx) now has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
StrForeachIdx(&s, chr, idx) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, s.length, chr);
// When we reach idx=3, drastically shrink the string
if (idx == 3) {
StrResize(&s, 2); // Shrink to only 2 characters
WriteFmt("String resized to length {}, but basic foreach iteration continues... idx = {}\n", s.length, idx);
}
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Str.Foreach.Simple tests\n\n");
// Array of normal test functions
- In
Vec.Access.c:19
:
// Test VecAt function
bool test_vec_at(void) {
WriteFmt("Testing VecAt\n");
// Create a vector of integers
- In
Vec.Access.c:51
:
// Test VecPtrAt function
bool test_vec_ptr_at(void) {
WriteFmt("Testing VecPtrAt\n");
// Create a vector of integers
- In
Vec.Access.c:88
:
// Test VecFirst and VecLast functions
bool test_vec_first_last(void) {
WriteFmt("Testing VecFirst and VecLast\n");
// Create a vector of integers
- In
Vec.Access.c:119
:
// Test VecBegin and VecEnd functions
bool test_vec_begin_end(void) {
WriteFmt("Testing VecBegin and VecEnd\n");
// Create a vector of integers
- In
Vec.Access.c:149
:
// Test VecSize and VecLen functions
bool test_vec_size_len(void) {
WriteFmt("Testing VecSize and VecLen\n");
// Create a vector of integers
- In
Vec.Access.c:199
:
// Test VecAlignedOffsetAt function
bool test_vec_aligned_offset_at(void) {
WriteFmt("Testing VecAlignedOffsetAt\n");
// Create a vector of integers with default alignment (1)
- In
Vec.Access.c:233
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Access tests\n\n");
// Array of test functions
- In
Vec.Remove.c:262
:
// Print before state
WriteFmt("Before fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:264
:
WriteFmt("Before fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:266
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Test VecDeleteRangeFast - delete 3 elements starting at index 2
- In
Vec.Remove.c:281
:
// Print after state
WriteFmt("After fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:283
:
WriteFmt("After fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:285
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Check length after deletion
- In
Vec.Remove.c:455
:
// Print before state
WriteFmt("Before L-value fast delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:457
:
WriteFmt("Before L-value fast delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:459
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Test L-value fast delete operation
- In
Vec.Remove.c:468
:
// Print after state
WriteFmt("After L-value fast delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:470
:
WriteFmt("After L-value fast delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:472
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Check vector after L-value fast deletion
- In
Vec.Remove.c:536
:
// Print before state
WriteFmt("Before R-value fast delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:538
:
WriteFmt("Before R-value fast delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:540
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Remember the value to be deleted and the last value
- In
Vec.Remove.c:550
:
// Print after state
WriteFmt("After R-value fast delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:552
:
WriteFmt("After R-value fast delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:554
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Check length
- In
Vec.Remove.c:685
:
// Print before state
WriteFmt("Before L-value fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:687
:
WriteFmt("Before L-value fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:689
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Values that should be deleted (30, 40, 50)
- In
Vec.Remove.c:700
:
// Print after state
WriteFmt("After L-value fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:702
:
WriteFmt("After L-value fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:704
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Check vector after L-value fast range deletion
- In
Vec.Remove.c:764
:
// Print before state
WriteFmt("Before R-value fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:766
:
WriteFmt("Before R-value fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:768
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Values that should be deleted (30, 40, 50)
- In
Vec.Remove.c:777
:
// Print after state
WriteFmt("After R-value fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
- In
Vec.Remove.c:779
:
WriteFmt("After R-value fast range delete: ");
for (u64 i = 0; i < vec.length; i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
- In
Vec.Remove.c:781
:
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");
// Check vector after R-value fast range deletion
bool test_bitvec_run_lengths_null_bv(void) {
WriteFmt("Testing BitVecRunLengths with NULL bitvector\n");
u64 runs[5];
bool test_bitvec_run_lengths_null_runs(void) {
WriteFmt("Testing BitVecRunLengths with NULL runs array\n");
BitVec bv = BitVecInit();
bool test_bitvec_run_lengths_null_values(void) {
WriteFmt("Testing BitVecRunLengths with NULL values array\n");
BitVec bv = BitVecInit();
bool test_bitvec_run_lengths_zero_max_runs(void) {
WriteFmt("Testing BitVecRunLengths with zero max_runs\n");
BitVec bv = BitVecInit();
bool test_bitvec_foreach_invalid_usage(void) {
WriteFmt("Testing BitVec foreach with invalid bitvec\n");
// Test foreach with invalid bitvec (length > 0 but data is NULL)
// Main function that runs all deadend tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Foreach.Deadend tests\n\n");
// Array of deadend test functions
- In
BitVec.Type.c:16
:
// Test basic BitVec type functionality
bool test_bitvec_type_basic(void) {
WriteFmt("Testing basic BitVec type functionality\n");
// Create a bitvector
- In
BitVec.Type.c:32
:
// Test ValidateBitVec macro
bool test_bitvec_validate(void) {
WriteFmt("Testing ValidateBitVec macro\n");
// Create a valid bitvector
- In
BitVec.Type.c:51
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Type tests\n\n");
// Array of test functions
// Deadend test 1: BitVecFindPattern with NULL source
bool test_bitvec_find_pattern_null_source(void) {
WriteFmt("Testing BitVecFindPattern(NULL, pattern) - should fatal\n");
BitVec pattern = BitVecInit();
// Deadend test 2: BitVecFindPattern with NULL pattern
bool test_bitvec_find_pattern_null_pattern(void) {
WriteFmt("Testing BitVecFindPattern(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
// Deadend test 3: BitVecFindLastPattern with NULL source
bool test_bitvec_find_last_pattern_null_source(void) {
WriteFmt("Testing BitVecFindLastPattern(NULL, pattern) - should fatal\n");
BitVec pattern = BitVecInit();
// Deadend test 4: BitVecFindLastPattern with NULL pattern
bool test_bitvec_find_last_pattern_null_pattern(void) {
WriteFmt("Testing BitVecFindLastPattern(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
// Deadend test 5: BitVecFindAllPattern with NULL source
bool test_bitvec_find_all_pattern_null_source(void) {
WriteFmt("Testing BitVecFindAllPattern(NULL, pattern, results, 10) - should fatal\n");
size results[10];
// Deadend test 6: BitVecFindAllPattern with NULL pattern
bool test_bitvec_find_all_pattern_null_pattern(void) {
WriteFmt("Testing BitVecFindAllPattern(source, NULL, results, 10) - should fatal\n");
BitVec source = BitVecInit();
// Deadend test 7: BitVecFindAllPattern with NULL results
bool test_bitvec_find_all_pattern_null_results(void) {
WriteFmt("Testing BitVecFindAllPattern(source, pattern, NULL, 10) - should fatal\n");
BitVec source = BitVecInit();
// Deadend test 8: BitVecFindAllPattern with zero max_results
bool test_bitvec_find_all_pattern_zero_max_results(void) {
WriteFmt("Testing BitVecFindAllPattern(source, pattern, results, 0) - should fatal\n");
BitVec source = BitVecInit();
bool test_bitvec_starts_with_null_source(void) {
WriteFmt("Testing BitVecStartsWith(NULL, prefix) - should fatal\n");
BitVec prefix = BitVecInit();
BitVecPush(&prefix, true);
bool test_bitvec_starts_with_null_prefix(void) {
WriteFmt("Testing BitVecStartsWith(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_ends_with_null_source(void) {
WriteFmt("Testing BitVecEndsWith(NULL, suffix) - should fatal\n");
BitVec suffix = BitVecInit();
BitVecPush(&suffix, true);
bool test_bitvec_ends_with_null_suffix(void) {
WriteFmt("Testing BitVecEndsWith(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_contains_at_null_source(void) {
WriteFmt("Testing BitVecContainsAt(NULL, pattern, 0) - should fatal\n");
BitVec pattern = BitVecInit();
BitVecPush(&pattern, true);
bool test_bitvec_contains_at_null_pattern(void) {
WriteFmt("Testing BitVecContainsAt(source, NULL, 0) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_replace_null_source(void) {
WriteFmt("Testing BitVecReplace(NULL, old, new) - should fatal\n");
// Don't create BitVecs since we're testing NULL source validation
bool test_bitvec_matches_null_source(void) {
WriteFmt("Testing BitVecMatches(NULL, pattern, wildcard) - should fatal\n");
BitVec pattern = BitVecInit();
BitVec wildcard = BitVecInit();
bool test_bitvec_regex_match_null_source(void) {
WriteFmt("Testing BitVecRegexMatch(NULL, pattern) - should fatal\n");
BitVecRegexMatch(NULL, "101");
return true;
bool test_bitvec_regex_match_null_pattern(void) {
WriteFmt("Testing BitVecRegexMatch(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_prefix_match_null_source(void) {
WriteFmt("Testing BitVecPrefixMatch(NULL, patterns, 1) - should fatal\n");
BitVecs vp = VecInitWithDeepCopy(NULL, BitVecDeinit);
BitVecPush(VecPtrAt(&vp, 0), true);
bool test_bitvec_prefix_match_null_patterns(void) {
WriteFmt("Testing BitVecPrefixMatch(source, NULL, 1) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
bool test_bitvec_suffix_match_null_source(void) {
WriteFmt("Testing BitVecSuffixMatch(NULL, patterns, 1) - should fatal\n");
BitVecs vp = VecInitWithDeepCopy(NULL, BitVecDeinit);
BitVecPush(VecPtrAt(&vp, 0), true);
bool test_bitvec_suffix_match_null_patterns(void) {
WriteFmt("Testing BitVecSuffixMatch(source, NULL, 1) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
// Main function that runs all deadend tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Pattern.Deadend tests\n\n");
// Deadend tests that would cause program termination
- In
Str.Init.c:23
:
// Test StrInit function
bool test_str_init(void) {
WriteFmt("Testing StrInit\n");
Str s = StrInit();
- In
Str.Init.c:40
:
// Test StrInitFromCstr function
bool test_str_init_from_cstr(void) {
WriteFmt("Testing StrInitFromCstr\n");
const char *test_str = "Hello, World!";
- In
Str.Init.c:58
:
// Test StrInitFromZstr function
bool test_str_init_from_zstr(void) {
WriteFmt("Testing StrInitFromZstr\n");
const char *test_str = "Hello, World!";
- In
Str.Init.c:75
:
// Test StrInitFromStr function
bool test_str_init_from_str(void) {
WriteFmt("Testing StrInitFromStr\n");
Str src = StrInitFromZstr("Hello, World!");
- In
Str.Init.c:94
:
// Test StrDup function (alias for StrInitFromStr)
bool test_str_dup(void) {
WriteFmt("Testing StrDup\n");
Str src = StrInitFromZstr("Hello, World!");
- In
Str.Init.c:113
:
// Test StrWriteFmt function
bool test_str_WriteFmt(void) {
WriteFmt("Testing StrWriteFmt\n");
Str s = StrInit();
- In
Str.Init.c:130
:
// Test StrInitStack macro
bool test_str_init_stack(void) {
WriteFmt("Testing StrInitStack\n");
bool result = true;
- In
Str.Init.c:164
:
// Test StrInitCopy function
bool test_str_init_copy(void) {
WriteFmt("Testing StrInitCopy\n");
Str src = StrInitFromZstr("Hello, World!");
- In
Str.Init.c:186
:
// Test StrDeinit function
bool test_str_deinit(void) {
WriteFmt("Testing StrDeinit\n");
Str s = StrInitFromZstr("Hello, World!");
- In
Str.Init.c:205
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Str.Init tests\n\n");
// Array of test functions
- In
Str.Ops.c:21
:
// Test string comparison functions
bool test_str_cmp(void) {
WriteFmt("Testing StrCmp and StrCmpCstr\n");
Str s1 = StrInitFromZstr("Hello");
- In
Str.Ops.c:56
:
// Test string find functions
bool test_str_find(void) {
WriteFmt("Testing StrFindStr, StrFindZstr, and StrFindCstr\n");
Str haystack = StrInitFromZstr("Hello World");
- In
Str.Ops.c:92
:
// Test string starts/ends with functions
bool test_str_starts_ends_with(void) {
WriteFmt("Testing StrStartsWith and StrEndsWith variants\n");
Str s = StrInitFromZstr("Hello World");
- In
Str.Ops.c:128
:
// Test string replace functions
bool test_str_replace(void) {
WriteFmt("Testing StrReplace variants\n");
// Test StrReplaceZstr
- In
Str.Ops.c:163
:
// Test string split functions
bool test_str_split(void) {
WriteFmt("Testing StrSplit and StrSplitToIters\n");
// Test StrSplit
- In
Str.Ops.c:209
:
// Test string strip functions
bool test_str_strip(void) {
WriteFmt("Testing StrStrip variants\n");
// Test StrLStrip
- In
Str.Ops.c:249
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Str.Ops tests\n\n");
// Array of test functions
// Test basic pattern matching functions
bool test_bitvec_basic_pattern_functions(void) {
WriteFmt("Testing basic BitVec pattern functions\n");
BitVec source = BitVecInit();
// Test BitVecFindPattern function comprehensively
bool test_bitvec_find_pattern(void) {
WriteFmt("Testing BitVecFindPattern function\n");
BitVec source = BitVecInit();
// Test BitVecFindLastPattern function
bool test_bitvec_find_last_pattern(void) {
WriteFmt("Testing BitVecFindLastPattern function\n");
BitVec source = BitVecInit();
// Test BitVecFindAllPattern function
bool test_bitvec_find_all_pattern(void) {
WriteFmt("Testing BitVecFindAllPattern function\n");
BitVec source = BitVecInit();
// Test edge cases for pattern functions
bool test_bitvec_pattern_edge_cases(void) {
WriteFmt("Testing BitVec pattern edge cases\n");
BitVec source = BitVecInit();
// Stress tests with large data
bool test_bitvec_pattern_stress_tests(void) {
WriteFmt("Testing BitVec pattern stress tests\n");
BitVec source = BitVecInit();
// BitVecStartsWith tests
bool test_bitvec_starts_with_basic(void) {
WriteFmt("Testing BitVecStartsWith basic functionality\n");
BitVec source = BitVecInit();
bool test_bitvec_starts_with_edge_cases(void) {
WriteFmt("Testing BitVecStartsWith edge cases\n");
BitVec source = BitVecInit();
// BitVecEndsWith tests
bool test_bitvec_ends_with_basic(void) {
WriteFmt("Testing BitVecEndsWith basic functionality\n");
BitVec source = BitVecInit();
bool test_bitvec_ends_with_edge_cases(void) {
WriteFmt("Testing BitVecEndsWith edge cases\n");
BitVec source = BitVecInit();
// BitVecFindPattern tests (replacing BitVecContains)
bool test_bitvec_contains_basic(void) {
WriteFmt("Testing BitVecFindPattern basic functionality\n");
BitVec source = BitVecInit();
// BitVecContainsAt tests
bool test_bitvec_contains_at_basic(void) {
WriteFmt("Testing BitVecContainsAt basic functionality\n");
BitVec source = BitVecInit();
bool test_bitvec_contains_at_edge_cases(void) {
WriteFmt("Testing BitVecContainsAt edge cases\n");
BitVec source = BitVecInit();
// BitVecCountPattern tests
bool test_bitvec_count_pattern_basic(void) {
WriteFmt("Testing BitVecCountPattern basic functionality\n");
BitVec source = BitVecInit();
// BitVecRFindPattern tests
bool test_bitvec_rfind_pattern_basic(void) {
WriteFmt("Testing BitVecRFindPattern basic functionality\n");
BitVec source = BitVecInit();
// BitVecReplace tests
bool test_bitvec_replace_basic(void) {
WriteFmt("Testing BitVecReplace basic functionality\n");
BitVec source = BitVecInit();
// BitVecReplaceAll tests
bool test_bitvec_replace_all_basic(void) {
WriteFmt("Testing BitVecReplaceAll basic functionality\n");
BitVec source = BitVecInit();
// BitVecMatches tests
bool test_bitvec_matches_basic(void) {
WriteFmt("Testing BitVecMatches basic functionality\n");
BitVec source = BitVecInit();
// BitVecFuzzyMatch tests
bool test_bitvec_fuzzy_match_basic(void) {
WriteFmt("Testing BitVecFuzzyMatch basic functionality\n");
BitVec source = BitVecInit();
// BitVecRegexMatch tests
bool test_bitvec_regex_match_basic(void) {
WriteFmt("Testing BitVecRegexMatch basic functionality\n");
BitVec source = BitVecInit();
// BitVecPrefixMatch tests
bool test_bitvec_prefix_match_basic(void) {
WriteFmt("Testing BitVecPrefixMatch basic functionality\n");
BitVec source = BitVecInit();
// BitVecSuffixMatch tests
bool test_bitvec_suffix_match_basic(void) {
WriteFmt("Testing BitVecSuffixMatch basic functionality\n");
BitVec source = BitVecInit();
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Pattern.Simple tests\n\n");
// Array of test functions
// Test BitVecGet function
bool test_bitvec_get(void) {
WriteFmt("Testing BitVecGet\n");
BitVec bv = BitVecInit();
// Test BitVecSet function
bool test_bitvec_set(void) {
WriteFmt("Testing BitVecSet\n");
BitVec bv = BitVecInit();
// Test BitVecFlip function
bool test_bitvec_flip(void) {
WriteFmt("Testing BitVecFlip\n");
BitVec bv = BitVecInit();
// Test BitVecLength and BitVecCapacity functions
bool test_bitvec_length_capacity(void) {
WriteFmt("Testing BitVecLength and BitVecCapacity\n");
BitVec bv = BitVecInit();
// Test BitVecCount functions
bool test_bitvec_count_operations(void) {
WriteFmt("Testing BitVecCount operations\n");
BitVec bv = BitVecInit();
// Edge case tests for BitVecGet
bool test_bitvec_get_edge_cases(void) {
WriteFmt("Testing BitVecGet edge cases\n");
BitVec bv = BitVecInit();
// Edge case tests for BitVecSet
bool test_bitvec_set_edge_cases(void) {
WriteFmt("Testing BitVecSet edge cases\n");
BitVec bv = BitVecInit();
// Edge case tests for BitVecFlip
bool test_bitvec_flip_edge_cases(void) {
WriteFmt("Testing BitVecFlip edge cases\n");
BitVec bv = BitVecInit();
// Edge case tests for BitVecCount
bool test_bitvec_count_edge_cases(void) {
WriteFmt("Testing BitVecCount edge cases\n");
BitVec bv = BitVecInit();
// Test multiple operations together
bool test_bitvec_access_multiple_operations(void) {
WriteFmt("Testing BitVec multiple access operations\n");
BitVec bv = BitVecInit();
// Test with large patterns
bool test_bitvec_access_large_patterns(void) {
WriteFmt("Testing BitVec access with large patterns\n");
BitVec bv = BitVecInit();
// Test macro functions
bool test_bitvec_macro_functions(void) {
WriteFmt("Testing BitVec macro functions\n");
BitVec bv = BitVecInit();
// Stress test for access operations
bool test_bitvec_access_stress_test(void) {
WriteFmt("Testing BitVec access stress test\n");
BitVec bv = BitVecInit();
// Comprehensive bit pattern testing
bool test_bitvec_bit_patterns_comprehensive(void) {
WriteFmt("Testing BitVec comprehensive bit patterns\n");
BitVec bv = BitVecInit();
// Test BitVecFind functions (Find, FindLast)
bool test_bitvec_find_functions(void) {
WriteFmt("Testing BitVecFind functions\n");
BitVec bv = BitVecInit();
// Test BitVec predicate functions (All, Any, None)
bool test_bitvec_predicate_functions(void) {
WriteFmt("Testing BitVec predicate functions\n");
BitVec bv = BitVecInit();
// Test BitVecLongestRun function
bool test_bitvec_longest_run(void) {
WriteFmt("Testing BitVecLongestRun\n");
BitVec bv = BitVecInit();
// Edge case tests for Find functions
bool test_bitvec_find_edge_cases(void) {
WriteFmt("Testing BitVecFind edge cases\n");
BitVec bv = BitVecInit();
// Edge case tests for predicate functions
bool test_bitvec_predicate_edge_cases(void) {
WriteFmt("Testing BitVec predicate edge cases\n");
BitVec bv = BitVecInit();
// Edge case tests for LongestRun function
bool test_bitvec_longest_run_edge_cases(void) {
WriteFmt("Testing BitVecLongestRun edge cases\n");
BitVec bv = BitVecInit();
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Access.Simple tests\n\n");
// Array of test functions
- In
Str.Insert.c:30
:
// Test StrInsertCharAt function
bool test_str_insert_char_at(void) {
WriteFmt("Testing StrInsertCharAt\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Insert.c:58
:
// Test StrInsertCstr function
bool test_str_insert_cstr(void) {
WriteFmt("Testing StrInsertCstr\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Insert.c:74
:
// Test StrInsertZstr function
bool test_str_insert_zstr(void) {
WriteFmt("Testing StrInsertZstr\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Insert.c:90
:
// Test StrInsert function
bool test_str_insert(void) {
WriteFmt("Testing StrInsert\n");
Str s1 = StrInitFromZstr("Hello");
- In
Str.Insert.c:108
:
// Test StrPushCstr function
bool test_str_push_cstr(void) {
WriteFmt("Testing StrPushCstr\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Insert.c:124
:
// Test StrPushZstr function
bool test_str_push_zstr(void) {
WriteFmt("Testing StrPushZstr\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Insert.c:140
:
// Test StrPushBackCstr function
bool test_str_push_back_cstr(void) {
WriteFmt("Testing StrPushBackCstr\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Insert.c:156
:
// Test StrPushBackZstr function
bool test_str_push_back_zstr(void) {
WriteFmt("Testing StrPushBackZstr\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Insert.c:172
:
// Test StrPushFrontCstr function
bool test_str_push_front_cstr(void) {
WriteFmt("Testing StrPushFrontCstr\n");
Str s = StrInitFromZstr("World");
- In
Str.Insert.c:188
:
// Test StrPushFrontZstr function
bool test_str_push_front_zstr(void) {
WriteFmt("Testing StrPushFrontZstr\n");
Str s = StrInitFromZstr("World");
- In
Str.Insert.c:204
:
// Test StrPushBack function
bool test_str_push_back(void) {
WriteFmt("Testing StrPushBack\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Insert.c:225
:
// Test StrPushFront function
bool test_str_push_front(void) {
WriteFmt("Testing StrPushFront\n");
Str s = StrInitFromZstr("World");
- In
Str.Insert.c:246
:
// Test StrMergeL function
bool test_str_merge_l(void) {
WriteFmt("Testing StrMergeL\n");
Str s1 = StrInitFromZstr("Hello");
- In
Str.Insert.c:271
:
// Test StrMergeR function
bool test_str_merge_r(void) {
WriteFmt("Testing StrMergeR\n");
Str s1 = StrInitFromZstr("Hello");
- In
Str.Insert.c:292
:
// Test StrMerge function (alias for StrMergeR)
bool test_str_merge(void) {
WriteFmt("Testing StrMerge\n");
Str s1 = StrInitFromZstr("Hello");
- In
Str.Insert.c:313
:
// Test StrAppendf function
bool test_str_appendf(void) {
WriteFmt("Testing StrAppendf\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Insert.c:329
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Str.Insert tests\n\n");
// Array of test functions
- In
Str.Memory.c:19
:
// Test StrTryReduceSpace function
bool test_str_try_reduce_space(void) {
WriteFmt("Testing StrTryReduceSpace\n");
Str s = StrInit();
- In
Str.Memory.c:44
:
// Test StrSwapCharAt function
bool test_str_swap_char_at(void) {
WriteFmt("Testing StrSwapCharAt\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Memory.c:66
:
// Test StrResize function
bool test_str_resize(void) {
WriteFmt("Testing StrResize\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Memory.c:92
:
// Test StrReserve function
bool test_str_reserve(void) {
WriteFmt("Testing StrReserve\n");
Str s = StrInit();
- In
Str.Memory.c:117
:
// Test StrClear function
bool test_str_clear(void) {
WriteFmt("Testing StrClear\n");
Str s = StrInitFromZstr("Hello, World!");
- In
Str.Memory.c:139
:
// Test StrReverse function
bool test_str_reverse(void) {
WriteFmt("Testing StrReverse\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Memory.c:185
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Str.Memory tests\n\n");
// Array of test functions
- In
BitVec.Init.c:24
:
// Test BitVecInit function
bool test_bitvec_init(void) {
WriteFmt("Testing BitVecInit\n");
// Test basic initialization
- In
BitVec.Init.c:43
:
// Test BitVecDeinit function
bool test_bitvec_deinit(void) {
WriteFmt("Testing BitVecDeinit\n");
BitVec bv = BitVecInit();
- In
BitVec.Init.c:71
:
// Test BitVecReserve function
bool test_bitvec_reserve(void) {
WriteFmt("Testing BitVecReserve\n");
BitVec bv = BitVecInit();
// Test BitVecClear function
bool test_bitvec_clear(void) {
WriteFmt("Testing BitVecClear\n");
BitVec bv = BitVecInit();
// Test BitVecReu64 function
bool test_bitvec_resize(void) {
WriteFmt("Testing BitVecResize\n");
BitVec bv = BitVecInit();
// Edge case tests - boundary conditions and unusual but valid inputs
bool test_bitvec_init_edge_cases(void) {
WriteFmt("Testing BitVecInit edge cases\n");
// Test multiple initializations
bool test_bitvec_reserve_edge_cases(void) {
WriteFmt("Testing BitVecReserve edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_resize_edge_cases(void) {
WriteFmt("Testing BitVecReu64 edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_clear_edge_cases(void) {
WriteFmt("Testing BitVecClear edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_multiple_cycles(void) {
WriteFmt("Testing BitVec multiple init/deinit cycles\n");
bool result = true;
// Deadend tests - verify expected failures occur gracefully
bool test_bitvec_null_pointer_failures(void) {
WriteFmt("Testing BitVec NULL pointer handling\n");
// Test NULL pointer passed to functions that should validate
bool test_bitvec_invalid_operations(void) {
WriteFmt("Testing BitVec invalid operations\n");
// Test operation that should trigger validation failure
bool test_bitvec_set_operations_failures(void) {
WriteFmt("Testing BitVec set operations on invalid indices\n");
// Test operation that should trigger validation failure
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Init tests\n\n");
// Array of normal test functions
// Test BitVecShrinkToFit function
bool test_bitvec_shrink_to_fit(void) {
WriteFmt("Testing BitVecShrinkToFit\n");
BitVec bv = BitVecInit();
// Test BitVecReserve function (replacing BitVecSetCapacity)
bool test_bitvec_set_capacity(void) {
WriteFmt("Testing BitVecReserve\n");
BitVec bv = BitVecInit();
// Test BitVecSwap function
bool test_bitvec_swap(void) {
WriteFmt("Testing BitVecSwap\n");
BitVec bv1 = BitVecInit();
// Test BitVecClone function
bool test_bitvec_clone(void) {
WriteFmt("Testing BitVecClone\n");
BitVec original = BitVecInit();
// Edge case tests
bool test_bitvec_shrink_to_fit_edge_cases(void) {
WriteFmt("Testing BitVecShrinkToFit edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_set_capacity_edge_cases(void) {
WriteFmt("Testing BitVecReserve edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_swap_edge_cases(void) {
WriteFmt("Testing BitVecSwap edge cases\n");
BitVec bv1 = BitVecInit();
bool test_bitvec_clone_edge_cases(void) {
WriteFmt("Testing BitVecClone edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_memory_stress_test(void) {
WriteFmt("Testing BitVec memory stress test\n");
bool result = true;
// Deadend tests
bool test_bitvec_memory_null_failures(void) {
WriteFmt("Testing BitVec memory NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_swap_null_failures(void) {
WriteFmt("Testing BitVec swap NULL handling\n");
BitVec bv = BitVecInit();
bool test_bitvec_clone_null_failures(void) {
WriteFmt("Testing BitVec clone NULL handling\n");
// Test NULL pointer - should abort
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Memory tests\n\n");
// Array of normal test functions
- In
Vec.Init.c:43
:
// Test basic vector initialization
bool test_vec_init_basic(void) {
WriteFmt("Testing VecInit\n");
// Test with int type
- In
Vec.Init.c:73
:
// Test aligned vector initialization
bool test_vec_init_aligned(void) {
WriteFmt("Testing VecInitAligned\n");
// Test with int type and 4-byte alignment
- In
Vec.Init.c:103
:
// Test vector initialization with deep copy functions
bool test_vec_init_with_deep_copy(void) {
WriteFmt("Testing VecInitWithDeepCopy\n");
// Test with struct type and custom copy/deinit functions
- In
Vec.Init.c:122
:
// Test vector initialization with alignment and deep copy functions
bool test_vec_init_aligned_with_deep_copy(void) {
WriteFmt("Testing VecInitAlignedWithDeepCopy\n");
// Test with struct type, custom copy/deinit functions, and 8-byte alignment
- In
Vec.Init.c:141
:
// Test vector stack initialization
bool test_vec_init_stack(void) {
WriteFmt("Testing VecInitStack\n");
bool result = true;
- In
Vec.Init.c:213
:
// Test vector clone initialization
bool test_vec_init_clone(void) {
WriteFmt("Testing vector cloning\n");
// Create a source vector
- In
Vec.Init.c:254
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Init tests\n\n");
// Array of test functions
- In
Vec.Ops.c:30
:
// Test VecSwapItems function
bool test_vec_swap_items(void) {
WriteFmt("Testing VecSwapItems\n");
// Create a vector of integers
- In
Vec.Ops.c:65
:
// Test VecReverse function
bool test_vec_reverse(void) {
WriteFmt("Testing VecReverse\n");
// Create a vector of integers
- In
Vec.Ops.c:117
:
// Test VecSort function
bool test_vec_sort(void) {
WriteFmt("Testing VecSort\n");
// Create a vector of integers
- In
Vec.Ops.c:156
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Ops tests\n\n");
// Array of test functions
- In
Vec.Insert.c:24
:
// Test VecPushBack function
bool test_vec_push_back(void) {
WriteFmt("Testing VecPushBack\n");
// Create a vector of integers
- In
Vec.Insert.c:52
:
// Test VecPushFront function
bool test_vec_push_front(void) {
WriteFmt("Testing VecPushFront\n");
// Create a vector of integers
- In
Vec.Insert.c:80
:
// Test VecInsert function
bool test_vec_insert(void) {
WriteFmt("Testing VecInsert\n");
// Create a vector of integers
- In
Vec.Insert.c:115
:
// Test VecPushBackArr function
bool test_vec_push_back_arr(void) {
WriteFmt("Testing VecPushBackArr\n");
// Create a vector of integers
- In
Vec.Insert.c:156
:
// Test VecPushFrontArr function
bool test_vec_push_front_arr(void) {
WriteFmt("Testing VecPushFrontArr\n");
// Create a vector of integers
- In
Vec.Insert.c:197
:
// Test VecInsertRange function for inserting at a specific index
bool test_vec_push_arr(void) {
WriteFmt("Testing VecInsertRange at specific index\n");
// Create a vector of integers
- In
Vec.Insert.c:230
:
// Test VecInsertRange function for inserting from another vector
bool test_vec_insert_range(void) {
WriteFmt("Testing VecInsertRange from another vector\n");
// Create a vector of integers
- In
Vec.Insert.c:268
:
// Test VecMerge function
bool test_vec_merge(void) {
WriteFmt("Testing VecMerge\n");
// Create a vector of integers
- In
Vec.Insert.c:309
:
// Test L-value and R-value operations
bool test_lvalue_rvalue_operations(void) {
WriteFmt("Testing L-value and R-value operations\n");
// Create a vector of integers
- In
Vec.Insert.c:392
:
// Test that L-value insertions properly memset values to 0 after insertion
bool test_lvalue_memset_after_insertion(void) {
WriteFmt("Testing L-value memset after insertion\n");
// Create a vector of integers without copy_init
- In
Vec.Insert.c:468
:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Insert tests\n\n");
// Array of test functions
// Test BitVecGet function
bool test_bitvec_get(void) {
WriteFmt("Testing BitVecGet\n");
BitVec bv = BitVecInit();
// Test BitVecSet function
bool test_bitvec_set(void) {
WriteFmt("Testing BitVecSet\n");
BitVec bv = BitVecInit();
// Test BitVecFlip function
bool test_bitvec_flip(void) {
WriteFmt("Testing BitVecFlip\n");
BitVec bv = BitVecInit();
// Test length and capacity operations
bool test_bitvec_length_capacity(void) {
WriteFmt("Testing BitVec length and capacity operations\n");
BitVec bv = BitVecInit();
// Test count operations
bool test_bitvec_count_operations(void) {
WriteFmt("Testing BitVec count operations\n");
BitVec bv = BitVecInit();
// Edge case tests
bool test_bitvec_get_edge_cases(void) {
WriteFmt("Testing BitVecGet edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_set_edge_cases(void) {
WriteFmt("Testing BitVecSet edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_flip_edge_cases(void) {
WriteFmt("Testing BitVecFlip edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_count_edge_cases(void) {
WriteFmt("Testing BitVec count edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_access_multiple_operations(void) {
WriteFmt("Testing BitVec multiple access operations\n");
BitVec bv = BitVecInit();
// NEW: Test large bit patterns and complex access patterns
bool test_bitvec_access_large_patterns(void) {
WriteFmt("Testing BitVec large pattern access\n");
BitVec bv = BitVecInit();
// NEW: Test macro functions comprehensively
bool test_bitvec_macro_functions(void) {
WriteFmt("Testing BitVec macro functions\n");
BitVec bv = BitVecInit();
// NEW: Stress test for access operations
bool test_bitvec_access_stress_test(void) {
WriteFmt("Testing BitVec access stress test\n");
BitVec bv = BitVecInit();
// NEW: Comprehensive bit pattern testing
bool test_bitvec_bit_patterns_comprehensive(void) {
WriteFmt("Testing BitVec comprehensive bit patterns\n");
BitVec bv = BitVecInit();
// Deadend tests
bool test_bitvec_access_null_failures(void) {
WriteFmt("Testing BitVec access NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_set_null_failures(void) {
WriteFmt("Testing BitVec set NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_flip_null_failures(void) {
WriteFmt("Testing BitVec flip NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_get_bounds_failures(void) {
WriteFmt("Testing BitVec get bounds checking\n");
BitVec bv = BitVecInit();
bool test_bitvec_set_bounds_failures(void) {
WriteFmt("Testing BitVec set bounds checking\n");
BitVec bv = BitVecInit();
bool test_bitvec_flip_bounds_failures(void) {
WriteFmt("Testing BitVec flip bounds checking\n");
BitVec bv = BitVecInit();
// NEW: More specific bounds checking deadend tests
bool test_bitvec_get_large_index_failures(void) {
WriteFmt("Testing BitVec get with large out-of-bounds index\n");
BitVec bv = BitVecInit();
bool test_bitvec_set_large_index_failures(void) {
WriteFmt("Testing BitVec set with large out-of-bounds index\n");
BitVec bv = BitVecInit();
bool test_bitvec_flip_edge_index_failures(void) {
WriteFmt("Testing BitVec flip with edge case out-of-bounds index\n");
BitVec bv = BitVecInit();
bool test_bitvec_count_null_failures(void) {
WriteFmt("Testing BitVec count operations with NULL pointer\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_get_max_index_failures(void) {
WriteFmt("Testing BitVec get with maximum index value\n");
BitVec bv = BitVecInit();
// Test BitVecFind and BitVecFindLast functions
bool test_bitvec_find_functions(void) {
WriteFmt("Testing BitVecFind and BitVecFindLast functions\n");
BitVec bv = BitVecInit();
// Test BitVecAll, BitVecAny, BitVecNone functions
bool test_bitvec_predicate_functions(void) {
WriteFmt("Testing BitVecAll, BitVecAny, BitVecNone functions\n");
BitVec bv = BitVecInit();
// Test BitVecLongestRun function
bool test_bitvec_longest_run(void) {
WriteFmt("Testing BitVecLongestRun function\n");
BitVec bv = BitVecInit();
// Edge case tests for Find functions
bool test_bitvec_find_edge_cases(void) {
WriteFmt("Testing BitVecFind edge cases\n");
BitVec bv = BitVecInit();
// Edge case tests for predicate functions
bool test_bitvec_predicate_edge_cases(void) {
WriteFmt("Testing BitVec predicate edge cases\n");
BitVec bv = BitVecInit();
// Edge case tests for LongestRun function
bool test_bitvec_longest_run_edge_cases(void) {
WriteFmt("Testing BitVecLongestRun edge cases\n");
BitVec bv = BitVecInit();
// Deadend tests - testing NULL pointers and invalid conditions that should cause fatal errors
bool test_bitvec_find_deadend_tests(void) {
WriteFmt("Testing BitVecFind deadend scenarios\n");
// This should cause LOG_FATAL and terminate the program
bool test_bitvec_predicate_deadend_tests(void) {
WriteFmt("Testing BitVec predicate deadend scenarios\n");
// This should cause LOG_FATAL and terminate the program
bool test_bitvec_longest_run_deadend_tests(void) {
WriteFmt("Testing BitVecLongestRun deadend scenarios\n");
// This should cause LOG_FATAL and terminate the program
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Access tests\n\n");
// Array of test functions (adding new tests to existing ones)
// Test BitVecToStr function
bool test_bitvec_to_string(void) {
WriteFmt("Testing BitVecToStr\n");
BitVec bv = BitVecInit();
// Test BitVecFromStr function
bool test_bitvec_from_string(void) {
WriteFmt("Testing BitVecFromStr\n");
// Convert from string
// Test BitVecToBytes function
bool test_bitvec_to_bytes(void) {
WriteFmt("Testing BitVecToBytes\n");
BitVec bv = BitVecInit();
// Test BitVecFromBytes function
bool test_bitvec_from_bytes(void) {
WriteFmt("Testing BitVecFromBytes\n");
// Create byte array
// Test BitVecToInteger function
bool test_bitvec_to_integer(void) {
WriteFmt("Testing BitVecToInteger\n");
BitVec bv = BitVecInit();
// Test BitVecFromInteger function
bool test_bitvec_from_integer(void) {
WriteFmt("Testing BitVecFromInteger\n");
// Convert from integer
// Edge case tests
bool test_bitvec_convert_edge_cases(void) {
WriteFmt("Testing BitVec convert edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_from_string_edge_cases(void) {
WriteFmt("Testing BitVecFromStr edge cases\n");
bool result = true;
bool test_bitvec_bytes_conversion_edge_cases(void) {
WriteFmt("Testing BitVec bytes conversion edge cases\n");
BitVec bv = BitVecInit();
bool test_bitvec_integer_conversion_edge_cases(void) {
WriteFmt("Testing BitVec integer conversion edge cases\n");
BitVec bv = BitVecInit();
// Round-trip conversion tests
bool test_bitvec_round_trip_conversions(void) {
WriteFmt("Testing BitVec round-trip conversions\n");
bool result = true;
// Bounds checking tests
bool test_bitvec_conversion_bounds_checking(void) {
WriteFmt("Testing BitVec conversion bounds checking\n");
bool result = true;
// Comprehensive conversion validation
bool test_bitvec_conversion_comprehensive(void) {
WriteFmt("Testing BitVec comprehensive conversion validation\n");
bool result = true;
// Large-scale conversion tests
bool test_bitvec_large_scale_conversions(void) {
WriteFmt("Testing BitVec large-scale conversions\n");
bool result = true;
// Enhanced deadend tests
bool test_bitvec_bytes_bounds_failures(void) {
WriteFmt("Testing BitVec bytes bounds failures\n");
BitVec bv = BitVecInit();
bool test_bitvec_integer_bounds_failures(void) {
WriteFmt("Testing BitVec integer bounds failures\n");
// Test BitVecToInteger with NULL pointer - should abort
// Deadend tests
bool test_bitvec_convert_null_failures(void) {
WriteFmt("Testing BitVec convert NULL pointer handling\n");
// Test NULL bitvec pointer - should abort
bool test_bitvec_from_string_null_failures(void) {
WriteFmt("Testing BitVec from string NULL handling\n");
// Test NULL string - should abort
bool test_bitvec_bytes_null_failures(void) {
WriteFmt("Testing BitVec bytes NULL handling\n");
// Test NULL bytes - should abort
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting BitVec.Convert tests\n\n");
// Array of normal test functions
- In
Read.Simple.c:59
:
// Test 1: Simple string parsing
bool test_simple_string_parsing(void) {
WriteFmt("Testing simple string parsing\n");
bool success = true;
- In
Read.Simple.c:74
:
if (StrCmpCstr(&name, "Alice", 5) != 0) {
WriteFmt("[DEBUG] Name check failed: expected 'Alice', got '");
for (size i = 0; i < name.length; i++) {
WriteFmt("{c}", name.data[i]);
- In
Read.Simple.c:76
:
WriteFmt("[DEBUG] Name check failed: expected 'Alice', got '");
for (size i = 0; i < name.length; i++) {
WriteFmt("{c}", name.data[i]);
}
WriteFmt("'\n");
- In
Read.Simple.c:78
:
WriteFmt("{c}", name.data[i]);
}
WriteFmt("'\n");
success = false;
}
- In
Read.Simple.c:83
:
if (StrCmpCstr(&city, "New York", 8) != 0) {
WriteFmt("[DEBUG] City check failed: expected 'New York', got '");
for (size i = 0; i < city.length; i++) {
WriteFmt("{c}", city.data[i]);
- In
Read.Simple.c:85
:
WriteFmt("[DEBUG] City check failed: expected 'New York', got '");
for (size i = 0; i < city.length; i++) {
WriteFmt("{c}", city.data[i]);
}
WriteFmt("'\n");
- In
Read.Simple.c:87
:
WriteFmt("{c}", city.data[i]);
}
WriteFmt("'\n");
success = false;
}
- In
Read.Simple.c:99
:
// Test 2: Simple number parsing
bool test_simple_numbers(void) {
WriteFmt("Testing simple number parsing\n");
bool success = true;
if (count != 42) {
WriteFmt("[DEBUG] Count check failed: expected 42, got {}\n", count);
success = false;
}
if (!(score > 95.4 && score < 95.6)) {
WriteFmt("[DEBUG] Score check failed: expected ~95.5, got {}\n", score);
success = false;
}
if (year != 2024) {
WriteFmt("[DEBUG] Year check failed: expected 2024, got {}\n", year);
success = false;
}
// Test 3: Simple boolean parsing
bool test_simple_boolean(void) {
WriteFmt("Testing simple boolean parsing\n");
bool success = true;
if (enabled != true) {
WriteFmt("[DEBUG] Enabled check failed: expected true, got {}\n", enabled ? "true" : "false");
success = false;
}
if (visible != false) {
WriteFmt("[DEBUG] Visible check failed: expected false, got {}\n", visible ? "true" : "false");
success = false;
}
// Test 4: Simple person object
bool test_simple_person_object(void) {
WriteFmt("Testing simple person object\n");
bool success = true;
if (person.id != 1001) {
WriteFmt("[DEBUG] Person ID check failed: expected 1001, got {}\n", person.id);
success = false;
}
if (StrCmpCstr(&person.name, "Bob", 3) != 0) {
WriteFmt("[DEBUG] Person name check failed: expected 'Bob', got '");
for (size i = 0; i < person.name.length; i++) {
WriteFmt("{c}", person.name.data[i]);
WriteFmt("[DEBUG] Person name check failed: expected 'Bob', got '");
for (size i = 0; i < person.name.length; i++) {
WriteFmt("{c}", person.name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", person.name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (person.age != 25) {
WriteFmt("[DEBUG] Person age check failed: expected 25, got {}\n", person.age);
success = false;
}
if (person.is_active != true) {
WriteFmt("[DEBUG] Person is_active check failed: expected true, got {}\n", person.is_active ? "true" : "false");
success = false;
}
if (!(person.salary > 49999.0 && person.salary < 50001.0)) {
WriteFmt("[DEBUG] Person salary check failed: expected ~50000.0, got {}\n", person.salary);
success = false;
}
// Test 5: Simple config object
bool test_simple_config_object(void) {
WriteFmt("Testing simple config object\n");
bool success = true;
if (config.debug_mode != false) {
WriteFmt("[DEBUG] Debug mode check failed: expected false, got {}\n", config.debug_mode ? "true" : "false");
success = false;
}
if (config.timeout != 30) {
WriteFmt("[DEBUG] Timeout check failed: expected 30, got {}\n", config.timeout);
success = false;
}
if (StrCmpCstr(&config.log_level, "INFO", 4) != 0) {
WriteFmt("[DEBUG] Log level check failed: expected 'INFO', got '");
for (size i = 0; i < config.log_level.length; i++) {
WriteFmt("{c}", config.log_level.data[i]);
WriteFmt("[DEBUG] Log level check failed: expected 'INFO', got '");
for (size i = 0; i < config.log_level.length; i++) {
WriteFmt("{c}", config.log_level.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", config.log_level.data[i]);
}
WriteFmt("'\n");
success = false;
}
// Test 6: Simple array of strings
bool test_simple_array_of_strings(void) {
WriteFmt("Testing simple array of strings\n");
bool success = true;
if (languages.length != 3) {
WriteFmt("[DEBUG] Languages length check failed: expected 3, got {}\n", languages.length);
success = false;
}
if (StrCmpCstr(lang1, "C", 1) != 0) {
WriteFmt("[DEBUG] Language 1 check failed: expected 'C', got '");
for (size i = 0; i < lang1->length; i++) {
WriteFmt("{c}", lang1->data[i]);
WriteFmt("[DEBUG] Language 1 check failed: expected 'C', got '");
for (size i = 0; i < lang1->length; i++) {
WriteFmt("{c}", lang1->data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", lang1->data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(lang2, "Python", 6) != 0) {
WriteFmt("[DEBUG] Language 2 check failed: expected 'Python', got '");
for (size i = 0; i < lang2->length; i++) {
WriteFmt("{c}", lang2->data[i]);
WriteFmt("[DEBUG] Language 2 check failed: expected 'Python', got '");
for (size i = 0; i < lang2->length; i++) {
WriteFmt("{c}", lang2->data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", lang2->data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(lang3, "Rust", 4) != 0) {
WriteFmt("[DEBUG] Language 3 check failed: expected 'Rust', got '");
for (size i = 0; i < lang3->length; i++) {
WriteFmt("{c}", lang3->data[i]);
WriteFmt("[DEBUG] Language 3 check failed: expected 'Rust', got '");
for (size i = 0; i < lang3->length; i++) {
WriteFmt("{c}", lang3->data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", lang3->data[i]);
}
WriteFmt("'\n");
success = false;
}
// Test 7: Simple nested object (1 level)
bool test_simple_nested_object(void) {
WriteFmt("Testing simple nested object\n");
bool success = true;
if (StrCmpCstr(&data.user.name, "Charlie", 7) != 0) {
WriteFmt("[DEBUG] User name check failed: expected 'Charlie', got '");
for (size i = 0; i < data.user.name.length; i++) {
WriteFmt("{c}", data.user.name.data[i]);
WriteFmt("[DEBUG] User name check failed: expected 'Charlie', got '");
for (size i = 0; i < data.user.name.length; i++) {
WriteFmt("{c}", data.user.name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", data.user.name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(&data.user.email, "charlie@example.com", 19) != 0) {
WriteFmt("[DEBUG] User email check failed: expected 'charlie@example.com', got '");
for (size i = 0; i < data.user.email.length; i++) {
WriteFmt("{c}", data.user.email.data[i]);
WriteFmt("[DEBUG] User email check failed: expected 'charlie@example.com', got '");
for (size i = 0; i < data.user.email.length; i++) {
WriteFmt("{c}", data.user.email.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", data.user.email.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (data.active != true) {
WriteFmt("[DEBUG] Active check failed: expected true, got {}\n", data.active ? "true" : "false");
success = false;
}
// Test 8: Simple product with tags array
bool test_simple_product_with_tags(void) {
WriteFmt("Testing simple product with tags array\n");
bool success = true;
if (product.id != 12345) {
WriteFmt("[DEBUG] Product ID check failed: expected 12345, got {}\n", product.id);
success = false;
}
if (StrCmpCstr(&product.name, "Laptop", 6) != 0) {
WriteFmt("[DEBUG] Product name check failed: expected 'Laptop', got '");
for (size i = 0; i < product.name.length; i++) {
WriteFmt("{c}", product.name.data[i]);
WriteFmt("[DEBUG] Product name check failed: expected 'Laptop', got '");
for (size i = 0; i < product.name.length; i++) {
WriteFmt("{c}", product.name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", product.name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (!(product.price > 999.98 && product.price < 1000.0)) {
WriteFmt("[DEBUG] Product price check failed: expected ~999.99, got {}\n", product.price);
success = false;
}
if (product.tags.length != 3) {
WriteFmt("[DEBUG] Product tags length check failed: expected 3, got {}\n", product.tags.length);
success = false;
}
if (StrCmpCstr(tag1, "electronics", 11) != 0) {
WriteFmt("[DEBUG] Tag 1 check failed: expected 'electronics', got '");
for (size i = 0; i < tag1->length; i++) {
WriteFmt("{c}", tag1->data[i]);
WriteFmt("[DEBUG] Tag 1 check failed: expected 'electronics', got '");
for (size i = 0; i < tag1->length; i++) {
WriteFmt("{c}", tag1->data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", tag1->data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(tag2, "computers", 9) != 0) {
WriteFmt("[DEBUG] Tag 2 check failed: expected 'computers', got '");
for (size i = 0; i < tag2->length; i++) {
WriteFmt("{c}", tag2->data[i]);
WriteFmt("[DEBUG] Tag 2 check failed: expected 'computers', got '");
for (size i = 0; i < tag2->length; i++) {
WriteFmt("{c}", tag2->data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", tag2->data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(tag3, "portable", 8) != 0) {
WriteFmt("[DEBUG] Tag 3 check failed: expected 'portable', got '");
for (size i = 0; i < tag3->length; i++) {
WriteFmt("{c}", tag3->data[i]);
WriteFmt("[DEBUG] Tag 3 check failed: expected 'portable', got '");
for (size i = 0; i < tag3->length; i++) {
WriteFmt("{c}", tag3->data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", tag3->data[i]);
}
WriteFmt("'\n");
success = false;
}
if (!result) {
WriteFmt("[DEBUG] JSON comparison failed\n");
WriteFmt("[DEBUG] Expected: '");
for (size i = 0; i < expected_clean.length; i++) {
if (!result) {
WriteFmt("[DEBUG] JSON comparison failed\n");
WriteFmt("[DEBUG] Expected: '");
for (size i = 0; i < expected_clean.length; i++) {
WriteFmt("{c}", expected_clean.data[i]);
WriteFmt("[DEBUG] Expected: '");
for (size i = 0; i < expected_clean.length; i++) {
WriteFmt("{c}", expected_clean.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", expected_clean.data[i]);
}
WriteFmt("'\n");
WriteFmt("[DEBUG] Got: '");
for (size i = 0; i < output_clean.length; i++) {
}
WriteFmt("'\n");
WriteFmt("[DEBUG] Got: '");
for (size i = 0; i < output_clean.length; i++) {
WriteFmt("{c}", output_clean.data[i]);
WriteFmt("[DEBUG] Got: '");
for (size i = 0; i < output_clean.length; i++) {
WriteFmt("{c}", output_clean.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", output_clean.data[i]);
}
WriteFmt("'\n");
}
// Test 1: Simple string writing
bool test_simple_string_writing(void) {
WriteFmt("Testing simple string writing\n");
bool success = true;
// Test 2: Simple number writing
bool test_simple_numbers_writing(void) {
WriteFmt("Testing simple number writing\n");
bool success = true;
// Test 3: Simple boolean writing
bool test_simple_boolean_writing(void) {
WriteFmt("Testing simple boolean writing\n");
bool success = true;
// Test 4: Simple person object writing
bool test_simple_person_object_writing(void) {
WriteFmt("Testing simple person object writing\n");
bool success = true;
// Test 5: Simple config object writing
bool test_simple_config_object_writing(void) {
WriteFmt("Testing simple config object writing\n");
bool success = true;
// Test 6: Simple array of strings writing
bool test_simple_array_of_strings_writing(void) {
WriteFmt("Testing simple array of strings writing\n");
bool success = true;
// Test 7: Simple nested object writing
bool test_simple_nested_object_writing(void) {
WriteFmt("Testing simple nested object writing\n");
bool success = true;
// Test 8: Simple product with tags array writing
bool test_simple_product_with_tags_writing(void) {
WriteFmt("Testing simple product with tags array writing\n");
bool success = true;
// Test basic iterator functionality
bool test_basic_iterator_functionality(void) {
WriteFmt("Testing basic iterator functionality\n");
Str json = StrInitFromZstr("{\"test\": \"value\"}");
if (!StrIterRemainingLength(&si)) {
WriteFmt("[DEBUG] Remaining length check failed: expected > 0, got {}\n", StrIterRemainingLength(&si));
success = false;
}
if (StrIterPeek(&si) != '{') {
WriteFmt("[DEBUG] Peek check failed: expected '{', got '{c}'\n", StrIterPeek(&si));
success = false;
}
// Test simple JSON object (1 level)
bool test_simple_json_object(void) {
WriteFmt("Testing simple JSON object (1 level)\n");
bool success = true;
if (data.id != 12345) {
WriteFmt("[DEBUG] ID check failed: expected 12345, got {}\n", data.id);
success = false;
}
if (StrCmpCstr(&data.name, "test", 4) != 0) {
WriteFmt("[DEBUG] Name check failed: expected 'test', got '");
for (size i = 0; i < data.name.length; i++) {
WriteFmt("{c}", data.name.data[i]);
WriteFmt("[DEBUG] Name check failed: expected 'test', got '");
for (size i = 0; i < data.name.length; i++) {
WriteFmt("{c}", data.name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", data.name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (data.active != true) {
WriteFmt("[DEBUG] Active check failed: expected true, got {}\n", data.active ? "true" : "false");
success = false;
}
if (!(data.score > 98.4 && data.score < 98.6)) {
WriteFmt("[DEBUG] Score check failed: expected 98.4-98.6, got {}\n", data.score);
success = false;
}
// Test two-level nesting
bool test_two_level_nesting(void) {
WriteFmt("Testing two-level nesting\n");
bool success = true;
if (data.user.id != 123) {
WriteFmt("[DEBUG] User ID check failed: expected 123, got {}\n", data.user.id);
success = false;
}
if (StrCmpCstr(&data.user.profile.name, "Alice", 5) != 0) {
WriteFmt("[DEBUG] Profile name check failed: expected 'Alice', got '");
for (u64 i = 0; i < data.user.profile.name.length; i++) {
WriteFmt("{}", data.user.profile.name.data[i]);
WriteFmt("[DEBUG] Profile name check failed: expected 'Alice', got '");
for (u64 i = 0; i < data.user.profile.name.length; i++) {
WriteFmt("{}", data.user.profile.name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{}", data.user.profile.name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (data.user.profile.age != 30) {
WriteFmt("[DEBUG] Profile age check failed: expected 30, got {}\n", data.user.profile.age);
success = false;
}
if (StrCmpCstr(&data.status, "active", 6) != 0) {
WriteFmt("[DEBUG] Status check failed: expected 'active', got '");
for (size i = 0; i < data.status.length; i++) {
WriteFmt("{}", data.status.data[i]);
WriteFmt("[DEBUG] Status check failed: expected 'active', got '");
for (size i = 0; i < data.status.length; i++) {
WriteFmt("{}", data.status.data[i]);
}
WriteFmt("'\n");
WriteFmt("{}", data.status.data[i]);
}
WriteFmt("'\n");
success = false;
}
// Test three-level nesting
bool test_three_level_nesting(void) {
WriteFmt("Testing three-level nesting\n");
bool success = true;
if (StrCmpCstr(&data.company.departments.engineering.head, "John", 4) != 0) {
WriteFmt("[DEBUG] Engineering head check failed: expected 'John', got '");
for (size i = 0; i < data.company.departments.engineering.head.length; i++) {
WriteFmt("{c}", data.company.departments.engineering.head.data[i]);
WriteFmt("[DEBUG] Engineering head check failed: expected 'John', got '");
for (size i = 0; i < data.company.departments.engineering.head.length; i++) {
WriteFmt("{c}", data.company.departments.engineering.head.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", data.company.departments.engineering.head.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (data.company.departments.engineering.count != 25) {
WriteFmt(
"[DEBUG] Engineering count check failed: expected 25, got {}\n",
data.company.departments.engineering.count
if (data.company.departments.engineering.budget < 149999.0) {
WriteFmt(
"[DEBUG] Engineering budget check failed: expected > 149999.0, got {}\n",
data.company.departments.engineering.budget
if (StrCmpCstr(&data.company.name, "TechCorp", 8) != 0) {
WriteFmt("[DEBUG] Company name check failed: expected 'TechCorp', got '");
for (size i = 0; i < data.company.name.length; i++) {
WriteFmt("{c}", data.company.name.data[i]);
WriteFmt("[DEBUG] Company name check failed: expected 'TechCorp', got '");
for (size i = 0; i < data.company.name.length; i++) {
WriteFmt("{c}", data.company.name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", data.company.name.data[i]);
}
WriteFmt("'\n");
success = false;
}
// Test dynamic key parsing (like your example) - Fixed initialization
bool test_dynamic_key_parsing(void) {
WriteFmt("Testing dynamic key parsing\n");
bool success = true;
if (symbols.length != 2) {
WriteFmt("[DEBUG] Symbols length check failed: expected 2, got {}\n", symbols.length);
success = false;
}
if (!(sym1->source_function_id == 12345 || sym1->source_function_id == 54321)) {
WriteFmt(
"[DEBUG] Sym1 source function ID check failed: expected 12345 or 54321, got {}\n",
sym1->source_function_id
if (!(sym1->target_function_id == 67890 || sym1->target_function_id == 98765)) {
WriteFmt(
"[DEBUG] Sym1 target function ID check failed: expected 67890 or 98765, got {}\n",
sym1->target_function_id
if (!(sym1->distance > 0.8 && sym1->distance < 1.0)) {
WriteFmt("[DEBUG] Sym1 distance check failed: expected 0.8-1.0, got {}\n", sym1->distance);
success = false;
}
if (!(sym2->source_function_id == 12345 || sym2->source_function_id == 54321)) {
WriteFmt(
"[DEBUG] Sym2 source function ID check failed: expected 12345 or 54321, got {}\n",
sym2->source_function_id
if (!(sym2->target_function_id == 67890 || sym2->target_function_id == 98765)) {
WriteFmt(
"[DEBUG] Sym2 target function ID check failed: expected 67890 or 98765, got {}\n",
sym2->target_function_id
if (!(sym2->distance > 0.8 && sym2->distance < 1.0)) {
WriteFmt("[DEBUG] Sym2 distance check failed: expected 0.8-1.0, got {}\n", sym2->distance);
success = false;
}
// Test complex API response similar to your example - Fixed initialization
bool test_complex_api_response(void) {
WriteFmt("Testing complex API response structure\n");
bool success = true;
// Debug status check
if (response.status != true) {
WriteFmt("[DEBUG] Status check failed: expected true, got {}\n", response.status ? "true" : "false");
success = false;
}
// Debug message check
if (StrCmpCstr(&response.message, "Success", 7) != 0) {
WriteFmt("[DEBUG] Message check failed: expected 'Success', got '");
for (size i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
WriteFmt("[DEBUG] Message check failed: expected 'Success', got '");
for (size i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
success = false;
}
// Debug data length check
if (response.data.length != 1) {
WriteFmt("[DEBUG] Data length check failed: expected 1, got {}\n", response.data.length);
success = false;
}
// Debug individual symbol checks
if (sym->source_function_id != 12345) {
WriteFmt("[DEBUG] Source function ID check failed: expected 12345, got {}\n", sym->source_function_id);
success = false;
}
if (sym->target_function_id != 67890) {
WriteFmt("[DEBUG] Target function ID check failed: expected 67890, got {}\n", sym->target_function_id);
success = false;
}
if (!(sym->distance > 0.84 && sym->distance < 0.86)) {
WriteFmt("[DEBUG] Distance check failed: expected 0.84-0.86, got {}\n", sym->distance);
success = false;
}
if (sym->analysis_id != 999) {
WriteFmt("[DEBUG] Analysis ID check failed: expected 999, got {}\n", sym->analysis_id);
success = false;
}
if (sym->binary_id != 888) {
WriteFmt("[DEBUG] Binary ID check failed: expected 888, got {}\n", sym->binary_id);
success = false;
}
if (StrCmpCstr(&sym->analysis_name, "test_analysis", 13) != 0) {
WriteFmt("[DEBUG] Analysis name check failed: expected 'test_analysis', got '");
for (size i = 0; i < sym->analysis_name.length; i++) {
WriteFmt("{c}", sym->analysis_name.data[i]);
WriteFmt("[DEBUG] Analysis name check failed: expected 'test_analysis', got '");
for (size i = 0; i < sym->analysis_name.length; i++) {
WriteFmt("{c}", sym->analysis_name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", sym->analysis_name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(&sym->function_name, "main_func", 9) != 0) {
WriteFmt(
"[DEBUG] Function name check failed: expected 'main_func', got string of length {}\n",
sym->function_name.length
if (StrCmpCstr(&sym->sha256, "abc123", 6) != 0) {
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < sym->sha256.length; i++) {
WriteFmt("{c}", sym->sha256.data[i]);
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < sym->sha256.length; i++) {
WriteFmt("{c}", sym->sha256.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", sym->sha256.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (sym->debug != true) {
WriteFmt("[DEBUG] Debug flag check failed: expected true, got {}\n", sym->debug ? "true" : "false");
success = false;
}
if (StrCmpCstr(&sym->function_mangled_name, "_Z4main", 7) != 0) {
WriteFmt("[DEBUG] Mangled name check failed: expected '_Z4main', got '");
for (size i = 0; i < sym->function_mangled_name.length; i++) {
WriteFmt("{c}", sym->function_mangled_name.data[i]);
WriteFmt("[DEBUG] Mangled name check failed: expected '_Z4main', got '");
for (size i = 0; i < sym->function_mangled_name.length; i++) {
WriteFmt("{c}", sym->function_mangled_name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", sym->function_mangled_name.data[i]);
}
WriteFmt("'\n");
success = false;
}
// Test function info parsing
bool test_function_info_parsing(void) {
WriteFmt("Testing function info parsing\n");
bool success = true;
if (info.id != 12345) {
WriteFmt("[DEBUG] Function ID check failed: expected 12345, got {}\n", info.id);
success = false;
}
if (StrCmpCstr(&info.name, "test_func", 9) != 0) {
WriteFmt("[DEBUG] Function name check failed: expected 'test_func', got '");
for (size i = 0; i < info.name.length; i++) {
WriteFmt("{}", info.name.data[i]);
WriteFmt("[DEBUG] Function name check failed: expected 'test_func', got '");
for (size i = 0; i < info.name.length; i++) {
WriteFmt("{}", info.name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{}", info.name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (info.size != 1024) {
WriteFmt("[DEBUG] Function size check failed: expected 1024, got {}\n", info.size);
success = false;
}
if (info.vaddr != 4096) {
WriteFmt("[DEBUG] Function vaddr check failed: expected 4096, got {}\n", info.vaddr);
success = false;
}
// Test model info parsing
bool test_model_info_parsing(void) {
WriteFmt("Testing model info parsing\n");
bool success = true;
if (info.id != 54321) {
WriteFmt("[DEBUG] Model ID check failed: expected 54321, got {}\n", info.id);
success = false;
}
if (StrCmpCstr(&info.name, "test_model", 10) != 0) {
WriteFmt("[DEBUG] Model name check failed: expected 'test_model', got '");
for (size i = 0; i < info.name.length; i++) {
WriteFmt("{}", info.name.data[i]);
WriteFmt("[DEBUG] Model name check failed: expected 'test_model', got '");
for (size i = 0; i < info.name.length; i++) {
WriteFmt("{}", info.name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{}", info.name.data[i]);
}
WriteFmt("'\n");
success = false;
}
// Test search results with tags - Fixed implementation
bool test_search_results_with_tags(void) {
WriteFmt("Testing search results with tags\n");
bool success = true;
if (result.binary_id != 888) {
WriteFmt("[DEBUG] Binary ID check failed: expected 888, got {}\n", result.binary_id);
success = false;
}
if (StrCmpCstr(&result.binary_name, "test_binary", 11) != 0) {
WriteFmt("[DEBUG] Binary name check failed: expected 'test_binary', got '");
for (size i = 0; i < result.binary_name.length; i++) {
WriteFmt("{c}", result.binary_name.data[i]);
WriteFmt("[DEBUG] Binary name check failed: expected 'test_binary', got '");
for (size i = 0; i < result.binary_name.length; i++) {
WriteFmt("{c}", result.binary_name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", result.binary_name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (result.analysis_id != 999) {
WriteFmt("[DEBUG] Analysis ID check failed: expected 999, got {}\n", result.analysis_id);
success = false;
}
if (StrCmpCstr(&result.sha256, "abc123", 6) != 0) {
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < result.sha256.length; i++) {
WriteFmt("{c}", result.sha256.data[i]);
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < result.sha256.length; i++) {
WriteFmt("{c}", result.sha256.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", result.sha256.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (result.model_id != 12345) {
WriteFmt("[DEBUG] Model ID check failed: expected 12345, got {}\n", result.model_id);
success = false;
}
if (StrCmpCstr(&result.model_name, "test_model", 10) != 0) {
WriteFmt("[DEBUG] Model name check failed: expected 'test_model', got '");
for (size i = 0; i < result.model_name.length; i++) {
WriteFmt("{c}", result.model_name.data[i]);
WriteFmt("[DEBUG] Model name check failed: expected 'test_model', got '");
for (size i = 0; i < result.model_name.length; i++) {
WriteFmt("{c}", result.model_name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", result.model_name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(&result.owned_by, "user1", 5) != 0) {
WriteFmt("[DEBUG] Owned by check failed: expected 'user1', got '");
for (size i = 0; i < result.owned_by.length; i++) {
WriteFmt("{c}", result.owned_by.data[i]);
WriteFmt("[DEBUG] Owned by check failed: expected 'user1', got '");
for (size i = 0; i < result.owned_by.length; i++) {
WriteFmt("{c}", result.owned_by.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", result.owned_by.data[i]);
}
WriteFmt("'\n");
success = false;
}
// Test conditional parsing
bool test_conditional_parsing(void) {
WriteFmt("Testing conditional parsing\n");
bool success = true;
ApiResponse response = {false, StrInit(), VecInitWithDeepCopy(NULL, AnnSymbolDeinit)};
WriteFmt("[DEBUG] About to parse JSON...\n");
JR_OBJ(si, {
JR_STR_KV(si, "message", response.message);
WriteFmt("[DEBUG] Parsed status: {}, message: '", response.status ? "true" : "false");
for (size i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
WriteFmt("[DEBUG] Parsed status: {}, message: '", response.status ? "true" : "false");
for (size i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
if (response.status) {
if (response.status) {
WriteFmt("[DEBUG] Status is true, parsing data...\n");
JR_OBJ_KV(si, "data", {
u64 source_function_id = strtoull(key.data, NULL, 10);
JR_OBJ_KV(si, "data", {
u64 source_function_id = strtoull(key.data, NULL, 10);
WriteFmt("[DEBUG] Source function ID from key: {}\n", source_function_id);
JR_OBJ(si, {
// Properly initialize all Str fields
sym.target_function_id = strtoull(key.data, NULL, 10);
WriteFmt("[DEBUG] Target function ID from key: {}\n", sym.target_function_id);
JR_OBJ(si, {
});
WriteFmt(
"[DEBUG] Parsed symbol - distance: {}, analysis_id: {}, binary_id: {}\n",
sym.distance,
VecPushBack(&response.data, sym);
WriteFmt("[DEBUG] Added symbol to vector, length now: {}\n", response.data.length);
});
});
});
} else {
WriteFmt("[DEBUG] Status is false, skipping data parsing\n");
}
});
});
WriteFmt("[DEBUG] Finished parsing, response.data.length = {}\n", response.data.length);
// Debug checks
// Debug checks
if (response.status != true) {
WriteFmt("[DEBUG] Status check failed: expected true, got {}\n", response.status ? "true" : "false");
success = false;
}
if (StrCmpCstr(&response.message, "Success", 7) != 0) {
WriteFmt("[DEBUG] Message check failed: expected 'Success', got '");
for (size i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
WriteFmt("[DEBUG] Message check failed: expected 'Success', got '");
for (size i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (response.data.length != 1) {
WriteFmt("[DEBUG] Data length check failed: expected 1, got {}\n", response.data.length);
success = false;
}
if (sym->source_function_id != 12345) {
WriteFmt("[DEBUG] Source function ID check failed: expected 12345, got {}\n", sym->source_function_id);
success = false;
}
if (sym->target_function_id != 67890) {
WriteFmt("[DEBUG] Target function ID check failed: expected 67890, got {}\n", sym->target_function_id);
success = false;
}
if (!(sym->distance > 0.84 && sym->distance < 0.86)) {
WriteFmt("[DEBUG] Distance check failed: expected 0.84-0.86, got {}\n", sym->distance);
success = false;
}
if (sym->analysis_id != 999) {
WriteFmt("[DEBUG] Analysis ID check failed: expected 999, got {}\n", sym->analysis_id);
success = false;
}
if (sym->binary_id != 888) {
WriteFmt("[DEBUG] Binary ID check failed: expected 888, got {}\n", sym->binary_id);
success = false;
}
if (StrCmpCstr(&sym->analysis_name, "test_analysis", 13) != 0) {
WriteFmt("[DEBUG] Analysis name check failed: expected 'test_analysis', got '");
for (size i = 0; i < sym->analysis_name.length; i++) {
WriteFmt("{c}", sym->analysis_name.data[i]);
WriteFmt("[DEBUG] Analysis name check failed: expected 'test_analysis', got '");
for (size i = 0; i < sym->analysis_name.length; i++) {
WriteFmt("{c}", sym->analysis_name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", sym->analysis_name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(&sym->function_name, "main_func", 9) != 0) {
WriteFmt(
"[DEBUG] Function name check failed: expected 'main_func', got string of length {}\n",
sym->function_name.length
if (StrCmpCstr(&sym->sha256, "abc123", 6) != 0) {
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < sym->sha256.length; i++) {
WriteFmt("{c}", sym->sha256.data[i]);
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < sym->sha256.length; i++) {
WriteFmt("{c}", sym->sha256.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", sym->sha256.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (sym->debug != true) {
WriteFmt("[DEBUG] Debug flag check failed: expected true, got {}\n", sym->debug ? "true" : "false");
success = false;
}
if (StrCmpCstr(&sym->function_mangled_name, "_Z4main", 7) != 0) {
WriteFmt("[DEBUG] Mangled name check failed: expected '_Z4main', got '");
for (size i = 0; i < sym->function_mangled_name.length; i++) {
WriteFmt("{c}", sym->function_mangled_name.data[i]);
WriteFmt("[DEBUG] Mangled name check failed: expected '_Z4main', got '");
for (size i = 0; i < sym->function_mangled_name.length; i++) {
WriteFmt("{c}", sym->function_mangled_name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", sym->function_mangled_name.data[i]);
}
WriteFmt("'\n");
success = false;
}
// Test status response pattern
bool test_status_response_pattern(void) {
WriteFmt("Testing status response pattern\n");
bool success = true;
ApiResponse response = {false, StrInit(), VecInitWithDeepCopy(NULL, AnnSymbolDeinit)};
WriteFmt("[DEBUG] About to parse JSON...\n");
JR_OBJ(si, {
JR_STR_KV(si, "message", response.message);
WriteFmt("[DEBUG] Parsed status: {}, message: '", response.status ? "true" : "false");
for (size i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
WriteFmt("[DEBUG] Parsed status: {}, message: '", response.status ? "true" : "false");
for (size i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
if (response.status) {
if (response.status) {
WriteFmt("[DEBUG] Status is true, parsing data...\n");
JR_OBJ_KV(si, "data", {
u64 source_function_id = strtoull(key.data, NULL, 10);
JR_OBJ_KV(si, "data", {
u64 source_function_id = strtoull(key.data, NULL, 10);
WriteFmt("[DEBUG] Source function ID from key: {}\n", source_function_id);
JR_OBJ(si, {
// Properly initialize all Str fields
sym.target_function_id = strtoull(key.data, NULL, 10);
WriteFmt("[DEBUG] Target function ID from key: {}\n", sym.target_function_id);
JR_OBJ(si, {
});
WriteFmt(
"[DEBUG] Parsed symbol - distance: {}, analysis_id: {}, binary_id: {}\n",
sym.distance,
VecPushBack(&response.data, sym);
WriteFmt("[DEBUG] Added symbol to vector, length now: {}\n", response.data.length);
});
});
});
} else {
WriteFmt("[DEBUG] Status is false, skipping data parsing\n");
}
});
});
WriteFmt("[DEBUG] Finished parsing, response.data.length = {}\n", response.data.length);
// Debug checks
// Debug checks
if (response.status != true) {
WriteFmt("[DEBUG] Status check failed: expected true, got {}\n", response.status ? "true" : "false");
success = false;
}
if (StrCmpCstr(&response.message, "Success", 7) != 0) {
WriteFmt("[DEBUG] Message check failed: expected 'Success', got '");
for (u64 i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
WriteFmt("[DEBUG] Message check failed: expected 'Success', got '");
for (u64 i = 0; i < response.message.length; i++) {
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", response.message.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (response.data.length != 1) {
WriteFmt("[DEBUG] Data length check failed: expected 1, got {}\n", response.data.length);
success = false;
}
if (sym->source_function_id != 12345) {
WriteFmt("[DEBUG] Source function ID check failed: expected 12345, got {}\n", sym->source_function_id);
success = false;
}
if (sym->target_function_id != 67890) {
WriteFmt("[DEBUG] Target function ID check failed: expected 67890, got {}\n", sym->target_function_id);
success = false;
}
if (!(sym->distance > 0.84 && sym->distance < 0.86)) {
WriteFmt("[DEBUG] Distance check failed: expected 0.84-0.86, got {}\n", sym->distance);
success = false;
}
if (sym->analysis_id != 999) {
WriteFmt("[DEBUG] Analysis ID check failed: expected 999, got {}\n", sym->analysis_id);
success = false;
}
if (sym->binary_id != 888) {
WriteFmt("[DEBUG] Binary ID check failed: expected 888, got {}\n", sym->binary_id);
success = false;
}
if (StrCmpCstr(&sym->analysis_name, "test_analysis", 13) != 0) {
WriteFmt("[DEBUG] Analysis name check failed: expected 'test_analysis', got '");
for (size i = 0; i < sym->analysis_name.length; i++) {
WriteFmt("{}", sym->analysis_name.data[i]);
WriteFmt("[DEBUG] Analysis name check failed: expected 'test_analysis', got '");
for (size i = 0; i < sym->analysis_name.length; i++) {
WriteFmt("{}", sym->analysis_name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{}", sym->analysis_name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(&sym->function_name, "main_func", 9) != 0) {
WriteFmt("[DEBUG] Function name check failed: expected 'main_func', got '");
for (size i = 0; i < sym->function_name.length; i++) {
WriteFmt("{c}", sym->function_name.data[i]);
WriteFmt("[DEBUG] Function name check failed: expected 'main_func', got '");
for (size i = 0; i < sym->function_name.length; i++) {
WriteFmt("{c}", sym->function_name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", sym->function_name.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (StrCmpCstr(&sym->sha256, "abc123", 6) != 0) {
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < sym->sha256.length; i++) {
WriteFmt("{}", sym->sha256.data[i]);
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < sym->sha256.length; i++) {
WriteFmt("{}", sym->sha256.data[i]);
}
WriteFmt("'\n");
WriteFmt("{}", sym->sha256.data[i]);
}
WriteFmt("'\n");
success = false;
}
if (sym->debug != true) {
WriteFmt("[DEBUG] Debug flag check failed: expected true, got {}\n", sym->debug ? "true" : "false");
success = false;
}
if (StrCmpCstr(&sym->function_mangled_name, "_Z4main", 7) != 0) {
WriteFmt("[DEBUG] Mangled name check failed: expected '_Z4main', got '");
for (size i = 0; i < sym->function_mangled_name.length; i++) {
WriteFmt("{c}", sym->function_mangled_name.data[i]);
WriteFmt("[DEBUG] Mangled name check failed: expected '_Z4main', got '");
for (size i = 0; i < sym->function_mangled_name.length; i++) {
WriteFmt("{c}", sym->function_mangled_name.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", sym->function_mangled_name.data[i]);
}
WriteFmt("'\n");
success = false;
}
// Test 3: Empty string reading
bool test_empty_string_reading(void) {
WriteFmt("Testing empty string reading\n");
bool success = true;
if (obj.name.length == 0 && obj.description.length == 0) {
WriteFmt("[DEBUG] Empty string test passed - both strings empty\n");
} else {
WriteFmt(
WriteFmt("[DEBUG] Empty string test passed - both strings empty\n");
} else {
WriteFmt(
"[DEBUG] Empty string test FAILED - name len: {}, desc len: {}\n",
obj.name.length,
// Test 4: Negative numbers reading
bool test_negative_numbers_reading(void) {
WriteFmt("Testing negative numbers reading\n");
bool success = true;
if (obj.temp == -25 && obj.balance == -1000.50 && obj.delta == -0.001) {
WriteFmt(
"[DEBUG] Negative numbers test passed - temp: {}, balance: {}, delta: {}\n",
obj.temp,
);
} else {
WriteFmt(
"[DEBUG] Negative numbers test FAILED - temp: {}, balance: {}, delta: {}\n",
obj.temp,
// Test 5: Large numbers reading
bool test_large_numbers_reading(void) {
WriteFmt("Testing large numbers reading\n");
bool success = true;
if (obj.big_int == 9223372036854775807LL) {
WriteFmt("[DEBUG] Large integer test passed: {}\n", obj.big_int);
} else {
WriteFmt("[DEBUG] Large integer test FAILED: expected 9223372036854775807, got {}\n", obj.big_int);
WriteFmt("[DEBUG] Large integer test passed: {}\n", obj.big_int);
} else {
WriteFmt("[DEBUG] Large integer test FAILED: expected 9223372036854775807, got {}\n", obj.big_int);
success = false;
}
// Check if floats are in reasonable range (may not be exact due to precision)
if (obj.big_float > 1.0e+300 && obj.small_float > 0 && obj.small_float < 1.0e-300) {
WriteFmt("[DEBUG] Large float test passed\n");
} else {
WriteFmt("[DEBUG] Large float test FAILED - big: {e}, small: {e}\n", obj.big_float, obj.small_float);
WriteFmt("[DEBUG] Large float test passed\n");
} else {
WriteFmt("[DEBUG] Large float test FAILED - big: {e}, small: {e}\n", obj.big_float, obj.small_float);
success = false;
}
// Test 6: Zero values reading
bool test_zero_values_reading(void) {
WriteFmt("Testing zero values reading\n");
bool success = true;
if (obj.int_zero == 0 && obj.float_zero == 0.0 && obj.bool_false == false) {
WriteFmt(
"[DEBUG] Zero values test passed - int: {}, float: {}, bool: {}\n",
obj.int_zero,
);
} else {
WriteFmt(
"[DEBUG] Zero values test FAILED - int: {}, float: {}, bool: {}\n",
obj.int_zero,
// Test 7: Special characters in strings
bool test_special_characters_in_strings(void) {
WriteFmt("Testing special characters in strings\n");
bool success = true;
});
WriteFmt("[DEBUG] Special chars - path: '{}'\n", obj.path);
WriteFmt("[DEBUG] Special chars - message: '{}'\n", obj.message);
WriteFmt("[DEBUG] Special chars - data: '{}'\n", obj.data);
WriteFmt("[DEBUG] Special chars - path: '{}'\n", obj.path);
WriteFmt("[DEBUG] Special chars - message: '{}'\n", obj.message);
WriteFmt("[DEBUG] Special chars - data: '{}'\n", obj.data);
WriteFmt("[DEBUG] Special chars - path: '{}'\n", obj.path);
WriteFmt("[DEBUG] Special chars - message: '{}'\n", obj.message);
WriteFmt("[DEBUG] Special chars - data: '{}'\n", obj.data);
// Check if strings were parsed (exact content may vary based on escape handling)
// Check if strings were parsed (exact content may vary based on escape handling)
if (obj.path.length > 0 && obj.message.length > 0 && obj.data.length > 0) {
WriteFmt("[DEBUG] Special characters test passed - all strings parsed\n");
} else {
WriteFmt("[DEBUG] Special characters test FAILED - some strings empty\n");
WriteFmt("[DEBUG] Special characters test passed - all strings parsed\n");
} else {
WriteFmt("[DEBUG] Special characters test FAILED - some strings empty\n");
success = false;
}
// Test 8: Escape sequences reading
bool test_escape_sequences_reading(void) {
WriteFmt("Testing escape sequences reading\n");
bool success = true;
// Basic validation that strings were parsed
if (obj.escaped.length > 0 && obj.backslash.length > 0 && obj.newline.length > 0 && obj.tab.length > 0) {
WriteFmt("[DEBUG] Escape sequences test passed\n");
} else {
WriteFmt("[DEBUG] Escape sequences test FAILED\n");
WriteFmt("[DEBUG] Escape sequences test passed\n");
} else {
WriteFmt("[DEBUG] Escape sequences test FAILED\n");
success = false;
}
// Test 9: Whitespace variations reading
bool test_whitespace_variations_reading(void) {
WriteFmt("Testing whitespace variations reading\n");
bool success = true;
if (StrCmpCstr(&obj.name, "test", 4) == 0 && obj.value == 42 && obj.flag == true) {
WriteFmt(
"[DEBUG] Whitespace variations test passed - name: {}, value: {}, flag: {}\n",
obj.name.data,
);
} else {
WriteFmt(
"[DEBUG] Whitespace variations test FAILED - name: {}, value: {}, flag: {}\n",
obj.name.data,
// found_inner should be true (empty inner object still triggers JR_OBJ_KV)
if (!obj.found_outer && !obj.found_list && obj.found_deep && !obj.found_inner) {
WriteFmt("[DEBUG] Nested empty containers test passed\n");
} else {
WriteFmt(
WriteFmt("[DEBUG] Nested empty containers test passed\n");
} else {
WriteFmt(
"[DEBUG] Nested empty containers test results - outer: {}, list: {}, deep: {}, inner: {}\n",
obj.found_outer ? "true" : "false",
// Test 11: Mixed empty and filled containers
bool test_mixed_empty_and_filled(void) {
WriteFmt("Testing mixed empty and filled containers\n");
bool success = true;
if (obj.x_value == 1 && VecLen(&obj.filled_items) == 2 && VecAt(&obj.filled_items, 0) == 1 &&
VecAt(&obj.filled_items, 1) == 2) {
WriteFmt(
"[DEBUG] Mixed empty and filled test passed - x: {}, items: {}\n",
obj.x_value,
);
} else {
WriteFmt(
"[DEBUG] Mixed empty and filled test FAILED - x: {}, items: {}\n",
obj.x_value,
);
if (VecLen(&obj.filled_items) > 0) {
WriteFmt("[DEBUG] First item: {}\n", VecAt(&obj.filled_items, 0));
}
success = false;
// Test 12: Boundary integers
bool test_boundary_integers(void) {
WriteFmt("Testing boundary integers\n");
bool success = true;
if (obj.max_int == 2147483647LL && obj.min_int == -2147483648LL && obj.one == 1 && obj.minus_one == -1) {
WriteFmt(
"[DEBUG] Boundary integers test passed - max: {}, min: {}, one: {}, minus_one: {}\n",
obj.max_int,
);
} else {
WriteFmt(
"[DEBUG] Boundary integers test FAILED - max: {}, min: {}, one: {}, minus_one: {}\n",
obj.max_int,
// Test 13: Boundary floats
bool test_boundary_floats(void) {
WriteFmt("Testing boundary floats\n");
bool success = true;
if (obj.tiny > 0.0000001 && obj.tiny < 0.00001 && obj.huge > 999999.0 && obj.huge < 1000000.0 && obj.zero == 0.0 &&
obj.negative_tiny < -0.0000001 && obj.negative_tiny > -0.00001) {
WriteFmt(
"[DEBUG] Boundary floats test passed - tiny: {}, huge: {}, zero: {}, neg_tiny: {}\n",
obj.tiny,
);
} else {
WriteFmt(
"[DEBUG] Boundary floats test FAILED - tiny: {}, huge: {}, zero: {}, neg_tiny: {}\n",
obj.tiny,
if (!result) {
WriteFmtLn("[DEBUG] JSON comparison failed");
WriteFmt("[DEBUG] Expected: '");
for (u64 i = 0; i < expected_clean.length; i++) {
WriteFmt("{c}", expected_clean.data[i]);
WriteFmt("[DEBUG] Expected: '");
for (u64 i = 0; i < expected_clean.length; i++) {
WriteFmt("{c}", expected_clean.data[i]);
}
WriteFmtLn("'");
WriteFmtLn("'");
WriteFmt("[DEBUG] Got: '");
for (u64 i = 0; i < output_clean.length; i++) {
WriteFmt("{c}", output_clean.data[i]);
WriteFmt("[DEBUG] Got: '");
for (u64 i = 0; i < output_clean.length; i++) {
WriteFmt("{c}", output_clean.data[i]);
}
WriteFmtLn("'");
if (!result) {
WriteFmt("[DEBUG] JSON comparison failed\n");
WriteFmt("[DEBUG] Expected: '");
for (u64 i = 0; i < expected_clean.length; i++) {
if (!result) {
WriteFmt("[DEBUG] JSON comparison failed\n");
WriteFmt("[DEBUG] Expected: '");
for (u64 i = 0; i < expected_clean.length; i++) {
WriteFmt("{c}", expected_clean.data[i]);
WriteFmt("[DEBUG] Expected: '");
for (u64 i = 0; i < expected_clean.length; i++) {
WriteFmt("{c}", expected_clean.data[i]);
}
WriteFmt("'\n");
WriteFmt("{c}", expected_clean.data[i]);
}
WriteFmt("'\n");
WriteFmt("[DEBUG] Got: '");
for (u64 i = 0; i < output_clean.length; i++) {
}
WriteFmt("'\n");
WriteFmt("[DEBUG] Got: '");
for (u64 i = 0; i < output_clean.length; i++) {
WriteFmt("%c", output_clean.data[i]);
WriteFmt("[DEBUG] Got: '");
for (u64 i = 0; i < output_clean.length; i++) {
WriteFmt("%c", output_clean.data[i]);
}
WriteFmt("'\n");
WriteFmt("%c", output_clean.data[i]);
}
WriteFmt("'\n");
}
// Test 1: Two-level nesting writing
bool test_two_level_nesting_writing(void) {
WriteFmt("Testing two-level nesting writing\n");
bool success = true;
// Test 2: Three-level nesting writing
bool test_three_level_nesting_writing(void) {
WriteFmt("Testing three-level nesting writing\n");
bool success = true;
// Test 3: Complex API response writing
bool test_complex_api_response_writing(void) {
WriteFmt("Testing complex API response writing\n");
bool success = true;
// Test 4: Function info array writing
bool test_function_info_array_writing(void) {
WriteFmt("Testing function info array writing\n");
bool success = true;
// Test 5: Search results with tags writing
bool test_search_results_with_tags_writing(void) {
WriteFmt("Testing search results with tags writing\n");
bool success = true;
// Test 6: Dynamic object keys writing
bool test_dynamic_object_keys_writing(void) {
WriteFmt("Testing dynamic object keys writing\n");
bool success = true;
// Test 7: Deeply nested structure writing
bool test_deeply_nested_structure_writing(void) {
WriteFmt("Testing deeply nested structure writing\n");
bool success = true;
// Test 8: Mixed array types writing
bool test_mixed_array_types_writing(void) {
WriteFmt("Testing mixed array types writing\n");
bool success = true;
- In
TestRunner.c:28
:
bool test_deadend(TestFunction test_func, bool expect_failure) {
if (!test_func) {
WriteFmt("[ERROR] test_deadend: NULL test function provided\n");
return false;
}
- In
TestRunner.c:50
:
// If we get here, the test completed without aborting
if (expect_failure) {
WriteFmt(" [Unexpected success: Test completed without abort]\n");
test_result = false; // Expected failure but got success
} else {
- In
TestRunner.c:53
:
test_result = false; // Expected failure but got success
} else {
WriteFmt(" [Success: Test completed normally]\n");
test_result = true; // Expected success and got success
}
- In
TestRunner.c:59
:
// We jumped here from abort - test was aborted
if (expect_failure) {
WriteFmt(" [Expected failure: Test aborted as expected]\n");
test_result = true; // Expected failure and got abort
} else {
- In
TestRunner.c:62
:
test_result = true; // Expected failure and got abort
} else {
WriteFmt(" [Unexpected failure: Test aborted unexpectedly]\n");
test_result = false; // Expected success but got abort
}
- In
TestRunner.c:76
:
int simple_test_driver(TestFunction *tests, int count) {
if (!tests) {
WriteFmt("[ERROR] simple_test_driver: NULL tests array provided\n");
return count; // All tests failed
}
- In
TestRunner.c:85
:
// Run all tests and accumulate results
for (int i = 0; i < count; i++) {
WriteFmt("[TEST {}/{}] ", i + 1, count);
bool result = tests[i]();
if (result) {
- In
TestRunner.c:88
:
bool result = tests[i]();
if (result) {
WriteFmt("[PASS]\n\n");
passed++;
} else {
- In
TestRunner.c:91
:
passed++;
} else {
WriteFmt("[FAIL]\n\n");
failed++;
}
- In
TestRunner.c:97
:
// Print summary
WriteFmt("[SUMMARY] Total: {}, Passed: {}, Failed: {}\n", count, passed, failed);
return failed;
- In
TestRunner.c:105
:
int deadend_test_driver(TestFunction *tests, int count) {
if (!tests) {
WriteFmt("[ERROR] deadend_test_driver: NULL tests array provided\n");
return count; // All tests failed
}
- In
TestRunner.c:109
:
}
WriteFmt("\n[INFO] Testing deadend scenarios\n\n");
int passed = 0;
- In
TestRunner.c:116
:
// Run all deadend tests (expecting failure)
for (int i = 0; i < count; i++) {
WriteFmt("[TEST {}/{}] ", i + 1, count);
bool result = test_deadend(tests[i], true); // All deadend tests expect failure
if (result) {
- In
TestRunner.c:119
:
bool result = test_deadend(tests[i], true); // All deadend tests expect failure
if (result) {
WriteFmt("[PASS]\n\n");
passed++;
} else {
- In
TestRunner.c:122
:
passed++;
} else {
WriteFmt("[FAIL]\n\n");
failed++;
}
- In
TestRunner.c:128
:
// Print summary
WriteFmt("[SUMMARY] Deadend tests - Total: {}, Passed: {}, Failed: {}\n", count, passed, failed);
return failed;
- In
TestRunner.c:141
:
const char *test_name
) {
WriteFmt("[INFO] Starting {} tests\n\n", test_name ? test_name : "Test Suite");
int total_failed = 0;
- In
TestRunner.c:158
:
// Print final summary
WriteFmt(
"\n[FINAL SUMMARY] {} - Normal: {} tests, Deadend: {} tests, Total Failed: {}\n",
test_name ? test_name : "Test Suite",