16 Commits

Author SHA1 Message Date
dumb-kevin 05ab42807e tests/: wrap TU-local test fixture types in anon namespaces
- addiction_test: wrap addict_effect_totals
- battery_density_test: wrap battery_chemistry_family
- comestible_test: wrap all_stats
- encumbrance_test: wrap add_trait
- invlet_test: fuse inventory_location + invlet_state + test_action enums
- throwing_test: fuse throw_test_data + throw_test_pstats, move operator<< inside anon-ns
- vehicle_test: wrap vehicle_preset, damage_preset, folded_item_damage_preset, fuse rack_activation + rack_preset
- vision_test: wrap vision_test_case
- water_movement_test: fuse 6 swimmer/swim structs into one block
- weakpoint_test: wrap weakpoint_test_data, weakpoint_expectation, weakpoint_report
2026-05-12 10:53:28 +04:00
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
Binrui Dong 9fdb7ef59c Run IWYU
* Change _ctype.h and __locale to cctype and clocale

* Change _wctype.h to cwctype in game.cpp

* Change __functional_base to functional

* Remove libcxx internal headers

* Remove UNIX system headers

* Fix clang-tidy error with -nostdinc++
2021-02-06 00:18:41 -05:00
Kevin Granade 6d1841ac67 Precompiled Catch2 header (#42453)
* Hoist catch.hpp include to the top of files

* Precompile the catch header in tests
2020-07-29 01:28:26 +03:00
John Bytheway 32bda5329c Enable modernize-use-transparent-functors
Enable this clang-tidy check.
2020-07-03 23:12:51 -07:00
ZhilkinSerg f3fa0f901d Remove redundant empty statements, declarations and lines 2020-05-29 11:01:28 +03:00
John Bytheway e47cd44c48 Enable readability-container-size-empty
Enable this clang-tidy check and fix the issues it raises.
2019-08-19 14:45:14 -04:00
John Bytheway 4321c025d2 IWYU 20190629 (#31990)
* Add IWYU pragma: keep

* Run IWYU and astyle

* Run IWYU a second time

* Prevent #include <cxxabi.h>

Unclear why IWYU thinks this is needed.  It isn't, and it causes
problems on Visual Studio.
2019-07-01 12:25:53 +03:00
John Bytheway b67e5587fd flat_set: Add transparent comparison support 2019-05-13 09:21:38 +01:00
John Bytheway 62d22edcb9 flat_set: Fix hinted insertion
Was returning the wrong type, which led to std::inserter not working
with this container.
2019-05-13 09:21:38 +01:00
John Bytheway 6e78a1a863 flat_set: initializer_list and comparison support 2019-05-13 09:21:38 +01:00
John Bytheway cd61819a29 Make flat_set be a RandomAccessContainer also 2019-05-13 09:21:38 +01:00
John Bytheway 06377eb8b9 Fix and test range insertion
This could lead to duplicate values.  Fix by calling std::unique.
2019-05-13 09:21:38 +01:00
John Bytheway 04194d5f4b Helper function for comparing containers in tests 2019-05-13 09:21:38 +01:00
John Bytheway 2d067b9a87 More flat_set tests 2019-05-13 09:21:38 +01:00
John Bytheway aa56c79026 Initial implementation of flat_set
To provide a (hopefully) faster alternative to std::set for many
purposes needed by the game.
2019-05-13 09:21:38 +01:00