Skip to content

Commit 26f0175

Browse files
committed
[test] Add some more transition tests
1 parent 7d80f0e commit 26f0175

File tree

3 files changed

+232
-0
lines changed

3 files changed

+232
-0
lines changed

internal/app/controller/engine_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package controller
33
import (
44
"encoding/json"
55
"io/ioutil"
6+
"log"
67
"path/filepath"
78
"reflect"
89
"strings"
@@ -27,6 +28,7 @@ func Test_transitions(t *testing.T) {
2728
}
2829

2930
func processTransitionFile(t *testing.T, fileName string) {
31+
log.Printf("Process %v", fileName)
3032
path := filepath.Join("testdata", fileName)
3133
bytes, err := ioutil.ReadFile(path)
3234
if err != nil {
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
[
2+
{
3+
"state": {
4+
"stage": "First Half",
5+
"gameState": "Stopped",
6+
"gameStateForTeam": null,
7+
"gameTimeElapsed": 0,
8+
"gameTimeLeft": 300000000000,
9+
"matchDuration": 0,
10+
"teamState": {
11+
"Blue": {
12+
"name": "",
13+
"goals": 0,
14+
"goalie": 0,
15+
"yellowCards": 0,
16+
"yellowCardTimes": [],
17+
"redCards": 0,
18+
"timeoutsLeft": 4,
19+
"timeoutTimeLeft": 300000000000,
20+
"onPositiveHalf": false
21+
},
22+
"Yellow": {
23+
"name": "",
24+
"goals": 0,
25+
"goalie": 0,
26+
"yellowCards": 0,
27+
"yellowCardTimes": [],
28+
"redCards": 0,
29+
"timeoutsLeft": 4,
30+
"timeoutTimeLeft": 300000000000,
31+
"onPositiveHalf": true
32+
}
33+
}
34+
}
35+
},
36+
{
37+
"event": {
38+
"command": {
39+
"commandType": "ballPlacement",
40+
"forTeam": "Yellow"
41+
}
42+
},
43+
"state": {
44+
"stage": "First Half",
45+
"gameState": "Ball Placement",
46+
"gameStateForTeam": "Yellow",
47+
"gameTimeElapsed": 0,
48+
"gameTimeLeft": 300000000000,
49+
"matchDuration": 0,
50+
"teamState": {
51+
"Blue": {
52+
"name": "",
53+
"goals": 0,
54+
"goalie": 0,
55+
"yellowCards": 0,
56+
"yellowCardTimes": [],
57+
"redCards": 0,
58+
"timeoutsLeft": 4,
59+
"timeoutTimeLeft": 300000000000,
60+
"onPositiveHalf": false
61+
},
62+
"Yellow": {
63+
"name": "",
64+
"goals": 0,
65+
"goalie": 0,
66+
"yellowCards": 0,
67+
"yellowCardTimes": [],
68+
"redCards": 0,
69+
"timeoutsLeft": 4,
70+
"timeoutTimeLeft": 300000000000,
71+
"onPositiveHalf": true
72+
}
73+
}
74+
}
75+
},
76+
{
77+
"event": {
78+
"command": {
79+
"commandType": "stop"
80+
}
81+
},
82+
"state": {
83+
"stage": "First Half",
84+
"gameState": "Stopped",
85+
"gameStateForTeam": null,
86+
"gameTimeElapsed": 0,
87+
"gameTimeLeft": 300000000000,
88+
"matchDuration": 0,
89+
"teamState": {
90+
"Blue": {
91+
"name": "",
92+
"goals": 0,
93+
"goalie": 0,
94+
"yellowCards": 0,
95+
"yellowCardTimes": [],
96+
"redCards": 0,
97+
"timeoutsLeft": 4,
98+
"timeoutTimeLeft": 300000000000,
99+
"onPositiveHalf": false
100+
},
101+
"Yellow": {
102+
"name": "",
103+
"goals": 0,
104+
"goalie": 0,
105+
"yellowCards": 0,
106+
"yellowCardTimes": [],
107+
"redCards": 0,
108+
"timeoutsLeft": 4,
109+
"timeoutTimeLeft": 300000000000,
110+
"onPositiveHalf": true
111+
}
112+
}
113+
}
114+
}
115+
]
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
[
2+
{
3+
"state": {
4+
"stage": "First Half",
5+
"gameState": "Stopped",
6+
"gameStateForTeam": null,
7+
"gameTimeElapsed": 0,
8+
"gameTimeLeft": 300000000000,
9+
"matchDuration": 0,
10+
"teamState": {
11+
"Blue": {
12+
"name": "",
13+
"goals": 0,
14+
"goalie": 0,
15+
"yellowCards": 0,
16+
"yellowCardTimes": [],
17+
"redCards": 0,
18+
"timeoutsLeft": 4,
19+
"timeoutTimeLeft": 300000000000,
20+
"onPositiveHalf": false
21+
},
22+
"Yellow": {
23+
"name": "",
24+
"goals": 0,
25+
"goalie": 0,
26+
"yellowCards": 0,
27+
"yellowCardTimes": [],
28+
"redCards": 0,
29+
"timeoutsLeft": 4,
30+
"timeoutTimeLeft": 300000000000,
31+
"onPositiveHalf": true
32+
}
33+
}
34+
}
35+
},
36+
{
37+
"event": {
38+
"command": {
39+
"commandType": "penalty",
40+
"forTeam": "Yellow"
41+
}
42+
},
43+
"state": {
44+
"stage": "First Half",
45+
"gameState": "Prepare Penalty",
46+
"gameStateForTeam": "Yellow",
47+
"gameTimeElapsed": 0,
48+
"gameTimeLeft": 300000000000,
49+
"matchDuration": 0,
50+
"teamState": {
51+
"Blue": {
52+
"name": "",
53+
"goals": 0,
54+
"goalie": 0,
55+
"yellowCards": 0,
56+
"yellowCardTimes": [],
57+
"redCards": 0,
58+
"timeoutsLeft": 4,
59+
"timeoutTimeLeft": 300000000000,
60+
"onPositiveHalf": false
61+
},
62+
"Yellow": {
63+
"name": "",
64+
"goals": 0,
65+
"goalie": 0,
66+
"yellowCards": 0,
67+
"yellowCardTimes": [],
68+
"redCards": 0,
69+
"timeoutsLeft": 4,
70+
"timeoutTimeLeft": 300000000000,
71+
"onPositiveHalf": true
72+
}
73+
}
74+
}
75+
},
76+
{
77+
"event": {
78+
"command": {
79+
"commandType": "normalStart"
80+
}
81+
},
82+
"state": {
83+
"stage": "First Half",
84+
"gameState": "Running",
85+
"gameStateForTeam": null,
86+
"gameTimeElapsed": 0,
87+
"gameTimeLeft": 300000000000,
88+
"matchDuration": 0,
89+
"teamState": {
90+
"Blue": {
91+
"name": "",
92+
"goals": 0,
93+
"goalie": 0,
94+
"yellowCards": 0,
95+
"yellowCardTimes": [],
96+
"redCards": 0,
97+
"timeoutsLeft": 4,
98+
"timeoutTimeLeft": 300000000000,
99+
"onPositiveHalf": false
100+
},
101+
"Yellow": {
102+
"name": "",
103+
"goals": 0,
104+
"goalie": 0,
105+
"yellowCards": 0,
106+
"yellowCardTimes": [],
107+
"redCards": 0,
108+
"timeoutsLeft": 4,
109+
"timeoutTimeLeft": 300000000000,
110+
"onPositiveHalf": true
111+
}
112+
}
113+
}
114+
}
115+
]

0 commit comments

Comments
 (0)