Files
John Bytheway ebd549b300 Fix StringMaker ODR violations in tests
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.
2021-07-03 07:42:06 -07:00

16 lines
464 B
C

#pragma once
#ifndef CATA_TESTS_CATA_CATCH_H
#define CATA_TESTS_CATA_CATCH_H
// To avoid ODR violations, it's important that whenever a file includes
// catch.hpp it also includes stringmaker.h, so that all specializations of
// StringMaker match. Therefore, all test code should include catch.hpp via
// this file.
// IWYU pragma: begin_exports
#include "catch/catch.hpp"
#include "stringmaker.h"
// IWYU pragma: end_exports
#endif // CATA_TESTS_CATA_CATCH_H