How to combine unit testing with assert ()

Suppose the preconditions of my object functions are checked with assert(). How can I, without taking my hair from the process, write meaningful unit tests that catch failures when I pass invalid parameters for functions?

I mean, it assert()will be abort(), so how can I do all the other tests after that?

+3
source share
3 answers

You can replace it with a assert()macro that calls the unit testing structure in unit testing, but evaluates otherwise assert().

+4
source

assert. , , ( ), abort().

+4

Run the tests in the subprocess. Passing invalid parameters will cancel the child, but your test (parent) continues to work.

+3
source

All Articles