From 377bc9467523834112121d10e4406962e98a2e6e Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Mon, 8 Nov 2021 07:59:18 +0700 Subject: [PATCH] save --- compress/compress_test.go | 11 ++++++++++- compress/decompress.go | 1 + recsplit/recsplit_fuzz_test.go | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/compress/compress_test.go b/compress/compress_test.go index ac4a959ba..4e548e1a2 100644 --- a/compress/compress_test.go +++ b/compress/compress_test.go @@ -55,7 +55,7 @@ func TestCompressEmptyDict(t *testing.T) { func TestCompressDict1(t *testing.T) { tmpDir := t.TempDir() - file := path.Join(tmpDir, "compressed") + file := path.Join(tmpDir, t.Name()) t.Name() c, err := NewCompressor(t.Name(), file, tmpDir, 1) if err != nil { @@ -81,7 +81,16 @@ func TestCompressDict1(t *testing.T) { if string(word) != expected { t.Errorf("expected %s, got (hex) %x", expected, word) } + i++ } + g.Reset(0) + word, a := g.Current(nil) + fmt.Printf("a:%d\n", a) + expected := fmt.Sprintf("longlongword %d", 0) + if string(word) != expected { + t.Errorf("expected %s, got (hex) %x", expected, word) + } + defer d.Close() } diff --git a/compress/decompress.go b/compress/decompress.go index 23f65785f..86b6641bd 100644 --- a/compress/decompress.go +++ b/compress/decompress.go @@ -18,6 +18,7 @@ package compress import ( "encoding/binary" + "fmt" "os" "github.com/ledgerwatch/erigon-lib/mmap" diff --git a/recsplit/recsplit_fuzz_test.go b/recsplit/recsplit_fuzz_test.go index 119886337..f79d7e0de 100644 --- a/recsplit/recsplit_fuzz_test.go +++ b/recsplit/recsplit_fuzz_test.go @@ -35,6 +35,10 @@ func FuzzRecSplit(f *testing.F) { if len(in) < count { t.Skip() } + for len(in) < 1_000 { + in = append(in, in...) + } + // split in into count keys dups := make(map[string]struct{}) // Length of one key