-
Notifications
You must be signed in to change notification settings - Fork 0
/
conn_test.go
33 lines (30 loc) · 907 Bytes
/
conn_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
package skytable_test
import "testing"
func TestConn_BuildSingleActionPacketRaw(t *testing.T) {
c, err := NewConnNoAuth()
if err != nil {
t.Fatal(err)
}
tests := []struct {
name string
args []any
wantRaw string
wantErr bool
}{
{ "SetX", []any { "SET", "X", 100 }, "*1\n~3\n3\nSET\n1\nX\n3\n100\n", false },
{ "GetX", []any { "GET", "X" }, "*1\n~2\n3\nGET\n1\nX\n", false },
{ "SysInfoProtocol", []any { "SYS", "INFO", "PROTOCOL" }, "*1\n~3\n3\nSYS\n4\nINFO\n8\nPROTOCOL\n", false },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotRaw, err := c.BuildSingleActionPacketRaw(tt.args)
if (err != nil) != tt.wantErr {
t.Errorf("Conn.BuildSingleActionPacketRaw() error = %v, wantErr %v", err, tt.wantErr)
return
}
if gotRaw != tt.wantRaw {
t.Errorf("Conn.BuildSingleActionPacketRaw() = %v, want %v", gotRaw, tt.wantRaw)
}
})
}
}