diff --git a/src/c/items.c b/src/c/items.c index 1b223fa..801c49b 100644 --- a/src/c/items.c +++ b/src/c/items.c @@ -46,7 +46,7 @@ Item *getItems(char *itemsMapFile) Item i; i.id = atoi(arr[0]); strcpy(i.itemName, arr[1]); - //printf(arr[2]); + // printf(arr[2]); i.price = atoi(arr[3]); getItems[lineCounter] = i; @@ -61,7 +61,12 @@ int getItemPrice(Item *item) return item->price; } -void setItemPrice(Item* item, int price) +void setItemPrice(Item *item, int price) { - item->price = price; + item->price = price; +} + +int getItemShopAvailable(Item *item) +{ + return item->inShopAvailable; } diff --git a/src/c/items.h b/src/c/items.h index 0fa3740..68fa410 100644 --- a/src/c/items.h +++ b/src/c/items.h @@ -20,6 +20,6 @@ Item *getItems(char *itemsMapFile); int getItemPrice(Item *item); void setItemPrice(Item *item, int price); - +int getItemShopAvailable(Item *item); #endif \ No newline at end of file diff --git a/test/c/test_items.c b/test/c/test_items.c index bfd4439..8904fe1 100644 --- a/test/c/test_items.c +++ b/test/c/test_items.c @@ -72,4 +72,23 @@ void test_getItemPrice(void) TEST_ASSERT_EQUAL(price, result); } +void test_getItemShopAvailable(void) +{ + // arrange + bool value = true, result; + + // act + Item test; + test.inShopAvailable = value; + result = getItemShopAvailable(&test); + + //output + printf("getItemShopAvailable | value should be: %d -> is: %d", value, result); + + // assert + TEST_ASSERT_EQUAL(value, result); +} + + + #endif // TEST