test_deadend

Table of Contents

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

NameDirectionDescription
test_funcinTest function to execute.
expect_failureinIf 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)

    
    // Run a specific deadend test using setjmp/longjmp to capture aborts
    bool test_deadend(TestFunction test_func, bool expect_failure) {
    if (!test_func) {
    printf("[ERROR] test_deadend: NULL test function provided\n");
    bool test_deadend(TestFunction test_func, bool expect_failure) {
    if (!test_func) {
    printf("[ERROR] test_deadend: NULL test function provided\n");
    return false;
    }
    for (int i = 0; i < count; i++) {
    printf("[TEST %d/%d] ", i + 1, count);
    bool result = test_deadend(tests[i], true); // All deadend tests expect failure
    if (result) {
    printf("[PASS]\n\n");

Share :

Related Posts

deadend_test_driver

deadend_test_driver Description Run an array of deadend test functions (all expecting failure).

Read More

simple_test_driver

simple_test_driver Description Run an array of simple test functions.

Read More

bool

bool Description Function pointer type for test functions.

Read More