mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-02-03 08:48:40 +08:00
add more tests
This commit is contained in:
parent
e37858295a
commit
096fe3bc47
26
core/stores/cache/util_test.go
vendored
Normal file
26
core/stores/cache/util_test.go
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package cache
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestFormatKeys(t *testing.T) {
|
||||||
|
assert.Equal(t, "a,b", formatKeys([]string{"a", "b"}))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTotalWeights(t *testing.T) {
|
||||||
|
val := TotalWeights([]NodeConf{
|
||||||
|
{
|
||||||
|
Weight: -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Weight: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Weight: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
assert.Equal(t, 1, val)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user