Crossfire Server, Trunk
check_c_object.c File Reference
#include <global.h>
#include <stdlib.h>
#include <check.h>
#include <loader.h>
#include <toolkit_common.h>
#include <sproto.h>
+ Include dependency graph for check_c_object.c:

Go to the source code of this file.

Macros

#define DO_DROP   2
 
#define DO_TAKE   1
 
#define TEST_ITEMS_COUNT   11
 

Functions

static END_TEST Suite * c_object_suite (void)
 
static void do_test (const int do_what, const char *param,...)
 
static objectfind_best_apply_object_match (object *start, object *pl, const char *params, int aflag)
 
int main (void)
 
static void setup (void)
 
END_TEST START_TEST (test_command_drop)
 
 START_TEST (test_command_take)
 
 START_TEST (test_find_best_apply_object_match)
 
END_TEST START_TEST (test_put_object_in_sack)
 
static void teardown (void)
 

Variables

static char * test_items [TEST_ITEMS_COUNT]
 

Macro Definition Documentation

◆ DO_DROP

#define DO_DROP   2

Definition at line 190 of file check_c_object.c.

◆ DO_TAKE

#define DO_TAKE   1

Definition at line 189 of file check_c_object.c.

◆ TEST_ITEMS_COUNT

#define TEST_ITEMS_COUNT   11

Definition at line 174 of file check_c_object.c.

Function Documentation

◆ c_object_suite()

static END_TEST Suite* c_object_suite ( void  )
static

Definition at line 318 of file check_c_object.c.

References setup(), and teardown().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_test()

static void do_test ( const int  do_what,
const char *  param,
  ... 
)
static

Actual testing function. It creates all items in test_items, puts them on map or in inventory, and either takes or drops with the specified parameter. After "param", there should be 2 integer lists finished by -1, specifying first the index of items to lock, then the index of items that should be picked/dropped by the commant.

Parameters
do_whateither DO_TAKE or DO_DROP.
paramparameter to the take or drop command.
...items to lock, then items that should be non pickable, then items which should be taken/dropped.

Definition at line 203 of file check_c_object.c.

References convert::action, archininventory::arch, arch_to_object(), make_face_from_files::args, reputation_trigger_connect::check(), command_drop(), command_take(), create_archetype(), DO_TAKE, env, FLAG_INV_LOCKED, FLAG_NO_PICK, get_empty_map(), INS_BELOW_ORIGINATOR, disinfect::map, object_insert_in_map_at(), object_insert_in_ob(), SET_FLAG, test_items, TEST_ITEMS_COUNT, test_map, give::top, and try_find_archetype().

Referenced by START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_best_apply_object_match()

static object* find_best_apply_object_match ( object start,
object pl,
const char *  params,
int  aflag 
)
static

Definition at line 47 of file check_c_object.c.

References AP_APPLY, AP_UNAPPLY, FLAG_APPLIED, object_matches_string(), roll-o-matic::params, QUERY_FLAG, and Ice::tmp.

Referenced by START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main()

int main ( void  )

Definition at line 334 of file check_c_object.c.

References c_object_suite(), cctk_setdatadir(), Settings::debug, init(), and settings.

+ Here is the call graph for this function:

◆ setup()

static void setup ( void  )
static

Definition at line 40 of file check_c_object.c.

Referenced by c_object_suite().

+ Here is the caller graph for this function:

◆ START_TEST() [1/4]

END_TEST START_TEST ( test_command_drop  )

Definition at line 298 of file check_c_object.c.

References DO_DROP, and do_test().

+ Here is the call graph for this function:

◆ START_TEST() [2/4]

START_TEST ( test_command_take  )

Definition at line 269 of file check_c_object.c.

References DO_TAKE, and do_test().

+ Here is the call graph for this function:

◆ START_TEST() [3/4]

START_TEST ( test_find_best_apply_object_match  )

◆ START_TEST() [4/4]

◆ teardown()

static void teardown ( void  )
static

Definition at line 43 of file check_c_object.c.

Referenced by c_object_suite().

+ Here is the caller graph for this function:

Variable Documentation

◆ test_items

char* test_items[TEST_ITEMS_COUNT]
static
Initial value:
= {
"sword",
"broadsword",
"power_crystal",
"plate_mail",
"full_helmet",
"ring",
"amulet",
"rod_light",
"platinacoin",
"gem",
"dungeon_magic"
}

Definition at line 175 of file check_c_object.c.

Referenced by do_test().