Skip to content

Instantly share code, notes, and snippets.

@JeffHoover
Created December 5, 2011 18:14
Show Gist options
  • Save JeffHoover/1434631 to your computer and use it in GitHub Desktop.
Save JeffHoover/1434631 to your computer and use it in GitHub Desktop.
From my data-driven Game of Life code from Global Day of CodeRetreat
// Full code base:
// https://github.com/JeffHoover/Data-Driven-GoL
// Hard to read bare assertion:
// Assert.AreEqual(State.DEAD, _ruleEngine.GetNextCellState(State.DEAD, numNeighbors));
// Easier to read helper method:
Assert_Dead_Cell_Stays_Dead_With_X_Neighbors(numNeighbors));
// Suggested by @mattslavicek - loses important information about cell starting state
// AssertCellEvolvesAndRemainsDead(int numNeighbors));
// Another hard-to-read bare assertion:
// Assert.AreEqual(State.DEAD, _ruleEngine.GetNextCellState(State.DEAD, numNeighbors));
// Maybe:
// AssertDeadCellEvolvesAndStaysDead(int numNeighbors));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment