(t *testing.T)
| 1350 | } |
| 1351 | |
| 1352 | func TestRle16RandomInplaceAndNot017(t *testing.T) { |
| 1353 | t.Run("runContainer16 `iandNot` operation against other container types should correctly do the inplace-and-not operation", func(t *testing.T) { |
| 1354 | seed := int64(42) |
| 1355 | rand.Seed(seed) |
| 1356 | |
| 1357 | trials := []trial{ |
| 1358 | {n: 1000, percentFill: .95, ntrial: 2}, |
| 1359 | } |
| 1360 | |
| 1361 | tester := func(tr trial) { |
| 1362 | for j := 0; j < tr.ntrial; j++ { |
| 1363 | ma := make(map[int]bool) |
| 1364 | mb := make(map[int]bool) |
| 1365 | |
| 1366 | n := tr.n |
| 1367 | a := []uint16{} |
| 1368 | b := []uint16{} |
| 1369 | |
| 1370 | draw := int(float64(n) * tr.percentFill) |
| 1371 | for i := 0; i < draw; i++ { |
| 1372 | r0 := rand.Intn(n) |
| 1373 | a = append(a, uint16(r0)) |
| 1374 | ma[r0] = true |
| 1375 | |
| 1376 | r1 := rand.Intn(n) |
| 1377 | b = append(b, uint16(r1)) |
| 1378 | mb[r1] = true |
| 1379 | } |
| 1380 | |
| 1381 | // showArray16(a, "a") |
| 1382 | // showArray16(b, "b") |
| 1383 | |
| 1384 | // hash version of and-not |
| 1385 | hashi := make(map[int]bool) |
| 1386 | for k := range ma { |
| 1387 | hashi[k] = true |
| 1388 | } |
| 1389 | for k := range mb { |
| 1390 | delete(hashi, k) |
| 1391 | } |
| 1392 | |
| 1393 | // RunContainer's and-not |
| 1394 | rc := newRunContainer16FromVals(false, a...) |
| 1395 | |
| 1396 | // vs bitmapContainer |
| 1397 | bc := newBitmapContainer() |
| 1398 | for _, bv := range b { |
| 1399 | bc.iadd(bv) |
| 1400 | } |
| 1401 | |
| 1402 | // vs arrayContainer |
| 1403 | ac := newArrayContainer() |
| 1404 | for _, bv := range b { |
| 1405 | ac.iadd(bv) |
| 1406 | } |
| 1407 | |
| 1408 | // vs runContainer |
| 1409 | rcb := newRunContainer16FromVals(false, b...) |
nothing calls this directly
no test coverage detected
searching dependent graphs…