Ниже я показал код и результат
Тестовый экземпляр проходит, когда true == true
Что здесь происходит? < /p>
#include
struct C1 {
union { char *str; bool b; };
operator bool() const { return this->b; }
C1(char *str) : str(str) {}
};
TEST_CASE("Validate C1") {
C1 c1("hello");
REQUIRE(bool(c1.b) == true);
}
< /code>
output < /h4>
-------------------------------------------------------------------------------
Validate C1
-------------------------------------------------------------------------------
tests/test_catch2.cpp:10
...............................................................................
tests/test_catch2.cpp:12: FAILED:
REQUIRE( bool(c1.b) == true )
with expansion:
true == true
===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed
Подробнее здесь: https://stackoverflow.com/questions/797 ... -true-true
Catch2 V3 Тест не сбои с расширением true == true [дублировать] ⇐ C++
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение