I like to use catch for my c++ unit tests.
My goal is to compare std::array
and std::vector
. I created the this failing example.
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
TEST_CASE("Vector") {
std::vector<double> direction = {0.1, 0.3, 0.4};
std::vector<double> false_direction = {0.1, 0.0, 0.4};
REQUIRE(direction == false_direction);
}
TEST_CASE("Array") {
std::array<double, 3> direction = {0.1, 0.3, 0.4};
std::array<double, 3> false_direction = {0.1, 0.0, 0.4};
REQUIRE(direction == false_direction);
}
The output of this test is for the check of std::vector
REQUIRE( direction == false_direction ) with expansion: { 0.1, 0.3, 0.4 } == { 0.1, 0.0, 0.4 }
and for std::array
REQUIRE( direction == false_direction ) with expansion: {?} == {?}
What can I do to display the actual and expected value? I like to have the very same display in a violated REQUIRE
condition for std::array
as for std::vector
.
I use the latest version of catch (v1.10.0).