(t *testing.T, i, repeat int)
| 2035 | } |
| 2036 | |
| 2037 | func testFile(t *testing.T, i, repeat int) { |
| 2038 | if err := downloadBenchmarkFiles(t, testFiles[i].filename); err != nil { |
| 2039 | t.Skipf("failed to download testdata: %s", err) |
| 2040 | } |
| 2041 | |
| 2042 | if testing.Short() { |
| 2043 | repeat = 0 |
| 2044 | } |
| 2045 | t.Run(fmt.Sprint(i, "-", testFiles[i].label), func(t *testing.T) { |
| 2046 | bDir := filepath.FromSlash(*benchdataDir) |
| 2047 | data := readFile(t, filepath.Join(bDir, testFiles[i].filename)) |
| 2048 | if testing.Short() && len(data) > 10000 { |
| 2049 | t.SkipNow() |
| 2050 | } |
| 2051 | oSize := len(data) |
| 2052 | for i := 0; i < repeat; i++ { |
| 2053 | data = append(data, data[:oSize]...) |
| 2054 | } |
| 2055 | t.Run("s2", func(t *testing.T) { |
| 2056 | testWriterRoundtrip(t, data) |
| 2057 | }) |
| 2058 | t.Run("s2-better", func(t *testing.T) { |
| 2059 | testWriterRoundtrip(t, data, WriterBetterCompression()) |
| 2060 | }) |
| 2061 | t.Run("s2-best", func(t *testing.T) { |
| 2062 | testWriterRoundtrip(t, data, WriterBestCompression()) |
| 2063 | }) |
| 2064 | t.Run("s2-uncompressed", func(t *testing.T) { |
| 2065 | testWriterRoundtrip(t, data, WriterUncompressed()) |
| 2066 | }) |
| 2067 | t.Run("block", func(t *testing.T) { |
| 2068 | d := data |
| 2069 | testBlockRoundtrip(t, d) |
| 2070 | }) |
| 2071 | t.Run("block-better", func(t *testing.T) { |
| 2072 | d := data |
| 2073 | testBetterBlockRoundtrip(t, d) |
| 2074 | }) |
| 2075 | t.Run("block-best", func(t *testing.T) { |
| 2076 | d := data |
| 2077 | testBestBlockRoundtrip(t, d) |
| 2078 | }) |
| 2079 | t.Run("s2-snappy", func(t *testing.T) { |
| 2080 | d := data |
| 2081 | testSnappyBlockRoundtrip(t, d) |
| 2082 | }) |
| 2083 | t.Run("snappy", func(t *testing.T) { |
| 2084 | testSnappyDecode(t, data) |
| 2085 | }) |
| 2086 | }) |
| 2087 | } |
| 2088 | |
| 2089 | func TestDataRoundtrips(t *testing.T) { |
| 2090 | test := func(t *testing.T, data []byte) { |
no test coverage detected
searching dependent graphs…