From 096fe3bc4721bb4d83a140ea525ad17e655f2904 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 1 Oct 2020 11:57:06 +0800 Subject: [PATCH] add more tests --- core/stores/cache/util_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 core/stores/cache/util_test.go diff --git a/core/stores/cache/util_test.go b/core/stores/cache/util_test.go new file mode 100644 index 00000000..95e48b62 --- /dev/null +++ b/core/stores/cache/util_test.go @@ -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) +}