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

Go to the source code of this file.

Macros

#define IS_OBJECT_ACTIVE(op)   (op->active_next || op->active_prev || op == active_objects)
 

Functions

int main (void)
 
static END_TEST Suite * object_suite (void)
 
static void setup (void)
 
END_TEST START_TEST (test_absdir)
 
END_TEST START_TEST (test_arch_present_in_ob)
 
END_TEST START_TEST (test_can_see_monsterP)
 
END_TEST START_TEST (test_dirdiff)
 
END_TEST START_TEST (test_find_dir_2)
 
END_TEST START_TEST (test_get_search_arr)
 
END_TEST START_TEST (test_map_find_by_archetype)
 
END_TEST START_TEST (test_map_find_by_type)
 
END_TEST START_TEST (test_object_add_weight)
 
 START_TEST (test_object_can_merge)
 
END_TEST START_TEST (test_object_can_pick)
 
END_TEST START_TEST (test_object_check_move_on)
 
END_TEST START_TEST (test_object_clear)
 
END_TEST START_TEST (test_object_clear_owner)
 
END_TEST START_TEST (test_object_copy)
 
END_TEST START_TEST (test_object_copy_owner)
 
END_TEST START_TEST (test_object_count_active)
 
END_TEST START_TEST (test_object_count_free)
 
END_TEST START_TEST (test_object_count_used)
 
END_TEST START_TEST (test_object_create_clone)
 
END_TEST START_TEST (test_object_decrease_nrof)
 
END_TEST START_TEST (test_object_distance)
 
END_TEST START_TEST (test_object_dump)
 
END_TEST START_TEST (test_object_dump_all)
 
END_TEST START_TEST (test_object_find_by_name_global)
 
END_TEST START_TEST (test_object_find_by_tag_global)
 
END_TEST START_TEST (test_object_find_by_type_subtype)
 
END_TEST START_TEST (test_object_find_first_free_spot)
 
END_TEST START_TEST (test_object_find_free_spot)
 
END_TEST START_TEST (test_object_free_all_data)
 
END_TEST START_TEST (test_object_free_drop_inventory)
 
END_TEST START_TEST (test_object_get_env_recursive)
 
END_TEST START_TEST (test_object_get_key_value)
 
END_TEST START_TEST (test_object_get_owner)
 
END_TEST START_TEST (test_object_get_player_container)
 
END_TEST START_TEST (test_object_get_value)
 
END_TEST START_TEST (test_object_insert_in_map)
 
END_TEST START_TEST (test_object_insert_in_map_at)
 
END_TEST START_TEST (test_object_insert_in_ob)
 
END_TEST START_TEST (test_object_matches_string)
 
END_TEST START_TEST (test_object_merge)
 
END_TEST START_TEST (test_object_new)
 
END_TEST START_TEST (test_object_present_in_ob)
 
END_TEST START_TEST (test_object_present_in_ob_by_name)
 
END_TEST START_TEST (test_object_remove)
 
END_TEST START_TEST (test_object_remove_from_active_list)
 
END_TEST START_TEST (test_object_replace_insert_in_map)
 
END_TEST START_TEST (test_object_reset)
 
END_TEST START_TEST (test_object_set_cheat)
 
END_TEST START_TEST (test_object_set_flag_inv)
 
END_TEST START_TEST (test_object_set_owner)
 
END_TEST START_TEST (test_object_set_value)
 
END_TEST START_TEST (test_object_split)
 
END_TEST START_TEST (test_object_sub_weight)
 
END_TEST START_TEST (test_object_sum_weight)
 
END_TEST START_TEST (test_object_unset_flag_inv)
 
END_TEST START_TEST (test_object_update)
 
 START_TEST (test_object_update_speed)
 
END_TEST START_TEST (test_object_update_turn_face)
 
END_TEST START_TEST (test_object_was_destroyed)
 
static void teardown (void)
 

Macro Definition Documentation

◆ IS_OBJECT_ACTIVE

#define IS_OBJECT_ACTIVE (   op)    (op->active_next || op->active_prev || op == active_objects)

Definition at line 458 of file check_object.c.

Function Documentation

◆ main()

int main ( void  )

Definition at line 1249 of file check_object.c.

References object_suite().

+ Here is the call graph for this function:

◆ object_suite()

static END_TEST Suite* object_suite ( void  )
static

Definition at line 1177 of file check_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:

◆ setup()

static void setup ( void  )
static

Definition at line 41 of file check_object.c.

References cctk_init_std_archetypes(), cctk_setdatadir(), and cctk_setlog().

Referenced by object_suite().

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

◆ START_TEST() [1/60]

END_TEST START_TEST ( test_absdir  )

This is the test to check the behaviour of the method int absdir(int d);

Definition at line 1060 of file check_object.c.

◆ START_TEST() [2/60]

END_TEST START_TEST ( test_arch_present_in_ob  )

This is the test to check the behaviour of the method object *arch_present_in_ob(const archetype *at, const object *op);

Definition at line 988 of file check_object.c.

◆ START_TEST() [3/60]

END_TEST START_TEST ( test_can_see_monsterP  )

This is the test to check the behaviour of the method int can_see_monsterP(mapstruct *m, int x, int y, int dir);

Definition at line 1076 of file check_object.c.

◆ START_TEST() [4/60]

END_TEST START_TEST ( test_dirdiff  )

This is the test to check the behaviour of the method int dirdiff(int dir1, int dir2);

Definition at line 1068 of file check_object.c.

◆ START_TEST() [5/60]

END_TEST START_TEST ( test_find_dir_2  )

This is the test to check the behaviour of the method int find_dir_2(int x, int y);

Definition at line 1052 of file check_object.c.

◆ START_TEST() [6/60]

END_TEST START_TEST ( test_get_search_arr  )

This is the test to check the behaviour of the method void get_search_arr(int *search_arr);

Definition at line 1036 of file check_object.c.

◆ START_TEST() [7/60]

END_TEST START_TEST ( test_map_find_by_archetype  )

This is the test to check the behaviour of the method object *map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at);

Definition at line 956 of file check_object.c.

◆ START_TEST() [8/60]

END_TEST START_TEST ( test_map_find_by_type  )

This is the test to check the behaviour of the method object *map_find_by_type(mapstruct *m, int x, int y, unsigned char type);

Definition at line 964 of file check_object.c.

◆ START_TEST() [9/60]

END_TEST START_TEST ( test_object_add_weight  )

This is the test to check the behaviour of the method void object_add_weight(object *op, signed long weight);

Definition at line 908 of file check_object.c.

◆ START_TEST() [10/60]

START_TEST ( test_object_can_merge  )

This is the test to check the behaviour of the method int object_can_merge(object *ob1, object *ob2);

Definition at line 101 of file check_object.c.

References add_string(), cctk_create_game_object(), guildbuy::ob1, guildbuy::ob2, and object_can_merge().

+ Here is the call graph for this function:

◆ START_TEST() [11/60]

END_TEST START_TEST ( test_object_can_pick  )

This is the test to check the behaviour of the method int object_can_pick(const object *who, const object *item);

Definition at line 1084 of file check_object.c.

◆ START_TEST() [12/60]

END_TEST START_TEST ( test_object_check_move_on  )

This is the test to check the behaviour of the method int object_check_move_on(object *op, object *originator);

Definition at line 948 of file check_object.c.

◆ START_TEST() [13/60]

END_TEST START_TEST ( test_object_clear  )

This is the test to check the behaviour of the method void object_clear(object *op);

Definition at line 358 of file check_object.c.

References add_string(), cctk_create_game_object(), cctk_set_object_strings(), guildbuy::ob1, object_clear(), and query_refcount().

+ Here is the call graph for this function:

◆ START_TEST() [14/60]

END_TEST START_TEST ( test_object_clear_owner  )

This is the test to check the behaviour of the method void object_clear_owner(object *op);

Definition at line 291 of file check_object.c.

References cctk_create_game_object(), guildbuy::ob1, guildbuy::ob2, object_clear_owner(), and object_set_owner().

+ Here is the call graph for this function:

◆ START_TEST() [15/60]

END_TEST START_TEST ( test_object_copy  )

This is the test to check the behaviour of the method void object_copy(object *op2, object *op);

Definition at line 382 of file check_object.c.

References add_string(), cctk_create_game_object(), cctk_set_object_strings(), guildbuy::ob1, guildbuy::ob2, object_copy(), and query_refcount().

+ Here is the call graph for this function:

◆ START_TEST() [16/60]

END_TEST START_TEST ( test_object_copy_owner  )

This is the test to check the behaviour of the method void object_copy_owner(object *op, object *clone);

Definition at line 321 of file check_object.c.

References cctk_create_game_object(), guildbuy::ob1, guildbuy::ob2, object_copy_owner(), object_get_owner(), and object_set_owner().

+ Here is the call graph for this function:

◆ START_TEST() [17/60]

END_TEST START_TEST ( test_object_count_active  )

This is the test to check the behaviour of the method int object_count_active(void);

Definition at line 582 of file check_object.c.

References cctk_create_game_object(), MIN_ACTIVE_SPEED, guildbuy::ob1, object_count_active(), and object_update_speed().

+ Here is the call graph for this function:

◆ START_TEST() [18/60]

END_TEST START_TEST ( test_object_count_free  )

This is the test to check the behaviour of the method int object_count_free(void);

Definition at line 547 of file check_object.c.

References cctk_create_game_object(), and object_count_free().

+ Here is the call graph for this function:

◆ START_TEST() [19/60]

END_TEST START_TEST ( test_object_count_used  )

This is the test to check the behaviour of the method int object_count_used(void);

Definition at line 568 of file check_object.c.

References cctk_create_game_object(), and object_count_used().

+ Here is the call graph for this function:

◆ START_TEST() [20/60]

END_TEST START_TEST ( test_object_create_clone  )

This is the test to check the behaviour of the method object *object_create_clone(object *asrc);

Definition at line 1092 of file check_object.c.

◆ START_TEST() [21/60]

END_TEST START_TEST ( test_object_decrease_nrof  )

This is the test to check the behaviour of the method object *object_decrease_nrof(object *op, uint32_t i);

Definition at line 888 of file check_object.c.

References cctk_create_game_object(), FLAG_FREED, obj::nrof, object_decrease_nrof(), and QUERY_FLAG.

+ Here is the call graph for this function:

◆ START_TEST() [22/60]

END_TEST START_TEST ( test_object_distance  )

This is the test to check the behaviour of the method int object_distance(const object *ob1, const object *ob2);

Definition at line 1044 of file check_object.c.

◆ START_TEST() [23/60]

END_TEST START_TEST ( test_object_dump  )

This is the test to check the behaviour of the method void object_dump(object *op);

Definition at line 200 of file check_object.c.

References cctk_create_game_object(), guildbuy::ob1, guildbuy::ob2, object_dump(), object_insert_in_ob(), rotate-tower::result, stringbuffer_finish(), and stringbuffer_new().

+ Here is the call graph for this function:

◆ START_TEST() [24/60]

END_TEST START_TEST ( test_object_dump_all  )

This is the test to check the behaviour of the method void object_dump_all(void);

Definition at line 223 of file check_object.c.

References cctk_create_game_object(), and object_dump_all().

+ Here is the call graph for this function:

◆ START_TEST() [25/60]

END_TEST START_TEST ( test_object_find_by_name_global  )

This is the test to check the behaviour of the method object *object_find_by_name_global(const char *str);

Definition at line 249 of file check_object.c.

References add_string(), cctk_create_game_object(), guildbuy::ob1, object_find_by_name_global(), and rotate-tower::result.

+ Here is the call graph for this function:

◆ START_TEST() [26/60]

END_TEST START_TEST ( test_object_find_by_tag_global  )

This is the test to check the behaviour of the method object *object_find_by_tag_global(tag_t i);

Definition at line 234 of file check_object.c.

References cctk_create_game_object(), guildbuy::ob1, object_find_by_tag_global(), and rotate-tower::result.

+ Here is the call graph for this function:

◆ START_TEST() [27/60]

END_TEST START_TEST ( test_object_find_by_type_subtype  )

This is the test to check the behaviour of the method object *object_find_by_type_subtype(const object *who, int type, int subtype);

Definition at line 1108 of file check_object.c.

◆ START_TEST() [28/60]

END_TEST START_TEST ( test_object_find_first_free_spot  )

This is the test to check the behaviour of the method int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y);

Definition at line 1028 of file check_object.c.

◆ START_TEST() [29/60]

END_TEST START_TEST ( test_object_find_free_spot  )

This is the test to check the behaviour of the method int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop);

Definition at line 1020 of file check_object.c.

◆ START_TEST() [30/60]

END_TEST START_TEST ( test_object_free_all_data  )

This is the test to check the behaviour of the method void object_free_all_data(void);

Definition at line 267 of file check_object.c.

◆ START_TEST() [31/60]

END_TEST START_TEST ( test_object_free_drop_inventory  )

This is the test to check the behaviour of the method void object_free_drop_inventory(object *ob);

Definition at line 531 of file check_object.c.

References cctk_create_game_object(), FLAG_FREED, guildbuy::ob1, guildbuy::ob2, object_free_drop_inventory(), object_insert_in_ob(), and QUERY_FLAG.

+ Here is the call graph for this function:

◆ START_TEST() [32/60]

END_TEST START_TEST ( test_object_get_env_recursive  )

This is the test to check the behaviour of the method object *object_get_env_recursive(object *op);

Definition at line 153 of file check_object.c.

References cctk_create_game_object(), guildbuy::ob1, guildbuy::ob2, object_get_env_recursive(), object_insert_in_ob(), and rotate-tower::result.

+ Here is the call graph for this function:

◆ START_TEST() [33/60]

END_TEST START_TEST ( test_object_get_key_value  )

This is the test to check the behaviour of the method key_value *object_get_key_value(const object *ob, const char *key);

Definition at line 1116 of file check_object.c.

◆ START_TEST() [34/60]

END_TEST START_TEST ( test_object_get_owner  )

This is the test to check the behaviour of the method object *object_get_owner(object *op);

Definition at line 275 of file check_object.c.

References cctk_create_game_object(), CLEAR_FLAG, FLAG_REMOVED, guildbuy::ob1, guildbuy::ob2, object_get_owner(), and object_set_owner().

+ Here is the call graph for this function:

◆ START_TEST() [35/60]

END_TEST START_TEST ( test_object_get_player_container  )

This is the test to check the behaviour of the method object *object_get_player_container(object *op);

Definition at line 175 of file check_object.c.

References cctk_create_game_object(), guildbuy::ob1, guildbuy::ob2, object_get_player_container(), object_insert_in_ob(), PLAYER, and rotate-tower::result.

+ Here is the call graph for this function:

◆ START_TEST() [36/60]

END_TEST START_TEST ( test_object_get_value  )

This is the test to check the behaviour of the method const char *object_get_value(const object *op, const char *const key);

Definition at line 1124 of file check_object.c.

◆ START_TEST() [37/60]

END_TEST START_TEST ( test_object_insert_in_map  )

This is the test to check the behaviour of the method object *object_insert_in_map(object *op, mapstruct *m, object *originator, int flag);

Definition at line 702 of file check_object.c.

References obj::above, obj::below, cctk_create_game_object(), FLAG_FREED, get_empty_map(), GET_MAP_OB, sunnista::got, INS_ABOVE_FLOOR_ONLY, INS_BELOW_ORIGINATOR, disinfect::map, obj::nrof, object_insert_in_map(), QUERY_FLAG, obj::value, obj::x, and obj::y.

+ Here is the call graph for this function:

◆ START_TEST() [38/60]

END_TEST START_TEST ( test_object_insert_in_map_at  )

This is the test to check the behaviour of the method object *object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y);

Definition at line 671 of file check_object.c.

References cctk_create_game_object(), get_empty_map(), GET_MAP_OB, sunnista::got, disinfect::map, obj::more, and object_insert_in_map_at().

+ Here is the call graph for this function:

◆ START_TEST() [39/60]

END_TEST START_TEST ( test_object_insert_in_ob  )

This is the test to check the behaviour of the method object *object_insert_in_ob(object *op, object *where);

Definition at line 916 of file check_object.c.

References obj::carrying, cctk_create_game_object(), obj::inv, object_insert_in_ob(), and object_remove().

+ Here is the call graph for this function:

◆ START_TEST() [40/60]

END_TEST START_TEST ( test_object_matches_string  )

This is the test to check the behaviour of the method int object_matches_string(object *pl, object *op, const char *name);

Definition at line 1140 of file check_object.c.

References add_string(), cctk_create_game_object(), CLEAR_FLAG, FLAG_IDENTIFIED, FLAG_UNPAID, object_matches_string(), altar_valkyrie::pl, SET_FLAG, and obj::title.

+ Here is the call graph for this function:

◆ START_TEST() [41/60]

END_TEST START_TEST ( test_object_merge  )

This is the test to check the behaviour of the method object *object_merge(object *op, object *top);

Definition at line 645 of file check_object.c.

References obj::above, add_string(), obj::below, cctk_create_game_object(), obj::name, guildbuy::ob1, and guildbuy::ob2.

+ Here is the call graph for this function:

◆ START_TEST() [42/60]

END_TEST START_TEST ( test_object_new  )

This is the test to check the behaviour of the method object *object_new(void);

Definition at line 410 of file check_object.c.

References llevDebug, LOG(), guildjoin::ob, and object_new().

+ Here is the call graph for this function:

◆ START_TEST() [43/60]

END_TEST START_TEST ( test_object_present_in_ob  )

This is the test to check the behaviour of the method object *object_present_in_ob(unsigned char type, const object *op);

Definition at line 972 of file check_object.c.

◆ START_TEST() [44/60]

END_TEST START_TEST ( test_object_present_in_ob_by_name  )

This is the test to check the behaviour of the method object *object_present_in_ob_by_name(int type, const char *str, const object *op);

Definition at line 980 of file check_object.c.

◆ START_TEST() [45/60]

END_TEST START_TEST ( test_object_remove  )

This is the test to check the behaviour of the method void object_remove(object *op);

Definition at line 633 of file check_object.c.

◆ START_TEST() [46/60]

END_TEST START_TEST ( test_object_remove_from_active_list  )

This is the test to check the behaviour of the method void object_remove_from_active_list(object *op);

Definition at line 507 of file check_object.c.

References cctk_create_game_object(), IS_OBJECT_ACTIVE, MIN_ACTIVE_SPEED, guildbuy::ob1, object_remove_from_active_list(), and object_update_speed().

+ Here is the call graph for this function:

◆ START_TEST() [47/60]

END_TEST START_TEST ( test_object_replace_insert_in_map  )

◆ START_TEST() [48/60]

END_TEST START_TEST ( test_object_reset  )

This is the test to check the behaviour of the method void object_reset(object *op);

Definition at line 338 of file check_object.c.

References cctk_create_game_object(), guildbuy::ob1, and object_reset().

+ Here is the call graph for this function:

◆ START_TEST() [49/60]

END_TEST START_TEST ( test_object_set_cheat  )

This is the test to check the behaviour of the method void object_set_cheat(object *op);

Definition at line 1012 of file check_object.c.

◆ START_TEST() [50/60]

END_TEST START_TEST ( test_object_set_flag_inv  )

This is the test to check the behaviour of the method void object_set_flag_inv(object *op, int flag);

Definition at line 996 of file check_object.c.

◆ START_TEST() [51/60]

END_TEST START_TEST ( test_object_set_owner  )

This is the test to check the behaviour of the method void object_set_owner(object *op, object *owner);

Definition at line 307 of file check_object.c.

References cctk_create_game_object(), guildbuy::ob1, guildbuy::ob2, and object_set_owner().

+ Here is the call graph for this function:

◆ START_TEST() [52/60]

END_TEST START_TEST ( test_object_set_value  )

This is the test to check the behaviour of the method int object_set_value(object *op, const char *key, const char *value, int add_key);

Definition at line 1132 of file check_object.c.

◆ START_TEST() [53/60]

END_TEST START_TEST ( test_object_split  )

This is the test to check the behaviour of the method object *object_split(object *orig_ob, uint32_t nr);

Definition at line 861 of file check_object.c.

References cctk_create_game_object(), FLAG_FREED, obj::nrof, object_split(), and QUERY_FLAG.

+ Here is the call graph for this function:

◆ START_TEST() [54/60]

END_TEST START_TEST ( test_object_sub_weight  )

This is the test to check the behaviour of the method void object_sub_weight(object *op, signed long weight);

Definition at line 601 of file check_object.c.

References cctk_create_game_object(), CONTAINER, guildbuy::ob1, guildbuy::ob2, object_insert_in_ob(), object_sub_weight(), object_sum_weight(), obj::type, and obj::weight.

+ Here is the call graph for this function:

◆ START_TEST() [55/60]

END_TEST START_TEST ( test_object_sum_weight  )

This is the test to check the behaviour of the method signed long object_sum_weight(object *op);

Definition at line 124 of file check_object.c.

References cctk_create_game_object(), CONTAINER, guildbuy::ob1, guildbuy::ob2, object_insert_in_ob(), object_sum_weight(), and obj::weight.

+ Here is the call graph for this function:

◆ START_TEST() [56/60]

END_TEST START_TEST ( test_object_unset_flag_inv  )

This is the test to check the behaviour of the method void object_unset_flag_inv(object *op, int flag);

Definition at line 1004 of file check_object.c.

◆ START_TEST() [57/60]

END_TEST START_TEST ( test_object_update  )

This is the test to check the behaviour of the method void object_update(object *op, int action);

Definition at line 523 of file check_object.c.

◆ START_TEST() [58/60]

START_TEST ( test_object_update_speed  )

This is the test to check the behaviour of the method void object_update_speed(object *op);

Definition at line 462 of file check_object.c.

References cctk_create_game_object(), IS_OBJECT_ACTIVE, MIN_ACTIVE_SPEED, guildbuy::ob1, guildbuy::ob2, object_update_speed(), and obj::speed.

+ Here is the call graph for this function:

◆ START_TEST() [59/60]

END_TEST START_TEST ( test_object_update_turn_face  )

This is the test to check the behaviour of the method void object_update_turn_face(object *op);

Definition at line 442 of file check_object.c.

References cctk_create_game_object(), guildbuy::ob1, and object_update_turn_face().

+ Here is the call graph for this function:

◆ START_TEST() [60/60]

END_TEST START_TEST ( test_object_was_destroyed  )

This is the test to check the behaviour of the method int object_was_destroyed(const object *op, tag_t old_tag);

Definition at line 1100 of file check_object.c.

◆ teardown()

static void teardown ( void  )
static

Definition at line 48 of file check_object.c.

Referenced by object_suite().

+ Here is the caller graph for this function: