mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-13 17:49:25 +00:00
Added tests for aged brie
This commit is contained in:
1 parent
438a5d6612
commit
cdb407461b
2 files changed
+39
-2
No files matched your search
@@ -0,0 +1,35 @@
|
||||
#include <check.h>
|
||||
#include "GildedRose.h"
|
||||
|
||||
#define CHEESE "Aged Brie"
|
||||
|
||||
START_TEST(agedBrie_whenSellInPositive_increasesQualityByOne)
|
||||
{
|
||||
Item items[1];
|
||||
init_item(items, CHEESE, 10, 15);
|
||||
update_quality(items, 1);
|
||||
|
||||
ck_assert_int_eq(16, items[0].quality);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(agedBrie_cannotIncreaseQualityAboveFifty)
|
||||
{
|
||||
Item items[1];
|
||||
init_item(items, CHEESE, 10, 50);
|
||||
update_quality(items, 1);
|
||||
|
||||
ck_assert_int_eq(50, items[0].quality);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
TCase *tcase_brie(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
tc = tcase_create("aged-brie");
|
||||
tcase_add_test(tc, agedBrie_whenSellInPositive_increasesQualityByOne);
|
||||
tcase_add_test(tc, agedBrie_cannotIncreaseQualityAboveFifty);
|
||||
|
||||
return tc;
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#define NORMAL_ITEM "Elixer of Mongoose"
|
||||
|
||||
TCase *tcase_brie(void);
|
||||
|
||||
START_TEST(normalitem_whenSellInPositive_decreasesQualityByOne)
|
||||
{
|
||||
@@ -34,7 +35,7 @@ START_TEST(normalitem_whenQualityZero_doesNotDecrease)
|
||||
}
|
||||
END_TEST
|
||||
|
||||
TCase *tcase_rose(void)
|
||||
TCase *tcase_normal(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
@@ -51,7 +52,8 @@ Suite *suite_normal(void)
|
||||
Suite *s;
|
||||
|
||||
s = suite_create("characterization-tests");
|
||||
suite_add_tcase(s, tcase_rose());
|
||||
suite_add_tcase(s, tcase_normal());
|
||||
suite_add_tcase(s, tcase_brie());
|
||||
|
||||
return s;
|
||||
}
|
||||
Reference in new issue
Block a user