-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtype_test.go
More file actions
54 lines (51 loc) · 1.03 KB
/
type_test.go
File metadata and controls
54 lines (51 loc) · 1.03 KB
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
package msgpack
import "testing"
func TestTagType(t *testing.T) {
tests := []struct {
typ Type
tag byte
}{
{Nil, tagNil},
{Bool, tagTrue},
{Bool, tagFalse},
{Int, negFixintTag(-7)},
{Int, tagInt8},
{Int, tagInt16},
{Int, tagInt32},
{Int, tagInt64},
{Uint, posFixintTag(7)},
{Uint, tagUint8},
{Uint, tagUint16},
{Uint, tagUint32},
{Uint, tagUint64},
{Float, tagFloat32},
{Float, tagFloat64},
{Bytes, tagBin8},
{Bytes, tagBin16},
{Bytes, tagBin32},
{String, fixstrTag(7)},
{String, tagStr8},
{String, tagStr16},
{String, tagStr32},
{Array, fixarrayTag(7)},
{Array, tagArray16},
{Array, tagArray32},
{Map, fixmapTag(7)},
{Map, tagMap16},
{Map, tagMap32},
{Ext, tagFixExt1},
{Ext, tagFixExt2},
{Ext, tagFixExt4},
{Ext, tagFixExt8},
{Ext, tagFixExt16},
{Ext, tagExt8},
{Ext, tagExt16},
{Ext, tagExt32},
}
for _, test := range tests {
typ := tagType(test.tag)
if typ != test.typ {
t.Errorf("unexpected type for tag %02x: %s (expected %s)", test.tag, typ, test.typ)
}
}
}