]> pd.if.org Git - hexagon/blob - t/gridsize.c
f4335fd291a412d9cc0cfd6879a6bcb8ff1694db
[hexagon] / t / gridsize.c
1 #include "hexagon.h"
2
3 #include "tap.h"
4
5 int searchbound(int low, int high) {
6         int try;
7
8         while (low != high - 1) {
9                 try = (low + high) / 2;
10                 if (HL_map_bounds_ok(try,try)) {
11                         low = try;
12                 } else {
13                         high = try;
14                 }
15         }
16         return low;
17 }
18
19 int main(void) {
20         int start;
21         int x;
22
23         plan_tests(2);
24
25         x = 1;
26         do {
27                 x = x * 2;
28         } while (HL_map_bounds_ok(x,x));
29         x = searchbound(x/2, x);
30         ok(x == HL_map_max_dimension(), "checking HL_map_max_dimension()");
31
32         start = HL_cantor_xy(x,x);
33         ok(start > 0, "maximum cantor size is greater than zero");
34
35         return 0;
36 }