X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=t%2Fdistance.c;h=55bfd5ce69ca06c3c41633ffad0be19791914d5e;hb=06868ef42497f1cbc480831029f5f69b395dfdd2;hp=28d520e89c235ca0fbe1ca06c976aa1a872488eb;hpb=5c48a06bc8649958e69013c53e925b83398ebc74;p=hexagon diff --git a/t/distance.c b/t/distance.c index 28d520e..55bfd5c 100644 --- a/t/distance.c +++ b/t/distance.c @@ -1,19 +1,24 @@ -#include "hexmap.h" +#include "hexagon.h" -#include "tap.h" +#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)\n", - x1, y1, x2, y2, dist, expect); + is_int(expect, dist, + "distance from (%02d, %02d) to (%02d, %02d)", + x1, y1, x2, y2); } int main(void) { - plan_tests(8); + plan(8); dcheck(1,1,2,1,1); dcheck(1,1,2,2,2); @@ -24,5 +29,5 @@ int main(void) { dcheck(-1,-1,1,2,4); dcheck(-1,-1,-1,-2,1); - return exit_status(); + return 0; }