public void First_state_is_initial_state(int[][] initialState) { var state = ToBoolArray(initialState); Assert.That(Conway.States(state).First(), Is.EqualTo(state)); }
public void Next_state_is_generated_correctly(int[][] initialState, int[][] nextState) { var state1 = ToBoolArray(initialState); var state2 = ToBoolArray(nextState); Assert.That(Conway.States(state1).Skip(1).First(), Is.EqualTo(state2)); }
public void Oscillating_blinker_example() { var horizontalState = ToBoolArray(new [] { new [] { 0, 0, 0 }, new [] { 1, 1, 1 }, new [] { 0, 0, 0 } }); var verticalState = ToBoolArray(new [] { new [] { 0, 1, 0 }, new [] { 0, 1, 0 }, new [] { 0, 1, 0 } }); var states = Conway.States(horizontalState); Assert.That(states.Take(3), Is.EqualTo(new [] { horizontalState, verticalState, horizontalState })); }
public void Cannot_call_with_null_arguments() { Assert.That(() => Conway.States(null).ToArray(), Throws.TypeOf <ArgumentNullException>()); }