package discrete_test import ( "github.com/gonum/discrete" "testing" ) func TestTileGraph_carving(t *testing.T) { tg := discrete.NewTileGraph(4, 4, false) if tg == nil || tg.String() != "▀▀▀▀\n▀▀▀▀\n▀▀▀▀\n▀▀▀▀" { t.Fatal("Tile graph not generated correctly") } tg.SetPassability(0, 1, true) if tg == nil || tg.String() != "▀ ▀▀\n▀▀▀▀\n▀▀▀▀\n▀▀▀▀" { t.Fatal("Passability set incorrectly") } tg.SetPassability(0, 1, false) if tg == nil || tg.String() != "▀▀▀▀\n▀▀▀▀\n▀▀▀▀\n▀▀▀▀" { t.Fatal("Passability set incorrectly") } tg.SetPassability(0, 1, true) if tg == nil || tg.String() != "▀ ▀▀\n▀▀▀▀\n▀▀▀▀\n▀▀▀▀" { t.Fatal("Passability set incorrectly") } tg.SetPassability(0, 2, true) if tg == nil || tg.String() != "▀ ▀\n▀▀▀▀\n▀▀▀▀\n▀▀▀▀" { t.Fatal("Passability set incorrectly") } tg.SetPassability(1, 2, true) if tg == nil || tg.String() != "▀ ▀\n▀▀ ▀\n▀▀▀▀\n▀▀▀▀" { t.Fatal("Passability set incorrectly") } tg.SetPassability(2, 2, true) if tg == nil || tg.String() != "▀ ▀\n▀▀ ▀\n▀▀ ▀\n▀▀▀▀" { t.Fatal("Passability set incorrectly") } tg.SetPassability(3, 2, true) if tg == nil || tg.String() != "▀ ▀\n▀▀ ▀\n▀▀ ▀\n▀▀ ▀" { t.Fatal("Passability set incorrectly") } }