19 Commits

Author SHA1 Message Date
moxian c44d65a8ae Run IWYU again to pick up the changes 2025-02-11 13:02:19 -08: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
Procyonae 982df19d0f Change /tests remaining uses of raw string item initialisation to use itype_id s
"remaining uses" being somewhat of an understatement -_-
2025-01-10 15:31:15 +00:00
PatrikLundell 5648f805dc typified a bit of map.cpp + dependents 2024-10-12 13:12:23 +02:00
PatrikLundell 1542a3ac1b typified activity_actor 2024-05-15 17:01:50 +02:00
PatrikLundell cc0c85564d Made gates.h typed and the following adjustments (#71809)
* Made gates.h typed and the following adjustments

* missed to commit the test adjustments
2024-02-18 12:23:45 -06:00
andrei a59501ecaa tests/active_items: don't prune stale actives during test (#64018) 2023-03-07 13:22:44 -05:00
andrei 468c87e019 map/item: add only active contents to active cache (#63233)
* map/item: add only active contents to active cache

* active items: remove redundant looping
2023-03-02 01:54:02 +03:00
John Bytheway 2320732f3a Start porting map point types
Continuing the effort to move the game towards type-safe points.  The
last commit added coordinate systems relative to the reality bubble.
This origin gets the abbreviation bub, and four aliases point_bub_ms,
point_bub_sm, tripoint_bub_ms, and tripoint_bub_sm represent these
points.

As a starting point, I have converted all or most of the
construction-related code to these new point types.  This started in
construction.cpp and I followed the compiler errors and continues to
port code so long as it seemed construction related.

One big change is that lots of the map functions are getting extra
overloads taking these new point types.  During the period where we are
still porting code these overloads will exist in parallel with those
taking raw points.  However, the long term plan is to remove the old
overloads, and I've marked each with a TODO comment to that effect.

I didn't discover any bugs in the process of these changes and there
should not be any behavioural changes.
2022-07-11 20:13:09 -04:00
John Bytheway 72741cf290 Migrate map::abs_sub to typesafe point
It is now a tripoint_abs_sm, rather than simply a tripoint.  Also update
the accessor functions for it and various other related code.
2022-02-20 18:47:39 -05: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 b285a13080 Make time_point( int ) constructor explicit
Resolves a TODO on that constructor, and one more TODO elsewhere due to
the resulting refactoring.

time_point was implicitly convertible from int.  This led to unclear
code.  In particular, the item constructor took a time_point and a
quantity, and these two ints appeared adjacent with no obvious way to
see what they meant at call sites.

Make the constructor explicit, so the conversion is no longer implicit.
Update the rest of the code accordingly.

In most cases switched from 0 to calendar::turn_zero, which is
equivalent.  In a couple of places, used start_of_cataclysm instead,
when it seemed more appropriate (such as birthday of toilet water).
It's possible there are more cases which should have been something
other than turn_zero.
2020-11-10 11:21:02 -08: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
Kevin Granade 8f27fb597d Global reference migration part 15 2020-07-03 01:41:50 +00:00
Eric Pierce 74f87fad87 Change CHECK to REQUIRE to abort at first failure
When an assertion in this test fails, the other ~17K assertions in the
loop also tend to fail, producing a lot of noisy output.

Using REQUIRE instead of CHECK assertions causes testing to stop after
the first failure.
2020-04-19 06:41:43 +00:00
John Bytheway e189957ff2 Run IWYU 20200408 (#39364)
* Helper script to run IWYU

* Run IWYU

* Update deprecated headers

* Run IWYU again

* Re-suppress cxxabi.h

This pragma got accidentally removed because it was deemed to be a
comment attached to a #include.

* Remove extra SDL header includes

* Fix ime.cpp headers

Some tweaks to help IWYU not break this file by messing with
platform-specific stuff not relevant on Linux.

* Update game.h

* Move new point.h includes inside #ifdef

* Re-add platform_win.h to mapsharing.cpp

* Apply suggestions from code review

Co-authored-by: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
2020-04-10 12:16:19 +03:00
John Bytheway ba319e75d8 Rename test files for consistency
Have all files containing tests be named *_test.cpp.
2020-01-11 11:05:54 -05:00