#include "hexmap.h" #include "tap.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); 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); } int main(void) { plan_tests(5); 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); return exit_status(); }