github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/karlseguin/ccache/configuration_test.go (about)

     1  package ccache
     2  
     3  import (
     4  	. "github.com/karlseguin/expect"
     5  	"testing"
     6  )
     7  
     8  type ConfigurationTests struct{}
     9  
    10  func Test_Configuration(t *testing.T) {
    11  	Expectify(new(ConfigurationTests), t)
    12  }
    13  
    14  func (_ *ConfigurationTests) BucketsPowerOf2() {
    15  	for i := uint32(0); i < 31; i++ {
    16  		c := Configure().Buckets(i)
    17  		if i == 1 || i == 2 || i == 4 || i == 8 || i == 16 {
    18  			Expect(c.buckets).ToEqual(int(i))
    19  		} else {
    20  			Expect(c.buckets).ToEqual(16)
    21  		}
    22  	}
    23  }