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");
}