4 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
actual-nh 82b0740c0c Weariness and sleep (#51686)
* Start on dealing with sleep & weariness

This adds the SLEEP_EXERCISE activity level (0.85). This is not used
for actual caloric expenditure (to avoid needing to increase
NO_EXERCISE, currently 1.0, to compensate). It is the start on adding
in more-fine-tuned weariness recovery vs activity level, including
with various mutations re the need to sleep.

* Update activity_tracker_test for new code

This is not a full update for testing the new sleep-related
functionality, but simply making it work for the non-sleep state.

* Make non-sleeping default for activity tracker

* Fixing tests for updates

* Make low_activity_ticks a float

The purpose is to allow for intermediates between "light+ activity",
"no activity", and "sleep activity", for rounds with mixtures
(including of higher than light activity combined with no activity).

* Correct _EXERCISE vs _ACTIVITY mixup... sigh.

* Fatigue/fatigue regen mods affect weariness

This should allow characters with reduced needs for sleep due to
either reduced fatigue gain while awake or increased fatigue loss
during sleep to get the analogous benefits for weariness recovery -
1/(reduced fatigue gain rates) as a multiplier for recovery while
awake, increased fatigue recovery rates as a multiplier for recovery
while asleep. Note that this will also do the reverse for mutations
such as SLEEPY! NEEDS PLAYTESTING!

* Create a partial test for weary-affecting mutations

This is a partial test because it doesn't check for the effects of
mutations combined with sleep (hopefully yet).

* See if can figure out why no mutation effect

* Not clear_avatar when want a mutation/trait present

* Revert debugmsg since does seem to be getting info

* Schedule each time

Trying to figure out why not getting info back.

* Get avatar inside function - see if changes anything

* DEBUG_LS has an undocumented effect on weariness

* Allow for mutation increasing recovery to beyond 16 hours

* Realized threshold change due to fatigue differences

I realized that the thresholds would be changing also (even during the
digging) due to fatigue-modifying mutations. The revised version may be
too loose - it should be possible to figure out how much of an effect
the threshold changes will have - but will let us see if things are at
least consistent.

* Tighten some parts of test (loosen 1)

In the 8 hours before should be resting, effect on weariness of
mutations should be just from fatigue, which should not be as big as
a full multiplier would make it. Loosen 1 test - the SLEEPY2 mutation
(fatigue modifier 1, thus multiplier 2) appears to result in more
instability, even in the starting 8 hours.

Bit more allowance for roundoff, instability

* Add tests: mutations re weariness recovery while sleep

This adds tests for mutation effects on recovery rates during sleep.
(It also does loosen some numbers a bit more, making playtesting even
more desirable!)

* Use cal, not kcal, for weariness

Weariness levels are being rather unstable, and an increase in precision
may be helpful.

* Decay intake every 5 minutes

Now that intake is in calories, not kcal, roundoff is less of a worry.
This should help with instability from intake updating too infrequently.

* Preset intake to long-term stable value

Intake is likely at least partially fluctuating because it starts at 0,
instead of closer to its long-term stable value. That value, if one
assumes consumption of base_bmr() kcal divided evenly over 24 hours,
and multiplies the new sum by 0.95 (1 - default WEARY_RECOVERY_MULT)
every hour, turns out to be base_bmr()*(19/24), at least empirically.

* Adjust weary tests for new intake boost

Some of the times for the weary tests were, unsurprisingly, affected by
the intake initialization. There were generally delays in becoming
weary with resultant changes with decreases (when applicable). There
were some oddball cases with the 24-hour digging in which the time
went down, and similarly with the 12-hour digging in which the top
weary time went up; I suspect this was an effect of other changes
that were concealed by the intake changes.

* Adjust numbers further for altered tests

* Remove tick_counter, handle migration

tick_counter is no longer needed. intake and tracker are now in
calories, not kcal, so using detection of tick_counter in saves
to trigger multiplication by 1000.

Co-authored-by: actual-nh <actual-nh@users.noreply.github.com>
2021-10-25 15:48:41 -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
Kevin Granade 8bc8877fc4 Increase granularity of activity tracking to per turn. (#45316)
* Extract activity and weariness tracking to a helper class.

Co-authored-by: Alex Mooney <alexmooney@fastmail.com>
2021-03-31 11:35:31 +03:00