(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestAppendByte(t *testing.T) { |
| 53 | tests := []struct { |
| 54 | initial *Bitset |
| 55 | value byte |
| 56 | numBits int |
| 57 | expected *Bitset |
| 58 | }{ |
| 59 | { |
| 60 | New(), |
| 61 | 0x01, |
| 62 | 1, |
| 63 | New(b1), |
| 64 | }, |
| 65 | { |
| 66 | New(b1), |
| 67 | 0x01, |
| 68 | 1, |
| 69 | New(b1, b1), |
| 70 | }, |
| 71 | { |
| 72 | New(b0), |
| 73 | 0x01, |
| 74 | 1, |
| 75 | New(b0, b1), |
| 76 | }, |
| 77 | { |
| 78 | New(b1, b0, b1, b0, b1, b0, b1), |
| 79 | 0xAA, // 0b10101010 |
| 80 | 2, |
| 81 | New(b1, b0, b1, b0, b1, b0, b1, b1, b0), |
| 82 | }, |
| 83 | { |
| 84 | New(b1, b0, b1, b0, b1, b0, b1), |
| 85 | 0xAA, // 0b10101010 |
| 86 | 8, |
| 87 | New(b1, b0, b1, b0, b1, b0, b1, b1, b0, b1, b0, b1, b0, b1, b0), |
| 88 | }, |
| 89 | } |
| 90 | |
| 91 | for _, test := range tests { |
| 92 | test.initial.AppendByte(test.value, test.numBits) |
| 93 | if !equal(test.initial.Bits(), test.expected.Bits()) { |
| 94 | t.Errorf("Got %v, expected %v", test.initial.Bits(), |
| 95 | test.expected.Bits()) |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | func TestAppendUint32(t *testing.T) { |
| 101 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…