X-Git-Url: https://pd.if.org/git/?p=hexagon;a=blobdiff_plain;f=t%2Fcantor.c;fp=t%2Fcantor.c;h=7362714c09e5ae9823acea24715059dbdfdb1c11;hp=1e7dbf6e8c6358f46cafdc07ab622e786ba83b46;hb=06868ef42497f1cbc480831029f5f69b395dfdd2;hpb=c5a7aa5029146b2bcea5daae53c6aa3e5e33ed04 diff --git a/t/cantor.c b/t/cantor.c index 1e7dbf6..7362714 100644 --- a/t/cantor.c +++ b/t/cantor.c @@ -5,21 +5,21 @@ #include "ctap.h" int main(void) { - int xy[2]; - int ijk[3]; int hex; + struct HL_hex in; + struct HL_hex out; int x, y; - plan(81*4); + plan(81*2); for (x=-4;x<=4;x++) { for (y=-4;y<=4;y++) { - hex = HL_cantor_xy(x,y); - HL_cantor_arrays(hex, xy, ijk); - ok(x == xy[0], "x check %d %d", x, y); - ok(y == xy[1], "y check %d %d", x, y); - ok(x == HL_cantor_x(hex), "reverse check x %d %d",hex,x); - ok(x == HL_cantor_x(hex), "reverse check y %d %d",hex,y); + in.x = x; + in.y = y; + hex = HL_cantor(in); + out = HL_uncantor(hex); + is_int(x, out.x, "x check %d %d", x, y); + is_int(y, out.y, "y check %d %d", x, y); } }