-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.go
38 lines (28 loc) · 839 Bytes
/
main_test.go
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
package main
import (
"testing"
)
func TestSimulation(t *testing.T) {
// We have no particular expected output. We'll just try running it a bunch of
// times to make sure it doesn't crash.
for x := 0; x < 100; x++ {
roadMap := make(RoadMap)
foo := City{}
bar := City{}
qux := City{}
austin := City{}
roadMap["Foo"] = &foo
roadMap["Bar"] = &bar
roadMap["Qux"] = &qux
roadMap["Austin"] = &austin
roadMap["Foo"].roads.north = roadMap["Bar"]
roadMap["Bar"].roads.south = roadMap["Foo"]
roadMap["Austin"].roads.east = roadMap["Bar"]
roadMap["Bar"].roads.west = roadMap["Austin"]
roadMap["Qux"].roads.west = roadMap["Foo"]
roadMap["Foo"].roads.east = roadMap["Qux"]
mapInput := roadMap.outputMap()
// 3 aliens, 10 iterations. Surely something gets destroyed.
runSimulation(3, 10, mapInput)
}
}