| 1 | package bitfieldscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.21 bytes/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.21 fmt/" |
| 6 | "reflectscip-go gomod github.com/golang/go/src go1.21 reflect/" |
| 7 | "testingscip-go gomod github.com/golang/go/src go1.21 testing/" |
| 8 | ) |
| 9 | |
| 10 | func TestNewBitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestNewBitlist().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 11 | tests := []struct { |
| 12 | size uint64 |
| 13 | want Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 14 | }{ |
| 15 | { |
| 16 | size: 0, |
| 17 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, |
| 18 | }, |
| 19 | { |
| 20 | size: 1, |
| 21 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, |
| 22 | }, |
| 23 | { |
| 24 | size: 2, |
| 25 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x04}, |
| 26 | }, |
| 27 | { |
| 28 | size: 3, |
| 29 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x08}, |
| 30 | }, |
| 31 | { |
| 32 | size: 8, |
| 33 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x01}, |
| 34 | }, |
| 35 | { |
| 36 | size: 9, |
| 37 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x02}, |
| 38 | }, |
| 39 | } |
| 40 | |
| 41 | for _, tt := range tests { |
| 42 | got := NewBitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/NewBitlist().(tt.size) |
| 43 | if !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(got, tt.want) { |
| 44 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 45 | "NewBitlist(%d) = %x, wanted %x", |
| 46 | tt.size, |
| 47 | got, |
| 48 | tt.want, |
| 49 | ) |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | func TestBitlist_Lenscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_Len().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 55 | tests := []struct { |
| 56 | bitlist Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 57 | want uint64 |
| 58 | }{ |
| 59 | { |
| 60 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{}, |
| 61 | want: 0, |
| 62 | }, |
| 63 | { |
| 64 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00}, // 0b00000000, invalid list |
| 65 | want: 0, |
| 66 | }, |
| 67 | { |
| 68 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, // 0b00000001 |
| 69 | want: 0, |
| 70 | }, |
| 71 | { |
| 72 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 73 | want: 1, |
| 74 | }, |
| 75 | { |
| 76 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x08}, // 0b00001000 |
| 77 | want: 3, |
| 78 | }, |
| 79 | { |
| 80 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0E}, // 0b00001110 |
| 81 | want: 3, |
| 82 | }, |
| 83 | { |
| 84 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0F}, // 0b00001111 |
| 85 | want: 3, |
| 86 | }, |
| 87 | { |
| 88 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x10}, // 0b00010000 |
| 89 | want: 4, |
| 90 | }, |
| 91 | { |
| 92 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x01}, // 0b00000000, 0b00000001 |
| 93 | want: 8, |
| 94 | }, |
| 95 | { |
| 96 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x02}, // 0b00000000, 0b00000010 |
| 97 | want: 9, |
| 98 | }, |
| 99 | { |
| 100 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x02, 0x08}, // 0b00000000, 0b00000010, 0b00001000 |
| 101 | want: 19, |
| 102 | }, |
| 103 | } |
| 104 | |
| 105 | for _, tt := range tests { |
| 106 | if tt.bitlist.Lenscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Len().() != tt.want { |
| 107 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().("(%x).Len() = %d, wanted %d", tt.bitlist, tt.bitlist.Lenscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Len().(), tt.want) |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | func TestBitlist_BitAtscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_BitAt().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 113 | tests := []struct { |
| 114 | bitlist Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 115 | idx uint64 |
| 116 | want bool |
| 117 | }{ |
| 118 | { |
| 119 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{}, |
| 120 | idx: 0, |
| 121 | want: false, |
| 122 | }, |
| 123 | { |
| 124 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, // 0b00000001 |
| 125 | idx: 55, // Out of bounds |
| 126 | want: false, |
| 127 | }, |
| 128 | { |
| 129 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, // 0b00000001 |
| 130 | idx: 0, // ^ (length bit) |
| 131 | want: false, |
| 132 | }, |
| 133 | { |
| 134 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0E}, // 0b00001110 |
| 135 | idx: 0, // ^ |
| 136 | want: false, |
| 137 | }, |
| 138 | { |
| 139 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0E}, // 0b00001110 |
| 140 | idx: 1, // ^ |
| 141 | want: true, |
| 142 | }, |
| 143 | { |
| 144 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0E}, // 0b00001110 |
| 145 | idx: 3, // ^ |
| 146 | want: false, |
| 147 | }, |
| 148 | { |
| 149 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0E}, // 0b00001110 |
| 150 | idx: 4, // ^ (length bit) |
| 151 | want: false, |
| 152 | }, |
| 153 | { |
| 154 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x0F}, // 0b11111111, 0b00001111 |
| 155 | idx: 4, // ^ |
| 156 | want: true, |
| 157 | }, |
| 158 | { |
| 159 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x0F}, // 0b11111111, 0b00001111 |
| 160 | idx: 12, // ^ |
| 161 | want: false, |
| 162 | }, |
| 163 | { |
| 164 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x0F}, // 0b11111111, 0b00001111 |
| 165 | idx: 11, // ^ (length bit) |
| 166 | want: false, |
| 167 | }, |
| 168 | { |
| 169 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x0F}, // 0b00000000, 0b00001111 |
| 170 | idx: 10, // ^ |
| 171 | want: true, |
| 172 | }, |
| 173 | } |
| 174 | |
| 175 | for _, tt := range tests { |
| 176 | if tt.bitlist.BitAtscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#BitAt().(tt.idx) != tt.want { |
| 177 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 178 | "(%x).BitAt(%d) = %t, wanted %t", |
| 179 | tt.bitlist, |
| 180 | tt.idx, |
| 181 | tt.bitlist.BitAtscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#BitAt().(tt.idx), |
| 182 | tt.want, |
| 183 | ) |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | func TestBitlist_SetBitAtscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_SetBitAt().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 189 | tests := []struct { |
| 190 | bitlist Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 191 | idx uint64 |
| 192 | val bool |
| 193 | want Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 194 | }{ |
| 195 | { |
| 196 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{}, |
| 197 | idx: 0, |
| 198 | val: true, |
| 199 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{}, |
| 200 | }, |
| 201 | { |
| 202 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, // 0b00000001 |
| 203 | idx: 0, // ^ |
| 204 | val: true, |
| 205 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, // 0b00000001 |
| 206 | }, |
| 207 | { |
| 208 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 209 | idx: 0, // ^ |
| 210 | val: true, |
| 211 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 212 | }, |
| 213 | { |
| 214 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x10}, // 0b00010000 |
| 215 | idx: 0, // ^ |
| 216 | val: true, |
| 217 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x11}, // 0b00010001 |
| 218 | }, |
| 219 | { |
| 220 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x10}, // 0b00010000 |
| 221 | idx: 0, // ^ |
| 222 | val: true, |
| 223 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x11}, // 0b00010001 |
| 224 | }, |
| 225 | { |
| 226 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x10}, // 0b00010000 |
| 227 | idx: 64, // Out of bounds |
| 228 | val: true, |
| 229 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x10}, // 0b00010001 |
| 230 | }, |
| 231 | { |
| 232 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 233 | idx: 0, // ^ |
| 234 | val: true, |
| 235 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 236 | }, |
| 237 | { |
| 238 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 239 | idx: 1, // ^ |
| 240 | val: false, |
| 241 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1D}, // 0b00011101 |
| 242 | }, |
| 243 | { |
| 244 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 245 | idx: 4, // ^ (length bit) |
| 246 | val: false, |
| 247 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 248 | }, |
| 249 | { |
| 250 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 251 | idx: 64, // Out of bounds |
| 252 | val: false, |
| 253 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 254 | }, |
| 255 | { |
| 256 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x01}, // 0b00011111, 0b00000001 |
| 257 | idx: 0, // ^ |
| 258 | val: true, |
| 259 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x01}, // 0b00011111, 0b00000001 |
| 260 | }, |
| 261 | { |
| 262 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x01}, // 0b00011111, 0b00000001 |
| 263 | idx: 0, // ^ |
| 264 | val: false, |
| 265 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1E, 0x01}, // 0b00011110, 0b00000001 |
| 266 | }, |
| 267 | { |
| 268 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x10}, // 0b00000000, 0b00010000 |
| 269 | idx: 8, // ^ |
| 270 | val: true, |
| 271 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x11}, // 0b00000000, 0b00010001 |
| 272 | }, |
| 273 | { |
| 274 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x11}, // 0b00000000, 0b00010001 |
| 275 | idx: 8, // ^ |
| 276 | val: false, |
| 277 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x10}, // 0b00000000, 0b00010000 |
| 278 | }, |
| 279 | } |
| 280 | |
| 281 | for _, tt := range tests { |
| 282 | original := make(Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#, len(tt.bitlist)) |
| 283 | copy(original, tt.bitlist) |
| 284 | |
| 285 | tt.bitlist.SetBitAtscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#SetBitAt().(tt.idx, tt.val) |
| 286 | if !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(tt.bitlist, tt.want) { |
| 287 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 288 | "(%x).SetBitAt(%d, %t) = %x, wanted %x", |
| 289 | original, |
| 290 | tt.idx, |
| 291 | tt.val, |
| 292 | tt.bitlist, |
| 293 | tt.want, |
| 294 | ) |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | func TestBitlist_Bytesscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_Bytes().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 300 | tests := []struct { |
| 301 | bitlist Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 302 | want []byte |
| 303 | }{ |
| 304 | { |
| 305 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{}, |
| 306 | want: []byte{}, |
| 307 | }, |
| 308 | { |
| 309 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00}, |
| 310 | want: []byte{}, |
| 311 | }, |
| 312 | { |
| 313 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, |
| 314 | want: []byte{}, |
| 315 | }, |
| 316 | { |
| 317 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, |
| 318 | want: []byte{}, |
| 319 | }, |
| 320 | { |
| 321 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, |
| 322 | want: []byte{0x01}, |
| 323 | }, |
| 324 | { |
| 325 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x12}, |
| 326 | want: []byte{0x02}, |
| 327 | }, |
| 328 | { |
| 329 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02, 0x01}, |
| 330 | want: []byte{0x02}, |
| 331 | }, |
| 332 | { |
| 333 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02, 0x02}, |
| 334 | want: []byte{0x02}, |
| 335 | }, |
| 336 | { |
| 337 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02, 0x01}, |
| 338 | want: []byte{0x02}, |
| 339 | }, |
| 340 | { |
| 341 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02, 0x03}, |
| 342 | want: []byte{0x02, 0x01}, |
| 343 | }, |
| 344 | { |
| 345 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01, 0x00, 0x08}, |
| 346 | want: []byte{0x01}, |
| 347 | }, { |
| 348 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x00, 0x02}, |
| 349 | want: []byte{}, |
| 350 | }, |
| 351 | } |
| 352 | |
| 353 | for _, tt := range tests { |
| 354 | got := tt.bitlist.Bytesscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Bytes().() |
| 355 | if !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(got, tt.want) { |
| 356 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 357 | "(%x).Bytes() = %x, wanted %x", |
| 358 | tt.bitlist, |
| 359 | got, |
| 360 | tt.want, |
| 361 | ) |
| 362 | } |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | func TestBitlist_BytesNoTrimscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_BytesNoTrim().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 367 | tests := []struct { |
| 368 | bitlist Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 369 | want []byte |
| 370 | }{ |
| 371 | { |
| 372 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{}, |
| 373 | want: []byte{}, |
| 374 | }, |
| 375 | { |
| 376 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00}, |
| 377 | want: []byte{}, |
| 378 | }, |
| 379 | { |
| 380 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, |
| 381 | want: []byte{}, |
| 382 | }, |
| 383 | { |
| 384 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, |
| 385 | want: []byte{0x00}, |
| 386 | }, |
| 387 | { |
| 388 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, |
| 389 | want: []byte{0x01}, |
| 390 | }, |
| 391 | { |
| 392 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x12}, |
| 393 | want: []byte{0x02}, |
| 394 | }, |
| 395 | { |
| 396 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02, 0x01}, |
| 397 | want: []byte{0x02}, |
| 398 | }, |
| 399 | { |
| 400 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02, 0x02}, |
| 401 | want: []byte{0x02, 0x00}, |
| 402 | }, |
| 403 | { |
| 404 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02, 0x03}, |
| 405 | want: []byte{0x02, 0x01}, |
| 406 | }, |
| 407 | { |
| 408 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01, 0x00, 0x08}, |
| 409 | want: []byte{0x01, 0x00, 0x00}, |
| 410 | }, |
| 411 | { |
| 412 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x00, 0x02}, |
| 413 | want: []byte{0x00, 0x00, 0x00}, |
| 414 | }, |
| 415 | { |
| 416 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x00, 0x01}, |
| 417 | want: []byte{0x00, 0x00}, |
| 418 | }, |
| 419 | } |
| 420 | |
| 421 | for _, tt := range tests { |
| 422 | got := tt.bitlist.BytesNoTrimscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#BytesNoTrim().() |
| 423 | if !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(got, tt.want) { |
| 424 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().("(%#x).BytesNoTrim() = %#v, wanted %#v", tt.bitlist, got, tt.want) |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | func TestBitlist_ToBitlist64scip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_ToBitlist64().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 430 | tests := []struct { |
| 431 | size uint64 |
| 432 | selectedIndices []uint64 |
| 433 | }{ |
| 434 | { |
| 435 | size: 0, |
| 436 | selectedIndices: []uint64{}, |
| 437 | }, |
| 438 | { |
| 439 | size: 1, |
| 440 | selectedIndices: []uint64{0}, |
| 441 | }, |
| 442 | { |
| 443 | size: 2, |
| 444 | selectedIndices: []uint64{0, 1}, |
| 445 | }, |
| 446 | { |
| 447 | size: 7, |
| 448 | selectedIndices: []uint64{0, 1, 6}, |
| 449 | }, |
| 450 | { |
| 451 | size: 8, |
| 452 | selectedIndices: []uint64{0, 1, 6, 7}, |
| 453 | }, |
| 454 | { |
| 455 | size: 9, |
| 456 | selectedIndices: []uint64{3, 4}, |
| 457 | }, |
| 458 | { |
| 459 | size: 60, |
| 460 | selectedIndices: []uint64{0, 2, 50}, |
| 461 | }, |
| 462 | { |
| 463 | size: 64, |
| 464 | selectedIndices: []uint64{0, 2, 63}, |
| 465 | }, |
| 466 | { |
| 467 | size: 69, |
| 468 | selectedIndices: []uint64{0, 2, 63, 67}, |
| 469 | }, |
| 470 | { |
| 471 | size: 128, |
| 472 | selectedIndices: []uint64{0, 2, 63, 67, 120}, |
| 473 | }, |
| 474 | { |
| 475 | size: 128, |
| 476 | selectedIndices: []uint64{0, 2, 63, 67, 90, 100, 120, 126, 127}, |
| 477 | }, |
| 478 | { |
| 479 | size: 192, |
| 480 | selectedIndices: []uint64{0, 2, 63, 67, 90, 100, 120, 126, 127, 150, 170}, |
| 481 | }, |
| 482 | } |
| 483 | |
| 484 | selectIndices := func(b Bitfieldscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitfield#, indices []uint64) Bitfieldscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitfield# { |
| 485 | for _, idx := range indices { |
| 486 | b.SetBitAtscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitfield#SetBitAt.(idx, true) |
| 487 | } |
| 488 | return b |
| 489 | } |
| 490 | createBitlist64 := func(n uint64, indices []uint64) *Bitlist64scip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist64# { |
| 491 | return (selectIndices(NewBitlist64scip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/NewBitlist64().(n), indices)).(*Bitlist64scip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist64#) |
| 492 | } |
| 493 | createBitlist := func(n uint64, indices []uint64) Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# { |
| 494 | return (selectIndices(NewBitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/NewBitlist().(n), indices)).(Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#) |
| 495 | } |
| 496 | |
| 497 | for _, tt := range tests { |
| 498 | source := createBitlist(tt.size, tt.selectedIndices) |
| 499 | wanted := createBitlist64(tt.size, tt.selectedIndices) |
| 500 | t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("size:%d,indices:%v", tt.size, tt.selectedIndices), func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 501 | // Convert to Bitlist64. |
| 502 | got, err := source.ToBitlist64scip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#ToBitlist64().() |
| 503 | if err != nil { |
| 504 | t.Errorscip-go gomod github.com/golang/go/src go1.21 testing/common#Error().(err) |
| 505 | } |
| 506 | if !reflectscip-go gomod github.com/golang/go/src go1.21 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21 reflect/DeepEqual().(got, wanted) { |
| 507 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().("ToBitlist64(%#x) = %#b, wanted %#b", source, got, wanted) |
| 508 | } |
| 509 | |
| 510 | // Now convert back, and compare to the original. |
| 511 | gotSource := got.ToBitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist64#ToBitlist().() |
| 512 | if !reflectscip-go gomod github.com/golang/go/src go1.21 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21 reflect/DeepEqual().(gotSource, source) { |
| 513 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().("ToBitlist64(%#x).ToBitlist() = %+v, wanted %+v", source, gotSource, source) |
| 514 | } |
| 515 | |
| 516 | // Make sure that both Bitlist and Bitlist64 Bytes() are equal. |
| 517 | if !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(source.Bytesscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Bytes().(), got.Bytesscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist64#Bytes().()) { |
| 518 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().("original.Bytes() != converted.Bytes() (%#x != %#x)", source.Bytesscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Bytes().(), got.Bytesscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist64#Bytes().()) |
| 519 | } |
| 520 | }) |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | func TestBitlist_Countscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_Count().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 525 | tests := []struct { |
| 526 | bitlist Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 527 | want uint64 |
| 528 | }{ |
| 529 | { |
| 530 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{}, |
| 531 | want: 0, |
| 532 | }, |
| 533 | { |
| 534 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00}, // 0b00000000, invalid list |
| 535 | want: 0, |
| 536 | }, |
| 537 | { |
| 538 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, // 0b00000001 |
| 539 | want: 0, |
| 540 | }, |
| 541 | { |
| 542 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 543 | want: 1, |
| 544 | }, |
| 545 | { |
| 546 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0F}, // 0b00001111 |
| 547 | want: 3, |
| 548 | }, |
| 549 | { |
| 550 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0F, 0x01}, // 0b00001111, 0b00000001 |
| 551 | want: 4, |
| 552 | }, |
| 553 | { |
| 554 | bitlist: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0F, 0x03}, // 0b00001111, 0b00000011 |
| 555 | want: 5, |
| 556 | }, |
| 557 | } |
| 558 | |
| 559 | for _, tt := range tests { |
| 560 | if tt.bitlist.Countscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Count().() != tt.want { |
| 561 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 562 | "(%x).Count() = %d, wanted %d", |
| 563 | tt.bitlist, |
| 564 | tt.bitlist.Countscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Count().(), |
| 565 | tt.want, |
| 566 | ) |
| 567 | } |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | func TestBitlist_Containsscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_Contains().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 572 | tests := []struct { |
| 573 | a Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 574 | b Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 575 | want bool |
| 576 | }{ |
| 577 | { |
| 578 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 579 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 580 | want: false, |
| 581 | }, |
| 582 | { |
| 583 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 584 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 585 | want: true, |
| 586 | }, |
| 587 | { |
| 588 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 589 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x15}, // 0b00010101 |
| 590 | want: false, |
| 591 | }, |
| 592 | { |
| 593 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 594 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 595 | want: true, |
| 596 | }, |
| 597 | { |
| 598 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 599 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 600 | want: true, |
| 601 | }, |
| 602 | { |
| 603 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x03}, // 0b00011111, 0b00000011 |
| 604 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x02}, // 0b00010011, 0b00000010 |
| 605 | want: true, |
| 606 | }, |
| 607 | { |
| 608 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x01}, // 0b00011111, 0b00000001 |
| 609 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x93, 0x01}, // 0b10010011, 0b00000001 |
| 610 | want: false, |
| 611 | }, |
| 612 | { |
| 613 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x02}, // 0b11111111, 0x00000010 |
| 614 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x03}, // 0b00010011, 0x00000011 |
| 615 | want: false, |
| 616 | }, |
| 617 | { |
| 618 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x85}, // 0b11111111, 0x10000111 |
| 619 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x8F}, // 0b00010011, 0x10001111 |
| 620 | want: false, |
| 621 | }, |
| 622 | { |
| 623 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x8F}, // 0b11111111, 0x10001111 |
| 624 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x83}, // 0b00010011, 0x10000011 |
| 625 | want: true, |
| 626 | }, |
| 627 | } |
| 628 | |
| 629 | for _, tt := range tests { |
| 630 | if got, err := tt.a.Containsscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Contains().(tt.b); got != tt.want || err != nil { |
| 631 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 632 | "(%x).Contains(%x) = %t, %v, wanted %t", |
| 633 | tt.a, |
| 634 | tt.b, |
| 635 | got, |
| 636 | err, |
| 637 | tt.want, |
| 638 | ) |
| 639 | } |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | func TestBitlist_Overlapsscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_Overlaps().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 644 | tests := []struct { |
| 645 | a Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 646 | b Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 647 | want bool |
| 648 | }{ |
| 649 | { |
| 650 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x06}, // 0b00000110 |
| 651 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x05}, // 0b00000101 |
| 652 | want: false, |
| 653 | }, |
| 654 | { |
| 655 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x32}, // 0b00110010 |
| 656 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x21}, // 0b00100001 |
| 657 | want: false, |
| 658 | }, |
| 659 | { |
| 660 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x41}, // 0b00100001 |
| 661 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x40}, // 0b00100000 |
| 662 | want: false, |
| 663 | }, |
| 664 | { |
| 665 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 666 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x11}, // 0b00010001 |
| 667 | want: true, |
| 668 | }, |
| 669 | { |
| 670 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x85}, // 0b11111111, 0b10000111 |
| 671 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x8F}, // 0b00010011, 0b10001111 |
| 672 | want: true, |
| 673 | }, |
| 674 | { |
| 675 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01, 0x40}, // 0b00000001, 0b01000000 |
| 676 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x40}, // 0b00000010, 0b01000000 |
| 677 | want: false, |
| 678 | }, |
| 679 | { |
| 680 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01, 0x40}, // 0b00000001, 0b01000000 |
| 681 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x40}, // 0b00000010, 0b01000000 |
| 682 | want: false, |
| 683 | }, |
| 684 | { |
| 685 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01, 0x40}, // 0b00000001, 0b01000000 |
| 686 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02, 0x40}, // 0b00000010, 0b01000000 |
| 687 | want: false, |
| 688 | }, |
| 689 | { |
| 690 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01, 0x40}, // 0b00000001, 0b01000000 |
| 691 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03, 0x40}, // 0b00000011, 0b01000000 |
| 692 | want: true, |
| 693 | }, |
| 694 | { |
| 695 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01, 0x01, 0x01}, // 0b00000001, 0b00000001, 0b00000001 |
| 696 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02, 0x00, 0x01}, // 0b00000010, 0b00000000, 0b00000001 |
| 697 | want: false, |
| 698 | }, |
| 699 | } |
| 700 | |
| 701 | for _, tt := range tests { |
| 702 | if result, err := tt.a.Overlapsscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Overlaps().(tt.b); result != tt.want || err != nil { |
| 703 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 704 | "(%x).Overlaps(%x) = %t, %v, wanted %t", |
| 705 | tt.a, |
| 706 | tt.b, |
| 707 | result, |
| 708 | err, |
| 709 | tt.want, |
| 710 | ) |
| 711 | } |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | func TestBitlist_Orscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_Or().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 716 | tests := []struct { |
| 717 | a Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 718 | b Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 719 | want Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 720 | }{ |
| 721 | { |
| 722 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 723 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 724 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 725 | }, |
| 726 | { |
| 727 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 728 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 729 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 730 | }, |
| 731 | { |
| 732 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 733 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x15}, // 0b00010101 |
| 734 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x17}, // 0b00010111 |
| 735 | }, |
| 736 | { |
| 737 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 738 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 739 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 740 | }, |
| 741 | { |
| 742 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x03}, // 0b00011111, 0b00000011 |
| 743 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x02}, // 0b00010011, 0b00000010 |
| 744 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x03}, // 0b00011111, 0b00000011 |
| 745 | }, |
| 746 | { |
| 747 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x01}, // 0b00011111, 0b00000001 |
| 748 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x93, 0x01}, // 0b10010011, 0b00000001 |
| 749 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x9F, 0x01}, // 0b00011111, 0b00000001 |
| 750 | }, |
| 751 | { |
| 752 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x02}, // 0b11111111, 0x00000010 |
| 753 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x03}, // 0b00010011, 0x00000011 |
| 754 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x03}, // 0b11111111, 0x00000011 |
| 755 | }, |
| 756 | { |
| 757 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x85}, // 0b11111111, 0x10000111 |
| 758 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x8F}, // 0b00010011, 0x10001111 |
| 759 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x8F}, // 0b11111111, 0x10001111 |
| 760 | }, |
| 761 | } |
| 762 | |
| 763 | for _, tt := range tests { |
| 764 | t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("Or()", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 765 | if got, err := tt.a.Orscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Or().(tt.b); !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(got, tt.want) || err != nil { |
| 766 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 767 | "(%x).Or(%x) = %x, %v, wanted %x", |
| 768 | tt.a, |
| 769 | tt.b, |
| 770 | got, |
| 771 | err, |
| 772 | tt.want, |
| 773 | ) |
| 774 | } |
| 775 | }) |
| 776 | |
| 777 | t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("NoAllocOr()", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 778 | for _, tt := range tests { |
| 779 | res := Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#(bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Clonescip-go gomod github.com/golang/go/src go1.21 bytes/Clone().(tt.a)) |
| 780 | // Make sure that no existing bits set interfere with operation. This is done to simulate |
| 781 | // the case when res variable is already populated from the previous run. |
| 782 | for i := uint64(0); i < res.Lenscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Len().(); i += 10 { |
| 783 | res.SetBitAtscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#SetBitAt().(i, true) |
| 784 | } |
| 785 | tt.a.NoAllocOrscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#NoAllocOr().(tt.b, res) |
| 786 | if !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(res, tt.want) { |
| 787 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().("(%+v).NoAllocOr(%+v) = %+v, wanted %x", tt.a, tt.b, res, tt.want) |
| 788 | } |
| 789 | } |
| 790 | }) |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | func TestBitlist_Andscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_And().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 795 | tests := []struct { |
| 796 | a Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 797 | b Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 798 | want Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 799 | }{ |
| 800 | { |
| 801 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 802 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 803 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 804 | }, |
| 805 | { |
| 806 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 807 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 808 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 809 | }, |
| 810 | { |
| 811 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 812 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x15}, // 0b00010101 |
| 813 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x11}, // 0b00010001 |
| 814 | }, |
| 815 | { |
| 816 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 817 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 818 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 819 | }, |
| 820 | { |
| 821 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x03}, // 0b00011111, 0b00000011 |
| 822 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x02}, // 0b00010011, 0b00000010 |
| 823 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x02}, // 0b00010011, 0b00000010 |
| 824 | }, |
| 825 | { |
| 826 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x9F, 0x01}, // 0b10011111, 0b00000001 |
| 827 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x93, 0x01}, // 0b10010011, 0b00000001 |
| 828 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x93, 0x01}, // 0b10010011, 0b00000001 |
| 829 | }, |
| 830 | { |
| 831 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x02}, // 0b11111111, 0x00000010 |
| 832 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x03}, // 0b00010011, 0x00000011 |
| 833 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x02}, // 0b00010011, 0x00000010 |
| 834 | }, |
| 835 | { |
| 836 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x87}, // 0b11111111, 0x10000111 |
| 837 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x8F}, // 0b00010011, 0x10001111 |
| 838 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x87}, // 0b00010011, 0x10000111 |
| 839 | }, |
| 840 | } |
| 841 | |
| 842 | for _, tt := range tests { |
| 843 | if got, err := tt.a.Andscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#And().(tt.b); !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(got, tt.want) || err != nil { |
| 844 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 845 | "(%x).And(%x) = %x, %v, wanted %x", |
| 846 | tt.a, |
| 847 | tt.b, |
| 848 | got, |
| 849 | err, |
| 850 | tt.want, |
| 851 | ) |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | func TestBitlist_Xorscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_Xor().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 857 | tests := []struct { |
| 858 | a Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 859 | b Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 860 | want Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 861 | }{ |
| 862 | { |
| 863 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 864 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 865 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 866 | }, |
| 867 | { |
| 868 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 869 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 870 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 871 | }, |
| 872 | { |
| 873 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 874 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x15}, // 0b00010101 |
| 875 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x16}, // 0b00010110 |
| 876 | }, |
| 877 | { |
| 878 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 879 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 880 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1c}, // 0b00011100 |
| 881 | }, |
| 882 | { |
| 883 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x03}, // 0b00011111, 0b00000011 |
| 884 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x02}, // 0b00010011, 0b00000010 |
| 885 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0c, 0x03}, // 0b00001100, 0b00000011 |
| 886 | }, |
| 887 | { |
| 888 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x9F, 0x01}, // 0b10011111, 0b00000001 |
| 889 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x93, 0x01}, // 0b10010011, 0b00000001 |
| 890 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x0c, 0x01}, // 0b00001100, 0b00000001 |
| 891 | }, |
| 892 | { |
| 893 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x02}, // 0b11111111, 0x00000010 |
| 894 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x03}, // 0b00010011, 0x00000011 |
| 895 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xec, 0x03}, // 0b11101100, 0x00000011 |
| 896 | }, |
| 897 | { |
| 898 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x87}, // 0b11111111, 0x10000111 |
| 899 | b: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13, 0x8F}, // 0b00010011, 0x10001111 |
| 900 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xec, 0x88}, // 0b11101100, 0x10001000 |
| 901 | }, |
| 902 | } |
| 903 | |
| 904 | for _, tt := range tests { |
| 905 | t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("(%x).Xor(%x)", tt.a, tt.b), func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 906 | if got, err := tt.a.Xorscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Xor().(tt.b); !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(got, tt.want) || err != nil { |
| 907 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 908 | "(%x).Xor(%x) = %x, %v, wanted %x", |
| 909 | tt.a, |
| 910 | tt.b, |
| 911 | got, |
| 912 | err, |
| 913 | tt.want, |
| 914 | ) |
| 915 | } |
| 916 | }) |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | func TestBitlist_Notscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_Not().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 921 | tests := []struct { |
| 922 | a Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 923 | want Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 924 | }{ |
| 925 | { |
| 926 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, // 0b00000001 |
| 927 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x01}, // 0b00000001 |
| 928 | }, |
| 929 | { |
| 930 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 931 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 932 | }, |
| 933 | { |
| 934 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x03}, // 0b00000011 |
| 935 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x02}, // 0b00000010 |
| 936 | }, |
| 937 | { |
| 938 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x05}, // 0b00000101 |
| 939 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x06}, // 0b00000110 |
| 940 | }, |
| 941 | { |
| 942 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x06}, // 0b00000110 |
| 943 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x05}, // 0b00000101 |
| 944 | }, |
| 945 | { |
| 946 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x83}, // 0b10000011 |
| 947 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xfc}, // 0b11111100 |
| 948 | }, |
| 949 | { |
| 950 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x13}, // 0b00010011 |
| 951 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1c}, // 0b00011100 |
| 952 | }, |
| 953 | { |
| 954 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F}, // 0b00011111 |
| 955 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x10}, // 0b00010000 |
| 956 | }, |
| 957 | { |
| 958 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x1F, 0x03}, // 0b00011111, 0b00000011 |
| 959 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xe0, 0x02}, // 0b11100000, 0b00000010 |
| 960 | }, |
| 961 | { |
| 962 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x9F, 0x01}, // 0b10011111, 0b00000001 |
| 963 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x60, 0x01}, // 0b01100000, 0b00000001 |
| 964 | }, |
| 965 | { |
| 966 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x02}, // 0b11111111, 0x00000010 |
| 967 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x03}, // 0b00000000, 0x00000011 |
| 968 | }, |
| 969 | { |
| 970 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x87}, // 0b11111111, 0x10000111 |
| 971 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0xf8}, // 0b00000000, 0x11111000 |
| 972 | }, |
| 973 | { |
| 974 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0xFF, 0x07}, // 0b11111111, 0x00000111 |
| 975 | want: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0x00, 0x04}, // 0b00000000, 0x00000100 |
| 976 | }, |
| 977 | } |
| 978 | |
| 979 | for _, tt := range tests { |
| 980 | t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("(%#x).Not()", tt.a), func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 981 | if !bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Equalscip-go gomod github.com/golang/go/src go1.21 bytes/Equal().(tt.a.Notscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Not().(), tt.want) { |
| 982 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 983 | "(%x).Not() = %x, wanted %x", |
| 984 | tt.a, |
| 985 | tt.a.Notscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#Not().(), |
| 986 | tt.want, |
| 987 | ) |
| 988 | } |
| 989 | }) |
| 990 | } |
| 991 | } |
| 992 | |
| 993 | func TestBitlist_BitIndicesscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/TestBitlist_BitIndices().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 994 | tests := []struct { |
| 995 | a Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist# |
| 996 | want []int |
| 997 | }{ |
| 998 | { |
| 999 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0b10010}, |
| 1000 | want: []int{1}, |
| 1001 | }, |
| 1002 | { |
| 1003 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0b10000}, |
| 1004 | want: []int{}, |
| 1005 | }, |
| 1006 | { |
| 1007 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0b10, 0b1}, |
| 1008 | want: []int{1}, |
| 1009 | }, |
| 1010 | { |
| 1011 | a: Bitlistscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#{0b11111111, 0b11}, |
| 1012 | want: []int{0, 1, 2, 3, 4, 5, 6, 7, 8}, |
| 1013 | }, |
| 1014 | } |
| 1015 | |
| 1016 | for _, tt := range tests { |
| 1017 | if !reflectscip-go gomod github.com/golang/go/src go1.21 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.21 reflect/DeepEqual().(tt.a.BitIndicesscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#BitIndices().(), tt.want) { |
| 1018 | t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().( |
| 1019 | "(%0.8b).BitIndices() = %x, wanted %x", |
| 1020 | tt.a, |
| 1021 | tt.a.BitIndicesscip-go gomod github.com/OffchainLabs/go-bitfield . `github.com/OffchainLabs/go-bitfield`/Bitlist#BitIndices().(), |
| 1022 | tt.want, |
| 1023 | ) |
| 1024 | } |
| 1025 | } |
| 1026 | } |