forked from aeonstasis/life-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhl22565-TestLife.c++
124 lines (80 loc) · 2.69 KB
/
hl22565-TestLife.c++
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// --------------------------
// projects/life/TestLife.c++
// Copyright (C) 2016
// Glenn P. Downing
// --------------------------
// https://code.google.com/p/googletest/wiki/V1_7_Primer#Basic_Assertions
// --------
// includes
// --------
#include "gtest/gtest.h"
#include "Life.h"
using namespace std;
// ----
// test
// ----
ConwayCell c = ConwayCell(0);
TEST(LifeFixture, test) { ASSERT_TRUE(c.getType() == 'c'); }
TEST(LifeFixture, test2) { ASSERT_TRUE(c.getType() != 'f'); }
TEST(LifeFixture, test3) { ASSERT_TRUE(c.getType() != 'a'); }
TEST(LifeFixture, test4) { ASSERT_TRUE(c.getState() == '*'); }
TEST(LifeFixture, test5) { ASSERT_TRUE(c.getState() != '.'); }
ConwayCell c2 = ConwayCell(-1);
TEST(LifeFixture, test6) { ASSERT_TRUE(c2.getState() == '.'); }
ConwayCell c3 = ConwayCell(0);
TEST(LifeFixture, test7) {
c3.ageCell(3);
ASSERT_TRUE(c3.getState() == '*');
}
ConwayCell c4 = ConwayCell(0);
TEST(LifeFixture, test8) {
c4.ageCell(1);
ASSERT_TRUE(c4.getState() == '.');
}
TEST(LifeFixture, test9) { ASSERT_TRUE(c4.getState() != '*'); }
TEST(LifeFixture, test10) { ASSERT_TRUE(c4.getState() != '0'); }
FredkinsCell f = FredkinsCell(0);
TEST(LifeFixture, test11) { ASSERT_TRUE(f.getType() == 'f'); }
TEST(LifeFixture, test12) { ASSERT_TRUE(f.getType() != 'c'); }
TEST(LifeFixture, test13) { ASSERT_TRUE(f.getType() != 'a'); }
TEST(LifeFixture, test14) { ASSERT_TRUE(f.getState() == '0'); }
TEST(LifeFixture, test15) { ASSERT_TRUE(f.getState() != '-'); }
FredkinsCell f2 = FredkinsCell(-1);
TEST(LifeFixture, test16) { ASSERT_TRUE(f2.getState() == '-'); }
FredkinsCell f3 = FredkinsCell(0);
TEST(LifeFixture, test17) {
f3.ageCell(3);
ASSERT_TRUE(f3.getState() == '1');
}
FredkinsCell f4 = FredkinsCell(0);
TEST(LifeFixture, test18) {
f4.ageCell(0);
ASSERT_TRUE(f4.getState() == '-');
}
TEST(LifeFixture, test19) { ASSERT_TRUE(f4.getState() != '*'); }
TEST(LifeFixture, test20) {
f4.ageCell(1);
ASSERT_TRUE(f4.getState() == '0');
}
TEST(LifeFixture, test21) {
f4.ageCell(3);
f4.ageCell(5);
ASSERT_TRUE(f4.isAge2());
}
TEST(LifeFixture, test22) {
f4.ageCell(3);
ASSERT_TRUE(!f4.isAge2());
}
TEST(LifeFixture, test23) {
f4.ageCell(0);
ASSERT_TRUE(!f4.isAge2());
}
Cell C1 = Cell('f', 0);
TEST(LifeFixture, test24) { ASSERT_TRUE(C1.getState() == '0'); }
TEST(LifeFixture, test25) { ASSERT_TRUE(C1.getState() != '-'); }
TEST(LifeFixture, test26) { ASSERT_TRUE(C1.getState() != '1'); }
TEST(LifeFixture, test27) { ASSERT_TRUE(C1.getType() == 'f'); }
TEST(LifeFixture, test28) { ASSERT_TRUE(C1.getType() != 'c'); }
Cell C2 = Cell('c', -1);
TEST(LifeFixture, test29) { ASSERT_TRUE(C2.getState() == '.'); }
TEST(LifeFixture, test30) { ASSERT_TRUE(C2.getType() == 'c'); }