From 1837243c354ef446d474a0853beb952ef22150c9 Mon Sep 17 00:00:00 2001 From: John Bytheway Date: Fri, 6 Dec 2019 23:53:36 -0500 Subject: [PATCH] Added test for the effect of tapeworm on calories --- tests/stomach_contents_tests.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/stomach_contents_tests.cpp b/tests/stomach_contents_tests.cpp index 96aaed52a7896..7c13bc8e6c7da 100644 --- a/tests/stomach_contents_tests.cpp +++ b/tests/stomach_contents_tests.cpp @@ -187,6 +187,25 @@ TEST_CASE( "all_nutrition_starve_test" ) CHECK( dummy.vitamin_get( vitamin_id( "calcium" ) ) >= -100 ); } +TEST_CASE( "tape_worm_halves_nutrients" ) +{ + const efftype_id effect_tapeworm( "tapeworm" ); + const bool print_tests = false; + player &dummy = g->u; + reset_time(); + clear_stomach( dummy ); + eat_all_nutrients( dummy ); + print_stomach_contents( dummy, print_tests ); + int regular_kcal = dummy.stomach.get_calories(); + clear_stomach( dummy ); + dummy.add_effect( effect_tapeworm, 1_days ); + eat_all_nutrients( dummy ); + print_stomach_contents( dummy, print_tests ); + int tapeworm_kcal = dummy.stomach.get_calories(); + + CHECK( tapeworm_kcal == regular_kcal / 2 ); +} + // reasonable length of time to pass before hunger sets in TEST_CASE( "hunger" ) {