60 Commits

Author SHA1 Message Date
RenechCDDA da2aaffffd Add quick setup option to clear map 2026-06-22 15:07:51 -04:00
GuardianDll 96d084a1f7 Zombies and humanoid monsters in general have vital weakpoints 2026-06-06 19:29:12 +02:00
RenechCDDA 245f503fc5 De-charge a bunch of stuff that should never have had charges (#87000) 2026-05-14 19:58:32 +02:00
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
thaelina ecb7ed024c Tests
Removed x_max x_cur x_bonus accesses outside of setters and getters in the character namespace
2026-03-02 03:17:11 -06:00
dumb-kevin e4bb943d3b Fix CI skip-detection job refs, Makefile parallel safety, and test tag syntax
- matrix.yml SKIP condition referenced non-existent job names
  (skip-duplicates, skip-duplicates-mods); corrected to match declared
  jobs (skip-duplicates-code, skip-duplicates-data). Same fix for the
  commented emscripten block.
- tests/Makefile batch runs now use --user-dir with a unique PID-based
  path so parallel shard execution doesn't collide on filesystem state.
- Normalized comma-separated TEST_CASE tags to space-separated across
  9 test files (25 declarations). Comma syntax is deprecated in Catch2
  v2 and removed in v3. Also fixed a missing space between adjacent
  tags in throwing_test.cpp.
2026-02-24 21:24:24 +04:00
Andrew Krieger 0215b26cce Rewrite all tests to clear map without touching character map memory, for performance. 2026-02-08 23:05:55 -08:00
PatrikLundell 586cf5f1ce Mapify: character etc. sees + sundry others (#79699)
* Mapify: character etc. sees + sundry others

* demanded changes

* Corrected correction
2025-02-18 09:29:22 -06:00
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
PatrikLundell 537d9d12a1 Standardized get/set pos operations for talker/creature class hierarchy (#79206)
* Standardized get/set pos operations for talker/creature class hierarchy

* sort out merge failure
2025-01-20 08:20:58 +01:00
osuphobia 818c74388a shot dispersion refactor 2025-01-17 23:33:31 +08:00
Procyonae 40f0b39e62 Merge branch 'master' into RemoveStringInitialisingItems 2025-01-10 17:00:48 +00: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 befd4486d1 sundry typification (#78985)
* sundry typification

* demanded work around
2025-01-06 22:26:26 -06:00
PatrikLundell 26eb173d36 typified character.h + npc.h (#78623)
* typified character.h + npc.h

* demanded collateral change

* demanded collateral change
2024-12-18 20:03:41 -06:00
PatrikLundell ef6b53acfb typified a little bit of map.h + dependents (#76340)
* typified a little bit of map.h + dependents
2024-09-27 15:10:36 -07:00
mqrause 4c69e47b2a change target_handler::trajectory to std::vector<tripoint_bub_ms> and then fix errors until it compiles again (#76671)
Co-authored-by: mqrause <martin@qrause.de>
2024-09-27 12:10:50 -07:00
RenechCDDA b0882ee2eb Update tests for protected moves variable 2024-03-09 16:33:12 -05:00
Alexey 07356b65a5 Normalize TEST_CASE names (#66241)
* Convert integer parsing test to use normal TEST_CASEs

* Rename test name too similar to another

* Test to enforce normalized test names

* Normalize TEST_CASE names (scripted)
2023-06-17 13:57:19 -03:00
Roman Melnik 7f6e5f7ad0 Prevent loot-generation errors during ranged_balance_test (#63174)
* Prevent loot-generation errors during weapons test

* Add optional parameter for spawn_test_monster

* Satisfy Clang-tidy
2023-01-22 03:26:49 -05:00
John Bytheway e95a4fc9b8 Promote string_id constants to global statics
Our string_id constants were a mixture of temporaries, locals, and
globals.  Pull them all out as globals, for consistency and efficiency.
The efficiency comes from the fact that each string_id instance caches
its respective int_id, and sharing one instance means that value need
not be recomputed.
2021-11-19 19:10:09 -05:00
John Bytheway 0a1191638e Remove redundant parentheses
Apply the new check to remove lots of redundant parentheses throughout
the codebase.
2021-11-07 12:57:53 -05:00
eltank e396c41283 Migrate more monster fields to absolute coords
Change to tripoint_abs_ms:
- goal [was map-relative]
- wander_pos [was map-relative]
- patrol_route [was absolute but not typed]
Remove serialization for path.
Invalidate path on map shift.
Made goal optional, unset when reached.
Rename goal-related functions for consistency/readability.
2021-09-06 00:00:41 -07:00
Eric 51520f6245 Move more player to character (#50971)
* player to character

* Update npc_talk_test.cpp
2021-08-23 00:58:51 -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 bf910e50e3 Declare lots of things static
Use the new clang-tidy check to convert a bunch of declarations to
static.

In a few cases, there were 'secret' dependencies being exposed without
headers.  Convert those to work via headers instead.
2020-09-05 23:13:04 -04:00
John Bytheway 51ddbd5661 Convert existing uses of auto caught by new check 2020-09-01 06:54:06 -04:00
John Bytheway 2463bc2374 Clear player in throwing_test
Without this, this test run in isolation would fail.

I'm not sure what aspect of the extra clearing code is needed.
2020-08-27 05:31:45 -04:00
Kevin Granade c5ccf0c2c7 IWYU for tests (#42806) 2020-08-09 09:46:57 +03:00
anothersimulacrum 8eaa61fd8f Remove inventory.h from character.h
Convert it to a pimpl<T> to help speed up build times.
2020-08-03 23:25:28 +00: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
Trioct 0907f8c230 Remove and replace Character::i_rem( int ) uses (#42136) 2020-07-15 08:57:24 +03:00
Kevin Granade cf21972870 Global reference migration part 21 (#41942) 2020-07-08 09:26:50 +03: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
Kevin Granade 36d9c58ae7 Add test asserting that time to throw is independent of size of thrown item stack size 2020-03-29 00:21:29 +00:00
Kevin Granade 5d392c0d6b Rebalance archery take... 5? (#37241)
* Rebalance archery take... 5?

* Require a ranged weapon to break a damage threshold in order to inflict a critical hit.

* Re-audit strength requirements.

* Apply suggestions from code review

Co-Authored-By: Isaac Freund <ifreund@ifreund.xyz>

* Outline archery balance guidelines.

Co-authored-by: Isaac Freund <ifreund@ifreund.xyz>
2020-03-02 09:39:49 +03:00
John Bytheway 35d93e3460 Set standard_npc position at construction time
This allows tests to avoid calling set_pos on such, which is not safe,
since it assumes the npc is a 'real' one.
2020-01-11 21:27:53 -05:00
Fris0uman 8f0b78ff63 Encapsulate Stamina (#34861) 2019-10-25 23:49:30 -07: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 f3049e5eea Fix missing declarations (#30739)
* Fix missing declarations
Mark functions with no prior declarations as static, and remove the
unused ones.
* Move debug_is_safe_string definition
Put it inside !WIN32 since it's only used there.
2019-05-22 11:00:54 -07:00
KorGgenT f42afc59d4 test includes 2019-05-21 10:25:49 -04:00
John Bytheway aff4636618 Run IWYU
Having refactored the type ids into a single header, IWYU is now able to
find many places where other headers can be removed.
2019-05-06 22:47:10 +01:00
John Bytheway 69de386614 Add in-vehicle sanity checks before setpos
After discovering that setpos can break the vehicle cache stuff, add
some sanity checks in various places in the tests where I'm concerned
they might unknowingly be moving a player out of a vehicle.
2019-05-05 10:38:24 +01:00
John Bytheway 5e20851c5b Second pass of IWYU changes
IWYU is not entirely idempotent; these are the changes from a second
pass of running it.
2019-04-22 12:02:41 +01:00
John Bytheway e3e7700aef Apply IWYU changes
This is a run of IWYU followed by astyle.
2019-04-22 11:42:51 +01:00
ZhilkinSerg c0bce91fa1 Used const where appropriate 2019-01-06 23:00:08 +03: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
John Bytheway 2041e449d0 Fix unused variable warnings 2018-12-06 22:02:17 +00:00