Browse Source

added getBaseDamage with test

remotes/origin/navigation
KRUGSON 2 years ago
parent
commit
66206804a3
  1. 5
      src/c/weapon.c
  2. 2
      src/c/weapon.h
  3. 18
      test/c/test_weapon.c

5
src/c/weapon.c

@ -38,4 +38,9 @@ int getDamageModifier(Weapon *weapon)
void setDamageModifier(Weapon *weapon, int modifierSet)
{
weapon->damageModifier = modifierSet;
}
int getBaseDamage(Weapon *weapon)
{
return weapon->baseDamage;
}

2
src/c/weapon.h

@ -32,4 +32,6 @@ void setTypeID(Weapon *weapon, int typeToSet);
int getDamageModifier(Weapon *weapon);
void setDamageModifier(Weapon *weapon, int modifierSet);
int getBaseDamage(Weapon *weapon);
#endif

18
test/c/test_weapon.c

@ -151,4 +151,22 @@ void test_setDamageModifier(void)
TEST_ASSERT_EQUAL(damageModifier, result);
}
void test_getBaseDamage(void)
{
// arrange
int baseDamage = 10, result;
Weapon test;
test.baseDamage = baseDamage;
/* act */
// Die Funktion wird ausgeführt
result = getBaseDamage(&test);
// output
printf("getBaseDamage | baseDamage should be: %d -> is: %d", baseDamage, result);
// assert
TEST_ASSERT_EQUAL(baseDamage, result);
}
#endif // TEST
Loading…
Cancel
Save