diff --git a/src/c/weapon.c b/src/c/weapon.c index 99c6fce..ddb66e8 100644 --- a/src/c/weapon.c +++ b/src/c/weapon.c @@ -48,4 +48,9 @@ int getBaseDamage(Weapon *weapon) void setBaseDamage(Weapon *weapon, int baseDmgSet) { weapon->baseDamage = baseDmgSet; +} + +bool getAvailable(Weapon *weapon) +{ + return weapon->canBeUsed; } \ No newline at end of file diff --git a/src/c/weapon.h b/src/c/weapon.h index 4149a10..cbc0661 100644 --- a/src/c/weapon.h +++ b/src/c/weapon.h @@ -35,4 +35,7 @@ void setDamageModifier(Weapon *weapon, int modifierSet); int getBaseDamage(Weapon *weapon); void setBaseDamage(Weapon *weapon, int baseDmgSet); +bool getAvailable(Weapon *weapon); + + #endif \ No newline at end of file diff --git a/test/c/test_weapon.c b/test/c/test_weapon.c index 241c481..8f23f5b 100644 --- a/test/c/test_weapon.c +++ b/test/c/test_weapon.c @@ -186,4 +186,22 @@ void test_setBaseDamage(void) TEST_ASSERT_EQUAL(baseDamage, result); } +void test_getAvailable(void) +{ + // arrange + bool canBeUsed = true, result; + Weapon test; + test.canBeUsed = canBeUsed; + + /* act */ + // Die Funktion wird ausgeführt + result = getAvailable(&test); + + // output + printf("getAvailable | canBeUsed should be: %d -> is: %d", canBeUsed, result); + + // assert + TEST_ASSERT_EQUAL(canBeUsed, result); +} + #endif // TEST