From 5c7ee2de9ebedc165125cae3743916a197ad51f1 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Wed, 3 Sep 2025 05:06:55 -0500 Subject: [PATCH] fix tests --- .../InventoryComponentTests.cpp | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp b/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp index 5816e616..a2dde8cf 100644 --- a/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp +++ b/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp @@ -4,6 +4,7 @@ #include "InventoryComponent.h" #include "BehaviorSlot.h" #include "Entity.h" +#include "eItemType.h" class InventoryComponentTest : public GameDependenciesTest { protected: @@ -20,15 +21,20 @@ protected: * Test that FindBehaviorSlot correctly maps equipLocation strings to BehaviorSlot enum values */ TEST_F(InventoryComponentTest, FindBehaviorSlotTest) { - // Test the mappings from the issue comments - EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_r"), BehaviorSlot::Primary); - EXPECT_EQ(InventoryComponent::FindBehaviorSlot("hair"), BehaviorSlot::Head); - EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_l"), BehaviorSlot::Offhand); - EXPECT_EQ(InventoryComponent::FindBehaviorSlot("clavicle"), BehaviorSlot::Neck); + // Test the mappings from the issue comments with appropriate item types + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_r", eItemType::RIGHT_HAND), BehaviorSlot::Primary); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("hair", eItemType::HAIR), BehaviorSlot::Head); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_l", eItemType::LEFT_HAND), BehaviorSlot::Offhand); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("clavicle", eItemType::NECK), BehaviorSlot::Neck); + + // Test consumable items always return Consumable slot regardless of equipLocation + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_r", eItemType::CONSUMABLE), BehaviorSlot::Consumable); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("hair", eItemType::CONSUMABLE), BehaviorSlot::Consumable); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("", eItemType::CONSUMABLE), BehaviorSlot::Consumable); // Test that unknown equipLocations return Invalid - EXPECT_EQ(InventoryComponent::FindBehaviorSlot("unknown"), BehaviorSlot::Invalid); - EXPECT_EQ(InventoryComponent::FindBehaviorSlot(""), BehaviorSlot::Invalid); - EXPECT_EQ(InventoryComponent::FindBehaviorSlot("root"), BehaviorSlot::Invalid); - EXPECT_EQ(InventoryComponent::FindBehaviorSlot("leftHand"), BehaviorSlot::Invalid); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("unknown", eItemType::RIGHT_HAND), BehaviorSlot::Invalid); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("", eItemType::HAT), BehaviorSlot::Invalid); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("root", eItemType::LEGS), BehaviorSlot::Invalid); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("leftHand", eItemType::LEFT_HAND), BehaviorSlot::Invalid); } \ No newline at end of file