Skip to content

Commit d47a01d

Browse files
committed
[test] Add unit test for config
1 parent 4c6e0d1 commit d47a01d

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package controller
2+
3+
import (
4+
"reflect"
5+
"testing"
6+
)
7+
8+
func Test_LoadConfig(t *testing.T) {
9+
defConfig := DefaultConfig()
10+
loadedConfig, err := LoadConfig("testdata/config.yaml")
11+
12+
if err != nil {
13+
t.Fatal(err)
14+
}
15+
16+
if !reflect.DeepEqual(defConfig, loadedConfig) {
17+
t.Fatalf("Configs are not equal:\ndefault:\n%v\nloaded:\n%v", defConfig, loadedConfig)
18+
}
19+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
network:
2+
publish-address: 224.5.23.1:10003
3+
vision-address: 224.5.23.2:10006
4+
server:
5+
auto-ref:
6+
address: :10007
7+
trusted-keys-dir: config/trusted_keys/auto_ref
8+
team:
9+
address: :10008
10+
trusted-keys-dir: config/trusted_keys/team
11+
game:
12+
yellow-card-duration: 2m
13+
multiple-card-step: 3
14+
multiple-foul-step: 3
15+
multiple-placement-failures: 5
16+
default-division: DivA
17+
normal:
18+
half-duration: 5m
19+
half-time-duration: 5m
20+
timeout-duration: 5m
21+
timeouts: 4
22+
break-after: 5m
23+
overtime:
24+
half-duration: 2m30s
25+
half-time-duration: 2m
26+
timeout-duration: 5m
27+
timeouts: 2
28+
break-after: 2m
29+
team-choice-timeout: 200ms
30+
default-geometry:
31+
DivA:
32+
field-length: 12.0
33+
field-width: 9.0
34+
defense-area-depth: 1.2
35+
defense-area-width: 2.4
36+
placement-offset-touch-line: 0.2
37+
placement-offset-goal-line: 0.2
38+
placement-offset-goal-line-goal-kick: 1.0
39+
placement-offset-defense-area: 1.0
40+
DivB:
41+
field-length: 9.0
42+
field-width: 6.0
43+
defense-area-depth: 1.0
44+
defense-area-width: 2.0
45+
placement-offset-touch-line: 0.2
46+
placement-offset-goal-line: 0.2
47+
placement-offset-goal-line-goal-kick: 1.0
48+
placement-offset-defense-area: 1.0
49+
max-bots:
50+
DivA: 8
51+
DivB: 6

0 commit comments

Comments
 (0)