diff --git a/src/c/character.c b/src/c/character.c index 2409dab..c3010be 100644 --- a/src/c/character.c +++ b/src/c/character.c @@ -25,6 +25,10 @@ int getCharacterStrength (Character *character) { return character->strength; } +void addCharacterStrength (Character *character, int addStrength) { + character->strength += addStrength; +} + void setCharacterDexterity (Character *character, int newDexterity) { character->dexterity = newDexterity; } diff --git a/src/c/character.h b/src/c/character.h index 0c18944..5caca85 100644 --- a/src/c/character.h +++ b/src/c/character.h @@ -16,6 +16,8 @@ void setCharacterStrength (Character *character, int newStrength); int getCharacterStrength (Character *character); +void addCharacterStrength (Character *character, int addStrength); + void setCharacterDexterity (Character *character, int newDexterity); int getCharacterDexterity (Character *character); diff --git a/test/c/test_character.c b/test/c/test_character.c index 71b43ec..d948c3c 100644 --- a/test/c/test_character.c +++ b/test/c/test_character.c @@ -47,6 +47,11 @@ void test_getCharacterStrength(void) { TEST_ASSERT_EQUAL_INT(5,testCharacter2.strength); } +void test_addCharacterStrength (void) { + addCharacterStrength(&testCharacter2,15); + TEST_ASSERT_EQUAL_INT(20,testCharacter2.strength); +} + void test_setCharacterDexterity(void) { TEST_ASSERT_EQUAL_INT(0,testCharacter.dexterity); setCharacterDexterity(&testCharacter,50);