-
Notifications
You must be signed in to change notification settings - Fork 0
/
type_test.go
74 lines (68 loc) · 2.67 KB
/
type_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
// Code generated by generate.sh; DO NOT EDIT.
package iproto_test
import (
"testing"
"github.com/tarantool/go-iproto"
)
func TestType(t *testing.T) {
cases := []struct {
Type iproto.Type
Str string
Val int
}{
{iproto.IPROTO_OK, "IPROTO_OK", 0},
{iproto.IPROTO_SELECT, "IPROTO_SELECT", 1},
{iproto.IPROTO_INSERT, "IPROTO_INSERT", 2},
{iproto.IPROTO_REPLACE, "IPROTO_REPLACE", 3},
{iproto.IPROTO_UPDATE, "IPROTO_UPDATE", 4},
{iproto.IPROTO_DELETE, "IPROTO_DELETE", 5},
{iproto.IPROTO_CALL_16, "IPROTO_CALL_16", 6},
{iproto.IPROTO_AUTH, "IPROTO_AUTH", 7},
{iproto.IPROTO_EVAL, "IPROTO_EVAL", 8},
{iproto.IPROTO_UPSERT, "IPROTO_UPSERT", 9},
{iproto.IPROTO_CALL, "IPROTO_CALL", 10},
{iproto.IPROTO_EXECUTE, "IPROTO_EXECUTE", 11},
{iproto.IPROTO_NOP, "IPROTO_NOP", 12},
{iproto.IPROTO_PREPARE, "IPROTO_PREPARE", 13},
{iproto.IPROTO_BEGIN, "IPROTO_BEGIN", 14},
{iproto.IPROTO_COMMIT, "IPROTO_COMMIT", 15},
{iproto.IPROTO_ROLLBACK, "IPROTO_ROLLBACK", 16},
{iproto.IPROTO_INSERT_ARROW, "IPROTO_INSERT_ARROW", 17},
{iproto.IPROTO_RAFT, "IPROTO_RAFT", 30},
{iproto.IPROTO_RAFT_PROMOTE, "IPROTO_RAFT_PROMOTE", 31},
{iproto.IPROTO_RAFT_DEMOTE, "IPROTO_RAFT_DEMOTE", 32},
{iproto.IPROTO_RAFT_CONFIRM, "IPROTO_RAFT_CONFIRM", 40},
{iproto.IPROTO_RAFT_ROLLBACK, "IPROTO_RAFT_ROLLBACK", 41},
{iproto.IPROTO_PING, "IPROTO_PING", 64},
{iproto.IPROTO_JOIN, "IPROTO_JOIN", 65},
{iproto.IPROTO_SUBSCRIBE, "IPROTO_SUBSCRIBE", 66},
{iproto.IPROTO_VOTE_DEPRECATED, "IPROTO_VOTE_DEPRECATED", 67},
{iproto.IPROTO_VOTE, "IPROTO_VOTE", 68},
{iproto.IPROTO_FETCH_SNAPSHOT, "IPROTO_FETCH_SNAPSHOT", 69},
{iproto.IPROTO_REGISTER, "IPROTO_REGISTER", 70},
{iproto.IPROTO_JOIN_META, "IPROTO_JOIN_META", 71},
{iproto.IPROTO_JOIN_SNAPSHOT, "IPROTO_JOIN_SNAPSHOT", 72},
{iproto.IPROTO_ID, "IPROTO_ID", 73},
{iproto.IPROTO_WATCH, "IPROTO_WATCH", 74},
{iproto.IPROTO_UNWATCH, "IPROTO_UNWATCH", 75},
{iproto.IPROTO_EVENT, "IPROTO_EVENT", 76},
{iproto.IPROTO_WATCH_ONCE, "IPROTO_WATCH_ONCE", 77},
{iproto.IPROTO_CHUNK, "IPROTO_CHUNK", 128},
{iproto.IPROTO_TYPE_ERROR, "IPROTO_TYPE_ERROR", 1 << 15},
{iproto.IPROTO_UNKNOWN, "IPROTO_UNKNOWN", -1},
{iproto.IPROTO_TYPE_STAT_MAX, "IPROTO_TYPE_STAT_MAX", int(iproto.IPROTO_INSERT_ARROW) + 1},
{iproto.VY_INDEX_RUN_INFO, "VY_INDEX_RUN_INFO", 100},
{iproto.VY_INDEX_PAGE_INFO, "VY_INDEX_PAGE_INFO", 101},
{iproto.VY_RUN_ROW_INDEX, "VY_RUN_ROW_INDEX", 102},
}
for _, tc := range cases {
t.Run(tc.Str, func(t *testing.T) {
if tc.Type.String() != tc.Str {
t.Errorf("Got %s, expected %s", tc.Type.String(), tc.Str)
}
if int(tc.Type) != tc.Val {
t.Errorf("Got %d, expected %d", tc.Type, tc.Val)
}
})
}
}