diff options
author | holisticode <holistic.computing@gmail.com> | 2019-02-07 20:51:24 +0800 |
---|---|---|
committer | Rafael Matias <rafael@skyle.net> | 2019-02-19 19:57:53 +0800 |
commit | 1ecf2860cff6e4da75abbd1e6b30a9b1d69c5a12 (patch) | |
tree | 5c5aa2511ae0962ab1e6255471c87a48380794e6 /swarm/storage/filestore_test.go | |
parent | 034f65e9e8976f3ca7d9622e4c362ad9c26ad5f7 (diff) | |
download | go-tangerine-1ecf2860cff6e4da75abbd1e6b30a9b1d69c5a12.tar go-tangerine-1ecf2860cff6e4da75abbd1e6b30a9b1d69c5a12.tar.gz go-tangerine-1ecf2860cff6e4da75abbd1e6b30a9b1d69c5a12.tar.bz2 go-tangerine-1ecf2860cff6e4da75abbd1e6b30a9b1d69c5a12.tar.lz go-tangerine-1ecf2860cff6e4da75abbd1e6b30a9b1d69c5a12.tar.xz go-tangerine-1ecf2860cff6e4da75abbd1e6b30a9b1d69c5a12.tar.zst go-tangerine-1ecf2860cff6e4da75abbd1e6b30a9b1d69c5a12.zip |
cmd/swarm: hashes command (#19008)
(cherry picked from commit 7f55b0cbd8618a1b0de8d7e37d2b0143ebae4abf)
Diffstat (limited to 'swarm/storage/filestore_test.go')
-rw-r--r-- | swarm/storage/filestore_test.go | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/swarm/storage/filestore_test.go b/swarm/storage/filestore_test.go index 2dbccdf11..06c4be1d7 100644 --- a/swarm/storage/filestore_test.go +++ b/swarm/storage/filestore_test.go @@ -190,22 +190,18 @@ func TestGetAllReferences(t *testing.T) { } fileStore := NewFileStore(localStore, NewFileStoreParams()) - checkRefs := func(dataSize int, expectedLen int) { - slice := testutil.RandomBytes(1, dataSize) + // testRuns[i] and expectedLen[i] are dataSize and expected length respectively + testRuns := []int{1024, 8192, 16000, 30000, 1000000} + expectedLens := []int{1, 3, 5, 9, 248} + for i, r := range testRuns { + slice := testutil.RandomBytes(1, r) addrs, err := fileStore.GetAllReferences(context.Background(), bytes.NewReader(slice), false) if err != nil { t.Fatal(err) } - if len(addrs) != expectedLen { - t.Fatalf("Expected reference array length to be %d, but is %d", expectedLen, len(addrs)) + if len(addrs) != expectedLens[i] { + t.Fatalf("Expected reference array length to be %d, but is %d", expectedLens[i], len(addrs)) } } - - // testRuns[i] and expectedLen[i] are dataSize and expected length respectively - testRuns := []int{1024, 8192, 16000, 30000, 1000000} - expectedLens := []int{1, 3, 5, 9, 248} - for i, r := range testRuns { - checkRefs(r, expectedLens[i]) - } } |