MCPcopy
hub / github.com/openacid/slim / TestBaseInit

Function TestBaseInit

array/base_test.go:115–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

113}
114
115func TestBaseInit(t *testing.T) {
116
117 ta := require.New(t)
118
119 ab := &array.Base{}
120
121 ta.Panics(func() { _ = ab.Init([]int32{}, 1) }, "elts int")
122 ta.Panics(func() { _ = ab.Init([]int32{1, 2}, []interface{}{uint32(1), uint64(1)}) }, "different type elts")
123
124 cases := []struct {
125 input []int32
126 elts interface{}
127 wantBitmaps []uint64
128 wantOffsets []int32
129 wantElts []byte
130 wanterr error
131 }{
132 {
133 []int32{}, []int{},
134 []uint64{},
135 []int32{},
136 []byte{},
137 nil,
138 },
139 {
140 []int32{}, []int{1},
141 []uint64{},
142 []int32{},
143 []byte{},
144 array.ErrIndexLen,
145 },
146 {
147 []int32{1, 0}, []int{1, 1},
148 []uint64{},
149 []int32{},
150 []byte{},
151 array.ErrIndexNotAscending,
152 },
153 {
154 []int32{0}, []int{1},
155 []uint64{},
156 []int32{},
157 []byte{},
158 encode.ErrNotFixedSize,
159 },
160 {
161 []int32{0}, []byte{1},
162 []uint64{1},
163 []int32{0},
164 []byte{1},
165 nil,
166 },
167 {
168 []int32{1, 3}, []int16{1, 2},
169 []uint64{0x0a},
170 []int32{0},
171 []byte{1, 0, 2, 0},
172 nil,

Callers

nothing calls this directly

Calls 1

InitMethod · 0.95

Tested by

no test coverage detected