diff --git a/src/c/character.c b/src/c/character.c index d9642ca..5938afa 100644 --- a/src/c/character.c +++ b/src/c/character.c @@ -27,4 +27,8 @@ void setCharacterDexterity (Character *character, int newDexterity) { int getCharacterDexterity (Character *character) { return character->dexterity; +} + +void setCharacterIntelligence (Character *character, int newIntelligence) { + character->intelligence = newIntelligence; } \ No newline at end of file diff --git a/src/c/character.h b/src/c/character.h index a0345e3..a5960fe 100644 --- a/src/c/character.h +++ b/src/c/character.h @@ -6,16 +6,18 @@ typedef struct { char name [50]; } Character; -void setCharacterHealthPoints (Character *character,int newHealthPoints); +void setCharacterHealthPoints (Character *character, int newHealthPoints); int getCharacterHealthPoints (Character *character); void setCharacterStrength (Character *character, int newStrength); -int getCharacterStrength(Character *character); +int getCharacterStrength (Character *character); void setCharacterDexterity (Character *character, int newDexterity); -int getCharacterDexterity(Character *character); +int getCharacterDexterity (Character *character); + +void setCharacterIntelligence (Character *character, int newIntelligence); #endif \ No newline at end of file diff --git a/test/c/test_character.c b/test/c/test_character.c index 0f12bcc..c204b09 100644 --- a/test/c/test_character.c +++ b/test/c/test_character.c @@ -12,6 +12,8 @@ void setUp(void) testCharacter2.strength = 5; testCharacter.dexterity = 0; testCharacter2.dexterity = 5; + testCharacter.intelligence = 0; + testCharacter2.intelligence = 5; } void tearDown(void) @@ -44,9 +46,14 @@ void test_setCharacterDexterity(void) { TEST_ASSERT_EQUAL_INT(50,testCharacter.dexterity); } - void test_getCharacterDexterity(void) { TEST_ASSERT_EQUAL_INT(5,testCharacter2.dexterity); } +void test_setCharacterIntelligence(void) { + TEST_ASSERT_EQUAL_INT(0,testCharacter.intelligence); + setCharacterIntelligence(&testCharacter,45); + TEST_ASSERT_EQUAL_INT(45,testCharacter.intelligence); +} + #endif // TEST \ No newline at end of file