7 void pcheck(struct HL_astar *p, int x1, int y1, int x2, int y2, int expect) {
10 from = HL_cantor_xy(x1,y1);
11 to = HL_cantor_xy(x2,y2);
18 dist = HL_findpath(p,0);
19 ok(p->error == 0, "found path from (%02d, %02d) to (%02d, %02d) with no error",
22 "found path from (%02d, %02d) to (%02d, %02d) path length = %d (expect %d)\n",
23 x1, y1, x2, y2, dist, expect);
33 ok(p != NULL, "allocated astar struct");
34 ok(p->malloced == 1, "allocated astar sets malloced");
35 ok(p->open == NULL, "initial open list empty");
36 ok(p->closed == NULL, "initial closed list empty");
38 p->start = HL_cantor_xy(1, 1);
39 p->goal = HL_cantor_xy(1, 2);
41 length = HL_findpath(p, 0);
42 ok(p->error == 0, "path finding returns no error");
44 pcheck(p, 1,1, 1,3, 2);
45 pcheck(p, 1,1, 2,1, 1);
46 pcheck(p, 1,1, 2,2, 2);
47 pcheck(p, 1,1, 3,1, 2);
48 pcheck(p, 1,1, 4,7, 8);