ccache/configuration_test.go
Sargun Dhillon df91803297 Add TrackingSet method
This method reduces the likelihood of a race condition where
you can add a (tracked) item to the cache, and the item isn't
the item you thought it was.
2020-08-13 10:43:38 -07:00

25 lines
449 B
Go

package ccache
import (
"testing"
. "github.com/karlseguin/expect"
)
type ConfigurationTests struct{}
func Test_Configuration(t *testing.T) {
Expectify(new(ConfigurationTests), t)
}
func (_ *ConfigurationTests) BucketsPowerOf2() {
for i := uint32(0); i < 31; i++ {
c := Configure().Buckets(i)
if i == 1 || i == 2 || i == 4 || i == 8 || i == 16 {
Expect(c.buckets).ToEqual(int(i))
} else {
Expect(c.buckets).ToEqual(16)
}
}
}