From 35ee3becf99bc04b77e15cc653dd4fbd772d3257 Mon Sep 17 00:00:00 2001 From: Jsor Date: Wed, 24 Jul 2013 07:36:08 -0700 Subject: [PATCH] One more A* test --- graph_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/graph_test.go b/graph_test.go index c587b14a..b98d6934 100644 --- a/graph_test.go +++ b/graph_test.go @@ -130,6 +130,12 @@ func TestHarderAStar(t *testing.T) { path, cost, _ := discrete.AStar(0, 8, tg, nil, nil) if cost != 4.0 || !discrete.IsPath(path, tg) { - t.Error("Non-optimal or impossible path found") + t.Error("Non-optimal or impossible path found for 3x3 grid") + } + + tg = discrete.NewTileGraph(1000, 1000, true) + path, cost, _ = discrete.AStar(00, 999*1000+999, tg, nil, nil) + if !discrete.IsPath(path, tg) || cost != 1998.0 { + t.Error("Non-optimal or impossible path found for 100x100 grid; cost:", cost, "path:\n"+tg.PathString(path)) } }