Just go through ten years, ensure days go forwards in the right
direction, and months/days transition correctly.
Also add a test to check specific time points look correct.
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.
* 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++
Make sure have correct starting/ending season length. Also check that
set_eternal_season doesn't change it when turn eternal season on/off.
See #46473 for the source of this fix, including some tests showing
errors resulting from not having it.
Rewrite existing moon phase tests, and add new tests for moon phases,
synodic month, light during each phase, and moonlight at dusk and dawn.
Behaviors tested:
- Moon has 8 phases (new, crescent, half, gibbous, full, etc. ...)
- Each phase from new to full gives steadily more light
- Full lunar cycle takes ~29.53 days with a 91-day season
- Lunar cycles are scaled based on season length, if not 91 days
- Moonlight dominates the night, early dawn, and late dusk hours
- Phase change always occurs at noon
Reasons for removing the existing tests:
- The "phase_changes_at_noon" test did not in fact test that phase
changed at noon; only that phase did NOT change 1pm and 11am. The new
test directly checks that phase changes occur from 11am-1pm.
- The "phases_take_28_days" test was imprecise about the expected
next-new-moon date, and besides - phases do *not* take 28 days. The new
test checks every day through a 32-day period.
- Due to the use of GENERATE, both tests produced a lot of redundant
output with `--durations yes` (as often used by CI). The new tests have
shorter, more meaningful output.
Some FIXMEs are left in the test cases as a path to potential future
improvement.
For time_durations in excess of 1 week, the formatting code would do the
wrong thing. It tried to format two units worth of time (e.g. 1 week
and 2 days) but the second unit could never be larger than hours. Now
it can be anything up to seasons.
* 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>