Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions exercises/practice/game-of-life/test/game_of_life_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import 'package:test/test.dart';
void main() {
group('Game of Life', () {
test('empty matrix', () {
final List<List<int>> matrix = [];
final game = GameOfLife(matrix);
final List<List<int>> input = [];
final game = GameOfLife(input);
game.tick();
final List<List<int>> expected = [];
expect(game.matrix(), expected);
}, skip: false);

test('live cells with zero live neighbors die', () {
final List<List<int>> matrix = [
final List<List<int>> input = [
[0, 0, 0],
[0, 1, 0],
[0, 0, 0],
];
final game = GameOfLife(matrix);
final game = GameOfLife(input);
game.tick();
final List<List<int>> expected = [
[0, 0, 0],
Expand All @@ -28,12 +28,12 @@ void main() {
}, skip: true);

test('live cells with only one live neighbor die', () {
final List<List<int>> matrix = [
final List<List<int>> input = [
[0, 0, 0],
[0, 1, 0],
[0, 1, 0],
];
final game = GameOfLife(matrix);
final game = GameOfLife(input);
game.tick();
final List<List<int>> expected = [
[0, 0, 0],
Expand All @@ -44,12 +44,12 @@ void main() {
}, skip: true);

test('live cells with two live neighbors stay alive', () {
final List<List<int>> matrix = [
final List<List<int>> input = [
[1, 0, 1],
[1, 0, 1],
[1, 0, 1],
];
final game = GameOfLife(matrix);
final game = GameOfLife(input);
game.tick();
final List<List<int>> expected = [
[0, 0, 0],
Expand All @@ -60,12 +60,12 @@ void main() {
}, skip: true);

test('live cells with three live neighbors stay alive', () {
final List<List<int>> matrix = [
final List<List<int>> input = [
[0, 1, 0],
[1, 0, 0],
[1, 1, 0],
];
final game = GameOfLife(matrix);
final game = GameOfLife(input);
game.tick();
final List<List<int>> expected = [
[0, 0, 0],
Expand All @@ -76,12 +76,12 @@ void main() {
}, skip: true);

test('dead cells with three live neighbors become alive', () {
final List<List<int>> matrix = [
final List<List<int>> input = [
[1, 1, 0],
[0, 0, 0],
[1, 0, 0],
];
final game = GameOfLife(matrix);
final game = GameOfLife(input);
game.tick();
final List<List<int>> expected = [
[0, 0, 0],
Expand All @@ -92,12 +92,12 @@ void main() {
}, skip: true);

test('live cells with four or more neighbors die', () {
final List<List<int>> matrix = [
final List<List<int>> input = [
[1, 1, 1],
[1, 1, 1],
[1, 1, 1],
];
final game = GameOfLife(matrix);
final game = GameOfLife(input);
game.tick();
final List<List<int>> expected = [
[1, 0, 1],
Expand All @@ -108,7 +108,7 @@ void main() {
}, skip: true);

test('bigger matrix', () {
final List<List<int>> matrix = [
final List<List<int>> input = [
[1, 1, 0, 1, 1, 0, 0, 0],
[1, 0, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 1, 1, 1],
Expand All @@ -118,7 +118,7 @@ void main() {
[0, 0, 1, 0, 1, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 1, 1],
];
final game = GameOfLife(matrix);
final game = GameOfLife(input);
game.tick();
final List<List<int>> expected = [
[1, 1, 0, 1, 1, 0, 0, 0],
Expand Down