РЕДАКТИРОВАТЬ: пример
С помощью следующего кода:
Код: Выделить всё
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
TEST_CASE("Compare Vectors", "[vector]") {
std::vector vec1 = {0, 1, 2, 3};
std::vector vec2 = {0, 1, 2, 4};
REQUIRE(vec1 == vec2);
}
Код: Выделить всё
-------------------------------------------------------------------------------
Compare Vectors
-------------------------------------------------------------------------------
test/UnitTests/test_Example/example.cc:4
...............................................................................
test/UnitTests/test_Example/example.cc:7: FAILED:
REQUIRE( vec1 == vec2 )
with expansion:
{ 0, 1, 2, 3 } == { 0, 1, 2, 4 }
===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed
Код: Выделить всё
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
TEST_CASE("Compare Vectors", "[vector]") {
std::vector vec1 = {0, 1, 2, 3};
std::vector vec2 = {0, 1, 2, 3.000001};
REQUIRE(vec1 == vec2);
}
Подробнее здесь: https://stackoverflow.com/questions/418 ... sing-catch