31 Commits

Author SHA1 Message Date
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
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
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
PatrikLundell 8f19d8e971 typified map.h + dependents, end of first pass (#76888) 2024-10-07 13:23:18 -07:00
PatrikLundell ab062c5e8b typified a bit of map.h/cpp + some dependents (#75125)
* typified a bit of map.h/cpp + some dependents

* Macro crasher found by one compiler!

* demanded changes

* stupid wokaround for demanded changes

* Sort out conflict mess
2024-09-10 09:42:54 -05:00
PatrikLundell 4ba6a9f7a8 Typified parts of map.h/map.cpp + usages 2024-07-18 00:23:02 +02:00
PatrikLundell 38267e0b54 Typified a bit of map.h/cpp (#74963)
* Typified a bit of map.h/cpp

* demanded changes
2024-07-10 21:45:20 -04:00
Procyonae e9f4fbd110 Remove extern ter ids (#72766) 2024-04-04 07:08:37 -07:00
Dillon Matchett 112b97a671 Move field halflife initialize to seperate function (#66700)
* add initialize function

* Testing
2023-07-06 19:54:09 -04:00
Dillon Matchett 245d2c818d Field Immunity At Effect Level (#66683)
* Code, Tests, Docs

* Update doc/JSON_INFO.md

Co-authored-by: David Seguin <davidseguin@live.ca>

---------

Co-authored-by: David Seguin <davidseguin@live.ca>
2023-07-05 23:04:13 -04: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
Joshua Chin 4353033b81 Add "mayfail" flag to fire spreading test 2021-09-07 16:21:44 -04:00
Zhilkin Serg 5cb2655590 Rename ter_bitflags to ter_furn_flag and make it class enum 2021-08-30 22:14:22 +03:00
Kevin Granade bc1d00cf4b More field spread sanity checks (#51212)
* More field spread sanity checks

* Set weather to clear in fire spread test
2021-08-29 22:19:08 -07:00
Kevin Granade fff078ac1d Sanity check for field spread test 2021-08-28 23:15:47 -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
actual-nh 446f13c73a Radioactive fields test allows equality (#48121)
* Use <= instead of < in one field test

The radioactive field test is repeatedly failing due to the test being
for less-than instead of less-than-or-equal (300 vs 300 turns). Due to
test logs not being searchable on either Github or Travis, I am not
able to locate some past cases I have seen, but I can locate
https://travis-ci.org/github/CleverRaven/Cataclysm-DDA/jobs/763202025
and
https://github.com/CleverRaven/Cataclysm-DDA/pull/48119/checks?check_run_id=2143797637.
(I am grateful to wapcaplet for the PR enabling actually seeing what
the numbers were.)

* Remove 2 unneeded changes.

I had been thinking of making all of the less-than turns into
less-than-or-equal turns, but decided against it. Some edits were left
over; this commit removes them.

Co-authored-by: actual-nh <actual-nh@users.noreply.github.com>
2021-03-21 09:03:25 +03:00
Eric Pierce fc3b949281 Compare turns instead of time_durations
Using CHECK with a time_duration yields unhelpful messages like:

    CHECK( fields_test_duration() < time_limit )
    {?} < {?}

Converting the compared values to an integer number of turns allows the
messages (for both success and failure) to be more intelligible, like:

    CHECK( fields_test_turns() < time_limit_turns )
    113 < 3600 (0xe10)
2021-03-12 13:26:23 -07:00
MarlossCDDA cb107ae7db Pump up time limit on field_test
The comment explicitly says that there's no basis for choosing 5 minutes
and it's fine to bump it, so that's what I'm doing
2021-03-11 18:28:50 -05:00
Aivean 885813aa47 fix #47479: gas spreading to the neighbour tiles in the case when target intensity is zero (field was removed in the same turn)
* added param `alive_only` to `field::find_field` methods. By default "removed" fields are not returned
* all field-related methods in `map` treat fields with zero intensity as non-existing
2021-02-16 17:43:28 -08:00
Aivean 3bb438ff82 change map::remove_field to mark fields as "not alive" deferring their actual removal to the map::process_fields_in_submap
fixes crash in  map::player_in_field (#47308)
2021-02-07 21:31:05 -08: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
Ivan Zaitsev 6ee435af3c Split map::process_fields_in_submap into field processors (#47076)
* extract "field processors" from `map::process_fields_in_submap`
simplify `field_type` and `field_entry` interfaces
* rewrite field_processor_fd_shock_vent using points (fixes clang-tidy warnings)
Co-authored-by: Binrui Dong <brett.browning.dong@gmail.com>
2021-02-05 18:48:37 -08:00
Zhilkin Serg 86e901a834 Merge pull request #47061 from Aivean/field_tests
Add bunch of unit tests for fields
2021-01-28 01:44:02 +03:00
Aivean ab52ccb646 fix fd_flame_burst intensity (required by fd_fire_vent)
add new unit tests for fields
2021-01-26 19:34:46 -08:00
Aivean 2af99d0a39 increase error margin for the acid decay test to reduce flakiness 2021-01-26 12:53:44 -08:00
Kevin Granade df54339b4b Exclude fire from exponential decay (#45431)
* Exclude fire from exponential decay

* Add a scaling factor of log2(e), experimentally determined.

* Add some basic tests for exiry time of fields

* Apply suggestions from code review

Co-authored-by: Curtis Merrill <curtis.r.merrill@gmail.com>

* Apply suggestions from code review

* Add M_LOG2E to math defines

Co-authored-by: Zhilkin Serg <ZhilkinSerg@users.noreply.github.com>
Co-authored-by: Curtis Merrill <curtis.r.merrill@gmail.com>
2020-11-24 12:19:14 +03:00