From c11006fb89bcac7fdfc2278990b2b1a3a3553ba9 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Tue, 17 Nov 2020 15:34:33 +0100 Subject: added type tests As a result these changes were made: - Simplified a few New* functions - Allowed empty inclusion and consistency proofs, which is in contrast to not being able to marshal them due to `tls:"minlen:1"`. For example, an inclusion proof will be empty for a Merkle tree of size 1. - Disallowed empty signatures and chains in a leaf's Appendix - Removed unnecessary examples --- trillian_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'trillian_test.go') diff --git a/trillian_test.go b/trillian_test.go index 7b26bb9..174fa13 100644 --- a/trillian_test.go +++ b/trillian_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/google/trillian" + "github.com/google/trillian/types" "github.com/system-transparency/stfe/server/testdata" "google.golang.org/grpc/codes" @@ -112,3 +113,13 @@ func makeTrillianGetLeavesByRangeResponse(t *testing.T, start, end int64, name, SignedLogRoot: testdata.NewGetLatestSignedLogRootResponse(t, 0, uint64(end)+1, make([]byte, 32)).SignedLogRoot, } } + +func makeTrillianLogRoot(t *testing.T, timestamp, size uint64, hash []byte) *types.LogRootV1 { + return &types.LogRootV1{ + TreeSize: size, + RootHash: hash, + TimestampNanos: timestamp, + Revision: 0, // not used by stfe + Metadata: nil, // not used by stfe + } +} -- cgit v1.2.3