diff --git a/src/c/weapon.c b/src/c/weapon.c index a506bb9..ccc980d 100644 --- a/src/c/weapon.c +++ b/src/c/weapon.c @@ -18,4 +18,9 @@ char *getFullName(Weapon *weapon) void setFullName(Weapon *weapon, char *fullNameToSet) { weapon->fullName = fullNameToSet; +} + +int getTypeID(Weapon *weapon) +{ + return weapon->typeID; } \ No newline at end of file diff --git a/src/c/weapon.h b/src/c/weapon.h index 86d4209..54110b4 100644 --- a/src/c/weapon.h +++ b/src/c/weapon.h @@ -24,4 +24,6 @@ void setName(Weapon *weapon, char *nameToSet); char *getFullName(Weapon *weapon); void setFullName(Weapon *weapon, char *fullNameToSet); +int getTypeID(Weapon *weapon); + #endif \ No newline at end of file diff --git a/test/c/test_weapon.c b/test/c/test_weapon.c index 0998f6f..9599e3b 100644 --- a/test/c/test_weapon.c +++ b/test/c/test_weapon.c @@ -81,4 +81,22 @@ void test_setFullName(void) TEST_ASSERT_EQUAL(fullNameWeapon, result); } +void test_getTypeID(void) +{ + // arrange + int type = 1, result; + Weapon test; + test.typeID = type; + + /* act */ + // Die Funktion wird ausgeführt + result = getTypeID(&test); + + // output + printf("getTypeID | typeID should be: %d -> is: %d", type, result); + + // assert + TEST_ASSERT_EQUAL(type, result); +} + #endif // TEST