|
checkasm 1.0.1
Assembly testing and benchmarking framework
|
Utility functions for checkasm tests.
This header provides utility functions commonly needed when writing checkasm tests, including:
Go to the source code of this file.
Data Structures | |
| struct | CheckasmDist |
| Describes a normal (Gaussian) distribution. More... | |
Macros | |
| #define | checkasm_dist_standard ((CheckasmDist) { 0.0, 1.0 }) |
| Standard normal distribution (mean=0, stddev=1). | |
| #define | CLEAR_BUF(buf) |
| Clear a fixed size buffer (convenience macro). | |
| #define | RANDOMIZE_BUF(buf) |
| Fill a fixed size buffer wth random data (convenience macro). | |
| #define | INITIALIZE_BUF(buf) |
| Fill a fixed size buffer with pathological test data (convenience macro). | |
| #define | float_near_ulp checkasm_float_near_ulp |
| #define | float_near_abs_eps checkasm_float_near_abs_eps |
| #define | float_near_abs_eps_ulp checkasm_float_near_abs_eps_ulp |
| #define | float_near_ulp_array checkasm_float_near_ulp_array |
| #define | float_near_abs_eps_array checkasm_float_near_abs_eps_array |
| #define | float_near_abs_eps_array_ulp checkasm_float_near_abs_eps_array_ulp |
| #define | double_near_abs_eps checkasm_double_near_abs_eps |
| #define | double_near_abs_eps_array checkasm_double_near_abs_eps_array |
| #define | CHECKASM_ALIGN(x) |
| Declare a variable with platform-specific alignment requirements. | |
| #define | DECL_CHECK_FUNC(NAME, TYPE) |
| #define | DECL_CHECKASM_CHECK_FUNC(type) |
| #define | checkasm_check_impl2(type) |
| #define | checkasm_check_impl(type) |
| #define | checkasm_check1(type, ...) |
| #define | checkasm_check2(type, ...) |
| #define | checkasm_check(type, ...) |
| Compare two 2D buffers and fail test if different. | |
| #define | checkasm_check_padded(type, ...) |
| Compare two 2D buffers, including padding regions (detect over-write). | |
| #define | CHECKASM_ROUND(x, a) |
| Round up to nearest multiple of a. | |
| #define | BUF_RECT(type, name, w, h) |
| Declare an aligned, padded rectangular buffer. | |
| #define | CLEAR_BUF_RECT(name) |
| Clear a rectangular buffer (including padding). | |
| #define | INITIALIZE_BUF_RECT(name) |
| Initialize a rectangular buffer (including padding) with pathological values. | |
| #define | RANDOMIZE_BUF_RECT(name) |
| Randomize a rectangular buffer (including padding). | |
| #define | checkasm_check_rect(rect1, ...) |
| Compare two rectangular buffers. | |
| #define | checkasm_check_rect_padded(rect1, ...) |
| Compare two rectangular buffers including padding. | |
| #define | checkasm_check_rect_padded_align(rect1, ...) |
| Compare two rectangular buffers, with custom alignment (over-write). | |
Functions | |
| CHECKASM_API int | checkasm_rand (void) |
| Generate a random non-negative integer. | |
| CHECKASM_API double | checkasm_randf (void) |
| Generate a random double-precision floating-point number. | |
| CHECKASM_API uint32_t | checkasm_rand_uint32 (void) |
| Generate a random 32-bit unsigned integer. | |
| CHECKASM_API int32_t | checkasm_rand_int32 (void) |
| Generate a random 32-bit signed integer. | |
| CHECKASM_API double | checkasm_rand_dist (CheckasmDist dist) |
| Generate a normally distributed random number. | |
| CHECKASM_API double | checkasm_rand_norm (void) |
| Generate a random number from the standard normal distribution. | |
| CHECKASM_API void | checkasm_randomize (void *buf, size_t bytes) |
| Fill a buffer with uniformly chosen random bytes. | |
| CHECKASM_API void | checkasm_randomize_mask8 (uint8_t *buf, int width, uint8_t mask) |
| Fill a uint8_t buffer with random values chosen uniformly within a mask. | |
| CHECKASM_API void | checkasm_randomize_mask16 (uint16_t *buf, int width, uint16_t mask) |
| Fill a uint16_t buffer with random values chosen uniformly within a mask. | |
| CHECKASM_API void | checkasm_randomize_range (double *buf, int width, double range) |
| Fill a double buffer with random values chosen uniformly below a limit. | |
| CHECKASM_API void | checkasm_randomize_rangef (float *buf, int width, float range) |
| Fill a float buffer with random values chosen uniformly below a limit. | |
| CHECKASM_API void | checkasm_randomize_dist (double *buf, int width, CheckasmDist dist) |
| Fill a double buffer with normally distributed random values. | |
| CHECKASM_API void | checkasm_randomize_distf (float *buf, int width, CheckasmDist dist) |
| Fill a float buffer with normally distributed random values. | |
| CHECKASM_API void | checkasm_randomize_norm (double *buf, int width) |
| Fill a double buffer with values from a standard normal distribution. | |
| CHECKASM_API void | checkasm_randomize_normf (float *buf, int width) |
| Fill a float buffer with values from a standard normal distribution. | |
| CHECKASM_API void | checkasm_clear (void *buf, size_t bytes) |
| Clear a buffer to a pre-determined pattern (currently 0xAA). | |
| CHECKASM_API void | checkasm_clear8 (uint8_t *buf, int width, uint8_t val) |
| Fill a uint8_t buffer with a constant value. | |
| CHECKASM_API void | checkasm_clear16 (uint16_t *buf, int width, uint16_t val) |
| Fill a uint16_t buffer with a constant value. | |
| CHECKASM_API void | checkasm_init (void *buf, size_t bytes) |
| Initialize a buffer with pathological test patterns. | |
| CHECKASM_API void | checkasm_init_mask8 (uint8_t *buf, int width, uint8_t mask) |
| Initialize a uint8_t buffer with pathological values within a mask. | |
| CHECKASM_API void | checkasm_init_mask16 (uint16_t *buf, int width, uint16_t mask) |
| Initialize a uint16_t buffer with pathological values within a mask. | |
| CHECKASM_API int | checkasm_float_near_ulp (float a, float b, unsigned max_ulp) |
| Compare floats using ULP (Units in Last Place) tolerance. | |
| CHECKASM_API int | checkasm_float_near_abs_eps (float a, float b, float eps) |
| Compare floats using absolute epsilon tolerance. | |
| CHECKASM_API int | checkasm_float_near_abs_eps_ulp (float a, float b, float eps, unsigned max_ulp) |
| Compare floats using both epsilon and ULP tolerances. | |
| CHECKASM_API int | checkasm_float_near_ulp_array (const float *a, const float *b, unsigned max_ulp, int len) |
| Compare float arrays using ULP tolerance. | |
| CHECKASM_API int | checkasm_float_near_abs_eps_array (const float *a, const float *b, float eps, int len) |
| Compare float arrays using absolute epsilon tolerance. | |
| CHECKASM_API int | checkasm_float_near_abs_eps_array_ulp (const float *a, const float *b, float eps, unsigned max_ulp, int len) |
| Compare float arrays using both epsilon and ULP tolerances. | |
| CHECKASM_API int | checkasm_double_near_abs_eps (double a, double b, double eps) |
| Compare doubles using absolute epsilon tolerance. | |
| CHECKASM_API int | checkasm_double_near_abs_eps_array (const double *a, const double *b, double eps, unsigned len) |
| Compare double arrays using absolute epsilon tolerance. | |
| DECL_CHECKASM_CHECK_FUNC (int) | |
| DECL_CHECKASM_CHECK_FUNC (int8_t) | |
| DECL_CHECKASM_CHECK_FUNC (int16_t) | |
| DECL_CHECKASM_CHECK_FUNC (int32_t) | |
| DECL_CHECKASM_CHECK_FUNC (unsigned) | |
| DECL_CHECKASM_CHECK_FUNC (uint8_t) | |
| DECL_CHECKASM_CHECK_FUNC (uint16_t) | |
| DECL_CHECKASM_CHECK_FUNC (uint32_t) | |
| CHECKASM_API int | checkasm_check_impl_float_ulp (const char *file, int line, const float *buf1, ptrdiff_t stride1, const float *buf2, ptrdiff_t stride2, int w, int h, const char *name, unsigned max_ulp, int align_w, int align_h, int padding) |
| Compare float buffers with ULP tolerance. | |
| CHECKASM_API double checkasm_rand_dist | ( | CheckasmDist | dist | ) |
Generate a normally distributed random number.
| [in] | dist | Distribution parameters (mean and standard deviation) |
| CHECKASM_API double checkasm_rand_norm | ( | void | ) |
Generate a random number from the standard normal distribution.