barbu110 / ctest

small testing utility for C programs
MIT License
4 stars 1 forks source link

Assertions should be evaluated immediately, not postponed until test execution ends #4

Open barbu110 opened 5 years ago

barbu110 commented 5 years ago

Failed assertions should leave the test in a FAILED state and should not allow the execution to continue.

Required changes:

The test function should receive an assertion_runner_fn instead of an assertion_container. This will not only help in the above mentioned problem, but also eliminate the limitation created by MAX_ASSERTIONS_PER_TEST definition.

The assertion_runner_fn should be defined as follows:

typedef int (*assertion_runner_fn)(struct assertion *);

This function should return 0 when the assertion successes and 1 when the assertion fails (similar to Unix syscalls).