]> pd.if.org Git - hexagon/blobdiff - t/astar.c
use ctap
[hexagon] / t / astar.c
index 2ed40c07fc9072cf823c81306fc677d74d287751..729a7a864f8863391d453f8736a76f8bdd3ae482 100644 (file)
--- a/t/astar.c
+++ b/t/astar.c
@@ -2,7 +2,7 @@
 
 #include "hexagon.h"
 
-#include "tap.h"
+#include "ctap.h"
 
 void pcheck(struct HL_astar *p, int x1, int y1, int x2, int y2, int expect) {
        int from, to, dist;
@@ -10,7 +10,7 @@ void pcheck(struct HL_astar *p, int x1, int y1, int x2, int y2, int expect) {
        from = HL_cantor_xy(x1,y1);
        to = HL_cantor_xy(x2,y2);
 
-       HL_astar_clear(p);
+//     HL_astar_clear(p);
 
        p->start = from;
        p->goal = to;
@@ -36,9 +36,8 @@ int neighbor55(int hex, int dir) {
 
 int main(void) {
        struct HL_astar *p;
-       int length;
 
-       plan_tests(17);
+       plan(16);
 
        p = HL_astar_init(0);
        ok(p != NULL, "allocated astar struct");
@@ -46,23 +45,22 @@ int main(void) {
        ok(p->open == NULL, "initial open list empty");
        ok(p->closed == NULL, "initial closed list empty");
 
-       p->start = HL_cantor_xy(1, 1);
-       p->goal = HL_cantor_xy(1, 2);
-       
-       length = HL_findpath(p, 0);
-       ok(p->error == 0, "path finding returns no error");
-
        pcheck(p, 1,1, 1,3, 2);
+       HL_astar_init(p);
        pcheck(p, 1,1, 2,1, 1);
+       HL_astar_init(p);
        pcheck(p, 1,1, 2,2, 2);
+       HL_astar_init(p);
        pcheck(p, 1,1, 3,1, 2);
+       HL_astar_init(p);
        pcheck(p, 1,1, 4,7, 8);
 
-       HL_astar_clear(p);
+       //HL_astar_clear(p);
+       HL_astar_init(p);
        p->neighbor = neighbor55;
        pcheck(p,5,4,5,6,3);
 
        HL_astar_free(p);
 
-       return exit_status();
+       return 0;
 }