]> pd.if.org Git - hexagon/blob - t/hexbin.c
move astar to lib
[hexagon] / t / hexbin.c
1 #include "hexagon.h"
2
3 #include "ctap.h"
4
5 int main(void) {
6         double px, py;
7         struct HL_hex h;
8
9         plan(8);
10
11         px = 0.444194; py = -4.639363;
12         h = HL_hexbin(1.0, px, py);
13         is_int(1, h.x, "hexbin x %f, %f", px, py);
14         is_int(4, h.y, "hexbin x %f, %f", px, py);
15
16         px = 0.0; py = 0.0;
17         h = HL_hexbin(1.0, px, py);
18         is_int(0, h.x, "hexbin x %f, %f", px, py);
19         is_int(0, h.y, "hexbin x %f, %f", px, py);
20
21         px = 0.288675; py = 0.5;
22         h = HL_hexbin(0.111111, px, py);
23         is_int(3, h.x, "center hexbin x %f, %f", px, py);
24         is_int(-5, h.y, "center hexbin x %f, %f", px, py);
25
26         px = 0.866025; py = 0.5;
27         h = HL_hexbin(0.1111111, px, py);
28         is_int(9, h.x, "vertex hexbin x %f, %f", px, py);
29         is_int(-5, h.y, "vertex hexbin y %f, %f", px, py);
30
31         return 0;
32 }