github.com/grailbio/base@v0.0.11/recordio/recordioutil/suffix_test.go (about) 1 // Copyright 2017 GRAIL, Inc. All rights reserved. 2 // Use of this source code is governed by the Apache-2.0 3 // license that can be found in the LICENSE file. 4 5 package recordioutil_test 6 7 import ( 8 "testing" 9 10 "github.com/grailbio/base/recordio/recordioutil" 11 "github.com/klauspost/compress/flate" 12 ) 13 14 func TestSuffix(t *testing.T) { 15 wropts := func(compress bool) recordioutil.WriterOpts { 16 opts := recordioutil.WriterOpts{} 17 if compress { 18 opts.FlateLevel = flate.BestCompression 19 } 20 return opts 21 } 22 23 for i, tc := range []struct { 24 opts recordioutil.WriterOpts 25 suffix string 26 }{ 27 {wropts(false), ".grail-rpk"}, 28 {wropts(true), ".grail-rpk-gz"}, 29 } { 30 if got, want := recordioutil.SuffixFromWriterOpts(tc.opts), tc.suffix; got != want { 31 t.Errorf("%v: got %v, want %v", i, got, want) 32 } 33 } 34 }