mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 04:32:06 +00:00 
			
		
		
		
	fix tests
This commit is contained in:
		| @@ -4,6 +4,7 @@ | |||||||
| #include "InventoryComponent.h" | #include "InventoryComponent.h" | ||||||
| #include "BehaviorSlot.h" | #include "BehaviorSlot.h" | ||||||
| #include "Entity.h" | #include "Entity.h" | ||||||
|  | #include "eItemType.h" | ||||||
|  |  | ||||||
| class InventoryComponentTest : public GameDependenciesTest { | class InventoryComponentTest : public GameDependenciesTest { | ||||||
| protected: | protected: | ||||||
| @@ -20,15 +21,20 @@ protected: | |||||||
|  * Test that FindBehaviorSlot correctly maps equipLocation strings to BehaviorSlot enum values |  * Test that FindBehaviorSlot correctly maps equipLocation strings to BehaviorSlot enum values | ||||||
|  */ |  */ | ||||||
| TEST_F(InventoryComponentTest, FindBehaviorSlotTest) { | TEST_F(InventoryComponentTest, FindBehaviorSlotTest) { | ||||||
| 	// Test the mappings from the issue comments | 	// Test the mappings from the issue comments with appropriate item types | ||||||
| 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_r"), BehaviorSlot::Primary); | 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_r", eItemType::RIGHT_HAND), BehaviorSlot::Primary); | ||||||
| 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("hair"), BehaviorSlot::Head); | 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("hair", eItemType::HAIR), BehaviorSlot::Head); | ||||||
| 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_l"), BehaviorSlot::Offhand); | 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_l", eItemType::LEFT_HAND), BehaviorSlot::Offhand); | ||||||
| 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("clavicle"), BehaviorSlot::Neck); | 	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 | 	// Test that unknown equipLocations return Invalid | ||||||
| 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("unknown"), BehaviorSlot::Invalid); | 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("unknown", eItemType::RIGHT_HAND), BehaviorSlot::Invalid); | ||||||
| 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot(""), BehaviorSlot::Invalid); | 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("", eItemType::HAT), BehaviorSlot::Invalid); | ||||||
| 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("root"), BehaviorSlot::Invalid); | 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("root", eItemType::LEGS), BehaviorSlot::Invalid); | ||||||
| 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("leftHand"), BehaviorSlot::Invalid); | 	EXPECT_EQ(InventoryComponent::FindBehaviorSlot("leftHand", eItemType::LEFT_HAND), BehaviorSlot::Invalid); | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user
	 Aaron Kimbrell
					Aaron Kimbrell