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
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)
- @prove --exec '' 2>/dev/null
+ @prove --exec $(TESTS) '' 2>/dev/null
libhexagon.a: $(OBJS)
ar r $@ $+
#include "hexagon.h"
-#include "tap.h"
+#include "ctap.h"
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++) {
}
}
- return exit_status();
+ return 0;
}
#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;
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;
int main(void) {
struct HL_astar *p;
- plan_tests(16);
+ plan(16);
p = HL_astar_init(0);
ok(p != NULL, "allocated astar struct");
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);
+ 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;
}
#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;
int length;
#endif
- plan_tests(2);
+ plan(2);
p = HL_astar_init(0);
HL_astar_free(p);
- return exit_status();
+ return 0;
}
#include "hexagon.h"
-#include "tap.h"
+#include "ctap.h"
int main(void) {
int xy[2];
int hex;
int x, y;
- plan_tests(81*4);
+ plan(81*4);
for (x=-4;x<=4;x++) {
for (y=-4;y<=4;y++) {
}
}
- return exit_status();
+ return 0;
}
#include "hexagon.h"
-#include "tap.h"
+#include "ctap.h"
int main(void) {
int start, x, y;
- plan_tests(6);
+ plan(6);
x = 0; y = 0;
start = HL_cantor_xy(x,y);
ok(HL_center_y(start) == 2.0, "%d %d center Y = %f", x, y,
HL_center_y(start));
- return exit_status();
+ return 0;
}
#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;
}
int main(void) {
- plan_tests(8);
+ plan(8);
dcheck(1,1,2,1,1);
dcheck(1,1,2,2,2);
dcheck(-1,-1,1,2,4);
dcheck(-1,-1,-1,-2,1);
- return exit_status();
+ return 0;
}
#include "hexagon.h"
-#include "tap.h"
+#include "ctap.h"
int searchbound(int low, int high) {
int try;
int start;
int x;
- plan_tests(2);
+ plan(2);
x = 1;
do {
#include "hexagon.h"
-#include "tap.h"
+#include "ctap.h"
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);
ok(x == 9, "vertex bin X %d == 9", x);
ok(y == -5, "vertex bin Y %d == -5", y);
- return exit_status();
+ return 0;
}
#include "hexagon.h"
-#include "tap.h"
+#include "ctap.h"
int icmp(const void *ap, const void *bp) {
int a;
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);
count = HL_hexes_at_range(start, 2, range, 0);
ok(count == 12, "6 hexes at range1 from 3,3");
- return exit_status();
+ return 0;
}
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");
- return exit_status();
+ return 0;
}