Crossfire Server, Trunk  R22047
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 object * find_best_apply_object_match (object *start, object *pl, const char *params, int aflag)
 
int main (void)
 
static void setup (void)
 
 START_TEST (test_find_best_apply_object_match)
 
END_TEST START_TEST (test_put_object_in_sack)
 
 START_TEST (test_command_take)
 
END_TEST START_TEST (test_command_drop)
 
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.

Referenced by START_TEST().

◆ DO_TAKE

#define DO_TAKE   1

Definition at line 189 of file check_c_object.c.

Referenced by do_test(), and START_TEST().

◆ TEST_ITEMS_COUNT

#define TEST_ITEMS_COUNT   11

Definition at line 174 of file check_c_object.c.

Referenced by do_test().

Function Documentation

◆ c_object_suite()

static END_TEST Suite* c_object_suite ( void  )
static

Definition at line 316 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 arch_to_object(), command_drop(), command_take(), create_archetype(), DO_TAKE, FLAG_INV_LOCKED, FLAG_NO_PICK, get_empty_map(), treasureliststruct::items, object_insert_in_map_at(), object_insert_in_ob(), SET_FLAG, test_items, TEST_ITEMS_COUNT, test_map, 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(), and QUERY_FLAG.

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 332 of file check_c_object.c.

References c_object_suite(), cctk_setdatadir(), Settings::debug, init(), Settings::logfilename, 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]

START_TEST ( test_find_best_apply_object_match  )

Definition at line 66 of file check_c_object.c.

References add_string(), CLEAR_FLAG, create_archetype(), find_best_apply_object_match(), FLAG_IDENTIFIED, and object_insert_in_ob().

+ Here is the call graph for this function:

◆ START_TEST() [2/4]

END_TEST START_TEST ( test_put_object_in_sack  )

◆ START_TEST() [3/4]

START_TEST ( test_command_take  )

Definition at line 267 of file check_c_object.c.

References DO_TAKE, and do_test().

+ Here is the call graph for this function:

◆ START_TEST() [4/4]

END_TEST START_TEST ( test_command_drop  )

Definition at line 296 of file check_c_object.c.

References DO_DROP, and do_test().

+ Here is the call graph for this function:

◆ 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().