C - 编写自定义处理程序

I've written a custom test method in PHP to give me a custom response when running simple tests. Is there a way to implement this in C without having to re-invent the wheel?

function test($assertion, $msg = null)
{
    assert_options(ASSERT_WARNING, false);

    if(assert($assertion))
    {
        echo "PASS: {$assertion}
";
    }
    else
    {
        echo $msg, "
", "FAIL: {$assertion}
";
    }
}

My solution: (edit)

void test(bool expected, bool actual)
{
    printf((expected == actual) ? "PASS" : "FAIL");
}

I think this is what you're looking for:

void test(bool expected, bool actual, char *msg)
{
    printf(((expected == actual) ? "PASS: %s
" : "FAIL: %s
"), msg);
}

It has the same test-like characteristics and it outputs a simple message in the same format as your PHP function. Note that I have not tested this and I'm not sure if the ternary in the printf actually compiles, but my guess is that it does.