-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypemaps_test.go
42 lines (35 loc) · 1 KB
/
typemaps_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
package dbus
import "testing"
func TestTypeMaps(t *testing.T) {
for want, typ := range strToType {
if got := typeToStr[typ]; got == want {
continue
}
if got := kindToStr[typ.Kind()]; got == want {
continue
}
t.Errorf("strToType[%q] = %v, but no reverse mapping in typeToStr or kindToStr", typ, want)
}
for want, b := range typeToStr {
if got := strToType[b]; got != want {
t.Errorf("strToType[%q] = %v, want %v", b, got, want)
}
}
for kind, typ := range kindToType {
str := kindToStr[kind]
if str == 0 {
t.Errorf("kindToType[%v] = %v, has no kindToStr", kind, typ)
}
if gotType := strToType[str]; gotType != typ {
t.Errorf("kindToType[%s] = %s, kindToStr[%s] = %q, but no strToType[%q] = %s, want %s", kind, typ, kind, str, str, gotType, typ)
}
}
for _, kind := range mapKeyKinds.Slice() {
if kindToStr[kind] == 0 {
t.Errorf("map key kind %s has no kindToStr", kind)
}
if kindToType[kind] == nil {
t.Errorf("map key kind %s has no kindToType", kind)
}
}
}