64 FAIL_UNLESS(between->
next == second,
"Between should be before second");
67 FAIL_UNLESS(
list.items == other_first,
"Other first should be first item");
68 FAIL_UNLESS(other_first->
next == new_first,
"Other first should be before new first");
91 object *
inv =
op->inv;
92 while ((*items) != NULL) {
94 FAIL_UNLESS(strcmp(
inv->name, *items) == 0,
"got %s instead of %s",
inv->name, *items);
100 printf(
" => unexpected inv %s\n",
inv->name);
110 const char *items[] = {
"kobold's heart", NULL};
123 const char *items[] = {
144 object *
inv =
op->inv;
147 while (first != last) {
148 if (strcmp(*first,
inv->arch->name) == 0) {
158 "rune_medium_fireball",
159 "rune_burning_hands",
171 "rune_summon_air_elemental",
173 "rune_large_icestorm",
174 "rune_large_fireball",
175 "rune_ball_lightning",
177 "rune_summon_earth_elemental",
178 "rune_summon_fire_elemental",
179 "rune_summon_water_elemental",
188 for (
int i = 0; i < 1000; i++) {
198 for (
int i = 0; i < 1000; i++) {
205 FAIL_UNLESS(nastier > 0,
"should get a nastier trap");
215 memset(&
t, 0,
sizeof(
t));
218 t.list_magic_value =
value;
219 t.list_magic_adjustment = adjustment;
221 memset(&tl, 0,
sizeof(tl));
226 for (
int i = 0; (i < 1000) && (nastier == 0); i++) {
237 FAIL_UNLESS(nastier > 0,
"should get a nastier trap");
252 memset(&
t, 0,
sizeof(
t));
258 memset(&tl, 0,
sizeof(tl));
287 Suite *s = suite_create(
"treasure");
288 TCase *tc_core = tcase_create(
"Core");
293 suite_add_tcase(s, tc_core);
294 tcase_add_test(tc_core, test_add_treasure_in_list);
295 tcase_add_test(tc_core, test_treasure_remove_item);
296 tcase_add_test(tc_core, test_create_treasure_one);
297 tcase_add_test(tc_core, test_create_treasure_all);
298 tcase_add_test(tc_core, test_magic_limit);
299 tcase_add_test(tc_core, test_magic_set);
300 tcase_add_test(tc_core, test_magic_adjustment);
301 tcase_add_test(tc_core, test_artifact_valid);
302 tcase_add_test(tc_core, test_artifact_invalid);
303 tcase_add_test(tc_core, test_artifact_not_existing);
311 SRunner *sr = srunner_create(s);
315 srunner_set_fork_status(sr, CK_NOFORK);
317 srunner_set_xml(sr, LOGDIR
"/unit/common/treasure.xml");
318 srunner_set_log(sr, LOGDIR
"/unit/common/treasure.out");
319 srunner_run_all(sr, CK_ENV);
320 nf = srunner_ntests_failed(sr);
322 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;