(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestBytes(t *testing.T) { |
| 147 | bA := NewBitArray(4) |
| 148 | bA.SetIndex(0, true) |
| 149 | check := func(bA *BitArray, bz []byte) { |
| 150 | if !bytes.Equal(bA.Bytes(), bz) { |
| 151 | panic(fmt.Sprintf("Expected %X but got %X", bz, bA.Bytes())) |
| 152 | } |
| 153 | } |
| 154 | check(bA, []byte{0x01}) |
| 155 | bA.SetIndex(3, true) |
| 156 | check(bA, []byte{0x09}) |
| 157 | |
| 158 | bA = NewBitArray(9) |
| 159 | check(bA, []byte{0x00, 0x00}) |
| 160 | bA.SetIndex(7, true) |
| 161 | check(bA, []byte{0x80, 0x00}) |
| 162 | bA.SetIndex(8, true) |
| 163 | check(bA, []byte{0x80, 0x01}) |
| 164 | |
| 165 | bA = NewBitArray(16) |
| 166 | check(bA, []byte{0x00, 0x00}) |
| 167 | bA.SetIndex(7, true) |
| 168 | check(bA, []byte{0x80, 0x00}) |
| 169 | bA.SetIndex(8, true) |
| 170 | check(bA, []byte{0x80, 0x01}) |
| 171 | bA.SetIndex(9, true) |
| 172 | check(bA, []byte{0x80, 0x03}) |
| 173 | } |
| 174 | |
| 175 | func TestEmptyFull(t *testing.T) { |
| 176 | ns := []int{47, 123} |
nothing calls this directly
no test coverage detected