Browse Source

prod/test: created getCharacterDexterity and test_getCharacterDexterity

remotes/origin/characterStats
Kai Kehres 2 years ago
parent
commit
520b949005
  1. 4
      src/c/character.c
  2. 2
      src/c/character.h
  3. 5
      test/c/test_character.c

4
src/c/character.c

@ -23,4 +23,8 @@ int getCharacterStrength (Character *character) {
void setCharacterDexterity (Character *character, int newDexterity) { void setCharacterDexterity (Character *character, int newDexterity) {
character->dexterity = newDexterity; character->dexterity = newDexterity;
}
int getCharacterDexterity (Character *character) {
return character->dexterity;
} }

2
src/c/character.h

@ -16,4 +16,6 @@ int getCharacterStrength(Character *character);
void setCharacterDexterity (Character *character, int newDexterity); void setCharacterDexterity (Character *character, int newDexterity);
int getCharacterDexterity(Character *character);
#endif #endif

5
test/c/test_character.c

@ -44,4 +44,9 @@ void test_setCharacterDexterity(void) {
TEST_ASSERT_EQUAL_INT(50,testCharacter.dexterity); TEST_ASSERT_EQUAL_INT(50,testCharacter.dexterity);
} }
void test_getCharacterDexterity(void) {
TEST_ASSERT_EQUAL_INT(5,testCharacter2.dexterity);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save