-
Notifications
You must be signed in to change notification settings - Fork 0
/
concurrentgamemodel_test.go
92 lines (83 loc) · 2.82 KB
/
concurrentgamemodel_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
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
92
package modelchecking
import (
"testing"
)
func CreateSimpleCGM() (ConcurrentGameModel, error) {
cgm2, err := CreateConcurrentGameModel(
[]string{"Agent1", "Agent2"},
[]string{"Rome", "Florence", "Venice"},
[]string{"Drunk", "Sober"},
[]string{"Ride Horse", "Take Boat", "Follow Legion"},
map[string]map[string][]string{
"Agent1": {
"Rome": {"Ride Horse", "Take Boat", "Follow Legion"},
"Florence": {"Ride Horse", "Take Boat"},
"Venice": {"Take Boat"},
},
"Agent2": {
"Rome": {"Ride Horse", "Take Boat", "Follow Legion"},
"Florence": {"Ride Horse"},
"Venice": {"Take Boat", "Follow Legion"},
},
},
map[string]map[string]string{
"Rome": {
"Ride Horse, Ride Horse": "Florence",
"Ride Horse, Take Boat": "Florence",
"Ride Horse, Follow Legion": "Florence",
"Take Boat, Ride Horse": "Venice",
"Take Boat, Take Boat": "Venice",
"Take Boat, Follow Legion": "Venice",
"Follow Legion, Ride Horse": "Rome",
"Follow Legion, Take Boat": "Rome",
"Follow Legion, Follow Legion": "Rome",
},
"Florence": {
"Ride Horse, Ride Horse": "Rome",
"Ride Horse, Take Boat": "Venice",
"Ride Horse, Follow Legion": "Florence",
"Take Boat, Ride Horse": "Florence",
"Take Boat, Take Boat": "Florence",
"Take Boat, Follow Legion": "Florence",
"Follow Legion, Ride Horse": "Florence",
"Follow Legion, Take Boat": "Florence",
"Follow Legion, Follow Legion": "Rome",
},
"Venice": {
"Ride Horse, Ride Horse": "Rome",
"Ride Horse, Take Boat": "Rome",
"Ride Horse, Follow Legion": "Venice",
"Take Boat, Ride Horse": "Florence",
"Take Boat, Take Boat": "Rome",
"Take Boat, Follow Legion": "Florence",
"Follow Legion, Ride Horse": "Florence",
"Follow Legion, Take Boat": "Florence",
"Follow Legion, Follow Legion": "Rome",
},
},
map[string][]string{
"Drunk": {"Rome"},
"Sober": {"Florence", "Venice"},
},
)
return cgm2, err
}
func TestConcurrentGameModel_Constructor1(t *testing.T) {
// Create Simple Empty Concurrent Game Model
cgm1 := ConcurrentGameModel{}
// Try to get a state which is outside of the allowable range.
if cgm1.o != nil {
t.Errorf("Expected for uninitialized CGM to have nil transition function. But it is not nil!")
}
}
func TestConcurrentGameModel_CreateConcurrentGameModel1(t *testing.T) {
// Create Simple Empty Concurrent Game Model
cgm2, err := CreateSimpleCGM()
if err != nil {
t.Errorf("There was an error while creating simple CGM: %v", err.Error())
}
// Try to get a state which is outside of the allowable range.
if cgm2.o == nil {
t.Errorf("Expected for uninitialized CGM to have non-empty transition function. But it is nil!")
}
}