ValidateStrs

Table of Contents

ValidateStrs

Description

Validate whether a given Strs object is valid. Not foolproof but will work most of the time. Aborts if provided Strs is not valid.

Parameters

NameDirectionDescription
vsinPointer to Strs object to validate.

Success

Continue execution, meaning given Strs object is most probably valid.

Failure

abort

Usage example (Cross-references)

    }
    
    void ValidateStrs(const Strs* vs) {
    VecForeachPtr(vs, sp, { ValidateStr(sp); });
    }
    // Test ValidateStrs macro
    bool test_validate_strs(void) {
    printf("Testing ValidateStrs macro\n");
    
    // Create a valid Strs
    
    // This should not crash
    ValidateStrs(&sv);
    
    // Note: We can't really test invalid Strs objects here as ValidateStrs
    // Deadend test: Test ValidateStrs with invalid Strs (should crash/abort)
    bool test_validate_invalid_strs(void) {
    printf("Testing ValidateStrs with invalid Strs (should abort)\n");
    
    // Create an invalid Strs by corrupting its fields
    
    // This should abort the program
    ValidateStrs(&sv);
    
    // Should never reach here

Share :