(t *testing.T)
| 276 | } |
| 277 | |
| 278 | func TestSubstr(t *testing.T) { |
| 279 | data := []bool{b0, b1, b0, b1, b0, b1, b1, b0} |
| 280 | |
| 281 | tests := []struct { |
| 282 | start int |
| 283 | end int |
| 284 | expected []bool |
| 285 | }{ |
| 286 | { |
| 287 | 0, |
| 288 | 8, |
| 289 | []bool{b0, b1, b0, b1, b0, b1, b1, b0}, |
| 290 | }, |
| 291 | { |
| 292 | 0, |
| 293 | 0, |
| 294 | []bool{}, |
| 295 | }, |
| 296 | { |
| 297 | 0, |
| 298 | 1, |
| 299 | []bool{b0}, |
| 300 | }, |
| 301 | { |
| 302 | 2, |
| 303 | 4, |
| 304 | []bool{b0, b1}, |
| 305 | }, |
| 306 | } |
| 307 | |
| 308 | for _, test := range tests { |
| 309 | b := New() |
| 310 | b.AppendBools(data...) |
| 311 | |
| 312 | result := b.Substr(test.start, test.end) |
| 313 | |
| 314 | expected := New() |
| 315 | expected.AppendBools(test.expected...) |
| 316 | |
| 317 | if !result.Equals(expected) { |
| 318 | t.Errorf("Got %s, expected %s", result.String(), expected.String()) |
| 319 | } |
| 320 | } |
| 321 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…