MCPcopy Create free account
hub / github.com/distributedio/titan / TestArray_Encode

Function TestArray_Encode

encoding/resp/resp_test.go:24–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22}
23
24func TestArray_Encode(t *testing.T) {
25 assert := assert.New(t)
26 out := bytes.NewBuffer(nil)
27 e := NewEncoder(out)
28
29 // Empty array
30 err := e.Array(0)
31 assert.NoError(err)
32 assert.Equal("*0\r\n", out.String())
33
34 // Array with one item
35 out.Reset()
36 err = e.Array(1)
37 assert.NoError(err)
38 assert.Equal("*1\r\n", out.String())
39
40 // Array of large data
41 out.Reset()
42 err = e.Array(1000000000000)
43 assert.NoError(err)
44 assert.Equal("*1000000000000\r\n", out.String())
45}
46
47func TestSimpleString_Decode(t *testing.T) {
48 assert := assert.New(t)

Callers

nothing calls this directly

Calls 4

ArrayMethod · 0.95
NewEncoderFunction · 0.85
ResetMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected