#include <math.h>
-#include "hexmap.h"
+#include "hexagon.h"
-#include "tap.h"
+#include "ctap.h"
+
+#define EPS 0.00000001
int main(void) {
- int start, x, y;
+ int x, y;
+ struct HL_hex start;
+ struct HL_point center;
+ double stride;
+
+ stride = 1.5 / sqrt(3.0);
- plan_tests(6);
+ plan(6);
x = 0; y = 0;
- start = HL_cantor_xy(x,y);
- ok(HL_center_x(start) == x * 1.5 / sqrt(3.0), "%d %d center X", x, y);
- ok(HL_center_y(start) == 0.0, "%d %d center Y", x, y);
+ start = HL_hex_xy(x,y);
+ center = HL_hexcenter(start);
+ is_double(center.x, x * stride, EPS, "%d %d center X", x, y);
+ is_double(center.y, 0.0, EPS, "%d %d center Y", x, y);
x = 1; y = 1;
- start = HL_cantor_xy(x,y);
- ok(HL_center_x(start) == x * 1.5 / sqrt(3.0), "%d %d center X", x, y);
- ok(HL_center_y(start) == 0.5, "%d %d center Y = %f", x, y,
- HL_center_y(start));
+ start = HL_hex_xy(x,y);
+ center = HL_hexcenter(start);
+ is_double(center.x, x * stride, EPS, "%d %d center X", x, y);
+ is_double(center.y, 0.5, EPS, "%d %d center Y", x, y);
+
x = 2; y = 2;
- start = HL_cantor_xy(x,y);
- ok(HL_center_x(start) == x * 1.5 / sqrt(3.0), "%d %d center X", x, y);
- ok(HL_center_y(start) == 2.0, "%d %d center Y = %f", x, y,
- HL_center_y(start));
+ start = HL_hex_xy(x,y);
+ center = HL_hexcenter(start);
+ is_double(center.x, x * stride, EPS, "%d %d center X", x, y);
+ is_double(center.y, 2.0, EPS, "%d %d center Y", x, y);
- return exit_status();
+ return 0;
}