ebd549b300
Catch2 provides a customization point for converting our types to strings by specializing the StringMaker template. We have some specializations in stringmaker.h, but this feature was only working intermittently. I finally figured out that was due to an ODR violation. The test files that didn't include stringmaker.h were compiling a different specialization than the ones that did. Re-jig the test includes so that any file including catch.hpp also includes stringmaker.h, thereby ensuring that the custom specializations are used everywhere and there is no ODR violation. I achieved this by adding a new cata_catch.h header and making all existing headers include catch.hpp via the new header.
19 lines
448 B
C++
19 lines
448 B
C++
#pragma once
|
|
#ifndef CATA_TESTS_ASSERTION_HELPERS_H
|
|
#define CATA_TESTS_ASSERTION_HELPERS_H
|
|
|
|
#include "cata_catch.h"
|
|
|
|
#include <algorithm>
|
|
|
|
template<typename Container1, typename Container2>
|
|
void check_containers_equal( const Container1 &c1, const Container2 &c2 )
|
|
{
|
|
CAPTURE( c1 );
|
|
CAPTURE( c2 );
|
|
REQUIRE( c1.size() == c2.size() );
|
|
CHECK( std::equal( c1.begin(), c1.end(), c2.begin() ) );
|
|
}
|
|
|
|
#endif // CATA_TESTS_ASSERTION_HELPERS_H
|