You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
344 B
Go
27 lines
344 B
Go
4 years ago
|
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)
|
||
|
}
|