forked from chenzdido/homework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomputeState.test.js
52 lines (40 loc) · 1.66 KB
/
computeState.test.js
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
let computeState = require('./computeState.js');
let expect = require('chai').expect;
describe("test of computeState function", function(){
it("dead cell with neighbor==3", function(){
expect(computeState([[1,1,1],[0,0,0],[0,0,0]])).to.be.equal(1);
});
it("alive cell with neighbor==3", function(){
expect(computeState([[1,1,1],[0,1,0],[0,0,0]])).to.be.equal(1);
});
it("dead cell with neighbor==2", function(){
expect(computeState([[1,1,0],[0,0,0],[0,0,0]])).to.be.equal(0);
});
it("alive cell with neighbor==2", function(){
expect(computeState([[1,1,0],[0,1,0],[0,0,0]])).to.be.equal(1);
});
it("dead cell with neighbor==2", function(){
expect(computeState([[1,0,0],[0,0,0],[0,0,1]])).to.be.equal(0);
});
it("alive cell with neighbor==2", function(){
expect(computeState([[1,0,0],[0,1,0],[0,0,1]])).to.be.equal(1);
});
it("dead cell with neighbor<2", function(){
expect(computeState([[0,0,0],[0,0,1],[0,0,0]])).to.be.equal(0);
});
it("alive cell with neighbor<2", function(){
expect(computeState([[0,0,0],[0,1,1],[0,0,0]])).to.be.equal(0);
});
it("dead cell with neighbor<2", function(){
expect(computeState([[0,0,0],[0,0,0],[0,0,0]])).to.be.equal(0);
});
it("alive cell with neighbor<2", function(){
expect(computeState([[0,0,0],[0,1,0],[0,0,0]])).to.be.equal(0);
});
it("dead cell with neighbor>3", function(){
expect(computeState([[1,1,1],[1,0,1],[1,1,1]])).to.be.equal(0);
});
it("alive cell with neighbor>3", function(){
expect(computeState([[1,1,1],[1,1,1],[1,1,1]])).to.be.equal(0);
});
});