Created
May 12, 2013 04:32
-
-
Save echojc/5562418 to your computer and use it in GitHub Desktop.
Repetitive way to test different inputs for a function that determines whether a cell in Conway's Game of Life should become alive or stay dead given the number of live neighbours.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe ("alive cells") { | |
val cell = Cell(Alive) | |
it ("should become Dead when there are 0 live neighbours") { | |
cell.next(0) should be (Cell(Dead)) | |
} | |
it ("should become Dead when there are 1 live neighbours") { | |
cell.next(1) should be (Cell(Dead)) | |
} | |
it ("should become Alive when there are 2 live neighbours") { | |
cell.next(2) should be (Cell(Alive)) | |
} | |
it ("should become Alive when there are 3 live neighbours") { | |
cell.next(3) should be (Cell(Alive)) | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment