Skip to content

Commit cee8bef

Browse files
Heiko SeebergerHeiko Seeberger
authored andcommitted
Game of life: Outline for cells (verify:ignore)
1 parent 4b25090 commit cee8bef

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/main/scala/Cell.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
case class Cell(x: Int, y: Int) {
2+
3+
def neighbors: Set[Cell] =
4+
???
5+
}

src/test/scala/CellSpec.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import org.scalactic.TypeCheckedTripleEquals
2+
import org.scalatest.{ Matchers, WordSpec }
3+
4+
class CellSpec
5+
extends WordSpec
6+
with Matchers
7+
with TypeCheckedTripleEquals {
8+
9+
"Calling neighbors" should {
10+
"return the surrounding Cells" in {
11+
val expectedNeighbours =
12+
Set(
13+
Cell(-1, -1), Cell(0, -1), Cell(1, -1),
14+
Cell(-1, 0), Cell(1, 0),
15+
Cell(-1, 1), Cell(0, 1), Cell(1, 1)
16+
)
17+
Cell(0, 0).neighbors should ===(expectedNeighbours)
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)