-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
91 lines (91 loc) · 2.56 KB
/
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
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
// @ts-ignore
var App = require('./app');
// @ts-ignore
var GameRoom = require('./logic/game-room');
// Add the specified number of parties to the game, and set all of them to
// disconnected.
function addParties(gs, numParties) {
for (var i = 1; i <= numParties; i++) {
gs.addParty("party " + i, "P" + i);
}
gs.commitAll();
gs.parties.forEach(function (party) {
party.connected = false;
});
}
function twoPartiesStart() {
var game = new GameRoom(App.gameManager.io, {
name: "two parties start",
gameCode: "2ps",
nation: "Kenderland",
private: false
}, function () { });
addParties(game.gs, 2);
App.gameManager.addTestGame(game);
}
function twoPartiesEnd() {
var game = new GameRoom(App.gameManager.io, {
name: "two parties end",
gameCode: "2pe",
nation: "Otria",
private: false
}, function () { });
addParties(game.gs, 2);
App.gameManager.addTestGame(game);
}
function twoPartiesVoting() {
var game = new GameRoom(App.gameManager.io, {
name: "two parties voting",
gameCode: "2pv",
nation: "Kenderland",
private: false
}, function () { });
addParties(game.gs, 2);
game.gs.commitAll();
game.gs.commitAll();
game.gs.commitAll();
App.gameManager.addTestGame(game);
}
function twoPartiesTwoDecline() {
var game = new GameRoom(App.gameManager.io, {
name: "two parties two decline",
gameCode: "2p2d",
nation: "Kenderland",
private: false
}, function () { });
addParties(game.gs, 2);
game.gs.decline = 2;
game.gs.parties.forEach(function (party) {
party.hitAvailable = true;
});
App.gameManager.addTestGame(game);
}
function threePartiesStart() {
var game = new GameRoom(App.gameManager.io, {
name: "three parties start",
gameCode: "3ps",
nation: "Otria",
private: false
}, function () { });
addParties(game.gs, 3);
App.gameManager.addTestGame(game);
}
function fourPartiesStart() {
var game = new GameRoom(App.gameManager.io, {
name: "four parties start",
gameCode: "4ps",
nation: "Otria",
private: false
}, function () { });
addParties(game.gs, 4);
App.gameManager.addTestGame(game);
}
var startTime = (new Date()).getUTCSeconds();
twoPartiesStart();
twoPartiesVoting();
twoPartiesTwoDecline();
twoPartiesEnd();
threePartiesStart();
fourPartiesStart();
var endTime = (new Date()).getUTCSeconds();
console.log("Created test games in " + (endTime - startTime) / 1000 + "s");