aboutsummaryrefslogtreecommitdiffstats
path: root/test.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-02-25 18:07:02 +0100
committerMattias Andrée <m@maandree.se>2026-02-25 18:07:02 +0100
commitbf5dd19e69e19abbfebc7a7cc343f08e168251cc (patch)
treedba9956da1c95bc49ca61f3c49374dfe1ffe8776 /test.c
parentAdd testing (diff)
downloadlibtracebitmap-master.tar.gz
libtracebitmap-master.tar.bz2
libtracebitmap-master.tar.xz
Add test to verify that traces do not cross each otherHEAD1.0.2.2master
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'test.c')
-rw-r--r--test.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test.c b/test.c
index 59d885e..a797512 100644
--- a/test.c
+++ b/test.c
@@ -21,6 +21,8 @@
#define BOTTOM_COVERED 0x2
#define LEFT_COVERED 0x4
#define RIGHT_COVERED 0x8
+#define VERT_COVERED 0x3
+#define HORZ_COVERED 0xC
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define MAX(A, B) ((A) > (B) ? (A) : (B))
@@ -167,6 +169,8 @@ cb_new_stop(size_t y, size_t x, void *user_data)
coverage |= (i != MAX(x, x0)) * RIGHT_COVERED;
EXPECT(!(ctx->edges[y * EXT_WIDTH + i] & coverage));
ctx->edges[y * EXT_WIDTH + i] |= coverage;
+ if (coverage == HORZ_COVERED)
+ EXPECT((ctx->edges[y * EXT_WIDTH + i] & VERT_COVERED) != VERT_COVERED);
}
} else {
for (i = MIN(y, y0), n = MAX(y, y0);; i++) {
@@ -174,6 +178,8 @@ cb_new_stop(size_t y, size_t x, void *user_data)
coverage |= (i != MAX(y, y0)) * BOTTOM_COVERED;
EXPECT(!(ctx->edges[i * EXT_WIDTH + x] & coverage));
ctx->edges[i * EXT_WIDTH + x] |= coverage;
+ if (coverage == VERT_COVERED)
+ EXPECT((ctx->edges[i * EXT_WIDTH + x] & HORZ_COVERED) != HORZ_COVERED);
if (i == n)
break;
flip_row_right(ctx->out, i, x);