Closed lukashuebner closed 8 months ago
What was this doing? (seems like removing it makes tests fail?)
Also, this is not a bug ;)
@Hespian I updated the comment in the first message to include more details.
while currently the death test version is used more often, after writing some more death tests, it became clear that the version which overrides KASSERT
by throwing exceptions is a lot more flexible and makes it easier to test. I renamed the death test version, so that we do not have an ambiguous name. It is currently used nowhere, because using only the exception version all tests succeed.
We have multiple (different) redefinitions of
KASSERT_KASSERT_HPP_KASSERT_IMPL
for testing withKASSERT
s. One intests/test_assertions.hpp
(used in three files) and one intests/test_helpers.hpp
(used everywhere else).@niklas-uhl and I decided to just try to remove the lesser used version and see what happens even though we vaguely remembered what happened now: If the
KASSERT
fails only one some ranks, the test will fail.The two redefinitions of
KASSERT_KASSERT_HPP_KASSERT_IMPL
take the following two approaches:tests/test_assertions.hpp
: MakeKASSERT
throw an exception on error. Will give a compilation warning (=error) forKASSERT
s in destructors because they might throw during stack unwinding which willstd::terminate()
.tests/assertion_helpers.hpp
: Use GoogleTest's death tests to check if the program failed with a specific error message. Breaks some assertions as described above.We thus need to do some of the following:
KASSERT_DESTRUCTOR
which doesn't get overwritten or don't useKASSERT
in destructors@DanielSeemaier originally implemented those two methods, so his input might be valueable.