From 17664c12fc8eb2cad8894e747211c42e814a6618 Mon Sep 17 00:00:00 2001 From: Eric Pierce Date: Fri, 7 Feb 2020 17:33:22 -0700 Subject: [PATCH 1/9] Add tests for basic info, conductivity, qualities Tests item info for description, category, volume, weight, qualities and conductivity. --- tests/iteminfo_test.cpp | 61 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index 46a1e4ea495e1..3d9bc4cfae4e8 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -16,6 +16,19 @@ static void iteminfo_test( const item &i, const iteminfo_query &q, const std::st CHECK( info == reference ); } +TEST_CASE( "show basic item info", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::DESCRIPTION, iteminfo_parts::BASE_CATEGORY, + iteminfo_parts::BASE_VOLUME, iteminfo_parts::BASE_WEIGHT } ); + iteminfo_test( + item( "jug_plastic" ), q, + "A standard plastic jug used for milk and household cleaning chemicals.\n" + "--\n" + "Category: CONTAINERS" + "Volume: 3.750 L" + " Weight: 0.42 lbs\n" ); +} + TEST_CASE( "armor_info", "[item][iteminfo]" ) { // Just a generic typical piece of clothing @@ -99,3 +112,51 @@ TEST_CASE( "nutrient_ranges_for_recipe_exemplars", "[item][iteminfo]" ) "Vitamins (RDA): Calcium (7-28%), Iron (0-83%), " "Vitamin A (3-11%), Vitamin B12 (2-6%), and Vitamin C (1-85%)\n" ); } + +TEST_CASE( "show item conductivity", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::DESCRIPTION_CONDUCTIVITY } ); + + SECTION( "non-conductive items" ) { + iteminfo_test( + item( "2x4" ), q, + "--\n" + "* This item does not conduct electricity.\n" ); + iteminfo_test( + item( "fire_ax" ), q, + "--\n" + "* This item does not conduct electricity.\n" ); + } + + SECTION( "conductive items" ) { + iteminfo_test( + item( "pipe" ), q, + "--\n" + "* This item conducts electricity.\n" ); + iteminfo_test( + item( "halligan" ), q, + "--\n" + "* This item conducts electricity.\n" ); + } +} + +TEST_CASE( "show item qualities", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::QUALITIES } ); + + SECTION( "screwdriver" ) { + iteminfo_test( + item( "screwdriver" ), q, + "--\n" + "Has level 1 screw driving quality.\n" ); + } + + SECTION( "screwdriver_set" ) { + iteminfo_test( + item( "screwdriver_set" ), q, + "--\n" + "Has level 1 screw driving quality.\n" + "Has level 1 fine screw driving quality.\n" ); + } +} + From 77b27be65493a36161386cd019ac19c75dba04ff Mon Sep 17 00:00:00 2001 From: Eric Pierce Date: Fri, 7 Feb 2020 19:21:28 -0700 Subject: [PATCH 2/9] Enhance and clean up iteminfo tests Include price and material in basic info test; refactor armor_info tests into one test case with two sections. All passing. --- tests/iteminfo_test.cpp | 64 +++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index 3d9bc4cfae4e8..ba1f0a31f8d48 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -16,52 +16,54 @@ static void iteminfo_test( const item &i, const iteminfo_query &q, const std::st CHECK( info == reference ); } -TEST_CASE( "show basic item info", "[item][iteminfo]" ) +TEST_CASE( "item description and physical attributes", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::DESCRIPTION, iteminfo_parts::BASE_CATEGORY, - iteminfo_parts::BASE_VOLUME, iteminfo_parts::BASE_WEIGHT } ); + iteminfo_parts::BASE_PRICE, iteminfo_parts::BASE_VOLUME, + iteminfo_parts::BASE_WEIGHT, iteminfo_parts::BASE_MATERIAL } ); iteminfo_test( item( "jug_plastic" ), q, "A standard plastic jug used for milk and household cleaning chemicals.\n" "--\n" - "Category: CONTAINERS" + "Category: CONTAINERS Price: $0.00\n" "Volume: 3.750 L" - " Weight: 0.42 lbs\n" ); -} - -TEST_CASE( "armor_info", "[item][iteminfo]" ) -{ - // Just a generic typical piece of clothing - iteminfo_query q( { iteminfo_parts::ARMOR_BODYPARTS, iteminfo_parts::ARMOR_LAYER, - iteminfo_parts::ARMOR_COVERAGE, iteminfo_parts::ARMOR_WARMTH, - iteminfo_parts::ARMOR_ENCUMBRANCE, iteminfo_parts::ARMOR_PROTECTION - } ); - iteminfo_test( - item( "longshirt" ), q, - "--\n" - // NOLINTNEXTLINE(cata-text-style) - "Covers: The torso. The arms. \n" - // NOLINTNEXTLINE(cata-text-style) - "Layer: Normal. \n" - "Coverage: 90% Warmth: 5\n" + " Weight: 0.42 lbs\n" "--\n" - "Encumbrance: 3 (poor fit)\n" - "Protection: Bash: 1 Cut: 1\n" - " Acid: 0 Fire: 0 Environmental: 0\n" ); + "Material: Plastic\n" ); + } -TEST_CASE( "if_covers_nothing_omit_irreelevant_info", "[item][iteminfo]" ) +TEST_CASE( "armor info", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::ARMOR_BODYPARTS, iteminfo_parts::ARMOR_LAYER, iteminfo_parts::ARMOR_COVERAGE, iteminfo_parts::ARMOR_WARMTH, iteminfo_parts::ARMOR_ENCUMBRANCE, iteminfo_parts::ARMOR_PROTECTION } ); - iteminfo_test( - item( "ear_plugs" ), q, - "--\n" - "Covers: Nothing.\n" ); + + SECTION( "shows coverage and protection values" ) { + iteminfo_test( + item( "longshirt" ), q, + "--\n" + // NOLINTNEXTLINE(cata-text-style) + "Covers: The torso. The arms. \n" + // NOLINTNEXTLINE(cata-text-style) + "Layer: Normal. \n" + "Coverage: 90% Warmth: 5\n" + "--\n" + "Encumbrance: 3 (poor fit)\n" + "Protection: Bash: 1 Cut: 1\n" + " Acid: 0 Fire: 0 Environmental: 0\n" ); + } + + SECTION( "omits irrelevant info if it covers nothing" ) { + iteminfo_test( + item( "ear_plugs" ), q, + "--\n" + "Covers: Nothing.\n" ); + } } + TEST_CASE( "gun_lists_default_ammo", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::GUN_DEFAULT_AMMO } ); @@ -113,7 +115,7 @@ TEST_CASE( "nutrient_ranges_for_recipe_exemplars", "[item][iteminfo]" ) "Vitamin A (3-11%), Vitamin B12 (2-6%), and Vitamin C (1-85%)\n" ); } -TEST_CASE( "show item conductivity", "[item][iteminfo]" ) +TEST_CASE( "item conductivity", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::DESCRIPTION_CONDUCTIVITY } ); @@ -140,7 +142,7 @@ TEST_CASE( "show item conductivity", "[item][iteminfo]" ) } } -TEST_CASE( "show item qualities", "[item][iteminfo]" ) +TEST_CASE( "list of item qualities", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::QUALITIES } ); From b7b3341a7e83ea92240caa8a323f16951909377e Mon Sep 17 00:00:00 2001 From: Eric Pierce Date: Fri, 7 Feb 2020 21:43:58 -0700 Subject: [PATCH 3/9] Add weapon, repairability, and flags Includes tests for: - Weapon attack rating and mvoes - Techniques when wielded - Repairability and with what tools - Item description flags --- tests/iteminfo_test.cpp | 149 ++++++++++++++++++++++++++++++++-------- 1 file changed, 119 insertions(+), 30 deletions(-) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index ba1f0a31f8d48..c00df39283df0 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -33,14 +33,42 @@ TEST_CASE( "item description and physical attributes", "[item][iteminfo]" ) } -TEST_CASE( "armor info", "[item][iteminfo]" ) +TEST_CASE( "weapon attack ratings and moves", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::BASE_DAMAGE, iteminfo_parts::BASE_TOHIT, + iteminfo_parts::BASE_MOVES } ); + + iteminfo_test( + item( "halligan" ), q, + "Bash: 20" + " Cut: 5" + " To-hit bonus: +2\n" + "Moves per attack: 145\n" ); + +} + +TEST_CASE( "techniques when wielded", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::DESCRIPTION_TECHNIQUES } ); + + iteminfo_test( + item( "halligan" ), q, + "--\n" + "Techniques when wielded:" + " Brutal Strike: Stun 1 turn, knockback 1 tile, crit only," + " Sweep Attack: Down 2 turns, and" + " Block: Medium blocking ability\n" ); + +} + +TEST_CASE( "armor coverage and protection values", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::ARMOR_BODYPARTS, iteminfo_parts::ARMOR_LAYER, iteminfo_parts::ARMOR_COVERAGE, iteminfo_parts::ARMOR_WARMTH, iteminfo_parts::ARMOR_ENCUMBRANCE, iteminfo_parts::ARMOR_PROTECTION } ); - SECTION( "shows coverage and protection values" ) { + SECTION( "shows coverage, encumbrance, and protection for armor with coverage" ) { iteminfo_test( item( "longshirt" ), q, "--\n" @@ -64,7 +92,7 @@ TEST_CASE( "armor info", "[item][iteminfo]" ) } -TEST_CASE( "gun_lists_default_ammo", "[item][iteminfo]" ) +TEST_CASE( "default ammo for gun", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::GUN_DEFAULT_AMMO } ); iteminfo_test( @@ -73,7 +101,7 @@ TEST_CASE( "gun_lists_default_ammo", "[item][iteminfo]" ) "Gun is not loaded, so stats below assume the default ammo: wooden broadhead arrow\n" ); } -TEST_CASE( "gun_damage_multiplier_not_integer", "[item][iteminfo]" ) +TEST_CASE( "gun damage with floating-point damage multiplier", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::GUN_DAMAGE, iteminfo_parts::GUN_DAMAGE_AMMOPROP, iteminfo_parts::GUN_DAMAGE_TOTAL @@ -84,35 +112,34 @@ TEST_CASE( "gun_damage_multiplier_not_integer", "[item][iteminfo]" ) "Damage: 18*1.25 = 22\n" ); } -TEST_CASE( "nutrients_in_regular_item", "[item][iteminfo]" ) -{ +TEST_CASE( "nutrients in food", "[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" ); -} + SECTION( "fixed nutrient values in regular item" ) + { + 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): 317-" - "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" ); + SECTION( "nutrient ranges for recipe exemplars", "[item][iteminfo]" ) + { + item i( "icecream" ); + i.set_var( "recipe_exemplar", "icecream" ); + iteminfo_test( + i, q, + "--\n" + "Nutrition will vary with chosen ingredients.\n" + "Calories (kcal): 317-" + "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" ); + } } TEST_CASE( "item conductivity", "[item][iteminfo]" ) @@ -153,12 +180,74 @@ TEST_CASE( "list of item qualities", "[item][iteminfo]" ) "Has level 1 screw driving quality.\n" ); } - SECTION( "screwdriver_set" ) { + SECTION( "screwdriver set" ) { iteminfo_test( item( "screwdriver_set" ), q, "--\n" "Has level 1 screw driving quality.\n" "Has level 1 fine screw driving quality.\n" ); } + + SECTION( "Halligan bar" ) { + iteminfo_test( + item( "halligan" ), q, + "--\n" + "Has level 1 digging quality.\n" + "Has level 2 hammering quality.\n" + "Has level 4 prying quality.\n" ); + } +} + +TEST_CASE( "repairable and with what tools", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::DESCRIPTION_REPAIREDWITH } ); + + iteminfo_test( + item( "longshirt" ), q, + "--\n" + "Repaired with: bone needle, wooden needle, sewing kit, or tailor's kit\n" + "--\n" + "* This item can be reinforced.\n" ); + + iteminfo_test( + item( "halligan" ), q, + "--\n" + "Repaired with: extended toolset, arc welder, or makeshift arc welder\n" ); + + iteminfo_test( + item( "hazmat_suit" ), q, + "--\n" + "Repaired with: soldering iron or extended toolset\n" ); + + iteminfo_test( + item( "rock" ), q, + "--\n" + "* This item is not repairable.\n" ); +} + +TEST_CASE( "item description flags", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::DESCRIPTION_FLAGS } ); + + iteminfo_test( + item( "halligan" ), q, + "--\n" + "* This item can be clipped on to a belt loop of the appropriate size.\n" + "* As a weapon, this item is well-made and will" + " withstand the punishment of combat.\n" ); + + iteminfo_test( + item( "hazmat_suit" ), q, + "--\n" + "* This gear completely protects you from" + " electric discharges.\n" + "* This gear completely protects you from" + " any gas.\n" + "* This gear is generally worn over clothing.\n" + "* This clothing completely protects you from" + " radiation.\n" + "* This piece of clothing is designed to keep you dry in the rain.\n" + "* This clothing won't let water through." + " Unless you jump in the river or something like that.\n" ); } From 8b9c4fe5454fc7639cdab1b01003f295f52310b9 Mon Sep 17 00:00:00 2001 From: Eric Pierce Date: Sat, 8 Feb 2020 06:08:41 -0700 Subject: [PATCH 4/9] Add missing brace and fix brace style --- tests/iteminfo_test.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index c00df39283df0..f05ddc11bf034 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -113,11 +113,11 @@ TEST_CASE( "gun damage with floating-point damage multiplier", "[item][iteminfo] } TEST_CASE( "nutrients in food", "[item][iteminfo]" ) +{ iteminfo_query q( { iteminfo_parts::FOOD_NUTRITION, iteminfo_parts::FOOD_VITAMINS, iteminfo_parts::FOOD_QUENCH } ); - SECTION( "fixed nutrient values in regular item" ) - { + SECTION( "fixed nutrient values in regular item" ) { item i( "icecream" ); iteminfo_test( i, q, @@ -127,8 +127,7 @@ TEST_CASE( "nutrients in food", "[item][iteminfo]" ) "Vitamins (RDA): Calcium (9%), Vitamin A (9%), and Vitamin B12 (11%)\n" ); } - SECTION( "nutrient ranges for recipe exemplars", "[item][iteminfo]" ) - { + SECTION( "nutrient ranges for recipe exemplars", "[item][iteminfo]" ) { item i( "icecream" ); i.set_var( "recipe_exemplar", "icecream" ); iteminfo_test( From 0192fbeb20887426de38a646aeb27ec26b31462d Mon Sep 17 00:00:00 2001 From: Eric Pierce Date: Sat, 8 Feb 2020 08:04:40 -0700 Subject: [PATCH 5/9] Expand ranged weapon and food spoilage tests Using compound bow to test: - reload time - firing mode - weapon mods Using pine nuts to test: - freshness/spoiled indicator --- tests/iteminfo_test.cpp | 99 ++++++++++++++++++++++++++++++++++------- 1 file changed, 82 insertions(+), 17 deletions(-) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index f05ddc11bf034..e72a216cdcf8e 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -3,10 +3,12 @@ #include #include "avatar.h" +#include "calendar.h" #include "catch/catch.hpp" #include "game.h" #include "item.h" #include "iteminfo_query.h" +#include "itype.h" static void iteminfo_test( const item &i, const iteminfo_query &q, const std::string &reference ) { @@ -91,25 +93,61 @@ TEST_CASE( "armor coverage and protection values", "[item][iteminfo]" ) } } - -TEST_CASE( "default ammo for gun", "[item][iteminfo]" ) +TEST_CASE( "ranged weapon attributes", "[item][iteminfo]" ) { - iteminfo_query q( { iteminfo_parts::GUN_DEFAULT_AMMO } ); - iteminfo_test( - item( "compbow" ), q, - "--\n" - "Gun is not loaded, so stats below assume the default ammo: wooden broadhead arrow\n" ); -} + SECTION( "ammo capacity" ) { + iteminfo_query q( { iteminfo_parts::GUN_CAPACITY } ); + iteminfo_test( + item( "compbow" ), q, + "--\n" + "Capacity: 1 round of arrows\n" ); + } + + SECTION( "default ammo when unloaded" ) { + iteminfo_query q( { iteminfo_parts::GUN_DEFAULT_AMMO } ); + iteminfo_test( + item( "compbow" ), q, + "--\n" + "Gun is not loaded, so stats below assume the default ammo:" + " wooden broadhead arrow\n" ); + } + + SECTION( "damage including floating-point multiplier" ) { + iteminfo_query q( { iteminfo_parts::GUN_DAMAGE, iteminfo_parts::GUN_DAMAGE_AMMOPROP, + iteminfo_parts::GUN_DAMAGE_TOTAL + } ); + iteminfo_test( + item( "compbow" ), q, + "--\n" + "Damage: 18*1.25 = 22\n" ); + } + + SECTION( "time to reload" ) { + iteminfo_query q( { iteminfo_parts::GUN_RELOAD_TIME } ); + iteminfo_test( + item( "compbow" ), q, + "--\n" + "Reload time: 110 moves \n" ); + } + + SECTION( "firing modes" ) { + iteminfo_query q( { iteminfo_parts::GUN_FIRE_MODES } ); + iteminfo_test( + item( "compbow" ), q, + "--\n" + "Fire modes: manual (1)\n" ); + } + + SECTION( "weapon mods" ) { + iteminfo_query q( { iteminfo_parts::DESCRIPTION_GUN_MODS } ); + iteminfo_test( + item( "compbow" ), q, + "--\n" + "Mods: 0/2 accessories;" + " 0/1 dampening; 0/1 sights;" + " 0/1 stabilizer; 0/1 underbarrel.\n" ); + } -TEST_CASE( "gun damage with floating-point damage multiplier", "[item][iteminfo]" ) -{ - iteminfo_query q( { iteminfo_parts::GUN_DAMAGE, iteminfo_parts::GUN_DAMAGE_AMMOPROP, - iteminfo_parts::GUN_DAMAGE_TOTAL - } ); - iteminfo_test( - item( "compbow" ), q, - "--\n" - "Damage: 18*1.25 = 22\n" ); } TEST_CASE( "nutrients in food", "[item][iteminfo]" ) @@ -141,6 +179,33 @@ TEST_CASE( "nutrients in food", "[item][iteminfo]" ) } } +TEST_CASE( "food freshness and lifetime", "[item][iteminfo]" ) +{ + iteminfo_query q( { iteminfo_parts::FOOD_ROT } ); + + SECTION( "food is fresh" ) { + iteminfo_test( + item( "pine_nuts" ), q, + "--\n" + "* This food is perishable, and at room temperature has" + " an estimated nominal shelf life of 6 weeks.\n" + "* This food looks as fresh as it can be.\n" ); + } + + SECTION( "food is old" ) { + item nuts( "pine_nuts" ); + nuts.mod_rot( nuts.type->comestible->spoils ); + iteminfo_test( + nuts, q, + "--\n" + "* This food is perishable, and at room temperature has" + " an estimated nominal shelf life of 6 weeks.\n" + "* This food looks old. It's on the brink of becoming inedible.\n" ); + } + +} + + TEST_CASE( "item conductivity", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::DESCRIPTION_CONDUCTIVITY } ); From 16426e53226694f41fdfd1cff5f68ed4d59d9d37 Mon Sep 17 00:00:00 2001 From: Eric Pierce Date: Mon, 10 Feb 2020 17:10:39 -0700 Subject: [PATCH 6/9] Remove longshirt repair test This test fails with the magiclysm mod loaded, since it inserts "enchanted tailor's kit" into the repair options. Since it's not essential, I simply took it out for now. --- tests/iteminfo_test.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index e72a216cdcf8e..3e0152f33c2d9 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -266,13 +266,6 @@ TEST_CASE( "repairable and with what tools", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::DESCRIPTION_REPAIREDWITH } ); - iteminfo_test( - item( "longshirt" ), q, - "--\n" - "Repaired with: bone needle, wooden needle, sewing kit, or tailor's kit\n" - "--\n" - "* This item can be reinforced.\n" ); - iteminfo_test( item( "halligan" ), q, "--\n" From 96b76dda501543afbb78fb80fb1f1c323b5381df Mon Sep 17 00:00:00 2001 From: Eric Pierce Date: Tue, 11 Feb 2020 07:36:00 -0700 Subject: [PATCH 7/9] Remove trailing space Co-Authored-By: Isaac Freund --- tests/iteminfo_test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index 36fa01507566f..92930a10d6dfb 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -128,7 +128,7 @@ TEST_CASE( "ranged weapon attributes", "[item][iteminfo]" ) iteminfo_test( item( "compbow" ), q, "--\n" - "Reload time: 110 moves \n" ); + "Reload time: 110 moves\n" ); } SECTION( "firing modes" ) { @@ -362,4 +362,3 @@ TEST_CASE( "show available recipes with item as an ingredient", "[item][iteminfo } } } - From c95c467a33ab88352f227d48b609356c54f6b24f Mon Sep 17 00:00:00 2001 From: Eric Pierce Date: Tue, 11 Feb 2020 15:27:49 -0700 Subject: [PATCH 8/9] Disable lint for reload time test Co-Authored-By: Isaac Freund --- tests/iteminfo_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index 92930a10d6dfb..4490123b4d8ad 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -128,7 +128,7 @@ TEST_CASE( "ranged weapon attributes", "[item][iteminfo]" ) iteminfo_test( item( "compbow" ), q, "--\n" - "Reload time: 110 moves\n" ); + "Reload time: 110 moves \n" ); // NOLINT(cata-text-style) } SECTION( "firing modes" ) { From c80a0b567cf8cb3397815c3260d967621c4a8e70 Mon Sep 17 00:00:00 2001 From: Eric Pierce Date: Tue, 11 Feb 2020 17:52:07 -0700 Subject: [PATCH 9/9] Ensure consistent spoilage estimate in test item.cpp#L934 `get_freshness_description` gives more detailed rot estimation messages to more skilled characters. Travis-CI revealed this test failing sometimes; this commit should ensure a consistent (0) skill level when testing these messages. --- tests/iteminfo_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index 4490123b4d8ad..19287b5135cdc 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -184,6 +184,10 @@ TEST_CASE( "food freshness and lifetime", "[item][iteminfo]" ) { iteminfo_query q( { iteminfo_parts::FOOD_ROT } ); + // Ensure test character has no skill estimating spoilage + g->u.empty_skills(); + REQUIRE_FALSE( g->u.can_estimate_rot() ); + SECTION( "food is fresh" ) { iteminfo_test( item( "pine_nuts" ), q,