Commit Graph

32 Commits

Author SHA1 Message Date
Fris0uman 36b9376843 Setup tests of the various type of automatic trigger for mutations (#47873) 2021-03-08 23:24:35 +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
Eric Pierce c9d731b19e Improve and document mutation tests
The intended purpose of these mutation tests was somewhat obscure, and
the output on failure could be difficult to interpret. This commit aims
to improve them in the following ways:

- Add a new test focused on a simple example with only 3 mutations
- Add explanatory comments to each test, to clarify the intent
- Replace 'auto' variables with explicit types, to aid static analysis
- Reduce the number of unnecessary assertions, to make output cleaner
2020-09-08 03:50:54 +00:00
Kevin Granade 0efd93fbfa Merge pull request #43983 from jbytheway/cpp_declarations
More stringent check forcing file-local things to be static
2020-09-08 01:42:07 +00:00
Kevin Granade b607788eb8 Wip mutation category (#44010)
* Add documentation for mutation_category JSON entity

* Misc doc fixes

* Add flag to suppress consistency checking of unfinished mutation categories
2020-09-07 08:43:03 +03: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 d63d3bd35a Make mutation_category ids be string_ids
The mutation_category_trait objects have ids, but they were just
std::strings.  Make them be a string_id<mutation_category_trait>
instead.

This is a general move towards type safety, although the specific goal I
wanted to achieve was better validity checking of cata_variants.
2020-09-03 07:39:35 -04:00
Eric Pierce 8e8ed7fdb4 Allow Scout trait to work with Self-Aware trait
Correct the "overmap_sight" mutation value map to be additive, rather
than multiplicative. Include a regression test that failed before this
change, and passes afterward.

Fix #42853

For reasons I do not understand, using "multiplicative" here caused the
"Self-Aware" trait to nullify the overmap sight adjustments from both
the "Scout" and "Topographagnosia" traits.
2020-08-14 21:17:31 -06:00
Kevin Granade c5ccf0c2c7 IWYU for tests (#42806) 2020-08-09 09:46:57 +03:00
Kevin Granade 2684dcbcf1 Merge pull request #42480 from ZhilkinSerg/sa-2020-06-29
Code optimizations reported by static code analysis (2020-06-29)
2020-07-29 23:55:24 +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
ZhilkinSerg 6a96a7ffdb Get rid of autos (+ constify) 2020-07-28 22:08:34 +03:00
Fris0uman 68e91cfe72 Move encumbrance to bodyparts (#41860) 2020-07-08 09:37:37 +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
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 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 52069b57e8 Missing #includes in tests 2018-12-01 11:59:26 +00:00
ZhilkinSerg 410a32c031 Refactored C-style ( T ) ( x ) casts to static_cast<T>( x ) 2018-11-07 14:19:56 +03:00
ZhilkinSerg f8eb2acd05 Optimized includes (tests) 2018-11-07 03:55:47 +03:00
ZhilkinSerg 4bfce17d3c Astyle 2018-09-07 17:20:46 +03:00
Kevin Granade e542b83c32 Add a few retries to give_All_mutations(). 2018-09-07 08:31:43 +00:00
Jianxiang Wang (王健翔) 72fb428110 Detect unexpected mutation failure in the mutation unit test (#25401) 2018-09-06 19:33:40 +00:00
Kelenius d0cb56f03c Updated mutation test 2018-04-19 14:14:31 +03:00
Coolthulhu 04772ad3b9 Astyle 2017-10-25 16:00:45 +02:00
Coolthulhu 480af708d4 Get rid of string hacks for mutation categories 2017-10-25 15:56:31 +02:00
Pausbrak 2cff5d71b4 astyle 2017-10-05 22:04:06 -04:00
Pausbrak 41f1d336d4 use temporary NPC instead of the global player 2017-10-05 21:56:09 -04:00
ryan b31b201856 astyle 2017-09-17 19:29:33 -04:00
ryan 21b616bc45 Added threshold breach chance test 2017-09-17 19:05:20 -04:00
ryan 64ee785784 Add sanity check test for mutation categories 2017-09-17 17:55:01 -04:00