You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.3 KiB

11 months ago
import kotlin.test.Test
import kotlin.test.BeforeTest
import technology.zim.MazeFinder
import technology.zim.World
import technology.zim.data.Tile
class MazeFinderTest {
@BeforeTest
fun setup() {
World.setSize(10, 10)
MazeFinder.primsAlgorithm()
}
@Test
fun topRowOutOfBoundsCheck() {
var southExists = false
World.tiles.value.forEach {
col ->
if(col[0].isSouth())
southExists = true
}
assert(southExists)
}
@Test
fun bottomRowOutOfBoundsCheck() {
var southNotExists = true
World.tiles.value.forEach {
col ->
if(col[9].isSouth())
southNotExists = false
}
assert(southNotExists)
}
@Test
fun allTilesVisited() {
World.tiles.value.forEach {
col ->
col.forEach {
tile ->
assert(tile.visited())
}
}
}
@Test
fun allTilesHaveConnections() {
World.tiles.value.forEachIndexed {
x,
col ->
col.forEachIndexed { y,
tileprop ->
if(!tileprop.visited())
println("Empty Connections at: " + Tile(x, y).toString())
assert(tileprop.visited())
}
}
}
}