21 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
moxian 2ee44002fd Mechanically IWYU the tests
python3 ~/github/include-what-you-use/iwyu_tool.py -j5 -p build $( find
src/ tests/ -maxdepth 1 -name '*.cpp' | grep -v -f
tools/iwyu/bad_files.txt )  --  -Xiwyu --comment_style=long -Xiwyu -
-max_line_length=1000 -Xiwyu --cxx17ns -Xiwyu
--mapping_file=../tools/iwyu/cata.imp   | tee out/iwyu/f-a-01.txt >
/dev/null

followed by

cat out/iwyu/f-a-02.txt | python3
~/github/include-what-you-use/fix_includes.py --reorder --nosafe_headers

followed by manual fixups of <stddef.h> -> <cstddef> and similar.

tests/generic_factory_test.cpp gets mangled very badly (IWYU bug) so
it's excluded from the list.

Code size:
includes:
$ cat obj/tiles/*.inc | wc
 288068  576136 17898260
$ cat tests/obj/tiles/*.inc | wc
 167044  334088 10465766

post-processed source (clang -E):
./make_preproc.sh src/
68567896 177775140 2134075721
./make_preproc.sh tests/
39341957 102891720 1243323710
2025-02-10 00:46:57 -08:00
Andrew Krieger 4bf68fbbfd s/_path_path()/_path()/g 2024-11-28 16:54:56 -05:00
Jianxiang Wang (王健翔) f255964f9c Migrate names to snippets & add weighted snippets (#70279)
* Migrate name.h/cpp to snippets and unify name snippet tags

* Implement weighted snippets

* Try to fix compiler error
2024-01-04 13:53:16 -06:00
John Bytheway dd5b7af626 Apply clang-tidy fixes for C++17
A few small changes in C++17 mean that clang-tidy is now able to apply a
few more fixes.  Do so.
2023-03-14 19:26:16 -04:00
akrieger b5466fcb81 Fix tests to use cata_path where needed. 2022-09-15 22:04:57 -07: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
John Bytheway c90ec0edcb Remove implicit constructors and update code 2021-01-30 11:12:41 -05:00
ZhilkinSerg 5dbedb4b17 Used constant references in function parameters 2020-08-23 02:56:40 +03:00
Kevin Granade c5ccf0c2c7 IWYU for tests (#42806) 2020-08-09 09:46:57 +03: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
ZhilkinSerg 27c49a33ff Make nameFlags a class enum 2020-05-12 09:12:07 +03:00
John Bytheway 95133d34f1 clang-tidy modernize-use-override (#32820)
* Enable modernize-use-override

* Remove virtual from functions marked override
2019-08-02 04:24:53 +03:00
ZhilkinSerg 9e5bcf4711 Added nickname to random name generator (#28965)
* Added nickname to random name generator

* Added nickname to name_generation tests
2019-04-03 20:06:47 -07:00
John Bytheway b0576393e3 Sort headers according to IWYU conventions
A first step towards IWYU support.  Doing the sorting first because it
makes reviewing any additions or removals of headers much simpler.

The IWYU order is:
- Associated headers
- Misc system headers
- C++ STL headers
- Other project headers

The biggest change is moving system headers before project headers (they
are usually afterwards in Cata at the moment.

The associated header for a cpp file is the header file which declares
the functions defined in that cpp file.  Normally that's the one which
shares the same name (up to extension), and if so IWYU figures it out
automatically.

However, in this project there are many corner cases, so we need to use
IWYU pragma: associated to tell it which header (or, in some cases,
which headers) is the associated header.  We are unusual in having
multiple associated headers for some files, which might lead to
discovering some interesting IWYU bugs later, but in theory it is
supported.
2019-01-05 14:03:31 +00:00
ZhilkinSerg a6a8ac90d9 Removed empty declarations 2018-11-08 22:04:21 +03:00
ZhilkinSerg f8eb2acd05 Optimized includes (tests) 2018-11-07 03:55:47 +03:00
taiyu 4c21134437 fix copypasted example code. 2017-10-30 11:43:39 -07:00
taiyu 7b7f6fead2 astyle name_test.cpp 2017-10-30 11:26:17 -07:00
taiyu f7e2b051b5 Added name tests, removed unused header in name.cpp 2017-10-30 11:14:53 -07:00