Skip to content

Commit 1677067

Browse files
committed
add test case for DecodeSlice function
1 parent 7aca9a0 commit 1677067

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

encoding_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ func TestDecode(t *testing.T) {
109109
}
110110

111111
func TestDecodeSlice(t *testing.T) {
112-
ints := []uint64{
113-
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
114-
}
115-
bytes := EncodeSlice(ints)
116-
t.Log(len(bytes))
117-
t.Log(bytes)
118-
slice := DecodeSlice[uint64](bytes)
119-
t.Log(slice)
112+
slice := DecodeSlice[uint]([]byte{
113+
0x1, // 1
114+
0x7f, // 127
115+
0x0, // 0
116+
0xff, 0x1, // 255
117+
0x80, 0x2, // 256
118+
})
119+
assert.Equal(t, []uint{1, 127, 0, 255, 256}, slice)
120120
}

0 commit comments

Comments
 (0)