You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having such implementation we could create WithAssertMock class for tests which will set mock assert implementation in constructor and reset it in destructor. To mimic runtime break the real assert does, mock could throw an exception and tests could expect the exception instead of expecting death. Probably there are cases where ASSERT() is used inside try cache block, but there should be not so many of them and for such cases we could throw some unusual exception which is not inherited from std::exception.
The text was updated successfully, but these errors were encountered:
Summary
Improve ASSERT to speed up tests.
Motivation
Testing ASSERT() cases using gtest's death tests is very slow with code coverage enabled.
Solution
ASSERT() could be rewritten into something like:
Having such implementation we could create
WithAssertMock
class for tests which will set mock assert implementation in constructor and reset it in destructor. To mimic runtime break the real assert does, mock could throw an exception and tests could expect the exception instead of expecting death. Probably there are cases whereASSERT()
is used inside try cache block, but there should be not so many of them and for such cases we could throw some unusual exception which is not inherited fromstd::exception
.The text was updated successfully, but these errors were encountered: