]> pd.if.org Git - hexagon/commitdiff
use ctap
authorNathan Wagner <nw@hydaspes.if.org>
Wed, 13 Jun 2018 09:27:58 +0000 (09:27 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Wed, 13 Jun 2018 09:27:58 +0000 (09:27 +0000)
Makefile
t/adjacency.c
t/astar.c
t/astarlg.c
t/cantor.c
t/center.c
t/distance.c
t/gridsize.c
t/hexbin.c
t/range.c
t/within.c

index 1662968c9d485bdbbb4007d220719f6a0d90635c..0ae921c540ddc748e989189455ec4ea0954ee5d6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ CFLAGS= -Wall -Wno-parentheses $(ARCH) -I. -I..
 OBJS= hexagon.o astar.o
 SRC=$(OBJS:.o=.c)
 TESTS= t/cantor.t t/distance.t t/adjacency.t t/range.t t/hexbin.t \
 OBJS= hexagon.o astar.o
 SRC=$(OBJS:.o=.c)
 TESTS= t/cantor.t t/distance.t t/adjacency.t t/range.t t/hexbin.t \
-       t/gridsize.t t/center.t t/astar.t t/astarlg.t
+       t/gridsize.t t/center.t t/astar.t
 PREFIX=/usr/local
 
 all:   libhexagon.a docs testfiles
 PREFIX=/usr/local
 
 all:   libhexagon.a docs testfiles
@@ -15,13 +15,13 @@ all:        libhexagon.a docs testfiles
 clean:
        rm -f $(OBJS) libhexagon.a $(TESTS)
 
 clean:
        rm -f $(OBJS) libhexagon.a $(TESTS)
 
-t/%.t:  t/%.o t/tap.o $(OBJS)
+t/%.t:  t/%.o t/ctap.o $(OBJS)
        $(CC) -I.. -I. -o $@ $+ $(LDFLAGS)
 
 testfiles:     $(TESTS)
 
 test:   libhexagon.a $(TESTS)
        $(CC) -I.. -I. -o $@ $+ $(LDFLAGS)
 
 testfiles:     $(TESTS)
 
 test:   libhexagon.a $(TESTS)
-       @prove --exec '' 2>/dev/null
+       @prove --exec $(TESTS) '' 2>/dev/null
 
 libhexagon.a:  $(OBJS)
        ar r $@ $+
 
 libhexagon.a:  $(OBJS)
        ar r $@ $+
index dc2c64fbb8c6bce8b3f89093783338570b82de7f..411228805f34b6a1b3d92abbfc09f57175c6ac17 100644 (file)
@@ -1,12 +1,12 @@
 #include "hexagon.h"
 
 #include "hexagon.h"
 
-#include "tap.h"
+#include "ctap.h"
 
 int main(void) {
        int hex, start, dist;
        int x, y, i;
 
 
 int main(void) {
        int hex, start, dist;
        int x, y, i;
 
-       plan_tests(294);
+       plan(294);
 
        for (x = -3 ; x <= 3; x++) {
                for (y = -3 ; y <= 3; y++) {
 
        for (x = -3 ; x <= 3; x++) {
                for (y = -3 ; y <= 3; y++) {
@@ -21,5 +21,5 @@ int main(void) {
                }
        }
 
                }
        }
 
-       return exit_status();
+       return 0;
 }
 }
index cb7f0434711c71dd59947a3fbc8e8d94d59351ee..729a7a864f8863391d453f8736a76f8bdd3ae482 100644 (file)
--- a/t/astar.c
+++ b/t/astar.c
@@ -2,7 +2,7 @@
 
 #include "hexagon.h"
 
 
 #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;
 
 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);
 
        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;
 
        p->start = from;
        p->goal = to;
@@ -37,7 +37,7 @@ int neighbor55(int hex, int dir) {
 int main(void) {
        struct HL_astar *p;
 
 int main(void) {
        struct HL_astar *p;
 
-       plan_tests(16);
+       plan(16);
 
        p = HL_astar_init(0);
        ok(p != NULL, "allocated astar struct");
 
        p = HL_astar_init(0);
        ok(p != NULL, "allocated astar struct");
@@ -46,16 +46,21 @@ int main(void) {
        ok(p->closed == NULL, "initial closed list empty");
 
        pcheck(p, 1,1, 1,3, 2);
        ok(p->closed == NULL, "initial closed list empty");
 
        pcheck(p, 1,1, 1,3, 2);
+       HL_astar_init(p);
        pcheck(p, 1,1, 2,1, 1);
        pcheck(p, 1,1, 2,1, 1);
+       HL_astar_init(p);
        pcheck(p, 1,1, 2,2, 2);
        pcheck(p, 1,1, 2,2, 2);
+       HL_astar_init(p);
        pcheck(p, 1,1, 3,1, 2);
        pcheck(p, 1,1, 3,1, 2);
+       HL_astar_init(p);
        pcheck(p, 1,1, 4,7, 8);
 
        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);
 
        p->neighbor = neighbor55;
        pcheck(p,5,4,5,6,3);
 
        HL_astar_free(p);
 
-       return exit_status();
+       return 0;
 }
 }
index 7d2ef6bc196d6f56b31b9a7d0a7d4be37a098d8c..4dcf582a4767597c614ee2d42db76f1ed3e225e6 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "hexagon.h"
 
 
 #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;
 
 void pcheck(struct HL_astar *p, int x1, int y1, int x2, int y2, int expect) {
        int from, to, dist;
@@ -40,7 +40,7 @@ int main(void) {
        int length;
 #endif
 
        int length;
 #endif
 
-       plan_tests(2);
+       plan(2);
 
        p = HL_astar_init(0);
 
 
        p = HL_astar_init(0);
 
@@ -48,5 +48,5 @@ int main(void) {
 
        HL_astar_free(p);
 
 
        HL_astar_free(p);
 
-       return exit_status();
+       return 0;
 }
 }
index e6ce28fb5fae40bb2b4cfa71b32eae085637afb3..1e7dbf6e8c6358f46cafdc07ab622e786ba83b46 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "hexagon.h"
 
 
 #include "hexagon.h"
 
-#include "tap.h"
+#include "ctap.h"
 
 int main(void) {
        int xy[2];
 
 int main(void) {
        int xy[2];
@@ -10,7 +10,7 @@ int main(void) {
        int hex;
        int x, y;
 
        int hex;
        int x, y;
 
-       plan_tests(81*4);
+       plan(81*4);
 
        for (x=-4;x<=4;x++) {
                for (y=-4;y<=4;y++) {
 
        for (x=-4;x<=4;x++) {
                for (y=-4;y<=4;y++) {
@@ -23,5 +23,5 @@ int main(void) {
                }
        }
 
                }
        }
 
-       return exit_status();
+       return 0;
 }
 }
index 72499a3afd557512062cd76cde01e5b87544780e..1c039c9de97aa391e009fc2bf5c264886af94945 100644 (file)
@@ -2,12 +2,12 @@
 
 #include "hexagon.h"
 
 
 #include "hexagon.h"
 
-#include "tap.h"
+#include "ctap.h"
 
 int main(void) {
        int start, x, y;
 
 
 int main(void) {
        int start, x, y;
 
-       plan_tests(6);
+       plan(6);
 
        x = 0; y = 0;
        start = HL_cantor_xy(x,y);
 
        x = 0; y = 0;
        start = HL_cantor_xy(x,y);
@@ -26,5 +26,5 @@ int main(void) {
        ok(HL_center_y(start) == 2.0, "%d %d center Y = %f", x, y,
                        HL_center_y(start));
 
        ok(HL_center_y(start) == 2.0, "%d %d center Y = %f", x, y,
                        HL_center_y(start));
 
-       return exit_status();
+       return 0;
 }
 }
index c3ff1cc2a57b0673256c9e1c5bee8f3f057d0a68..0fa88f0bd59ec52bf7941dba63eb905437943973 100644 (file)
@@ -1,6 +1,6 @@
 #include "hexagon.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;
 
 void dcheck(int x1, int y1, int x2, int y2, int expect) {
        int from, to, dist;
@@ -13,7 +13,7 @@ void dcheck(int x1, int y1, int x2, int y2, int expect) {
 }
 
 int main(void) {
 }
 
 int main(void) {
-       plan_tests(8);
+       plan(8);
 
        dcheck(1,1,2,1,1);
        dcheck(1,1,2,2,2);
 
        dcheck(1,1,2,1,1);
        dcheck(1,1,2,2,2);
@@ -24,5 +24,5 @@ int main(void) {
        dcheck(-1,-1,1,2,4);
        dcheck(-1,-1,-1,-2,1);
 
        dcheck(-1,-1,1,2,4);
        dcheck(-1,-1,-1,-2,1);
 
-       return exit_status();
+       return 0;
 }
 }
index f4335fd291a412d9cc0cfd6879a6bcb8ff1694db..8b304ea21abbec64258398a0793795067a17e492 100644 (file)
@@ -1,6 +1,6 @@
 #include "hexagon.h"
 
 #include "hexagon.h"
 
-#include "tap.h"
+#include "ctap.h"
 
 int searchbound(int low, int high) {
        int try;
 
 int searchbound(int low, int high) {
        int try;
@@ -20,7 +20,7 @@ int main(void) {
        int start;
        int x;
 
        int start;
        int x;
 
-       plan_tests(2);
+       plan(2);
 
        x = 1;
        do {
 
        x = 1;
        do {
index 5fc504d987a5e310ad4d89b09c8a543daebc902b..293d0f7782748e229071a980f4c4616aa9ca5950 100644 (file)
@@ -1,11 +1,11 @@
 #include "hexagon.h"
 
 #include "hexagon.h"
 
-#include "tap.h"
+#include "ctap.h"
 
 int main(void) {
        int x, y;
 
 
 int main(void) {
        int x, y;
 
-       plan_tests(6);
+       plan(6);
 
        HL_hexbin(1.0, 0.444194, -4.639363, &x, &y);
        ok(x == 1 && y == 4, "hexbin 0.444194, 4.639363 = 1, 4, %d %d", x, y);
 
        HL_hexbin(1.0, 0.444194, -4.639363, &x, &y);
        ok(x == 1 && y == 4, "hexbin 0.444194, 4.639363 = 1, 4, %d %d", x, y);
@@ -21,5 +21,5 @@ int main(void) {
         ok(x == 9, "vertex bin X %d == 9", x);
         ok(y == -5, "vertex bin Y %d == -5", y);
 
         ok(x == 9, "vertex bin X %d == 9", x);
         ok(y == -5, "vertex bin Y %d == -5", y);
 
-       return exit_status();
+       return 0;
 }
 }
index b4a4125ce924fb37dfb1607f6a3a86f8c55773c0..783a089f130cd87679b49e301cc001427bfa8dc4 100644 (file)
--- a/t/range.c
+++ b/t/range.c
@@ -6,7 +6,7 @@
 
 #include "hexagon.h"
 
 
 #include "hexagon.h"
 
-#include "tap.h"
+#include "ctap.h"
 
 int icmp(const void *ap, const void *bp) {
        int a;
 
 int icmp(const void *ap, const void *bp) {
        int a;
@@ -28,7 +28,7 @@ int main(void) {
        int range[32];
        int testrange[32];
 
        int range[32];
        int testrange[32];
 
-       plan_tests(7+4);
+       plan(7+4);
 
        /* printf("range = 1 from 3,3\n"); */
        start = HL_cantor_xy(3,3);
 
        /* printf("range = 1 from 3,3\n"); */
        start = HL_cantor_xy(3,3);
@@ -63,5 +63,5 @@ int main(void) {
        count = HL_hexes_at_range(start, 2, range, 0);
        ok(count == 12, "6 hexes at range1 from 3,3");
 
        count = HL_hexes_at_range(start, 2, range, 0);
        ok(count == 12, "6 hexes at range1 from 3,3");
 
-       return exit_status();
+       return 0;
 }
 }
index 9294b8bede88a7fe55bd97ae3e9c3fe6f27b1503..488430929ec9b06a1a253e1236ecb99b10890716 100644 (file)
@@ -9,11 +9,11 @@ int main(void) {
        int x, y, i, count;
        int range[32];
 
        int x, y, i, count;
        int range[32];
 
-       plan_tests(1);
+       plan(1);
 
        start = HL_cantor_xy(3,3);
        count = HL_hexes_within_range(start, 2, range, 0);
        ok(count == 18, "18 hexes within 2 hexes of 3,3");
 
 
        start = HL_cantor_xy(3,3);
        count = HL_hexes_within_range(start, 2, range, 0);
        ok(count == 18, "18 hexes within 2 hexes of 3,3");
 
-       return exit_status();
+       return 0;
 }
 }