Angband
Macros | Functions | Variables
unit-test.h File Reference
#include "unit-test-types.h"
#include "z-util.h"

Go to the source code of this file.

Macros

#define TEST
 
#define NOSETUP   int setup_tests(void **data) { return 0; }
 
#define NOTEARDOWN   int teardown_tests(void *data) { return 0; }
 
#define ok   return showpass();
 
#define eq(x, y)
 
#define noteq(x, y)
 
#define require(x)
 
#define ptreq(x, y)
 
#define null(x)
 
#define notnull(x)
 

Functions

int showpass (void)
 
int showfail (void)
 

Variables

int verbose
 
const char * suite_name
 

Macro Definition Documentation

#define eq (   x,
 
)
Value:
if ((x) != (y)) { \
if (verbose) { \
printf(" %s:%d: requirement '%s' == '%s' failed\n", suite_name, \
__LINE__, #x, #y); \
printf(" %s: 0x%016lld\n", #x, (long long)x); \
printf(" %s: 0x%016lld\n", #y, (long long)y); \
} \
return 1; \
}
int verbose
Definition: unit-test.c:12
int showfail(void)
Definition: unit-test.c:63
const char * suite_name
Definition: unit-test.h:19

Referenced by test_0(), test_ac0(), test_alloc0(), test_alloc1(), test_alloc2(), test_attack0(), test_baddir(), test_badmax(), test_badtval0(), test_badtval1(), test_base0(), test_base_object0(), test_blank(), test_blow0(), test_blow1(), test_blows(), test_breakage_chance(), test_char0(), test_char1(), test_charges0(), test_chart0(), test_color0(), test_combat0(), test_comment0(), test_comment1(), test_d0(), test_defaults(), test_depth0(), test_desc0(), test_die_msg0(), test_dir_to(), test_drop_eat(), test_drop_pickup(), test_equip0(), test_flags0(), test_flavor0(), test_generate0(), test_graphics0(), test_graphics1(), test_hearing0(), test_height0(), test_hgt0(), test_history0(), test_hp0(), test_hurt_msg0(), test_i0(), test_info0(), test_int0(), test_int1(), test_kind0(), test_loadgame(), test_magic0(), test_magic_missile(), test_max_lev0(), test_mexp0(), test_mimic0(), test_min0(), test_min_lev0(), test_msg0(), test_name0(), test_negative(), test_newgame(), test_obj_can_refill(), test_obj_flags0(), test_obj_piles(), test_opt0(), test_order(), test_owner0(), test_phrase0(), test_pile0(), test_play_flags0(), test_power0(), test_prefs(), test_priority0(), test_properties0(), test_pval0(), test_rand0(), test_rand1(), test_rarity0(), test_rat0(), test_reg0(), test_reg1(), test_reg2(), test_reg3(), test_reg4(), test_reg5(), test_reg_int(), test_reg_str(), test_reg_sym(), test_resist_flag0(), test_run_msg0(), test_section0(), test_section1(), test_skill_device0(), test_skill_dig0(), test_skill_disarm0(), test_skill_melee0(), test_skill_save0(), test_skill_search0(), test_skill_shoot0(), test_skill_stealth0(), test_skill_throw0(), test_sleep0(), test_slots0(), test_smell0(), test_spaces(), test_speed0(), test_spell_freq0(), test_spells0(), test_stairs1(), test_stairs2(), test_stat_dec(), test_stat_inc(), test_stats0(), test_store0(), test_str0(), test_sym0(), test_sym1(), test_syntax0(), test_syntax1(), test_syntax2(), test_time0(), test_title0(), test_typ0(), test_type0(), test_uint0(), test_uint1(), test_values0(), test_walk_msg0(), test_weight0(), test_wid0(), test_word0(), and test_word1().

#define NOSETUP   int setup_tests(void **data) { return 0; }
#define NOTEARDOWN   int teardown_tests(void *data) { return 0; }
#define noteq (   x,
 
)
Value:
if ((x) == (y)) { \
if (verbose) { \
printf(" %s:%d: requirement '%s' != '%s' failed\n", suite_name, \
__LINE__, #x, #y); \
printf(" %s: 0x%016lld\n", #x, (long long)x); \
printf(" %s: 0x%016lld\n", #y, (long long)y); \
} \
return 1; \
}
int verbose
Definition: unit-test.c:12
int showfail(void)
Definition: unit-test.c:63
const char * suite_name
Definition: unit-test.h:19

Referenced by test_magic_missile().

#define notnull (   x)
Value:
if ((x) == 0) { \
if (verbose) { \
printf(" %s:%d: requirement '%s' != NULL failed\n", suite_name, \
__LINE__, #x); \
printf(" %s: 0x%08lx\n", #x, (unsigned long)(x)); \
} \
return 1; \
}
int verbose
Definition: unit-test.c:12
int showfail(void)
Definition: unit-test.c:63
const char * suite_name
Definition: unit-test.h:19

Referenced by test_loadgame(), test_magic_missile(), and test_newgame().

#define null (   x)
Value:
if ((x) != 0) { \
if (verbose) { \
printf(" %s:%d: requirement '%s' == NULL failed\n", suite_name, \
__LINE__, #x); \
printf(" %s: 0x%08lxn", #x, (unsigned long)(x)); \
} \
return 1; \
}
int verbose
Definition: unit-test.c:12
int showfail(void)
Definition: unit-test.c:63
const char * suite_name
Definition: unit-test.h:19

Referenced by test_chart0(), test_drop_eat(), test_drop_pickup(), test_history0(), and test_obj_piles().

#define ok   return showpass();

Referenced by alloc_objects(), brand_object(), do_cmd_pref_file_hack(), get_pref_path(), match_monster_bases(), savefile_load(), setup_tests(), teardown_tests(), test_0(), test_ac0(), test_alloc(), test_alloc0(), test_alloc1(), test_alloc2(), test_append(), test_attack0(), test_baddir(), test_badmax(), test_badtval0(), test_badtval1(), test_base0(), test_base_object0(), test_blank(), test_blow0(), test_blow1(), test_blows(), test_breakage_chance(), test_char0(), test_char1(), test_charges0(), test_chart0(), test_cmd_lookup_orig(), test_cmd_lookup_rogue(), test_color0(), test_colour(), test_combat0(), test_comment0(), test_comment1(), test_d0(), test_dedup(), test_defaults(), test_depth0(), test_desc0(), test_die_msg0(), test_dir_to(), test_drop_eat(), test_drop_pickup(), test_effects(), test_empty(), test_equip0(), test_evaluate(), test_flags0(), test_flavor0(), test_generate0(), test_graphics0(), test_graphics1(), test_hearing0(), test_height0(), test_hgt0(), test_history0(), test_hp0(), test_hurt_msg0(), test_i0(), test_info0(), test_int0(), test_int1(), test_kind0(), test_length(), test_loadgame(), test_magic0(), test_magic_missile(), test_match_monster_bases(), test_max_lev0(), test_mexp0(), test_mimic0(), test_min0(), test_min_lev0(), test_msg0(), test_name0(), test_names(), test_negative(), test_newgame(), test_obj_can_refill(), test_obj_flags0(), test_obj_piles(), test_opt0(), test_order(), test_owner0(), test_parse_failure(), test_parse_success(), test_phrase0(), test_pile0(), test_play_flags0(), test_power0(), test_prefs(), test_priority0(), test_priv(), test_properties0(), test_pval0(), test_rand0(), test_rand1(), test_rarity0(), test_rat0(), test_reg0(), test_reg1(), test_reg2(), test_reg3(), test_reg4(), test_reg5(), test_reg_int(), test_reg_str(), test_reg_sym(), test_require(), test_resist_flag0(), test_run_msg0(), test_section0(), test_section1(), test_skill_device0(), test_skill_dig0(), test_skill_disarm0(), test_skill_melee0(), test_skill_save0(), test_skill_search0(), test_skill_shoot0(), test_skill_stealth0(), test_skill_throw0(), test_sleep0(), test_slots0(), test_smell0(), test_spaces(), test_speed0(), test_spell_freq0(), test_spells0(), test_stairs1(), test_stairs2(), test_stat_dec(), test_stat_inc(), test_stats0(), test_store0(), test_str0(), test_string_append(), test_string_append_null0(), test_string_append_null1(), test_string_append_null2(), test_string_free_null(), test_string_make(), test_string_make_null(), test_sym0(), test_sym1(), test_syntax0(), test_syntax1(), test_syntax2(), test_time0(), test_title0(), test_typ0(), test_type0(), test_uint0(), test_uint1(), test_values0(), test_walk_msg0(), test_weight0(), test_wid0(), test_word0(), and test_word1().

#define ptreq (   x,
 
)
Value:
if ((x) != (y)) { \
if (verbose) { \
printf(" %s:%d: requirement '%s' == '%s' failed\n", suite_name, \
__LINE__, #x, #y); \
printf(" %s: 0x%08lx\n", #x, (unsigned long)(x)); \
printf(" %s: 0x%08lx\n", #y, (unsigned long)(y)); \
} \
return 1; \
}
int verbose
Definition: unit-test.c:12
int showfail(void)
Definition: unit-test.c:63
const char * suite_name
Definition: unit-test.h:19

Referenced by test_chart0(), test_desc0(), test_equip0(), test_generate0(), test_obj_piles(), and test_priv().

#define require (   x)
Value:
do { \
if (!(x)) { \
if (verbose) \
printf(" %s:%d: requirement '%s' failed\n", \
suite_name, __LINE__, #x); \
return 1; \
} \
} while (0)
int verbose
Definition: unit-test.c:12
int showfail(void)
Definition: unit-test.c:63
const char * suite_name
Definition: unit-test.h:19

Referenced by test_0(), test_ac0(), test_alloc(), test_alloc0(), test_alloc2(), test_append(), test_attack0(), test_base0(), test_base_object0(), test_blow0(), test_blow1(), test_charges0(), test_chart0(), test_cmd_lookup_orig(), test_cmd_lookup_rogue(), test_color0(), test_colour(), test_combat0(), test_d0(), test_dedup(), test_depth0(), test_desc0(), test_die_msg0(), test_effects(), test_equip0(), test_evaluate(), test_flags0(), test_flavor0(), test_graphics0(), test_graphics1(), test_hearing0(), test_height0(), test_hgt0(), test_history0(), test_hp0(), test_hurt_msg0(), test_i0(), test_info0(), test_length(), test_magic0(), test_match_monster_bases(), test_max_lev0(), test_mexp0(), test_mimic0(), test_min0(), test_min_lev0(), test_msg0(), test_name0(), test_names(), test_obj_flags0(), test_opt0(), test_owner0(), test_parse_failure(), test_parse_success(), test_phrase0(), test_pile0(), test_play_flags0(), test_power0(), test_priority0(), test_properties0(), test_pval0(), test_rarity0(), test_rat0(), test_require(), test_resist_flag0(), test_run_msg0(), test_skill_device0(), test_skill_dig0(), test_skill_disarm0(), test_skill_melee0(), test_skill_save0(), test_skill_search0(), test_skill_shoot0(), test_skill_stealth0(), test_skill_throw0(), test_sleep0(), test_slots0(), test_smell0(), test_speed0(), test_spell_freq0(), test_spells0(), test_stat_dec(), test_stat_inc(), test_stats0(), test_store0(), test_string_append(), test_string_append_null0(), test_string_append_null1(), test_string_append_null2(), test_string_make(), test_string_make_null(), test_syntax0(), test_syntax1(), test_syntax2(), test_time0(), test_title0(), test_typ0(), test_type0(), test_walk_msg0(), test_weight0(), and test_wid0().

#define TEST

Function Documentation

int showfail ( void  )

References verbose.

int showpass ( void  )

References verbose.

Variable Documentation

const char* suite_name
int verbose

Referenced by main(), showfail(), and showpass().