Crossfire Server, Branches 1.12  R18729
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)
 
END_TEST Suite * object_suite (void)
 
void setup (void)
 
 START_TEST (test_can_merge)
 
END_TEST START_TEST (test_sum_weight)
 
END_TEST START_TEST (test_object_get_env_recursive)
 
END_TEST START_TEST (test_get_player_container)
 
END_TEST START_TEST (test_dump_object)
 
END_TEST START_TEST (test_dump_all_objects)
 
END_TEST START_TEST (test_find_object)
 
END_TEST START_TEST (test_find_object_name)
 
END_TEST START_TEST (test_free_all_object_data)
 
END_TEST START_TEST (test_get_owner)
 
END_TEST START_TEST (test_clear_owner)
 
END_TEST START_TEST (test_set_owner)
 
END_TEST START_TEST (test_copy_owner)
 
END_TEST START_TEST (test_reset_object)
 
END_TEST START_TEST (test_clear_object)
 
END_TEST START_TEST (test_copy_object)
 
END_TEST START_TEST (test_get_object)
 
END_TEST START_TEST (test_update_turn_face)
 
 START_TEST (test_update_ob_speed)
 
END_TEST START_TEST (test_remove_from_active_list)
 
END_TEST START_TEST (test_update_object)
 
END_TEST START_TEST (test_free_object)
 
END_TEST START_TEST (test_count_free)
 
END_TEST START_TEST (test_count_used)
 
END_TEST START_TEST (test_count_active)
 
END_TEST START_TEST (test_sub_weight)
 
END_TEST START_TEST (test_remove_ob)
 
END_TEST START_TEST (test_merge_ob)
 
END_TEST START_TEST (test_insert_ob_in_map_at)
 
END_TEST START_TEST (test_insert_ob_in_map)
 
END_TEST START_TEST (test_replace_insert_ob_in_map)
 
END_TEST START_TEST (test_get_split_ob)
 
END_TEST START_TEST (test_decrease_ob_nr)
 
END_TEST START_TEST (test_add_weight)
 
END_TEST START_TEST (test_insert_ob_in_ob)
 
END_TEST START_TEST (test_check_move_on)
 
END_TEST START_TEST (test_present_arch)
 
END_TEST START_TEST (test_present)
 
END_TEST START_TEST (test_present_in_ob)
 
END_TEST START_TEST (test_present_in_ob_by_name)
 
END_TEST START_TEST (test_present_arch_in_ob)
 
END_TEST START_TEST (test_flag_inv)
 
END_TEST START_TEST (test_unflag_inv)
 
END_TEST START_TEST (test_set_cheat)
 
END_TEST START_TEST (test_find_free_spot)
 
END_TEST START_TEST (test_find_first_free_spot)
 
END_TEST START_TEST (test_get_search_arr)
 
END_TEST START_TEST (test_find_dir)
 
END_TEST START_TEST (test_distance)
 
END_TEST START_TEST (test_find_dir_2)
 
END_TEST START_TEST (test_absdir)
 
END_TEST START_TEST (test_dirdiff)
 
END_TEST START_TEST (test_can_see_monsterP)
 
END_TEST START_TEST (test_can_pick)
 
END_TEST START_TEST (test_object_create_clone)
 
END_TEST START_TEST (test_was_destroyed)
 
END_TEST START_TEST (test_find_obj_by_type_subtype)
 
END_TEST START_TEST (test_get_ob_key_link)
 
END_TEST START_TEST (test_get_ob_key_value)
 
END_TEST START_TEST (test_set_ob_key_value)
 
END_TEST START_TEST (test_item_matched_string)
 
void teardown (void)
 

Macro Definition Documentation

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

Definition at line 463 of file check_object.c.

Referenced by START_TEST().

Function Documentation

int main ( void  )

Definition at line 1267 of file check_object.c.

References object_suite().

+ Here is the call graph for this function:

END_TEST Suite* object_suite ( void  )

Definition at line 1194 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:

void setup ( void  )

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 ( test_can_merge  )

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

Definition at line 102 of file check_object.c.

References add_string(), can_merge(), cctk_create_game_object(), obj::name, obj::nrof, and obj::type.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_sum_weight  )

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

Definition at line 125 of file check_object.c.

References cctk_create_game_object(), CONTAINER, insert_ob_in_ob(), obj::nrof, obj::stats, liv::Str, sum_weight(), obj::type, and obj::weight.

+ Here is the call graph for this function:

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 154 of file check_object.c.

References cctk_create_game_object(), insert_ob_in_ob(), and object_get_env_recursive().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_get_player_container  )

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

Definition at line 176 of file check_object.c.

References cctk_create_game_object(), get_player_container(), insert_ob_in_ob(), PLAYER, and obj::type.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_dump_object  )

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

Definition at line 201 of file check_object.c.

References cctk_create_game_object(), dump_object(), insert_ob_in_ob(), stringbuffer_finish(), and stringbuffer_new().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_dump_all_objects  )

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

Definition at line 224 of file check_object.c.

References cctk_create_game_object(), and dump_all_objects().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_find_object  )

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

Definition at line 239 of file check_object.c.

References cctk_create_game_object(), obj::count, and find_object().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_find_object_name  )

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

Definition at line 254 of file check_object.c.

References add_string(), cctk_create_game_object(), find_object_name(), and obj::name.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_free_all_object_data  )

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

Definition at line 272 of file check_object.c.

END_TEST START_TEST ( test_get_owner  )

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

Definition at line 280 of file check_object.c.

References cctk_create_game_object(), CLEAR_FLAG, FLAG_REMOVED, get_owner(), and set_owner().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_clear_owner  )

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

Definition at line 296 of file check_object.c.

References cctk_create_game_object(), clear_owner(), obj::owner, and set_owner().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_set_owner  )

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

Definition at line 312 of file check_object.c.

References cctk_create_game_object(), obj::owner, and set_owner().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_copy_owner  )

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

Definition at line 326 of file check_object.c.

References cctk_create_game_object(), copy_owner(), get_owner(), and set_owner().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_reset_object  )

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

Definition at line 343 of file check_object.c.

References cctk_create_game_object(), obj::lore, obj::materialname, obj::msg, obj::name, obj::name_pl, obj::race, reset_object(), obj::skill, obj::slaying, and obj::title.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_clear_object  )

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

Definition at line 363 of file check_object.c.

References add_string(), cctk_create_game_object(), cctk_set_object_strings(), clear_object(), obj::lore, obj::materialname, obj::msg, obj::name, obj::name_pl, query_refcount(), obj::race, obj::skill, obj::slaying, and obj::title.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_copy_object  )

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

Definition at line 387 of file check_object.c.

References add_string(), cctk_create_game_object(), cctk_set_object_strings(), copy_object(), obj::lore, obj::materialname, obj::msg, obj::name, obj::name_pl, query_refcount(), obj::race, obj::skill, obj::slaying, and obj::title.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_get_object  )

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

Definition at line 415 of file check_object.c.

References obj::active_next, obj::active_prev, get_object(), llevDebug, LOG(), obj::lore, obj::materialname, obj::msg, obj::name, obj::name_pl, obj::prev, obj::race, obj::skill, obj::slaying, and obj::title.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_update_turn_face  )

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

Definition at line 447 of file check_object.c.

References cctk_create_game_object(), obj::direction, obj::face, and update_turn_face().

+ Here is the call graph for this function:

START_TEST ( test_update_ob_speed  )

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

Definition at line 467 of file check_object.c.

References cctk_create_game_object(), IS_OBJECT_ACTIVE, MIN_ACTIVE_SPEED, obj::speed, and update_ob_speed().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_remove_from_active_list  )

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

Definition at line 512 of file check_object.c.

References cctk_create_game_object(), IS_OBJECT_ACTIVE, MIN_ACTIVE_SPEED, remove_from_active_list(), obj::speed, and update_ob_speed().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_update_object  )

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

Definition at line 528 of file check_object.c.

END_TEST START_TEST ( test_free_object  )

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

Definition at line 536 of file check_object.c.

References cctk_create_game_object(), FLAG_FREED, free_object(), insert_ob_in_ob(), and QUERY_FLAG.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_count_free  )

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

Definition at line 552 of file check_object.c.

References cctk_create_game_object(), and count_free().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_count_used  )

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

Definition at line 574 of file check_object.c.

References cctk_create_game_object(), and count_used().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_count_active  )

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

Definition at line 589 of file check_object.c.

References cctk_create_game_object(), count_active(), MIN_ACTIVE_SPEED, obj::speed, and update_ob_speed().

+ Here is the call graph for this function:

END_TEST START_TEST ( test_sub_weight  )

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

Definition at line 608 of file check_object.c.

References obj::carrying, cctk_create_game_object(), CONTAINER, insert_ob_in_ob(), obj::stats, liv::Str, sub_weight(), sum_weight(), obj::type, and obj::weight.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_remove_ob  )

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

Definition at line 640 of file check_object.c.

END_TEST START_TEST ( test_merge_ob  )

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

Definition at line 652 of file check_object.c.

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

+ Here is the call graph for this function:

END_TEST START_TEST ( test_insert_ob_in_map_at  )

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

Definition at line 679 of file check_object.c.

References cctk_create_game_object(), get_empty_map(), GET_MAP_OB, insert_ob_in_map_at(), and obj::more.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_insert_ob_in_map  )

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

Definition at line 710 of file check_object.c.

References obj::above, obj::below, cctk_create_game_object(), FLAG_FREED, get_empty_map(), GET_MAP_OB, INS_ABOVE_FLOOR_ONLY, INS_BELOW_ORIGINATOR, insert_ob_in_map(), obj::nrof, QUERY_FLAG, obj::value, obj::x, and obj::y.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_replace_insert_ob_in_map  )

This is the test to check the behaviour of the method void replace_insert_ob_in_map(const char *arch_string, object *op);

Definition at line 818 of file check_object.c.

References cctk_create_game_object(), obj::count, get_empty_map(), GET_MAP_OB, insert_ob_in_map_at(), replace_insert_ob_in_map(), and was_destroyed.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_get_split_ob  )

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

Definition at line 869 of file check_object.c.

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

+ Here is the call graph for this function:

END_TEST START_TEST ( test_decrease_ob_nr  )

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

Definition at line 896 of file check_object.c.

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

+ Here is the call graph for this function:

END_TEST START_TEST ( test_add_weight  )

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

Definition at line 916 of file check_object.c.

END_TEST START_TEST ( test_insert_ob_in_ob  )

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

Definition at line 924 of file check_object.c.

References obj::carrying, cctk_create_game_object(), insert_ob_in_ob(), obj::inv, remove_ob(), and obj::weight.

+ Here is the call graph for this function:

END_TEST START_TEST ( test_check_move_on  )

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

Definition at line 956 of file check_object.c.

END_TEST START_TEST ( test_present_arch  )

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

Definition at line 964 of file check_object.c.

END_TEST START_TEST ( test_present  )

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

Definition at line 972 of file check_object.c.

END_TEST START_TEST ( test_present_in_ob  )

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

Definition at line 980 of file check_object.c.

END_TEST START_TEST ( test_present_in_ob_by_name  )

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

Definition at line 988 of file check_object.c.

END_TEST START_TEST ( test_present_arch_in_ob  )

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

Definition at line 996 of file check_object.c.

END_TEST START_TEST ( test_flag_inv  )

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

Definition at line 1005 of file check_object.c.

END_TEST START_TEST ( test_unflag_inv  )

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

Definition at line 1013 of file check_object.c.

END_TEST START_TEST ( test_set_cheat  )

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

Definition at line 1021 of file check_object.c.

END_TEST START_TEST ( test_find_free_spot  )

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

Definition at line 1029 of file check_object.c.

END_TEST START_TEST ( test_find_first_free_spot  )

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

Definition at line 1037 of file check_object.c.

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 1045 of file check_object.c.

END_TEST START_TEST ( test_find_dir  )

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

Definition at line 1053 of file check_object.c.

END_TEST START_TEST ( test_distance  )

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

Definition at line 1061 of file check_object.c.

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 1069 of file check_object.c.

END_TEST START_TEST ( test_absdir  )

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

Definition at line 1077 of file check_object.c.

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 1085 of file check_object.c.

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 1093 of file check_object.c.

END_TEST START_TEST ( test_can_pick  )

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

Definition at line 1101 of file check_object.c.

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 1109 of file check_object.c.

END_TEST START_TEST ( test_was_destroyed  )

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

Definition at line 1117 of file check_object.c.

END_TEST START_TEST ( test_find_obj_by_type_subtype  )

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

Definition at line 1125 of file check_object.c.

END_TEST START_TEST ( test_get_ob_key_link  )

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

Definition at line 1133 of file check_object.c.

END_TEST START_TEST ( test_get_ob_key_value  )

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

Definition at line 1141 of file check_object.c.

END_TEST START_TEST ( test_set_ob_key_value  )

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

Definition at line 1149 of file check_object.c.

END_TEST START_TEST ( test_item_matched_string  )

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

Definition at line 1157 of file check_object.c.

References add_string(), cctk_create_game_object(), CLEAR_FLAG, obj::contr, FLAG_IDENTIFIED, FLAG_UNPAID, item_matched_string(), SET_FLAG, and obj::title.

+ Here is the call graph for this function:

void teardown ( void  )

Definition at line 48 of file check_object.c.

Referenced by object_suite().

+ Here is the caller graph for this function: