Macros for creating aligned, padded 2D test buffers.
More...
Macros for creating aligned, padded 2D test buffers.
These macros simplify creating properly aligned and padded rectangular buffers for testing, including automatic stride calculation and padding detection support.
◆ BUF_RECT
| #define BUF_RECT |
( |
| type, |
|
|
| name, |
|
|
| w, |
|
|
| h ) |
Value: DECL_CHECK_FUNC(*checkasm_check_impl_##name##_type, type) \
= checkasm_check_impl_##type; \
CHECKASM_ALIGN(type name##_buf[((h) + 32) * (
CHECKASM_ROUND(w, 64) + 64) + 64]); \
ptrdiff_t name##_stride =
sizeof(type) * (
CHECKASM_ROUND(w, 64) + 64); \
int name##_buf_h = (h) + 32; \
(void) checkasm_check_impl(name##_type); \
(void) name##_stride; \
(void) name##_buf_h; \
#define CHECKASM_ROUND(x, a)
Round up to nearest multiple of a.
Definition utils.h:522
Declare an aligned, padded rectangular buffer.
Creates a properly aligned rectangular buffer with padding on all sides for use with checkasm_check_rect_padded(). Sets up associated metadata (stride, height) and declares a pointer to the usable data region.
- Parameters
-
| type | Element type (e.g., uint8_t, int16_t) |
| name | Base name for the buffer variables |
| w | Width of the usable buffer region |
| h | Height of the usable buffer region |
Creates:
- name_buf: Full buffer array (with padding)
- name_stride: Stride in bytes
- name_buf_h: Total buffer height in lines (with padding)
- name: Pointer to start of usable region
#define BUF_RECT(type, name, w, h)
Declare an aligned, padded rectangular buffer.
Definition utils.h:553
#define CLEAR_BUF_RECT(name)
Clear a rectangular buffer (including padding).
Definition utils.h:570
#define INITIALIZE_BUF_RECT(name)
Initialize a rectangular buffer (including padding) with pathological values.
Definition utils.h:578
#define checkasm_call_new(...)
Call the implementation being tested with validation.
Definition test.h:342
◆ checkasm_check_rect
| #define checkasm_check_rect |
( |
| rect1, |
|
|
| ... ) |
Value:
#define checkasm_check(type,...)
Compare two 2D buffers and fail test if different.
Definition utils.h:480
Compare two rectangular buffers.
- Parameters
-
| rect1 | First buffer (from BUF_RECT) |
| ... | rect2, stride2, w, h, name |
- See also
- checkasm_check()
◆ checkasm_check_rect_padded
| #define checkasm_check_rect_padded |
( |
| rect1, |
|
|
| ... ) |
Value:
#define checkasm_check_padded(type,...)
Compare two 2D buffers, including padding regions (detect over-write).
Definition utils.h:501
Compare two rectangular buffers including padding.
- Parameters
-
| rect1 | First buffer (from BUF_RECT) |
| ... | rect2, stride2, w, h, name |
- See also
- checkasm_check()
◆ checkasm_check_rect_padded_align
| #define checkasm_check_rect_padded_align |
( |
| rect1, |
|
|
| ... ) |
Value:
Compare two rectangular buffers, with custom alignment (over-write).
- Parameters
-
| rect1 | First buffer (from BUF_RECT) |
| ... | rect2, stride2, w, h, name, align |
- See also
- checkasm_check_padded()
"buffer", 16, 1);
#define checkasm_check_rect_padded_align(rect1,...)
Compare two rectangular buffers, with custom alignment (over-write).
Definition utils.h:620
◆ CHECKASM_ROUND
| #define CHECKASM_ROUND |
( |
| x, |
|
|
| a ) |
Value:(((x) + ((a) - 1)) & ~((a) - 1))
Round up to nearest multiple of a.
- Parameters
-
| x | Value to round |
| a | Alignment (must be power of 2) |
◆ CLEAR_BUF_RECT
| #define CLEAR_BUF_RECT |
( |
| name | ) |
|
Value:
#define CLEAR_BUF(buf)
Clear a fixed size buffer (convenience macro).
Definition utils.h:254
Clear a rectangular buffer (including padding).
- Parameters
-
| name | Buffer name (from BUF_RECT) |
- See also
- checkasm_clear()
◆ INITIALIZE_BUF_RECT
| #define INITIALIZE_BUF_RECT |
( |
| name | ) |
|
Value:
#define INITIALIZE_BUF(buf)
Fill a fixed size buffer with pathological test data (convenience macro).
Definition utils.h:269
Initialize a rectangular buffer (including padding) with pathological values.
- Parameters
-
| name | Buffer name (from BUF_RECT) |
- See also
- checkasm_init()
◆ RANDOMIZE_BUF_RECT
| #define RANDOMIZE_BUF_RECT |
( |
| name | ) |
|
Value:
#define RANDOMIZE_BUF(buf)
Fill a fixed size buffer wth random data (convenience macro).
Definition utils.h:261
Randomize a rectangular buffer (including padding).
- Parameters
-
| name | Buffer name (from BUF_RECT) |
- See also
- checkasm_randomize()