kubo/blocks/blockstore/caching_test.go
Jakub Sztandera 7febd606d4
test: fixup style and add more checks to blockstore tests
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-08-16 18:59:36 +02:00

36 lines
848 B
Go

package blockstore
import "testing"
func TestCachingOptsLessThanZero(t *testing.T) {
opts := DefaultCacheOpts()
opts.HasARCCacheSize = -1
if _, err := CachedBlockstore(nil, nil, opts); err == nil {
t.Error("wrong ARC setting was not detected")
}
opts = DefaultCacheOpts()
opts.HasBloomFilterSize = -1
if _, err := CachedBlockstore(nil, nil, opts); err == nil {
t.Error("negative bloom size was not detected")
}
opts = DefaultCacheOpts()
opts.HasBloomFilterHashes = -1
if _, err := CachedBlockstore(nil, nil, opts); err == nil {
t.Error("negative hashes setting was not detected")
}
}
func TestBloomHashesAtZero(t *testing.T) {
opts := DefaultCacheOpts()
opts.HasBloomFilterHashes = 0
if _, err := CachedBlockstore(nil, nil, opts); err == nil {
t.Error("zero hashes setting with positive size was not detected")
}
}