-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_1.js
41 lines (40 loc) · 1.09 KB
/
test_1.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
module('Initialization Test');
test('out of box test', function(){
var G = Game();
G.ini();
equal(G.cells[0][0],0,'initial point is 0');
equal(G.isfilled(-1,10), undefined, 'out of box is zero');
});
module('Update Test');
test('update simple cells test', function(){
var G = Game();
G.ini();
G.cells[0][0]=1;
G.cells[0][1]=1;
G.cells[0][2]=1;
G.update();
equal(G.cells[0][0],0,'degenerated test');
equal(G.cells[0][1],1,'continue to the same state test');
equal(G.cells[0][2],0,'degenerated test');
equal(G.cells[1][1],1,'generated test');
G.update();
equal(G.cells[0][0],0,'continue to the same state test');
equal(G.cells[0][1],0,'degenerated test');
equal(G.cells[0][2],0,'continue to the same state test');
equal(G.cells[1][1],0,'degenerated test');
var T = Game();
T.ini();
T.cells[0][0]=1;
T.cells[0][1]=1;
T.cells[0][2]=1;
T.cells[1][0]=1;
T.cells[1][1]=1;
T.cells[1][2]=1;
T.cells[2][0]=1;
T.cells[2][1]=1;
T.cells[2][2]=1;
T.update();
equal(T.cells[1][1],0,'overcrowded test');
equal(T.cells[1][0],0,'overcorwded test');
equal(T.cells[1][2],0,'overcorwded test');
});