]> pd.if.org Git - isea/blob - t/hextest.c
Initial checkin.
[isea] / t / hextest.c
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 #include "tap.h"
5 #include "hex.h"
6
7 void iso(struct hex *h) {
8         hex_iso(h);
9         printf("iso(%d,%d,%d)", h->x, h->y, h->z);
10 }
11 void xy(struct hex *h) {
12         hex_xy(h);
13         printf("xy(%d,%d)", h->x, h->y);
14 }
15
16 int main(void) {
17         int x, y;
18
19         struct hex h;
20
21         plan_tests(121);
22
23         for (x = -5; x<6; x++) {
24                 for (y = -5 ; y<6;y++) {
25                         h.x = x;
26                         h.y = y;
27                         h.iso = 0;
28                         printf("# ");
29                         xy(&h); printf(" = "); iso(&h); printf(" = ");
30                         xy(&h); printf("\n");
31                         ok(h.x == x && h.y == y, "xy -> iso -> xy");
32                 }
33         }
34
35         return exit_status();
36
37 }
38