aboutsummaryrefslogtreecommitdiff
path: root/test/core.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-01-04 12:27:37 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-01-04 12:27:37 +0100
commitc0246e09f723edc1ef5bf0045d5ad2693919ddc6 (patch)
treea882cff258aaf1d5b88620ef21de254532f8c55d /test/core.c
parent47ab785f8de77a1c656079ac8cb4ca99d8fd8655 (diff)
downloadd2tk-c0246e09f723edc1ef5bf0045d5ad2693919ddc6.tar.xz
test: minor code cleanup.
Diffstat (limited to 'test/core.c')
-rw-r--r--test/core.c80
1 files changed, 30 insertions, 50 deletions
diff --git a/test/core.c b/test/core.c
index ff2775a..39b169a 100644
--- a/test/core.c
+++ b/test/core.c
@@ -12,29 +12,17 @@ typedef void (*d2tk_check_t)(const d2tk_com_t *com, const d2tk_clip_t *clip);
typedef struct _d2tk_mock_ctx_t d2tk_mock_ctx_t;
struct _d2tk_mock_ctx_t {
- struct {
- d2tk_core_t *core;
- d2tk_coord_t w;
- d2tk_coord_t h;
- unsigned pass;
- } pre;
- struct {
- d2tk_core_t *core;
- d2tk_coord_t w;
- d2tk_coord_t h;
- unsigned pass;
- } post;
- struct {
- d2tk_core_t *core;
- const d2tk_com_t *com;
- d2tk_coord_t xo;
- d2tk_coord_t yo;
- const d2tk_clip_t *clip;
- unsigned pass;
- } process;
d2tk_check_t check;
};
+#define DIM_W 640
+#define DIM_H 480
+
+#define CLIP_X 10
+#define CLIP_Y 10
+#define CLIP_W 100
+#define CLIP_H 100
+
static inline void
_d2tk_mock_pre(void *data, d2tk_core_t *core, d2tk_coord_t w, d2tk_coord_t h,
unsigned pass)
@@ -42,10 +30,10 @@ _d2tk_mock_pre(void *data, d2tk_core_t *core, d2tk_coord_t w, d2tk_coord_t h,
d2tk_mock_ctx_t *ctx = data;
assert(ctx);
- ctx->pre.core = core;
- ctx->pre.w = w;
- ctx->pre.h = h;
- ctx->pre.pass = pass;
+ assert(core);
+ assert(w == DIM_W);
+ assert(h == DIM_H);
+ assert(pass == 0);
}
static inline bool
@@ -55,10 +43,10 @@ _d2tk_mock_post(void *data, d2tk_core_t *core, d2tk_coord_t w, d2tk_coord_t h,
d2tk_mock_ctx_t *ctx = data;
assert(ctx);
- ctx->post.core = core;
- ctx->post.w = w;
- ctx->post.h = h;
- ctx->post.pass = pass;
+ assert(core);
+ assert(w == DIM_W);
+ assert(h == DIM_H);
+ assert(pass == 0);
assert(d2tk_core_get_pixels(core));
@@ -80,17 +68,17 @@ _d2tk_mock_sprite_free(void *data, uint8_t type, uintptr_t body)
static inline void
_d2tk_mock_process(void *data, d2tk_core_t *core, const d2tk_com_t *com,
- d2tk_coord_t xo, d2tk_coord_t yo, const d2tk_clip_t *clip, unsigned pass)
+ d2tk_coord_t xo, d2tk_coord_t yo,
+ const d2tk_clip_t *clip __attribute__((unused)), unsigned pass)
{
d2tk_mock_ctx_t *ctx = data;
assert(ctx);
- ctx->process.core = core;
- ctx->process.com = com;
- ctx->process.xo = xo;
- ctx->process.yo = yo;
- ctx->process.clip = clip;
- ctx->process.pass = pass;
+ assert(core);
+ assert(com);
+ assert(xo == CLIP_X);
+ assert(yo == CLIP_Y);
+ assert(pass == 0);
assert(com->instr == D2TK_INSTR_BBOX);
@@ -125,17 +113,17 @@ _d2tk_mock_process(void *data, d2tk_core_t *core, const d2tk_com_t *com,
static inline void
_d2tk_mock_process_triple(void *data, d2tk_core_t *core, const d2tk_com_t *com,
- d2tk_coord_t xo, d2tk_coord_t yo, const d2tk_clip_t *clip, unsigned pass)
+ d2tk_coord_t xo, d2tk_coord_t yo,
+ const d2tk_clip_t *clip __attribute__((unused)), unsigned pass)
{
d2tk_mock_ctx_t *ctx = data;
assert(ctx);
- ctx->process.core = core;
- ctx->process.com = com;
- ctx->process.xo = xo;
- ctx->process.yo = yo;
- ctx->process.clip = clip;
- ctx->process.pass = pass;
+ assert(core);
+ assert(com);
+ assert(xo == CLIP_X);
+ assert(yo == CLIP_Y);
+ assert(pass == 0);
assert(com->instr == D2TK_INSTR_BBOX);
@@ -232,9 +220,6 @@ _test_point()
assert(src.y == 22);
}
-#define DIM_W 640
-#define DIM_H 480
-
static void
_test_dimensions()
{
@@ -279,11 +264,6 @@ _test_bg_color()
#undef BG_COLOR
-#define CLIP_X 10
-#define CLIP_Y 10
-#define CLIP_W 100
-#define CLIP_H 100
-
#define MOVE_TO_X 10
#define MOVE_TO_Y 20