Browse Source

added setItemShopAvailable with test

remotes/origin/navigation
KRUGSON 2 years ago
parent
commit
e294af735d
  1. 5
      src/c/items.c
  2. 2
      src/c/items.h
  3. 15
      test/c/test_items.c

5
src/c/items.c

@ -70,3 +70,8 @@ int getItemShopAvailable(Item *item)
{
return item->inShopAvailable;
}
void setItemShopAvailable(Item *item, bool value)
{
item->inShopAvailable = value;
}

2
src/c/items.h

@ -16,10 +16,10 @@ typedef struct
Item *getItems(char *itemsMapFile);
int getItemPrice(Item *item);
void setItemPrice(Item *item, int price);
int getItemShopAvailable(Item *item);
void setItemShopAvailable(Item *item, bool value);
#endif

15
test/c/test_items.c

@ -89,6 +89,21 @@ void test_getItemShopAvailable(void)
TEST_ASSERT_EQUAL(value, result);
}
void test_setItemShopAvailable(void)
{
// arrange
bool value = true, result;
// act
Item test;
setItemShopAvailable(&test, value);
result = test.inShopAvailable;
//output
printf("setItemShopAvailable | value should be: %d -> is: %d", value, result);
// assert
TEST_ASSERT_EQUAL(value, result);
}
#endif // TEST
Loading…
Cancel
Save