From 14769138c06009e7a4c917fe60192e5db1083586 Mon Sep 17 00:00:00 2001 From: John Bytheway Date: Sat, 14 Dec 2019 21:14:12 -0500 Subject: [PATCH] Add iteminfo tests for nutrient display --- tests/iteminfo_test.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index ffa2434c47404..a11040fa3062b 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -57,6 +57,7 @@ TEST_CASE( "gun_lists_default_ammo", "[item][iteminfo]" ) "--\n" "Gun is not loaded, so stats below assume the default ammo: wooden broadhead arrow\n" ); } + TEST_CASE( "gun_damage_multiplier_not_integer", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::GUN_DAMAGE, iteminfo_parts::GUN_DAMAGE_AMMOPROP, @@ -67,3 +68,34 @@ TEST_CASE( "gun_damage_multiplier_not_integer", "[item][iteminfo]" ) "--\n" "Damage: 18*1.25 = 22\n" ); } + +TEST_CASE( "nutrients_in_regular_item", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::FOOD_NUTRITION, iteminfo_parts::FOOD_VITAMINS, + iteminfo_parts::FOOD_QUENCH + } ); + item i( "icecream" ); + iteminfo_test( + i, q, + "--\n" + "Calories (kcal): 325 " + "Quench: 0\n" + "Vitamins (RDA): Calcium (9%), Vitamin A (9%), and Vitamin B12 (11%)\n" ); +} + +TEST_CASE( "nutrient_ranges_for_recipe_exemplars", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::FOOD_NUTRITION, iteminfo_parts::FOOD_VITAMINS, + iteminfo_parts::FOOD_QUENCH + } ); + item i( "icecream" ); + i.set_var( "recipe_exemplar", "icecream" ); + iteminfo_test( + i, q, + "--\n" + "Nutrition will vary with chosen ingredients.\n" + "Calories (kcal): 313-" + "469 Quench: 0\n" + "Vitamins (RDA): Calcium (7-28%), Iron (0-83%), " + "Vitamin A (3-11%), Vitamin B12 (2-6%), and Vitamin C (1-85%)\n" ); +}