Files
wlgol/tests/test_pattern.c
T

28 lines
598 B
C
Raw Normal View History

#include <assert.h>
#include <stdio.h>
#include "pattern.h"
int main(void) {
assert(pattern_count() == 10);
const void *p = pattern_get(0);
(void)p;
int dx[16], dy[16];
int n = pattern_rotated_offsets(0, 0, dx, dy);
assert(n == 5);
int w, h;
pattern_bounds(0, 1, &w, &h);
assert(w == 3 && h == 3);
int dx2[16], dy2[16];
pattern_rotated_offsets(0, 1, dx2, dy2);
int same = 1;
for (int i = 0; i < n; i++) {
if (dx[i] != dx2[i] || dy[i] != dy2[i]) same = 0;
}
assert(!same);
printf("pattern tests passed\n");
return 0;
}