54 #define TEST_MAP_SIZE 40
55 #define NUM_TICKS_TO_RUN 500
56 #define NUM_COMETS_TO_CAST 30
57 #define STARTING_HP 25000
84 fail_unless(
mon != NULL,
"Unable to find orc object");
128 #ifdef PRINT_DEBUG_HP
129 printf(
"\nDumping debug hp for test %s\n ", test);
146 fail_unless(
mon->
name == our_mon->
name,
"Could not find our monster on the space?");
148 #ifdef PRINT_DEBUG_HP
149 printf(
"%d, ", our_mon->
stats.
hp);
152 if (our_mon->
stats.
hp == hp_row[
x]) {
154 }
else if (our_mon->
stats.
hp < hp_row[
x]) {
161 fail(
"Mon (%d, %d) has hp out of range (%d != %d +/- %d, diff %d)\n", our_mon->
x, our_mon->
y, our_mon->
stats.
hp, hp_row[
x],
HP_DELTA, diff);
166 #ifdef PRINT_DEBUG_HP
173 fprintf(stderr,
"Monster destroyed at %d, %d\n",
x,
x);
177 fail_unless(
mon->
name == our_mon->
name,
"Could not find our monster on the space?");
179 #ifdef PRINT_DEBUG_HP
180 printf(
"%d, ", our_mon->
stats.
hp);
182 if (our_mon->
stats.
hp == hp_diag[
x]) {
184 }
else if (our_mon->
stats.
hp < hp_diag[
x]) {
191 fail(
"Mon (%d, %d) has hp out of range (%d != %d +/- %d, diff %d)\n", our_mon->
x, our_mon->
y, our_mon->
stats.
hp, hp_diag[
x],
HP_DELTA, diff);
198 int hp_row[
TEST_MAP_SIZE] = {25000, 25000, 25000, 25000, 25000, 25000, 25000, 25000, 24924, 24920, 24916, 24912, 24908, 24904, 24900, 24896, 24892, 24888, 24884, 24880, 24869, 24880, 24884, 24888, 24892, 24896, 24900, 24904, 24908, 24912, 24916, 24920, 24924, 25000, 25000, 25000, 25000, 25000, 25000, 25000 },
199 hp_diag[
TEST_MAP_SIZE] = {25000, 25000, 25000, 25000, 25000, 25000, 25000, 25000, 24924, 24920, 24916, 24912, 24908, 24904, 24900, 24896, 24892, 24888, 24884, 24880, 24869, 24880, 24884, 24888, 24892, 24896, 24900, 24904, 24908, 24912, 24916, 24920, 24924, 25000, 25000, 25000, 25000, 25000, 25000, 25000 };
215 check_hp(
"cast_one_comet", hp_row, hp_diag);
221 int tick, num_cast = 0;
222 int hp_row[
TEST_MAP_SIZE] = {23756, 23617, 23516, 23428, 23397, 23291, 23203, 23097, 23014, 22875, 22801, 22782, 22706, 22707, 22620, 22645, 22646, 22595, 22705, 22773, 22809, 22835, 22975, 23098, 23239, 23346, 23462, 23597, 23627, 23675, 23786, 23888, 24001, 24119, 24206, 24306, 24336, 24455, 24565, 24649 },
223 hp_diag[
TEST_MAP_SIZE] = {25000, 25000, 25000, 25000, 25000, 25000, 25000, 25000, 23515, 23351, 23177, 23097, 22946, 22931, 22763, 22706, 22678, 22658, 22728, 22812, 22809, 22712, 22728, 22741, 22726, 22833, 22862, 22967, 23014, 23009, 23167, 23267, 23367, 23459, 23596, 23713, 23750, 23879, 24026, 24160 };
247 check_hp(
"cast_random_comet", hp_row, hp_diag);
254 int tick, num_cast = 0;
255 int hp_row[
TEST_MAP_SIZE] = {25000, 25000, 25000, 25000, 25000, 25000, 25000, 25000, 22355, 22262, 22115, 21966, 21837, 21684, 21554, 21424, 21268, 21137, 21006, 20875, 20534, 20875, 21006, 21137, 21268, 21424, 21554, 21684, 21837, 21966, 22115, 22262, 22355, 25000, 25000, 25000, 25000, 25000, 25000, 25000 },
256 hp_diag[
TEST_MAP_SIZE] = {25000, 25000, 25000, 25000, 25000, 25000, 25000, 25000, 22355, 22262, 22115, 21966, 21837, 21684, 21554, 21424, 21268, 21137, 21006, 20875, 20534, 20875, 21006, 21137, 21268, 21424, 21554, 21684, 21837, 21966, 22115, 22262, 22355, 25000, 25000, 25000, 25000, 25000, 25000, 25000 };
272 check_hp(
"cast_bunch_comet", hp_row, hp_diag);
278 Suite *s = suite_create(
"comet");
279 TCase *tc_core = tcase_create(
"Core");
286 tcase_set_timeout(tc_core, 20);
291 suite_add_tcase(s, tc_core);
292 tcase_add_test(tc_core, cast_one_comet);
293 tcase_add_test(tc_core, cast_bunch_comet);
294 tcase_add_test(tc_core, cast_random_comet);
303 SRunner *sr = srunner_create(s);
309 srunner_set_fork_status(sr, CK_NOFORK);
315 srunner_set_xml(sr, LOGDIR
"/unit/server/comet.xml");
316 srunner_set_log(sr, LOGDIR
"/unit/server/comet.out");
317 srunner_run_all(sr, CK_ENV);
318 nf = srunner_ntests_failed(sr);
321 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;