|
|
@ -56,11 +56,12 @@ void test_setEnemyHealth(void){ |
|
|
|
|
|
|
|
void test_getEnemyHealth(void){ |
|
|
|
//arrange |
|
|
|
int health = 50; |
|
|
|
int health = 50, result; |
|
|
|
//act |
|
|
|
enemy test = {health}; |
|
|
|
result = getEnemyHealth(test); |
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL(health, getEnemyHealth(test)); |
|
|
|
TEST_ASSERT_EQUAL(health, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_setEnemyDamage(void){ |
|
|
@ -114,4 +115,14 @@ void test_PlayerAttacksEnemy_DoesMinDamage(void) |
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL(expectedEnemyHealth, test.health); |
|
|
|
} |
|
|
|
|
|
|
|
//A better way to get the value of a struct, REFACTORING if it works |
|
|
|
void test_getterWithParams(void){ |
|
|
|
int health = 50, armor = 4, damage = 4, attack = 5; |
|
|
|
enemy test = {health, damage, armor, attack}; |
|
|
|
TEST_ASSERT_EQUAL(health, getEnemyInt(&test.health)); |
|
|
|
TEST_ASSERT_EQUAL(armor, getEnemyInt(&test.armor)); |
|
|
|
TEST_ASSERT_EQUAL(damage, getEnemyInt(&test.damage)); |
|
|
|
TEST_ASSERT_EQUAL(attack, getEnemyInt(&test.attack)); |
|
|
|
} |
|
|
|
#endif // TEST |