Hello, I'm programming some unit test with google test framework. But I want to check is some asserts are well placed and are useful. So my question is: does exists a way to catch an assert in google test?
Example:
int factorial(int n){
assert(n >= 0);
//....
}
And then the test:
#include <gtest/gtest.h>
TEST(FactorialTest,assertNegative){
EXPECT_ANY_THROW({
factorial(-1);
});
}
Actually, EXPECT_ANY_THROW doesn't catch the assert but only exceptions. I'm searching a solution to catch asserts.
Thanks to all