diff --git a/src/c/character.c b/src/c/character.c index 3da86cd..1664eea 100644 --- a/src/c/character.c +++ b/src/c/character.c @@ -11,4 +11,9 @@ void setCharacterHealthPoints (Character *character, int newHealthPoints){ int getCharacterHealthPoints (Character *character) { return character->healthPoints; -} \ No newline at end of file +} + +void setCharacterStrength(Character *character, int newStrength) +{ + character->strength = newStrength; +} diff --git a/src/c/character.h b/src/c/character.h index be8bf95..999692c 100644 --- a/src/c/character.h +++ b/src/c/character.h @@ -8,5 +8,10 @@ typedef struct { void setCharacterHealthPoints (Character *character,int newHealthPoints); +int getCharacterHealthPoints (Character *character); + +void setCharacterStrength (Character *character, int newStrength); + + #endif \ No newline at end of file diff --git a/test/c/test_character.c b/test/c/test_character.c index d4aca2f..3e26839 100644 --- a/test/c/test_character.c +++ b/test/c/test_character.c @@ -2,10 +2,14 @@ #include "unity.h" #include "character.h" Character testCharacter; +Character testCharacter2; void setUp(void) { - testCharacter.healthPoints = 0; + testCharacter.healthPoints = 0; + testCharacter2.healthPoints = 15; + testCharacter.strength = 0; + testCharacter2.strength = 5; } void tearDown(void) @@ -19,4 +23,16 @@ void test_setCharacterHealthPoints(void) TEST_ASSERT_EQUAL_INT(50,testCharacter.healthPoints); } +void test_getCharacterHealthPoints (void) { + TEST_ASSERT_EQUAL_INT(15,testCharacter2.healthPoints); +} +void test_setCharacterStrenght(void) +{ + TEST_ASSERT_EQUAL_INT(0,testCharacter.strength); + setCharacterStrength(&testCharacter,50); + TEST_ASSERT_EQUAL_INT(50,testCharacter.strength); +} + + + #endif // TEST \ No newline at end of file