|
Crossfire Server, Branch 1.12
R12190
|
#include <global.h>#include <stdlib.h>#include <check.h>#include <loader.h>#include <toolkit_common.h>#include "stringbuffer.h"
Go to the source code of this file.
Defines | |
| #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) | |
| This is the test to check the behaviour of the method int can_merge(object *ob1, object *ob2);. | |
| END_TEST | START_TEST (test_sum_weight) |
| This is the test to check the behaviour of the method signed long sum_weight(object *op);. | |
| 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);. | |
| 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);. | |
| END_TEST | START_TEST (test_dump_object) |
| This is the test to check the behaviour of the method void dump_object(object *op);. | |
| END_TEST | START_TEST (test_dump_all_objects) |
| This is the test to check the behaviour of the method void dump_all_objects(void);. | |
| END_TEST | START_TEST (test_find_object) |
| This is the test to check the behaviour of the method object *find_object(tag_t i);. | |
| 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);. | |
| 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);. | |
| END_TEST | START_TEST (test_get_owner) |
| This is the test to check the behaviour of the method object *get_owner(object *op);. | |
| END_TEST | START_TEST (test_clear_owner) |
| This is the test to check the behaviour of the method void clear_owner(object *op);. | |
| 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);. | |
| 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);. | |
| END_TEST | START_TEST (test_reset_object) |
| This is the test to check the behaviour of the method void reset_object(object *op);. | |
| END_TEST | START_TEST (test_clear_object) |
| This is the test to check the behaviour of the method void clear_object(object *op);. | |
| 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);. | |
| END_TEST | START_TEST (test_get_object) |
| This is the test to check the behaviour of the method object *get_object(void);. | |
| 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);. | |
| START_TEST (test_update_ob_speed) | |
| This is the test to check the behaviour of the method void update_ob_speed(object *op);. | |
| 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);. | |
| 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);. | |
| END_TEST | START_TEST (test_free_object) |
| This is the test to check the behaviour of the method void free_object(object *ob);. | |
| END_TEST | START_TEST (test_count_free) |
| This is the test to check the behaviour of the method int count_free(void);. | |
| END_TEST | START_TEST (test_count_used) |
| This is the test to check the behaviour of the method int count_used(void);. | |
| END_TEST | START_TEST (test_count_active) |
| This is the test to check the behaviour of the method int count_active(void);. | |
| 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);. | |
| END_TEST | START_TEST (test_remove_ob) |
| This is the test to check the behaviour of the method void remove_ob(object *op);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| END_TEST | START_TEST (test_set_cheat) |
| This is the test to check the behaviour of the method void set_cheat(object *op);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| END_TEST | START_TEST (test_absdir) |
| This is the test to check the behaviour of the method int absdir(int d);. | |
| END_TEST | START_TEST (test_dirdiff) |
| This is the test to check the behaviour of the method int dirdiff(int dir1, int dir2);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| 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);. | |
| void | teardown (void) |
| #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().
| int main | ( | void | ) |
Definition at line 1267 of file check_object.c.
References object_suite().

| END_TEST Suite* object_suite | ( | void | ) |
Definition at line 1194 of file check_object.c.
References setup(), and teardown().
Referenced by main().


| void setup | ( | void | ) |
Definition at line 41 of file check_object.c.
References cctk_init_std_archetypes(), cctk_setdatadir(), and cctk_setlog().

| 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(), and cctk_create_game_object().

| 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(), and sum_weight().

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

| 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(), and PLAYER.

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

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

| 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(), and find_object().

| 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(), and find_object_name().

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

| 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(), and set_owner().

| 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(), and set_owner().

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

| 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(), and reset_object().

| 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(), and query_refcount().

| 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(), and query_refcount().

| 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 get_object(), llevDebug, and LOG().

| 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(), and update_turn_face().

| 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, and update_ob_speed().

| 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(), and update_ob_speed().

| 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.

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

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

| 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, and update_ob_speed().

| 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 cctk_create_game_object(), CONTAINER, insert_ob_in_ob(), sub_weight(), and sum_weight().

| 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 add_string(), and cctk_create_game_object().

| 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, and insert_ob_in_map_at().

| 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 cctk_create_game_object(), FLAG_FREED, get_empty_map(), GET_MAP_OB, insert_ob_in_map(), and QUERY_FLAG.

| 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(), get_empty_map(), GET_MAP_OB, insert_ob_in_map_at(), and replace_insert_ob_in_map().

| 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(), and QUERY_FLAG.

| 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, and QUERY_FLAG.

| 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 cctk_create_game_object(), insert_ob_in_ob(), and remove_ob().

| 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, FLAG_IDENTIFIED, FLAG_UNPAID, item_matched_string(), and SET_FLAG.

| void teardown | ( | void | ) |
Definition at line 48 of file check_object.c.
1.7.6.1