mirror of
https://github.com/gonum/gonum.git
synced 2025-10-10 17:40:30 +08:00
49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
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")
|
|
}
|
|
}
|