(t *testing.T)
| 2029 | } |
| 2030 | |
| 2031 | func TestRle16RandomIaddRangeIremoveRange031(t *testing.T) { |
| 2032 | t.Run("runContainer16.iaddRange and iremoveRange should add/remove contents as expected, matching the same operations on the bitmap and array containers and the hashmap pos control", func(t *testing.T) { |
| 2033 | seed := int64(42) |
| 2034 | rand.Seed(seed) |
| 2035 | |
| 2036 | trials := []trial{ |
| 2037 | {n: 101, percentFill: .9, ntrial: 10}, |
| 2038 | } |
| 2039 | |
| 2040 | tester := func(tr trial) { |
| 2041 | for j := 0; j < tr.ntrial; j++ { |
| 2042 | ma := make(map[int]bool) |
| 2043 | |
| 2044 | n := tr.n |
| 2045 | a := []uint16{} |
| 2046 | |
| 2047 | draw := int(float64(n) * tr.percentFill) |
| 2048 | for i := 0; i < draw; i++ { |
| 2049 | r0 := rand.Intn(n) |
| 2050 | a = append(a, uint16(r0)) |
| 2051 | ma[r0] = true |
| 2052 | } |
| 2053 | |
| 2054 | // showArray16(a, "a") |
| 2055 | |
| 2056 | // RunContainer |
| 2057 | rc := newRunContainer16FromVals(false, a...) |
| 2058 | |
| 2059 | // vs bitmapContainer |
| 2060 | bc := newBitmapContainer() |
| 2061 | for _, av := range a { |
| 2062 | bc.iadd(av) |
| 2063 | } |
| 2064 | |
| 2065 | // vs arrayContainer |
| 2066 | ac := newArrayContainer() |
| 2067 | for _, av := range a { |
| 2068 | ac.iadd(av) |
| 2069 | } |
| 2070 | |
| 2071 | // iaddRange and iRemoveRange : pick some distinct random endpoints |
| 2072 | a0 := rand.Intn(n) |
| 2073 | a1 := a0 |
| 2074 | for a1 == a0 { |
| 2075 | a1 = rand.Intn(n) |
| 2076 | } |
| 2077 | if a0 > a1 { |
| 2078 | a0, a1 = a1, a0 |
| 2079 | } |
| 2080 | |
| 2081 | r0 := rand.Intn(n) |
| 2082 | r1 := r0 |
| 2083 | for r1 == r0 { |
| 2084 | r1 = rand.Intn(n) |
| 2085 | } |
| 2086 | if r0 > r1 { |
| 2087 | r0, r1 = r1, r0 |
| 2088 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…