21 Commits

Author SHA1 Message Date
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
prharvey a3f5d31341 Replace all global mon_flag_str_id with mon_flag_id located in mtype.h. Initialize them on game load. 2024-01-01 11:31:20 -07:00
David Seguin 12e198612d Jsonify monster flags (#66722)
* jsonify monster flags: code and flag conversion

* jsonify monster flags: docs and lang parser

* jsonify monster flags: optimizations

* jsonify monster flags: remove expensive debug stats tracker for mflags
2023-07-10 13:54:00 -03: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
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
Anton Burmistrov 1f65caca8b Fixed tests 2021-08-12 22:23:20 +04:00
anothersimulacrum 97f9f05e47 Remove strong stomach section of effects test
Remove the strong stomach immunity check in the tests, as it was removed
from the game in a96f069cd8
2021-08-02 10:13:22 +08:00
Venera3 6e829ef634 Add bleed resistance to monsters (#49546)
Co-authored-by: anothersimulacrum <anothersimulacrum@gmail.com>
2021-07-06 19:22:08 -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
Eric e0be945ac1 Merge most effect flags and character flags (#47633) 2021-07-03 07:41:56 -07:00
Venera3 681e80c5bb Adjust monster immunities to venoms, being downed (#46156) 2021-02-18 10:46:23 +03: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
Anton Burmistrov 1446c9da41 Bleeding type for species (#46357)
* Added ability to define bleeding type for species and made monsters bleed this type
* Set specific types of bleeding for species
* Fix tests
2020-12-31 22:15:53 -08:00
Aivean c32a629ceb replace all item flag constants with static string_ids
remove adapter has_flag (and related) methods that took string argument
change all remaining method signatures where item flags were passed as strings
2020-10-18 19:56:40 -07:00
Fris0uman f9c024880c Remove some num_bp in comments, and in the code 2020-10-08 14:28:28 +02:00
Kevin Granade c5ccf0c2c7 IWYU for tests (#42806) 2020-08-09 09:46:57 +03:00
Fris0uman 10e6058207 Remove body_part from effect (#42277)
* Effects use bodypart_id
* remove default value and unecessary overrides
* effect_map use bodypart_str_id, and replace num_bp with bp_null
2020-08-01 22:45:04 +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
Fris0uman 68e91cfe72 Move encumbrance to bodyparts (#41860) 2020-07-08 09:37:37 +03:00
Fris0uman 487d44d2a3 test fix 2020-06-29 22:32:15 +02:00
Eric Pierce f48ecfc4a4 Add creature effect tests
Includes test cases for `Creature` effects, covering functions:

- add_effect, remove_effect
- has_effect, has_effect_with_flag
- resists_effect, is_immune_effect

Behaviors exercised:

- characters may have an effect on a body part, or all-body
- monsters may only have all-body effects (not having body parts)
- monsters immune to an effect can still be forced to have it
- fleshy, warm-blooded monsters can bleed and be poisoned
- bony, non-warm monsters are immune to bleeding and poison
- fleshy, non-warm-blooded monsters are immune to bleeding and poison
- Slimy mutation gives immunity to corroding effect
- Tentacle bracing mutation gives immunity to downing
- Strong Stomach mutation gives immunity to nausea
2020-05-06 07:06:58 +00:00