forked from google-deepmind/objecthash-proto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctional_test.go
48 lines (42 loc) · 2.29 KB
/
functional_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
39
40
41
42
43
44
45
46
47
48
// Copyright 2017 The ObjectHash-Proto Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package protohash
import (
"testing"
oi "github.com/deepmind/objecthash-proto/internal"
"github.com/deepmind/objecthash-proto/tests"
wkt "github.com/deepmind/objecthash-proto/tests/well_known_types"
)
func TestFunctional(t *testing.T) {
protoHashers := oi.ProtoHashers{
DefaultHasher: NewHasher(),
FieldNamesAsKeysHasher: NewHasher(FieldNamesAsKeys()),
EnumsAsStringsHasher: NewHasher(EnumsAsStrings()),
StringPreferringHasher: NewHasher(FieldNamesAsKeys(), EnumsAsStrings()),
CustomMessageIdentifierHasher: NewHasher(MessageIdentifier(`m`)),
}
t.Run("TestBadness", func(t *testing.T) { tests.TestBadness(t, protoHashers) })
t.Run("TestEmptyFields", func(t *testing.T) { tests.TestEmptyFields(t, protoHashers) })
t.Run("TestFloatFields", func(t *testing.T) { tests.TestFloatFields(t, protoHashers) })
t.Run("TestIntegerFields", func(t *testing.T) { tests.TestIntegerFields(t, protoHashers) })
t.Run("TestMaps", func(t *testing.T) { tests.TestMaps(t, protoHashers) })
t.Run("TestOneOfFields", func(t *testing.T) { tests.TestOneOfFields(t, protoHashers) })
t.Run("TestOtherTypes", func(t *testing.T) { tests.TestOtherTypes(t, protoHashers) })
t.Run("TestProto2DefaultFieldValues", func(t *testing.T) { tests.TestProto2DefaultFieldValues(t, protoHashers) })
t.Run("TestRepeatedFields", func(t *testing.T) { tests.TestRepeatedFields(t, protoHashers) })
t.Run("TestStringFields", func(t *testing.T) { tests.TestStringFields(t, protoHashers) })
// Well-known types.
t.Run("TestTimestamps", func(t *testing.T) { wkt.TestTimestamps(t, protoHashers) })
t.Run("TestUnsupportedWellKnownTypes", func(t *testing.T) { wkt.TestUnsupportedWellKnownTypes(t, protoHashers) })
}