Finish all player set effect equipment tests. 87/87 tests passing.

removeExposedPackKey
sigonasr2 5 months ago
parent 1e4266e0cd
commit 3e8c7ddfc0
  1. 78
      Adventures in Lestoria Tests/PlayerTests.cpp
  2. 2
      Adventures in Lestoria/Version.h

@ -429,15 +429,93 @@ namespace PlayerTests
Inventory::EquipItem(setArmor,EquipSlot::ARMOR); Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(1.f,player->GetCooldownReductionPct(),L"Player should have 100% CDR"); Assert::AreEqual(1.f,player->GetCooldownReductionPct(),L"Player should have 100% CDR");
testKey->bHeld=true; //Force the key to be held down for testing purposes. testKey->bHeld=true; //Force the key to be held down for testing purposes.
player->CheckAndPerformAbility(player->GetRightClickAbility(),testKeyboardInput);
player->CheckAndPerformAbility(player->GetAbility1(),testKeyboardInput); player->CheckAndPerformAbility(player->GetAbility1(),testKeyboardInput);
player->CheckAndPerformAbility(player->GetAbility2(),testKeyboardInput); player->CheckAndPerformAbility(player->GetAbility2(),testKeyboardInput);
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput); player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
player->CheckAndPerformAbility(player->GetAbility4(),testKeyboardInput); player->CheckAndPerformAbility(player->GetAbility4(),testKeyboardInput);
game->SetElapsedTime(0.01f); //Force elapsed time value.
game->OnUserUpdate(0.01f); //Let 0.01 seconds go by. All abilities should be off cooldown. game->OnUserUpdate(0.01f); //Let 0.01 seconds go by. All abilities should be off cooldown.
Assert::AreEqual(0.f,player->GetRightClickAbility().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); //Defensive is currently not affected by CDR.
Assert::AreEqual(0.f,player->GetAbility1().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); Assert::AreEqual(0.f,player->GetAbility1().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown.");
Assert::AreEqual(0.f,player->GetAbility2().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); Assert::AreEqual(0.f,player->GetAbility2().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown.");
Assert::AreEqual(0.f,player->GetAbility3().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); Assert::AreEqual(0.f,player->GetAbility3().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown.");
Assert::AreEqual(0.f,player->GetAbility4().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); Assert::AreEqual(0.f,player->GetAbility4().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown.");
} }
TEST_METHOD(CritRateStatEquipCheck){
std::weak_ptr<Item>setArmor{Inventory::AddItem("Test Armor2"s)};
Assert::AreEqual(0.f,player->GetCritRatePct(),L"Crit Rate is 0%");
Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(1.f,player->GetCritRatePct(),L"Player should have 100% Crit Rate");
}
TEST_METHOD(CritDmgStatEquipCheck){
std::weak_ptr<Item>setArmor{Inventory::AddItem("Test Armor2"s)};
Assert::AreEqual(0.5f,player->GetCritDmgPct(),L"Crit Damage is 50%");
Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(1.5f,player->GetCritDmgPct(),L"Player should have 150% Crit Damage");
}
TEST_METHOD(HealthPctStatEquipCheck){
std::weak_ptr<Item>setArmor{Inventory::AddItem("Test Armor2"s)};
Assert::AreEqual(100,player->GetHealth(),L"Current Health is 100");
Assert::AreEqual(100,player->GetMaxHealth(),L"Max Health is 100");
Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(100,player->GetHealth(),L"Current Health is still 100");
Assert::AreEqual(200,player->GetMaxHealth(),L"Max Health is now 200");
}
TEST_METHOD(HP6RecoveryStatEquipCheck){
std::weak_ptr<Item>setArmor{Inventory::AddItem("Test Armor2"s)};
Assert::AreEqual(0.0_Pct,player->GetHP6RecoveryPct(),L"HP6 Recovery % is 0");
Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(100.0_Pct,player->GetHP6RecoveryPct(),L"HP6 Recovery % is 100%");
}
TEST_METHOD(HP4RecoveryStatEquipCheck){
std::weak_ptr<Item>setArmor{Inventory::AddItem("Test Armor3"s)};
Assert::AreEqual(0.0_Pct,player->GetHP4RecoveryPct(),L"HP4 Recovery % is 0");
Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(100.0_Pct,player->GetHP4RecoveryPct(),L"HP4 Recovery % is 100%");
}
TEST_METHOD(DamageReductionStatEquipCheck){
std::weak_ptr<Item>setArmor{Inventory::AddItem("Test Armor3"s)};
Assert::AreEqual(0.0_Pct,player->GetDamageReductionPct(),L"Damage Reduction is 0%");
Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(100.0_Pct,player->GetDamageReductionPct(),L"Damage Reduction is 100%");
}
TEST_METHOD(HPRecoveryStatEquipCheck){
std::weak_ptr<Item>setArmor{Inventory::AddItem("Test Armor4"s)};
Assert::AreEqual(0.0_Pct,player->GetHPRecoveryPct(),L"HP Recovery % is 0");
Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(100.0_Pct,player->GetHPRecoveryPct(),L"HP Recovery % is 100%");
}
TEST_METHOD(AttackSpeedStatEquipCheck){
std::weak_ptr<Item>setArmor{Inventory::AddItem("Test Armor4"s)};
Assert::AreEqual(0.f,player->GetAttackRecoveryRateReduction(),L"Attack Speed Reduction is 0 seconds");
Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(50.f,player->GetAttackRecoveryRateReduction(),L"Attack Speed Reduction is 50 seconds");
}
TEST_METHOD(ManaStatEquipCheck){
std::weak_ptr<Item>setArmor{Inventory::AddItem("Test Armor4"s)};
Assert::AreEqual(100,player->GetMana(),L"Mana is 100");
Assert::AreEqual(100,player->GetMaxMana(),L"Max Mana is 100");
Inventory::EquipItem(setArmor,EquipSlot::ARMOR);
Assert::AreEqual(100,player->GetMana(),L"Mana is still 100");
Assert::AreEqual(200,player->GetMaxMana(),L"Max Mana is now 200");
}
}; };
} }

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 3 #define VERSION_PATCH 3
#define VERSION_BUILD 9937 #define VERSION_BUILD 9940
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Loading…
Cancel
Save