|
@ -38,14 +38,15 @@ void test_items(void) |
|
|
|
|
|
|
|
|
void test_setItemPrice(void) |
|
|
void test_setItemPrice(void) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
// arrange |
|
|
// arrange |
|
|
int price = 50, result; |
|
|
int price = 50, result; |
|
|
|
|
|
|
|
|
// act |
|
|
// act |
|
|
Item test; |
|
|
Item test; |
|
|
setItemPrice(&test, price); |
|
|
setItemPrice(&test, price); |
|
|
result = test.price; |
|
|
result = test.price; |
|
|
|
|
|
|
|
|
|
|
|
//output |
|
|
printf("---------------------------------------------------\n"); |
|
|
printf("---------------------------------------------------\n"); |
|
|
printf("setItemPrice | price to set: %d -> item.price: %d", price, result); |
|
|
printf("setItemPrice | price to set: %d -> item.price: %d", price, result); |
|
|
|
|
|
|
|
@ -53,4 +54,22 @@ void test_setItemPrice(void) |
|
|
TEST_ASSERT_EQUAL(price, result); |
|
|
TEST_ASSERT_EQUAL(price, result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_getItemPrice(void) |
|
|
|
|
|
{ |
|
|
|
|
|
// arrange |
|
|
|
|
|
int price = 50, result; |
|
|
|
|
|
|
|
|
|
|
|
// act |
|
|
|
|
|
Item test; |
|
|
|
|
|
test.price = price; |
|
|
|
|
|
result = getItemPrice(&test); |
|
|
|
|
|
|
|
|
|
|
|
//output |
|
|
|
|
|
printf("getItemPrice | price should be: %d -> price is: %d", price, result); |
|
|
|
|
|
|
|
|
|
|
|
// assert |
|
|
|
|
|
TEST_ASSERT_EQUAL(price, result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#endif // TEST |
|
|
#endif // TEST |