WriteFmtLn

Table of Contents

WriteFmtLn

Description

Write formatted output to the standard output stream (stdout) followed by a newline. This is a convenience macro calling FWriteFmtLn with stdout.

Parameters

NameDirectionDescription
fmtstrinFormat string with {} placeholders. should be wrapped with variable.

Success

Placeholders in fmtstr are replaced by the passed arguments, and the resulting formatted string followed by a newline is written to stdout.

Failure

Failure might occur during memory allocation for the temporary string or during the write operation to stdout (fputs or fputc). Errors from StrWriteFmtInternal (logging messages) might also occur.

Usage example (Cross-references)

    // Test VecPopBack function
    bool test_vec_pop_back(void) {
    WriteFmtLn("Testing VecPopBack");
    
    // Create a vector of integers
    // Test VecPopFront function
    bool test_vec_pop_front(void) {
    WriteFmtLn("Testing VecPopFront");
    
    // Create a vector of integers
    // Test VecDelete function
    bool test_vec_delete(void) {
    WriteFmtLn("Testing VecDelete");
    
    // Create a vector of integers
    // Test VecDeleteFast function
    bool test_vec_delete_fast(void) {
    WriteFmtLn("Testing VecDeleteFast");
    
    // Create a vector of integers
    // Test VecDeleteRange function
    bool test_vec_delete_range(void) {
    WriteFmtLn("Testing VecDeleteRange");
    
    // Create a vector of integers
    // Test VecDeleteRangeFast
    bool test_vec_delete_range_fast(void) {
    WriteFmtLn("Testing VecDeleteRangeFast");
    
    // Create a vector of integers
    // Test VecDeleteLast function
    bool test_vec_delete_last(void) {
    WriteFmtLn("Testing VecDeleteLast");
    
    // Create a vector of integers
    // Test L-value standard delete operations
    bool test_lvalue_delete_operations(void) {
    WriteFmtLn("Testing L-value standard delete operations");
    
    // Create a vector of integers
    // Test R-value standard delete operations
    bool test_rvalue_delete_operations(void) {
    WriteFmtLn("Testing R-value standard delete operations");
    
    // Create a vector of integers
    // Test L-value fast delete operations
    bool test_lvalue_fast_delete_operations(void) {
    WriteFmtLn("Testing L-value fast delete operations");
    
    // Create a vector of integers
    // Check that the value at the deleted position is now the last value
    result = result && (VecAt(&vec, fast_index) == lastValue);
    WriteFmtLn(
    "Value at deleted position ({}) is now {} (expected {})\n",
    fast_index,
    result = result && found;
    if (!found) {
    WriteFmtLn("Value {} should be present but was not found", expected_values[i]);
    }
    }
    // Test R-value fast delete operations
    bool test_rvalue_fast_delete_operations(void) {
    WriteFmtLn("Testing R-value fast delete operations");
    
    // Create a vector of integers
    // Check that the value at the deleted position is now the last value
    result = result && (VecAt(&vec, 2) == lastValue);
    WriteFmtLn("Value at deleted position (2) is now {} (expected {})\n", VecAt(&vec, 2), lastValue);
    
    // Verify all expected values (except the deleted one and the moved one) are still present
    result = result && found;
    if (!found) {
    WriteFmtLn("Value {} should be present but was not found", expected_values[i]);
    }
    }
    // Test L-value delete range operations
    bool test_lvalue_delete_range_operations(void) {
    WriteFmtLn("Testing L-value delete range operations");
    
    // Create a vector of integers
    // Test R-value delete range operations
    bool test_rvalue_delete_range_operations(void) {
    WriteFmtLn("Testing R-value delete range operations");
    
    // Create a vector of integers
    // Test L-value fast delete range operations
    bool test_lvalue_fast_delete_range_operations(void) {
    WriteFmtLn("Testing L-value fast delete range operations");
    
    // Create a vector of integers
    result = result && !found;
    if (found) {
    WriteFmtLn("Value {} should be deleted but was found", valuesToDelete[i]);
    }
    }
    result = result && found;
    if (!found) {
    WriteFmtLn("Value {} should be present but was not found", remainingValues[i]);
    }
    }
    // Test R-value fast delete range operations
    bool test_rvalue_fast_delete_range_operations(void) {
    WriteFmtLn("Testing R-value fast delete range operations");
    
    // Create a vector of integers
    result = result && !found;
    if (found) {
    WriteFmtLn("Value {} should be deleted but was found", valuesToDelete[i]);
    }
    }
    result = result && found;
    if (!found) {
    WriteFmtLn("Value {} should be present but was not found", remainingValues[i]);
    }
    }
    // Test BitVecAnd function
    bool test_bitvec_and(void) {
    WriteFmtLn("Testing BitVecAnd");
    
    BitVec bv1    = BitVecInit();
    // Test BitVecOr function
    bool test_bitvec_or(void) {
    WriteFmtLn("Testing BitVecOr");
    
    BitVec bv1    = BitVecInit();
    // Test BitVecXor function
    bool test_bitvec_xor(void) {
    WriteFmtLn("Testing BitVecXor");
    
    BitVec bv1    = BitVecInit();
    // Test BitVecNot function
    bool test_bitvec_not(void) {
    WriteFmtLn("Testing BitVecNot");
    
    BitVec bv     = BitVecInit();
    // Test BitVecShiftLeft function - CORRECTED EXPECTATIONS
    bool test_bitvec_shift_left(void) {
    WriteFmtLn("Testing BitVecShiftLeft");
    
    BitVec bv = BitVecInit();
    // Test BitVecShiftRight function - CORRECTED EXPECTATIONS
    bool test_bitvec_shift_right(void) {
    WriteFmtLn("Testing BitVecShiftRight");
    
    BitVec bv = BitVecInit();
    // Test BitVecRotateLeft function
    bool test_bitvec_rotate_left(void) {
    WriteFmtLn("Testing BitVecRotateLeft");
    
    BitVec bv = BitVecInit();
    // Test BitVecRotateRight function
    bool test_bitvec_rotate_right(void) {
    WriteFmtLn("Testing BitVecRotateRight");
    
    BitVec bv = BitVecInit();
    // Test BitVecReverse function
    bool test_bitvec_reverse(void) {
    WriteFmtLn("Testing BitVecReverse");
    
    BitVec bv = BitVecInit();
    // Edge case tests
    bool test_bitvec_shift_edge_cases(void) {
    WriteFmtLn("Testing BitVec shift edge cases");
    
    BitVec bv     = BitVecInit();
    
    bool test_bitvec_rotate_edge_cases(void) {
    WriteFmtLn("Testing BitVec rotate edge cases");
    
    BitVec bv     = BitVecInit();
    
    bool test_bitvec_bitwise_ops_edge_cases(void) {
    WriteFmtLn("Testing BitVec bitwise operations edge cases");
    
    BitVec bv1    = BitVecInit();
    
    bool test_bitvec_reverse_edge_cases(void) {
    WriteFmtLn("Testing BitVecReverse edge cases");
    
    BitVec bv     = BitVecInit();
    // NEW: Comprehensive bitwise operations testing
    bool test_bitvec_bitwise_comprehensive(void) {
    WriteFmtLn("Testing BitVec comprehensive bitwise operations");
    
    BitVec bv1         = BitVecInit();
    // NEW: Comprehensive shift testing
    bool test_bitvec_shift_comprehensive(void) {
    WriteFmtLn("Testing BitVec comprehensive shift operations");
    
    BitVec bv     = BitVecInit();
    // NEW: Comprehensive rotate testing
    bool test_bitvec_rotate_comprehensive(void) {
    WriteFmtLn("Testing BitVec comprehensive rotate operations");
    
    BitVec bv     = BitVecInit();
    // NEW: Identity operations testing
    bool test_bitvec_bitwise_identity_operations(void) {
    WriteFmtLn("Testing BitVec bitwise identity operations");
    
    BitVec bv1         = BitVecInit();
    // NEW: Commutative properties testing
    bool test_bitvec_bitwise_commutative_properties(void) {
    WriteFmtLn("Testing BitVec bitwise commutative properties");
    
    BitVec bv1         = BitVecInit();
    // NEW: Large pattern testing
    bool test_bitvec_bitwise_large_patterns(void) {
    WriteFmtLn("Testing BitVec bitwise operations with large patterns");
    
    BitVec bv1         = BitVecInit();
    // Deadend tests
    bool test_bitvec_bitwise_null_failures(void) {
    WriteFmtLn("Testing BitVec bitwise NULL pointer handling");
    
    // Test NULL bitvec pointer - should abort
    
    bool test_bitvec_bitwise_ops_null_failures(void) {
    WriteFmtLn("Testing BitVec bitwise operations NULL handling");
    
    BitVec bv  = BitVecInit();
    
    bool test_bitvec_reverse_null_failures(void) {
    WriteFmtLn("Testing BitVec reverse NULL handling");
    
    // Test NULL pointer - should abort
    // NEW: Additional deadend tests
    bool test_bitvec_shift_ops_null_failures(void) {
    WriteFmtLn("Testing BitVec shift operations NULL handling");
    
    // Test NULL pointer for shift right - should abort
    
    bool test_bitvec_rotate_ops_null_failures(void) {
    WriteFmtLn("Testing BitVec rotate operations NULL handling");
    
    // Test NULL pointer for rotate - should abort
    
    bool test_bitvec_and_result_null_failures(void) {
    WriteFmtLn("Testing BitVec AND with NULL result handling");
    
    BitVec bv1 = BitVecInit();
    
    bool test_bitvec_or_operand_null_failures(void) {
    WriteFmtLn("Testing BitVec OR with NULL operand handling");
    
    BitVec result = BitVecInit();
    
    bool test_bitvec_xor_second_operand_null_failures(void) {
    WriteFmtLn("Testing BitVec XOR with NULL second operand handling");
    
    BitVec result = BitVecInit();
    
    bool test_bitvec_not_null_failures(void) {
    WriteFmtLn("Testing BitVec NOT with NULL handling");
    
    BitVec result = BitVecInit();
    // Main function that runs all tests
    int main(void) {
    WriteFmtLn("[INFO] Starting BitVec.BitWise tests");
    
    // Array of normal test functions
    // Test 1: Simple value round-trip
    bool test_simple_roundtrip(void) {
    WriteFmtLn("Testing simple value round-trip");
    
    bool success = true;
    });
    
    WriteFmtLn("[DEBUG] Generated JSON: {}", json);
    
    // Read back from JSON
    if (original.count == parsed.count && original.temperature == parsed.temperature &&
    original.enabled == parsed.enabled && StrCmp(&original.message, &parsed.message) == 0) {
    WriteFmtLn("[DEBUG] Simple round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Simple round-trip test FAILED");
    WriteFmtLn("[DEBUG] Simple round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Simple round-trip test FAILED");
    WriteFmtLn(
    "[DEBUG] Original: count={}, temp={}, enabled={}, msg='{}'",
    } else {
    WriteFmtLn("[DEBUG] Simple round-trip test FAILED");
    WriteFmtLn(
    "[DEBUG] Original: count={}, temp={}, enabled={}, msg='{}'",
    original.count,
    original.message.data
    );
    WriteFmtLn(
    "[DEBUG] Parsed: count={}, temp={}, enabled={}, msg='{}'",
    parsed.count,
    // Test 2: Numeric precision round-trip
    bool test_numeric_roundtrip(void) {
    WriteFmtLn("Testing numeric precision round-trip");
    
    bool success = true;
    });
    
    WriteFmtLn("[DEBUG] Numeric JSON: {}", json);
    
    // Read back from JSON
    
    if (ints_match && floats_match) {
    WriteFmtLn("[DEBUG] Numeric round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Numeric round-trip test FAILED");
    WriteFmtLn("[DEBUG] Numeric round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Numeric round-trip test FAILED");
    WriteFmtLn("[DEBUG] Integers match: {}", ints_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Floats match: {}", floats_match ? "true" : "false");
    } else {
    WriteFmtLn("[DEBUG] Numeric round-trip test FAILED");
    WriteFmtLn("[DEBUG] Integers match: {}", ints_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Floats match: {}", floats_match ? "true" : "false");
    success = false;
    WriteFmtLn("[DEBUG] Numeric round-trip test FAILED");
    WriteFmtLn("[DEBUG] Integers match: {}", ints_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Floats match: {}", floats_match ? "true" : "false");
    success = false;
    }
    // Test 3: Boolean round-trip
    bool test_boolean_roundtrip(void) {
    WriteFmtLn("Testing boolean round-trip");
    
    bool success = true;
    if (original.flag1 == parsed.flag1 && original.flag2 == parsed.flag2 && original.flag3 == parsed.flag3 &&
    original.flag4 == parsed.flag4) {
    WriteFmtLn("[DEBUG] Boolean round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Boolean round-trip test FAILED");
    WriteFmtLn("[DEBUG] Boolean round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Boolean round-trip test FAILED");
    success = false;
    }
    // Test 4: String round-trip
    bool test_string_roundtrip(void) {
    WriteFmtLn("Testing string round-trip");
    
    bool success = true;
    StrCmp(&original.with_spaces, &parsed.with_spaces) == 0 &&
    StrCmp(&original.with_special, &parsed.with_special) == 0) {
    WriteFmtLn("[DEBUG] String round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] String round-trip test FAILED");
    WriteFmtLn("[DEBUG] String round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] String round-trip test FAILED");
    success = false;
    }
    // Test 5: Array round-trip
    bool test_array_roundtrip(void) {
    WriteFmtLn("Testing array round-trip");
    
    bool success = true;
    
    if (numbers_match && strings_match) {
    WriteFmtLn("[DEBUG] Array round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Array round-trip test FAILED");
    WriteFmtLn("[DEBUG] Array round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Array round-trip test FAILED");
    WriteFmtLn(
    "[DEBUG] Numbers match: {} (orig {}, parsed {})\n",
    } else {
    WriteFmtLn("[DEBUG] Array round-trip test FAILED");
    WriteFmtLn(
    "[DEBUG] Numbers match: {} (orig {}, parsed {})\n",
    numbers_match ? "true" : "false",
    VecLen(&parsed_numbers)
    );
    WriteFmtLn(
    "[DEBUG] Strings match: {} (orig {}, parsed {})\n",
    strings_match ? "true" : "false",
    // Test 6: Nested object round-trip
    bool test_nested_object_roundtrip(void) {
    WriteFmtLn("Testing nested object round-trip");
    
    bool success = true;
    // Compare
    if (compare_persons(&original_person, &parsed_person)) {
    WriteFmtLn("[DEBUG] Nested object round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Nested object round-trip test FAILED");
    WriteFmtLn("[DEBUG] Nested object round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Nested object round-trip test FAILED");
    success = false;
    }
    // Test 7: Complex data round-trip
    bool test_complex_data_roundtrip(void) {
    WriteFmtLn("Testing complex data round-trip");
    
    bool success = true;
    });
    
    WriteFmtLn("[DEBUG] Complex JSON length: {}", json);
    
    // Read back from JSON
    
    if (user_match && config_match && numbers_match && flags_match) {
    WriteFmtLn("[DEBUG] Complex data round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Complex data round-trip test FAILED");
    WriteFmtLn("[DEBUG] Complex data round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Complex data round-trip test FAILED");
    WriteFmtLn("[DEBUG] User match: {}", user_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Config match: {}", config_match ? "true" : "false");
    } else {
    WriteFmtLn("[DEBUG] Complex data round-trip test FAILED");
    WriteFmtLn("[DEBUG] User match: {}", user_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Config match: {}", config_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Numbers match: {}", numbers_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Complex data round-trip test FAILED");
    WriteFmtLn("[DEBUG] User match: {}", user_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Config match: {}", config_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Numbers match: {}", numbers_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Flags match: {}", flags_match ? "true" : "false");
    WriteFmtLn("[DEBUG] User match: {}", user_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Config match: {}", config_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Numbers match: {}", numbers_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Flags match: {}", flags_match ? "true" : "false");
    success = false;
    WriteFmtLn("[DEBUG] Config match: {}", config_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Numbers match: {}", numbers_match ? "true" : "false");
    WriteFmtLn("[DEBUG] Flags match: {}", flags_match ? "true" : "false");
    success = false;
    }
    // Test 8: Empty containers round-trip
    bool test_empty_containers_roundtrip(void) {
    WriteFmtLn("Testing empty containers round-trip");
    
    bool success = true;
    if (parsed_str.length == 0 && VecLen(&parsed_numbers) == 0 && VecLen(&parsed_strings) == 0 &&
    !found_empty_object) { // Empty object should not execute the content
    WriteFmtLn("[DEBUG] Empty containers round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Empty containers round-trip test FAILED");
    WriteFmtLn("[DEBUG] Empty containers round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Empty containers round-trip test FAILED");
    WriteFmtLn(
    "[DEBUG] String length: {}, numbers: {}, strings: {}, found_obj: {}\n",
    } else {
    WriteFmtLn("[DEBUG] Empty containers round-trip test FAILED");
    WriteFmtLn(
    "[DEBUG] String length: {}, numbers: {}, strings: {}, found_obj: {}\n",
    parsed_str.length,
    // Test 9: Edge cases round-trip
    bool test_edge_cases_roundtrip(void) {
    WriteFmtLn("Testing edge cases round-trip");
    
    bool success = true;
    original.zero_float == parsed.zero_float && original.true_val == parsed.true_val &&
    original.false_val == parsed.false_val) {
    WriteFmtLn("[DEBUG] Edge cases round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Edge cases round-trip test FAILED");
    WriteFmtLn("[DEBUG] Edge cases round-trip test passed");
    } else {
    WriteFmtLn("[DEBUG] Edge cases round-trip test FAILED");
    success = false;
    }
    // Test 1: Empty object reading
    bool test_empty_object_reading(void) {
    WriteFmtLn("Testing empty object reading");
    
    bool success = true;
    
    if (!obj1.found_anything) {     // Should still be true for empty object (reader block didn't execute)
    WriteFmtLn("[DEBUG] Empty object test 1 passed - no fields processed");
    } else {
    WriteFmtLn("[DEBUG] Empty object test 1 FAILED - unexpected field processing");
    WriteFmtLn("[DEBUG] Empty object test 1 passed - no fields processed");
    } else {
    WriteFmtLn("[DEBUG] Empty object test 1 FAILED - unexpected field processing");
    success = false;
    }
    
    if (!obj2.found_anything) { // Should still be true for empty object
    WriteFmtLn("[DEBUG] Empty object with whitespace test passed");
    } else {
    WriteFmtLn("[DEBUG] Empty object with whitespace test FAILED");
    WriteFmtLn("[DEBUG] Empty object with whitespace test passed");
    } else {
    WriteFmtLn("[DEBUG] Empty object with whitespace test FAILED");
    success = false;
    }
    // Test 2: Empty array reading
    bool test_empty_array_reading(void) {
    WriteFmtLn("Testing empty array reading");
    
    bool success = true;
    
    if (VecLen(&items) == 0) {
    WriteFmtLn("[DEBUG] Empty array test passed - no items added");
    } else {
    WriteFmtLn("[DEBUG] Empty array test FAILED - {} items found", VecLen(&items));
    WriteFmtLn("[DEBUG] Empty array test passed - no items added");
    } else {
    WriteFmtLn("[DEBUG] Empty array test FAILED - {} items found", VecLen(&items));
    success = false;
    }
    
    if (VecLen(&data) == 0) {
    WriteFmtLn("[DEBUG] Empty array with whitespace test passed");
    } else {
    WriteFmtLn("[DEBUG] Empty array with whitespace test FAILED");
    WriteFmtLn("[DEBUG] Empty array with whitespace test passed");
    } else {
    WriteFmtLn("[DEBUG] Empty array with whitespace test FAILED");
    success = false;
    }
    });
    
    WriteFmtLn("[DEBUG] Escape sequences - escaped: '{}'\n", obj.escaped);
    WriteFmtLn("[DEBUG] Escape sequences - backslash: '{}'\n", obj.backslash);
    WriteFmtLn("[DEBUG] Escape sequences - newline length: {}\n", obj.newline.length);
    
    WriteFmtLn("[DEBUG] Escape sequences - escaped: '{}'\n", obj.escaped);
    WriteFmtLn("[DEBUG] Escape sequences - backslash: '{}'\n", obj.backslash);
    WriteFmtLn("[DEBUG] Escape sequences - newline length: {}\n", obj.newline.length);
    WriteFmtLn("[DEBUG] Escape sequences - tab length: {}\n", obj.tab.length);
    WriteFmtLn("[DEBUG] Escape sequences - escaped: '{}'\n", obj.escaped);
    WriteFmtLn("[DEBUG] Escape sequences - backslash: '{}'\n", obj.backslash);
    WriteFmtLn("[DEBUG] Escape sequences - newline length: {}\n", obj.newline.length);
    WriteFmtLn("[DEBUG] Escape sequences - tab length: {}\n", obj.tab.length);
    WriteFmtLn("[DEBUG] Escape sequences - backslash: '{}'\n", obj.backslash);
    WriteFmtLn("[DEBUG] Escape sequences - newline length: {}\n", obj.newline.length);
    WriteFmtLn("[DEBUG] Escape sequences - tab length: {}\n", obj.tab.length);
    
    // Basic validation that strings were parsed
    // Test 10: Nested empty containers
    bool test_nested_empty_containers(void) {
    WriteFmtLn("Testing nested empty containers\n");
    
    bool success = true;
    
    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]);
    }
    WriteFmtLn("'");
    
    WriteFmt("[DEBUG] Got: '");
    WriteFmt("{c}", output_clean.data[i]);
    }
    WriteFmtLn("'");
    }
    // Test 1: Empty object writing
    bool test_empty_object_writing(void) {
    WriteFmtLn("Testing empty object writing");
    
    bool success = true;
    // Test 2: Empty array writing
    bool test_empty_array_writing(void) {
    WriteFmtLn("Testing empty array writing");
    
    bool success = true;
    // Test 3: Empty string writing
    bool test_empty_string_writing(void) {
    WriteFmtLn("Testing empty string writing");
    
    bool success = true;
    // Test 4: Negative numbers writing
    bool test_negative_numbers_writing(void) {
    WriteFmtLn("Testing negative numbers writing");
    
    bool success = true;
    // Test 5: Large numbers writing
    bool test_large_numbers_writing(void) {
    WriteFmtLn("Testing large numbers writing");
    
    bool success = true;
    // For large numbers, just check that valid JSON was produced
    if (json.length > 0 && json.data[0] == '{' && json.data[json.length - 1] == '}') {
    WriteFmtLn("[DEBUG] Large numbers test passed - produced valid JSON structure");
    } else {
    WriteFmtLn("[DEBUG] Large numbers test FAILED - invalid JSON structure");
    WriteFmtLn("[DEBUG] Large numbers test passed - produced valid JSON structure");
    } else {
    WriteFmtLn("[DEBUG] Large numbers test FAILED - invalid JSON structure");
    success = false;
    }
    }
    
    WriteFmtLn("[DEBUG] Large numbers JSON: {}", json);
    
    StrDeinit(&json);
    // Test 6: Zero values writing
    bool test_zero_values_writing(void) {
    WriteFmtLn("Testing zero values writing\n");
    
    bool success = true;
    // Test 7: Special characters writing
    bool test_special_characters_writing(void) {
    WriteFmtLn("Testing special characters writing");
    
    bool success = true;
    });
    
    WriteFmtLn("[DEBUG] Special characters JSON: {}", json);
    
    // Just verify that valid JSON structure was produced
    // Just verify that valid JSON structure was produced
    if (json.length > 0 && json.data[0] == '{' && json.data[json.length - 1] == '}') {
    WriteFmtLn("[DEBUG] Special characters test passed - produced valid JSON");
    } else {
    WriteFmtLn("[DEBUG] Special characters test FAILED - invalid JSON structure");
    WriteFmtLn("[DEBUG] Special characters test passed - produced valid JSON");
    } else {
    WriteFmtLn("[DEBUG] Special characters test FAILED - invalid JSON structure");
    success = false;
    }
    // Test 8: Escape sequences writing
    bool test_escape_sequences_writing(void) {
    WriteFmtLn("Testing escape sequences writing");
    
    bool success = true;
    });
    
    WriteFmtLn("[DEBUG] Escape sequences JSON: {}", json);
    
    // Verify valid JSON structure was produced
    // Verify valid JSON structure was produced
    if (json.length > 0 && json.data[0] == '{' && json.data[json.length - 1] == '}') {
    WriteFmtLn("[DEBUG] Escape sequences test passed - produced valid JSON");
    } else {
    WriteFmtLn("[DEBUG] Escape sequences test FAILED - invalid JSON structure");
    WriteFmtLn("[DEBUG] Escape sequences test passed - produced valid JSON");
    } else {
    WriteFmtLn("[DEBUG] Escape sequences test FAILED - invalid JSON structure");
    success = false;
    }
    // Test 9: Nested empty containers writing
    bool test_nested_empty_containers_writing(void) {
    WriteFmtLn("Testing nested empty containers writing");
    
    bool success = true;
    // Test 10: Mixed empty and filled containers writing
    bool test_mixed_empty_and_filled_writing(void) {
    WriteFmtLn("Testing mixed empty and filled containers writing");
    
    bool success = true;
    // Test 11: Boundary integers writing
    bool test_boundary_integers_writing(void) {
    WriteFmtLn("Testing boundary integers writing");
    
    bool success = true;
    // Test 12: Boundary floats writing
    bool test_boundary_floats_writing(void) {
    WriteFmtLn("Testing boundary floats writing");
    
    bool success = true;
    // Check for reasonable float formatting (exact precision may vary)
    if (json.length > 0 && json.data[0] == '{' && json.data[json.length - 1] == '}') {
    WriteFmtLn("[DEBUG] Boundary floats test passed - JSON: {}", json);
    } else {
    WriteFmtLn("[DEBUG] Boundary floats test FAILED");
    WriteFmtLn("[DEBUG] Boundary floats test passed - JSON: {}", json);
    } else {
    WriteFmtLn("[DEBUG] Boundary floats test FAILED");
    success = false;
    }
    // Test 13: Single values writing (minimal valid JSON objects)
    bool test_single_values_writing(void) {
    WriteFmtLn("Testing single values writing");
    
    bool success = true;
    );
    
    WriteFmtLn(
    "ElfHeader64 {{\n"
    "  meta: {{class: {}, encoding: {}, version: {}, os_abi: {}}}\n"
    Vec(int) vi = VecInit();
    VecForeachIdx(&vi, val, i) {
    WriteFmtLn("{}", val);
    }
    
    // write the retrieved value to stdout (parent, not child)
    WriteFmtLn("got value = {}", val);
    
    // wait for program to exit for 1 second
    
    if (rule_name.length) {
    WriteFmtLn("Got Rule : {}", rule_name);
    StrDeinit(&rule_name);
    }

Share :

Related Posts

WriteFmt

WriteFmt Description Write formatted output to the standard output stream (stdout). This is a convenience macro calling FWriteFmt with stdout.

Read More

FReadFmt

FReadFmt Description Read formatted data from a file stream. This is a macro wrapper around FReadFmtInternal.

Read More

StrWriteFmtInternal

StrWriteFmtInternal Description Print out a formatted string with rust-style placeholders to given string o.

Read More