| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#include <stdlib.h> |
| 30 |
#include <check.h> |
| 31 |
#include <global.h> |
| 32 |
#include <sproto.h> |
| 33 |
|
| 34 |
static void setup(void) { |
| 35 |
} |
| 36 |
|
| 37 |
static void teardown(void) { |
| 38 |
} |
| 39 |
|
| 40 |
START_TEST(test_apply) { |
| 41 |
object *monster; |
| 42 |
object *sword; |
| 43 |
|
| 44 |
monster = create_archetype("goblin"); |
| 45 |
fail_unless(monster, "couldn't create goblin"); |
| 46 |
sword = create_archetype("sword"); |
| 47 |
fail_unless(sword, "couldn't create sword"); |
| 48 |
|
| 49 |
object_insert_in_ob(sword, monster); |
| 50 |
monster_check_apply_all(monster); |
| 51 |
|
| 52 |
fail_unless(QUERY_FLAG(sword, FLAG_APPLIED), "sword should be applied"); |
| 53 |
} |
| 54 |
END_TEST |
| 55 |
|
| 56 |
static Suite *bug_suite(void) { |
| 57 |
Suite *s = suite_create("bug"); |
| 58 |
TCase *tc_core = tcase_create("Core"); |
| 59 |
|
| 60 |
tcase_add_checked_fixture(tc_core, setup, teardown); |
| 61 |
|
| 62 |
suite_add_tcase(s, tc_core); |
| 63 |
tcase_add_test(tc_core, test_apply); |
| 64 |
tcase_set_timeout(tc_core, 0); |
| 65 |
|
| 66 |
return s; |
| 67 |
} |
| 68 |
|
| 69 |
int main(void) { |
| 70 |
int nf; |
| 71 |
Suite *s = bug_suite(); |
| 72 |
SRunner *sr = srunner_create(s); |
| 73 |
|
| 74 |
srunner_set_fork_status(sr, CK_NOFORK); |
| 75 |
init(0, NULL); |
| 76 |
|
| 77 |
srunner_set_xml(sr, LOGDIR "/bugs/bugtrack/883.xml"); |
| 78 |
srunner_set_log(sr, LOGDIR "/bugs/bugtrack/883.out"); |
| 79 |
srunner_run_all(sr, CK_ENV); |
| 80 |
nf = srunner_ntests_failed(sr); |
| 81 |
srunner_free(sr); |
| 82 |
return nf == 0 ? EXIT_SUCCESS : EXIT_FAILURE; |
| 83 |
} |