]> pd.if.org Git - hexagon/blobdiff - t/distance.c
rework library to use structs
[hexagon] / t / distance.c
index 0fa88f0bd59ec52bf7941dba63eb905437943973..55bfd5ce69ca06c3c41633ffad0be19791914d5e 100644 (file)
@@ -3,13 +3,18 @@
 #include "ctap.h"
 
 void dcheck(int x1, int y1, int x2, int y2, int expect) {
-       int from, to, dist;
-       from = HL_cantor_xy(x1,y1);
-       to = HL_cantor_xy(x2,y2);
+       int dist;
+       struct HL_hex from, to;
+
+       from.x = x1;
+       from.y = y1;
+       to.x = x2;
+       to.y = y2;
+
        dist = HL_distance(from,to);
-       ok(dist == expect,
-               "distance from (%02d, %02d) to (%02d, %02d) = %d (expect %d)",
-               x1, y1, x2, y2, dist, expect);
+       is_int(expect, dist,
+               "distance from (%02d, %02d) to (%02d, %02d)",
+               x1, y1, x2, y2);
 }
 
 int main(void) {