I started to use "Catch" unit testing framework and so far it's really great. I have used VS built in unit testing framwork with great pain .
one thing I have noticed that the macro REQUIRE_THROWS_AS
does not behave as one would expect
from the docs:
REQUIRE_THROWS_AS( expression, exception type ) and CHECK_THROWS_AS( expression, exception type )
Expects that an exception of the specified type is thrown during evaluation of the expression.
when I try to write
TEST_CASE("some test") {
SECTION("vector throws") {
std::vector<int> vec;
REQUIRE_THROWS_AS(vec.at(10), std::logic_error);
}
}
I expect the test to fail and yet it says the test passed. is there a bug in the framework or I am wrong?
Aucun commentaire:
Enregistrer un commentaire