@ -0,0 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "character.h"
Character character;
void setCharacterHealthPoints (Character *character, int newHealthPoints){
character->healthPoints = newHealthPoints;
}
@ -0,0 +1,12 @@
#ifndef CHARACTER_H
#define CHARACTER_H
typedef struct {
int strength,dexterity,intelligence,healthPoints,manaPoints;
char name [50];
} Character;
void setCharacterHealthPoints (Character *character,int newHealthPoints);
#endif
@ -0,0 +1,22 @@
#ifdef TEST
#include "unity.h"
Character testCharacter;
void setUp(void)
{
testCharacter.healthPoints = 0;
void tearDown(void)
void test_setCharacterHealthPoints(void)
TEST_ASSERT_EQUAL_INT(0,testCharacter.healthPoints);
setCharacterHealthPoints(&testCharacter,50);
TEST_ASSERT_EQUAL_INT(50,testCharacter.healthPoints);
#endif // TEST