-
Notifications
You must be signed in to change notification settings - Fork 14
/
hash_test.go
38 lines (32 loc) · 867 Bytes
/
hash_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package common_test
import (
"testing"
"github.com/peterldowns/testy/assert"
"github.com/peterldowns/pgtestdb/migrators/common"
)
func TestRecursiveHash(t *testing.T) {
t.Parallel()
hash1 := common.NewRecursiveHash()
hash2 := common.NewRecursiveHash()
assert.Equal(t, hash1.String(), hash2.String())
}
func TestRecursivityOfAdd(t *testing.T) {
t.Parallel()
hash1 := common.NewRecursiveHash()
hash1.Add([]byte("helloworld"))
hash2 := common.NewRecursiveHash()
hash2.Add([]byte("hello"))
hash2.Add([]byte("world"))
assert.NotEqual(t, hash1.String(), hash2.String())
}
func TestRecursivityOfFields(t *testing.T) {
t.Parallel()
hash1 := common.NewRecursiveHash(
common.Field("hello", "world"),
)
hash2 := common.NewRecursiveHash(
common.Field("hell", "o"),
common.Field("worl", "d"),
)
assert.NotEqual(t, hash1.String(), hash2.String())
}