X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=t%2Fhexbin.c;h=7afe2700030efd7877bfbc4bbf42f2e1330009b2;hb=06868ef42497f1cbc480831029f5f69b395dfdd2;hp=e486bc8f40442c636adb03a0406a4f112a33d582;hpb=8f632e5a3428101590e8cbe94025060c5c3b5ecf;p=hexagon diff --git a/t/hexbin.c b/t/hexbin.c index e486bc8..7afe270 100644 --- a/t/hexbin.c +++ b/t/hexbin.c @@ -1,25 +1,32 @@ -#include "hexmap.h" +#include "hexagon.h" -#include "tap.h" +#include "ctap.h" int main(void) { - int x, y; + double px, py; + struct HL_hex h; - plan_tests(6); + plan(8); - HL_hexbin(1.0, 0.444194, -4.639363, &x, &y); - ok(x == 1 && y == 4, "hexbin 0.444194, 4.639363 = 1, 4, %d %d", x, y); + px = 0.444194; py = -4.639363; + h = HL_hexbin(1.0, px, py); + is_int(1, h.x, "hexbin x %f, %f", px, py); + is_int(4, h.y, "hexbin x %f, %f", px, py); - HL_hexbin(1.0, 0.0, 0.0, &x, &y); - ok(x == 0 && y == 0, "0.0 0.0 -> 0 0"); + px = 0.0; py = 0.0; + h = HL_hexbin(1.0, px, py); + is_int(0, h.x, "hexbin x %f, %f", px, py); + is_int(0, h.y, "hexbin x %f, %f", px, py); - HL_hexbin(0.1111111, 0.288675, 0.500000, &x, &y); - ok(x == 3, "center bin X %d == 3", x); - ok(y == -5, "center bin Y %d == -5", y); + px = 0.288675; py = 0.5; + h = HL_hexbin(0.111111, px, py); + is_int(3, h.x, "center hexbin x %f, %f", px, py); + is_int(-5, h.y, "center hexbin x %f, %f", px, py); - HL_hexbin(0.1111111, 0.866025, 0.500000, &x, &y); - ok(x == 9, "vertex bin X %d == 9", x); - ok(y == -5, "vertex bin Y %d == -5", y); + px = 0.866025; py = 0.5; + h = HL_hexbin(0.1111111, px, py); + is_int(9, h.x, "vertex hexbin x %f, %f", px, py); + is_int(-5, h.y, "vertex hexbin y %f, %f", px, py); - return exit_status(); + return 0; }