-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCellTests.cpp
More file actions
44 lines (38 loc) · 1.08 KB
/
CellTests.cpp
File metadata and controls
44 lines (38 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "stdafx.h"
#include "CppUnitTest.h"
#include "Cell.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace GameOfLife
{
TEST_CLASS(CellTests)
{
public:
TEST_METHOD(CellKeepsAliveOnNextGeneration)
{
std::list<Cell> neighbors (3, Cell(State::ALIVE, std::list<Cell>()));
Cell cell (State::ALIVE, neighbors);
cell.nextGeneration();
Assert::AreEqual(State::ALIVE, cell.getState());
}
TEST_METHOD(CellDiesOnNextGeneration)
{
std::list<Cell> neighbors (1, Cell(State::ALIVE, std::list<Cell>()));
Cell cell (State::ALIVE, neighbors);
cell.nextGeneration();
Assert::AreEqual(State::DEAD, cell.getState());
}
TEST_METHOD(CellKeepsDeadOnNextGeneration)
{
Cell cell (State::DEAD, std::list<Cell>());
cell.nextGeneration();
Assert::AreEqual(State::DEAD, cell.getState());
}
TEST_METHOD(CellResurrectsOnNextGeneration)
{
std::list<Cell> neighbors (3, Cell(State::ALIVE, std::list<Cell>()));
Cell cell (State::DEAD, neighbors);
cell.nextGeneration();
Assert::AreEqual(State::ALIVE, cell.getState());
}
};
}