aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2019-01-16 01:21:18 +0100
committerDimitri Sokolyuk <demon@dim13.org>2019-01-16 01:22:18 +0100
commit3067a6dcc39b57a1315648fc55100646dd9da4fc (patch)
tree01d539067ad9df59be50637ee0f5851f3abea61c
parent02b7a44da8c54fb5a2be89d07e9e82d4ed0e8a7c (diff)
...
-rw-r--r--internal/hash/hash_func_test.go8
-rw-r--r--internal/hash/hash_log2_test.go10
2 files changed, 9 insertions, 9 deletions
diff --git a/internal/hash/hash_func_test.go b/internal/hash/hash_func_test.go
index f2bb0d1..458b306 100644
--- a/internal/hash/hash_func_test.go
+++ b/internal/hash/hash_func_test.go
@@ -5,7 +5,7 @@ import "testing"
func TestDefaultHash(t *testing.T) {
testCases := []struct {
key string
- hash uint32
+ want uint32
}{
{"", 0},
{"A", 65},
@@ -20,9 +20,9 @@ func TestDefaultHash(t *testing.T) {
}
for _, tc := range testCases {
t.Run(tc.key, func(t *testing.T) {
- x := defaultHash([]byte(tc.key))
- if x != tc.hash {
- t.Errorf("got %v, want %v", x, tc.hash)
+ got := defaultHash([]byte(tc.key))
+ if got != tc.want {
+ t.Errorf("got %v, want %v", got, tc.want)
}
})
}
diff --git a/internal/hash/hash_log2_test.go b/internal/hash/hash_log2_test.go
index 869edba..c58e213 100644
--- a/internal/hash/hash_log2_test.go
+++ b/internal/hash/hash_log2_test.go
@@ -7,7 +7,7 @@ import (
func TestLog2(t *testing.T) {
testCases := []struct {
- n, res uint32
+ num, want uint32
}{
{0, 0},
{1, 0},
@@ -21,10 +21,10 @@ func TestLog2(t *testing.T) {
{1024, 10},
}
for _, tc := range testCases {
- t.Run(fmt.Sprintf("log2(%v)=%v", tc.n, tc.res), func(t *testing.T) {
- res := log2(tc.n)
- if res != tc.res {
- t.Errorf("got %v; want %v", res, tc.res)
+ t.Run(fmt.Sprintf("log2(%v)=%v", tc.num, tc.want), func(t *testing.T) {
+ got := log2(tc.num)
+ if got != tc.want {
+ t.Errorf("got %v, want %v", got, tc.want)
}
})
}