48 object *victim = NULL;
49 object *hitter = NULL;
57 fail_unless(floor != NULL,
"can't find archetype battleground");
60 fail_unless(floor != NULL,
"can't find archetype battleground");
64 fail_unless(deplete != NULL,
"can't find archetype %s",
ARCH_DEPLETION);
67 fail_unless(victim != NULL,
"couldn't create kobold");
68 fail_unless(victim->
inv == NULL,
"kobold shouldn't have an inventory");
75 fail_unless(hitter != NULL,
"couldn't create sword");
81 fail_unless(
present_arch_in_ob(deplete, victim) == NULL,
"victim shouldn't be depleted before being attacked");
83 for (test = 0; test < 100; test++) {
87 fail_unless(victim->
inv == NULL,
"kobold shouldn't have an inventory after attacked");
88 fail_unless(
present_arch_in_ob(deplete, victim) == NULL,
"victim shouldn't be depleted when slaying not set");
95 fail_unless(
present_arch_in_ob(deplete, victim) != NULL,
"victim should be depleted when slaying is set");
101 Suite *s = suite_create(
"attack");
102 TCase *tc_core = tcase_create(
"Core");
107 suite_add_tcase(s, tc_core);
108 tcase_add_test(tc_core, test_hit_player);
116 SRunner *sr = srunner_create(s);
124 srunner_set_xml(sr, LOGDIR
"/unit/server/attack.xml");
125 srunner_set_log(sr, LOGDIR
"/unit/server/attack.out");
126 srunner_run_all(sr, CK_ENV);
127 nf = srunner_ntests_failed(sr);
129 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
archetype * find_archetype(const char *name)
mapstruct * get_empty_map(int sizex, int sizey)
object * insert_ob_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
END_TEST Suite * attack_suite(void)
object * create_archetype(const char *name)
START_TEST(test_hit_player)
void init(int argc, char **argv)
sint16 resist[NROFATTACKS]
object * present_arch_in_ob(const archetype *at, const object *op)
sstring add_string(const char *str)
int hit_player(object *op, int dam, object *hitter, uint32 type, int full_hit)