Browse Source

added getDamageModifier with test

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

5
src/c/weapon.c

@ -28,4 +28,9 @@ int getTypeID(Weapon *weapon)
void setTypeID(Weapon *weapon, int typeToSet)
{
weapon->typeID = typeToSet;
}
int getDamageModifier(Weapon *weapon)
{
return weapon->damageModifier;
}

4
src/c/weapon.h

@ -27,4 +27,8 @@ void setFullName(Weapon *weapon, char *fullNameToSet);
int getTypeID(Weapon *weapon);
void setTypeID(Weapon *weapon, int typeToSet);
//typeName placeholder
int getDamageModifier(Weapon *weapon);
#endif

18
test/c/test_weapon.c

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