diff --git a/project.yml b/project.yml index e253248..33ad5c2 100644 --- a/project.yml +++ b/project.yml @@ -98,4 +98,5 @@ :enabled: - stdout_pretty_tests_report - module_generator + - xml_tests_report ... diff --git a/src/c/encounter.c b/src/c/encounter.c index 87eca2d..a43acba 100644 --- a/src/c/encounter.c +++ b/src/c/encounter.c @@ -22,3 +22,19 @@ int playerHealth(int health, int damage){ } return health; } + +enemy createEnemy(int health) +{ + enemy test; + test.health = health; + return test; +} + +void *setEnemyHealth(int *num, int health){ + *num = health; + //return health; +} + +int getEnemyHealth(enemy enemy){ + return enemy.health; +} diff --git a/src/c/encounter.h b/src/c/encounter.h index 16cea26..b42072d 100644 --- a/src/c/encounter.h +++ b/src/c/encounter.h @@ -3,6 +3,12 @@ #include +typedef struct { + int health; +} enemy; + +//setEnemyHealth(&enemy.health, health); +void *setEnemyHealth(int *num, int health); bool playerAlive(int health); int playerHealth(int health, int damage); diff --git a/test/c/test_encounter.c b/test/c/test_encounter.c index 2af8a8b..6b4abdf 100644 --- a/test/c/test_encounter.c +++ b/test/c/test_encounter.c @@ -3,6 +3,7 @@ #include "encounter.h" + void setUp(void){ } @@ -43,4 +44,16 @@ void test_playerIsNotOverhealed(void){ TEST_ASSERT_EQUAL(expectedHealth, health); } +void test_setEnemyHealth(void){ + //arrange + int health = 50, result; + //act + enemy test = {health*2}; + setEnemyHealth(&test.health, health); + //assert + TEST_ASSERT_EQUAL(health, test.health); +} + + + #endif // TEST