tins2021/level_test.go

32 lines
616 B
Go
Raw Normal View History

package tins2021
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewLevelIsAllReachable(t *testing.T) {
level := NewLevel()
assert.True(t, level.Tiles.AllReachable(level.Player))
}
func TestRandomizedLevelIsAllReachable(t *testing.T) {
level := NewLevel()
level.Randomize(len(level.Tiles)/2, 0)
assert.True(t, level.Tiles.AllReachable(level.Player))
}
func BenchmarkRandomizedLevel(b *testing.B) {
for i := 0; i < b.N; i++ {
level := NewLevel()
level.Randomize(len(level.Tiles)*50/100, 0)
}
}
func BenchmarkNewLevel(b *testing.B) {
for i := 0; i < b.N; i++ {
NewLevel()
}
}