Browse Source

prod/test: creates spellHeal function and test

remotes/origin/nextcycle
Kai Kehres 2 years ago
parent
commit
8910a0d9a1
  1. 6
      src/c/spell.c
  2. 3
      src/c/spell.h
  3. 6
      test/c/test_spell.c

6
src/c/spell.c

@ -7,4 +7,10 @@
int spellFireball(Character *character) {
int damage = 10 + (getCharacterIntelligence(character) / 2);
return damage;
}
int spellHeal(Character *character) {
int heal = 10 + (getCharacterIntelligence(character) / 3);
return heal;
}

3
src/c/spell.h

@ -1,6 +1,9 @@
#ifndef SPELL_H
#define SPELL_H
#include "character.h"
int spellFireball(Character *character);
int spellHeal(Character *character);
#endif

6
test/c/test_spell.c

@ -35,4 +35,10 @@ void test_spellFireball(void)
TEST_ASSERT_EQUAL_INT(10,spellFireball(&testCharacter));
TEST_ASSERT_EQUAL_INT(13,spellFireball(&testCharacter2));
}
void test_spellHeal(void)
{
TEST_ASSERT_EQUAL_INT(10,spellHeal(&testCharacter));
TEST_ASSERT_EQUAL_INT(12,spellHeal(&testCharacter2));
}
#endif // TEST
Loading…
Cancel
Save