internal

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestCase

type TestCase struct {
	// Protos is a list of protobuf messages that should have the same objecthash.
	Protos []proto.Message

	// EquivalentObject is a plain Go object that should have the same objecthash
	// as the messages under the `protos` field.
	EquivalentObject interface{}

	// EquivalentJSONString is a JSON object that should have the same objecthash
	// as the messages under the `protos` field.
	EquivalentJSONString string

	// ExpectedHashString is the expected objecthash for all the objects in the
	// test case.
	ExpectedHashString string
}

TestCase represents typical ObjectHash-Proto test cases.

func (TestCase) Check

func (tc TestCase) Check(t *testing.T, hasher *ph.ProtoHasher)

Check tests the ObjectHashes for the protos in a TestCase's Protos field.

It does the following checks: - The ObjectHashes of the protos (stringified) are equal to the ExpectedHashString. - The ObjectHashes of the protos are equal to the ObjectHash of the EquivalentJSONString, if present. - The ObjectHashes of the protos are equal to the ObjectHash of the EquivalentObject, if present.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL