- debug.cpp: bugprone-command-processor on the three popen call sites
(nm symbol resolution, addr2line frame symbolization, crash-handler
shell_exec helper). These are debug/crash paths that intentionally
shell out.
- flexbuffer_cache.cpp: append bugprone-unchecked-string-to-number-conversion
to the existing cert-err34-c NOLINTs on the three sscanf calls that
parse compiler error strings; the parsed values are validated below.
- rng_test.cpp: append bugprone-float-loop-counter to the two existing
NOLINTs guarding the log-distribution sampling loop.
- test_main.cpp: bugprone-exception-escape on main; the test runner
lets exceptions propagate by design.
- zzip_test.cpp: append misc-predictable-rand to the existing NOLINT
guarding deterministic test byte generation.
- ncurses_def.cpp: cata-use-string_view on set_title; signature has
to mirror the sdltiles and wincurse implementations that use .c_str().
NPCs now drink from nearby water terrain, eat food from the ground,
and wear warm clothing from the ground. Seven reusable find/act
helpers with full pickup governance (ally rules, NO_NPC_PICKUP zones,
ownership, LOS). Danger-gate split: adjacent actions before the gate,
pathing after. Warmth gate switched from BT subtree to direct
needs_warmth_badly predicate.
Lazy game init in the listener replaces the filterTests/getAllTestCasesSorted
pre-scan. CataCIReporter (unused ConsoleReporter subclass) removed.
normalized_test_names_test internal API call extracted into a helper.
Listener stream member replaced with std::cerr (v3 removes it).
Add a testCaseEnded hook to the Catch2 listener that resets
commonly-leaked lightweight global state after each test case.
Currently calendar::turn, weather overrides, and temperature
cache leak freely between tests, causing order-dependent failures.
Expensive operations like clear_map() stay manual and explicit.
This should make test issues *a tiny bit* easier to debug.
For example, it will now be easy to know where does the
'loading non-main map at (0,0,0) which overlaps with main map (abs_sub =
(-5,-5,0))'
come from
* rewrite the loading screen to use ImGui
and simplify the usage too.
* write a loading screen for when we’re not using ImGui too
Fixes#75678
* add a stupid comment to appease clang
plus some other small changes to appease a different version of clang
---------
Co-authored-by: Daniel Brooks <db48x@orod-na-thon.tailcd79e.ts.net>
* Use Catch2 own argument parser
Parsing functions now works on strings, or removed.
Local variables promoted file global for upcoming listeners.
* Run init_global_game_state from Catch2 event listener
This avoid delay for Catch2 processing own options like --list-tests
* Obey linters
* Obey clang-tidy
Use `static`, `string_view`, avoid `auto`
* Apply .astylerc
* Fix crashing and print invalid values on listing
* Remember the RNG seed used the very first time
* Report the seed used by the game engine
* Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Colorize JSON errors
* Make formatter feed source filename to TextJsonIn
* Throw exception instead of dumping output to std::cerr
* Adjust math parser's caret appearance
* Set color in chkjson
* Adjust tests and formatters
* Add json error cursor check for unicode string
* Squelch global state lint for entry points
* Adjust stream offset so the buffer for utf8_width is pointing at a codepoint
* Log SDL renderers on one line
* Don't try to enumerate non-existing directories
* Remove a few more lines of log noise
* Actually leave the test world for inspection
In LLVM 16 this check was a lot more effective. So, it was briefly
disabled during the migration. This fixes all its warnings again, and
re-enables it.
* Add clang-tidy check to ensure fs::u8path is used to construct path from utf-8 string
* Fix fs::u8path and nullptr warnings
* Print error instead of showing a popup in test mode in write_to_file
* Remove cata::fstream wrappers
This check is mostly about using 'const Foo' where Foo is a typedef of a
pointer type. That can be confusing because people might think the
constness applies to the pointee type (like it would if Foo was a
macro), but it doesn't.
All the examples in CDDA were a result of the WORLDPTR typedef. I just
removed that typedef entirely since it served no real purpose; it was
just a longer way to type WORLD*. This change allowed improved
const-correctness and removing one const_cast.
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.
Extend the cata-assert check to suggest using cata_fatal, a new macro
for fatal errors.
Use that new macro to replace uses of abort, assert( false ), etc.
The output for successful tests, even if such is requested of via
Catch2's `-s` flag, now includes messages; it didn't before.
Co-authored-by: actual-nh <actual-nh@users.noreply.github.com>
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.
Run clang-tidy and fix or suppress all the issues it found. This
includes a few of the type of issue intended to be found, and one issue
in the check code itself.
* 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++