MCPcopy Index your code
hub / github.com/Workiva/go-datastructures / TestSparseBitArrayMarshalUnmarshal

Function TestSparseBitArrayMarshalUnmarshal

bitarray/encoding_test.go:96–115  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestSparseBitArrayMarshalUnmarshal(t *testing.T) {
97 numItems := uint64(1280)
98 input := newSparseBitArray()
99
100 for i := uint64(0); i < numItems; i++ {
101 if i%3 == 0 {
102 input.SetBit(i)
103 }
104 }
105
106 outputBytes, err := Marshal(input)
107 assert.Equal(t, err, nil)
108 assert.Equal(t, outputBytes[0], byte('S'))
109 assert.Equal(t, len(outputBytes), 337)
110
111 output, err := Unmarshal(outputBytes)
112 assert.Equal(t, err, nil)
113
114 assert.True(t, input.Equals(output))
115}
116
117func TestUnmarshalErrors(t *testing.T) {
118 numItems := uint64(1280)

Callers

nothing calls this directly

Calls 5

newSparseBitArrayFunction · 0.85
MarshalFunction · 0.85
UnmarshalFunction · 0.85
SetBitMethod · 0.65
EqualsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…