]> pd.if.org Git - hexagon/blob - t/adjacency.c
dc2c64fbb8c6bce8b3f89093783338570b82de7f
[hexagon] / t / adjacency.c
1 #include "hexagon.h"
2
3 #include "tap.h"
4
5 int main(void) {
6         int hex, start, dist;
7         int x, y, i;
8
9         plan_tests(294);
10
11         for (x = -3 ; x <= 3; x++) {
12                 for (y = -3 ; y <= 3; y++) {
13                         start = HL_cantor_xy(x, y);
14                         for (i = 0; i < 6; i++) {
15                                 hex = HL_adjhex(start, i);
16                                 dist = HL_distance(hex, start);
17                                 ok(dist == 1,
18                                         "%d, %d direction %d distance one",
19                                         x, y, i);
20                         }
21                 }
22         }
23
24         return exit_status();
25 }