X-Git-Url: https://pd.if.org/git/?p=hexagon;a=blobdiff_plain;f=t%2Fdistance.c;h=0fa88f0bd59ec52bf7941dba63eb905437943973;hp=0f3ef9792b3ecf779c12e5b727bf072e6fbcd3d2;hb=ce4fd67e5bfd07192ca5cb357798aaa3588512e4;hpb=8f632e5a3428101590e8cbe94025060c5c3b5ecf diff --git a/t/distance.c b/t/distance.c index 0f3ef97..0fa88f0 100644 --- a/t/distance.c +++ b/t/distance.c @@ -1,6 +1,6 @@ -#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; @@ -8,18 +8,21 @@ void dcheck(int x1, int y1, int x2, int y2, int expect) { to = HL_cantor_xy(x2,y2); dist = HL_distance(from,to); ok(dist == expect, - "distance from (%02d, %02d) to (%02d, %02d) = %d (expect %d)\n", + "distance from (%02d, %02d) to (%02d, %02d) = %d (expect %d)", x1, y1, x2, y2, dist, expect); } int main(void) { - plan_tests(5); + plan(8); dcheck(1,1,2,1,1); dcheck(1,1,2,2,2); dcheck(2,2,2,1,1); dcheck(1,1,2,3,3); dcheck(3,3,3,3,0); + dcheck(0,0,1,1,1); + dcheck(-1,-1,1,2,4); + dcheck(-1,-1,-1,-2,1); - return exit_status(); + return 0; }