I
istillshine
When I want to test if a function foo in a .c file behaves as
expected, I usually call it in my main.c in the following way.
if (1) { /* test function foo */
z = foo(x, y); /* */
assert(z==1);
}
When I want to test other functions, I change if (1) to if (0).
Are there better (and simpler) ways to test correctness of a function?
expected, I usually call it in my main.c in the following way.
if (1) { /* test function foo */
z = foo(x, y); /* */
assert(z==1);
}
When I want to test other functions, I change if (1) to if (0).
Are there better (and simpler) ways to test correctness of a function?