Skip to content

test_deadend

test_deadend

Description

Run a specific test function using setjmp/longjmp to capture aborts. This is used for deadend tests that are expected to call LOG_FATAL.

Parameters

Name Direction Description
test_func in Test function to execute.
expect_failure in If true, expects the test to call SysAbort().

Success

Returns true if test behaved as expected.

Failure

Returns false if test did not behave as expected.

Usage example (Cross-references)

Usage examples (Cross-references)
    
    // Run a specific deadend test using setjmp/longjmp to capture aborts
    bool test_deadend(TestFunction test_func, bool expect_failure) {
        if (!test_func) {
            WriteFmt("[ERROR] test_deadend: NULL test function provided\n");
    bool test_deadend(TestFunction test_func, bool expect_failure) {
        if (!test_func) {
            WriteFmt("[ERROR] test_deadend: NULL test function provided\n");
            return false;
        }
        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) {
                WriteFmt("[PASS]\n\n");
Last updated on