Go to the documentation of this file.
48 object *
tmp, *best = NULL;
49 int match_val = 0, tmpmatch;
68 object *gorokh, *cloak, *other;
97 object *sack, *
obj, *sack2, *dummy;
136 FAIL_UNLESS(sack->
inv == NULL,
"item was put in sack even if too heavy?");
174 #define TEST_ITEMS_COUNT 11
203 static void do_test(
const int do_what,
const char *param, ...) {
207 const char *
action = do_what ==
DO_TAKE ?
"picked" :
"dropped";
212 FAIL_UNLESS(monster != NULL,
"couldn't create kobold");
216 object *
top = monster;
231 va_start(
args, param);
233 while ((idx = va_arg(
args,
int)) != -1) {
236 while ((idx = va_arg(
args,
int)) != -1) {
247 while ((idx = va_arg(
args,
int)) != -1) {
281 do_test(
DO_TAKE,
"all", -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1);
282 do_test(
DO_TAKE,
"*", -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1);
319 Suite *s = suite_create(
"c_object");
320 TCase *tc_core = tcase_create(
"Core");
325 suite_add_tcase(s, tc_core);
326 tcase_add_test(tc_core, test_find_best_apply_object_match);
327 tcase_add_test(tc_core, test_put_object_in_sack);
328 tcase_add_test(tc_core, test_command_take);
329 tcase_add_test(tc_core, test_command_drop);
337 SRunner *sr = srunner_create(s);
343 srunner_set_fork_status (sr, CK_NOFORK);
345 srunner_set_xml(sr, LOGDIR
"/unit/server/c_object.xml");
346 srunner_set_log(sr, LOGDIR
"/unit/server/c_object.out");
347 srunner_run_all(sr, CK_ENV);
348 nf = srunner_ntests_failed(sr);
350 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
#define GET_MAP_OB(M, X, Y)
START_TEST(test_find_best_apply_object_match)
mapstruct * get_empty_map(int sizex, int sizey)
#define QUERY_FLAG(xyz, p)
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
static END_TEST Suite * c_object_suite(void)
object * object_insert_in_ob(object *op, object *where)
static const char * test_items[TEST_ITEMS_COUNT]
void object_free_drop_inventory(object *ob)
static void do_test(const int do_what, const char *param,...)
void command_take(object *op, const char *params)
sstring add_string(const char *str)
static void teardown(void)
#define INS_BELOW_ORIGINATOR
void free_map(mapstruct *m)
int object_matches_string(object *pl, object *op, const char *name)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
static std::shared_ptr< inja::Environment > env
object * create_archetype(const char *name)
void command_drop(object *op, const char *params)
void init(int argc, char **argv)
#define CLEAR_FLAG(xyz, p)
static object * find_best_apply_object_match(object *start, object *pl, const char *params, int aflag)
object * arch_to_object(archetype *at)
void object_remove(object *op)
archetype * try_find_archetype(const char *name)
void put_object_in_sack(object *op, object *sack, object *tmp, uint32_t nrof)