58 fail_unless(arch != NULL,
"Can't find 'orc' archetype!");
60 fail_unless(orc != NULL,
"Couldn't create first orc!");
65 fail_unless(result && result[0] ==
'\0',
"diff obj/clone was %s!", result);
75 fail_unless(result && strcmp(result,
"name Orc chief\nspeed 0.500000\n") == 0,
"diff modified obj/clone was %s!", result);
86 fail_unless(result && strcmp(result,
"name Orc chief\nWis 59\nhp 50\nexpmul 8.500000\ndam 168\nspeed 0.500000\n") == 0,
"2n diff modified obj/clone was %s!", result);
100 fail_unless(empty != NULL,
"Couldn't create empty archetype!");
102 snprintf(expect,
sizeof(expect),
"arch empty_archetype\nend\n");
106 fail_unless(result && strcmp(result, expect) == 0,
"dump_object was \"%s\" instead of \"%s\"!", result, expect);
115 fail_unless(empty->
head != NULL,
"Couldn't create empty archetype as head!");
116 fail_unless(empty->
inv != NULL,
"Couldn't create empty archetype as inv!");
117 fail_unless(empty->
more != NULL,
"Couldn't create empty archetype as more!");
118 fail_unless(empty->
owner != NULL,
"Couldn't create empty archetype as owner!");
119 fail_unless(empty->
env != NULL,
"Couldn't create empty archetype as env!");
125 fail_unless(result && strcmp(result, expect) == 0,
"dump_object was \"%s\" instead of \"%s\"!", result, expect);
131 Suite *s = suite_create(
"loader");
132 TCase *tc_core = tcase_create(
"Core");
137 suite_add_tcase(s, tc_core);
138 tcase_add_test(tc_core, test_get_ob_diff);
139 tcase_add_test(tc_core, test_dump_object);
147 SRunner *sr = srunner_create(s);
149 srunner_set_xml(sr, LOGDIR
"/unit/common/loader.xml");
150 srunner_set_log(sr, LOGDIR
"/unit/common/loader.out");
151 srunner_run_all(sr, CK_ENV);
152 nf = srunner_ntests_failed(sr);
154 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
archetype * find_archetype(const char *name)
StringBuffer * stringbuffer_new(void)
EXTERN archetype * empty_archetype
void dump_object(object *op, StringBuffer *sb)
START_TEST(test_get_ob_diff)
int snprintf(char *dest, int max, const char *format,...)
void get_ob_diff(StringBuffer *sb, object *op, object *op2)
END_TEST Suite * loader_suite(void)
#define FREE_AND_COPY(sv, nv)
object * arch_to_object(archetype *at)
char * stringbuffer_finish(StringBuffer *sb)