(t *testing.T)
| 79 | } |
| 80 | |
| 81 | func TestDuplicateOperation(t *testing.T) { |
| 82 | ba := newBitArray(10) |
| 83 | |
| 84 | err := ba.SetBit(5) |
| 85 | if err != nil { |
| 86 | t.Fatal(err) |
| 87 | } |
| 88 | |
| 89 | err = ba.SetBit(5) |
| 90 | if err != nil { |
| 91 | t.Fatal(err) |
| 92 | } |
| 93 | |
| 94 | result, err := ba.GetBit(5) |
| 95 | if err != nil { |
| 96 | t.Fatal(err) |
| 97 | } |
| 98 | |
| 99 | if !result { |
| 100 | t.Errorf(`Expected true at position: %d`, 5) |
| 101 | } |
| 102 | |
| 103 | err = ba.ClearBit(5) |
| 104 | if err != nil { |
| 105 | t.Fatal(err) |
| 106 | } |
| 107 | |
| 108 | err = ba.ClearBit(5) |
| 109 | if err != nil { |
| 110 | t.Fatal(err) |
| 111 | } |
| 112 | |
| 113 | result, err = ba.GetBit(5) |
| 114 | if err != nil { |
| 115 | t.Fatal(err) |
| 116 | } |
| 117 | |
| 118 | if result { |
| 119 | t.Errorf(`Expected false at position: %d`, 5) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | func TestOutOfBounds(t *testing.T) { |
| 124 | ba := newBitArray(4) |
nothing calls this directly
no test coverage detected
searching dependent graphs…