github.com/lingyao2333/mo-zero@v1.4.1/core/stores/cache/util_test.go (about) 1 package cache 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestFormatKeys(t *testing.T) { 10 assert.Equal(t, "a,b", formatKeys([]string{"a", "b"})) 11 } 12 13 func TestTotalWeights(t *testing.T) { 14 val := TotalWeights([]NodeConf{ 15 { 16 Weight: -1, 17 }, 18 { 19 Weight: 0, 20 }, 21 { 22 Weight: 1, 23 }, 24 }) 25 assert.Equal(t, 1, val) 26 }