(t *testing.T)
| 1968 | } |
| 1969 | |
| 1970 | func TestRle16RandomGetShortIterator030(t *testing.T) { |
| 1971 | t.Run("runContainer16.getShortIterator should traverse the contents expected, matching the traversal of the bitmap and array containers", func(t *testing.T) { |
| 1972 | seed := int64(42) |
| 1973 | rand.Seed(seed) |
| 1974 | |
| 1975 | trials := []trial{ |
| 1976 | {n: 100, percentFill: .95, ntrial: 1}, |
| 1977 | } |
| 1978 | |
| 1979 | tester := func(tr trial) { |
| 1980 | for j := 0; j < tr.ntrial; j++ { |
| 1981 | ma := make(map[int]bool) |
| 1982 | |
| 1983 | n := tr.n |
| 1984 | a := []uint16{} |
| 1985 | |
| 1986 | draw := int(float64(n) * tr.percentFill) |
| 1987 | for i := 0; i < draw; i++ { |
| 1988 | r0 := rand.Intn(n) |
| 1989 | a = append(a, uint16(r0)) |
| 1990 | ma[r0] = true |
| 1991 | } |
| 1992 | |
| 1993 | // showArray16(a, "a") |
| 1994 | |
| 1995 | // RunContainer |
| 1996 | rc := newRunContainer16FromVals(false, a...) |
| 1997 | |
| 1998 | // vs bitmapContainer |
| 1999 | bc := newBitmapContainer() |
| 2000 | for _, av := range a { |
| 2001 | bc.iadd(av) |
| 2002 | } |
| 2003 | |
| 2004 | // vs arrayContainer |
| 2005 | ac := newArrayContainer() |
| 2006 | for _, av := range a { |
| 2007 | ac.iadd(av) |
| 2008 | } |
| 2009 | |
| 2010 | rit := rc.getShortIterator() |
| 2011 | ait := ac.getShortIterator() |
| 2012 | bit := bc.getShortIterator() |
| 2013 | |
| 2014 | for ait.hasNext() { |
| 2015 | rn := rit.next() |
| 2016 | an := ait.next() |
| 2017 | bn := bit.next() |
| 2018 | |
| 2019 | assert.Equal(t, an, rn) |
| 2020 | assert.Equal(t, bn, rn) |
| 2021 | } |
| 2022 | } |
| 2023 | } |
| 2024 | |
| 2025 | for i := range trials { |
| 2026 | tester(trials[i]) |
| 2027 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…