diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-24 20:48:17 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-24 20:48:17 +0100 |
commit | ba10dd571e0b4f7fc1febe5ce24299e571eeb9e7 (patch) | |
tree | 7ac742fbc5091dde684a11184125652e8aaacb57 | |
parent | 13df779257e726c5e89843a36c55397ae4ae9105 (diff) |
fixed minor comments
-rw-r--r-- | instance_test.go | 4 | ||||
-rw-r--r-- | trillian_test.go | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/instance_test.go b/instance_test.go index 51f7a35..6ce31a9 100644 --- a/instance_test.go +++ b/instance_test.go @@ -10,6 +10,10 @@ import ( "github.com/system-transparency/stfe/x509util" ) +var ( + testHashLen = 31 +) + func makeTestLogParameters(t *testing.T, signer crypto.Signer) *LogParameters { anchorList, err := x509util.NewCertificateList(testdata.PemAnchors) if err != nil { diff --git a/trillian_test.go b/trillian_test.go index bbbfff3..c7bdcf1 100644 --- a/trillian_test.go +++ b/trillian_test.go @@ -173,7 +173,7 @@ func TestCheckGetInclusionProofByHash(t *testing.T) { }, { description: "bad response: proof with invalid node hash", - rsp: makeTrillianGetInclusionProofByHashResponse(t, int64(testIndex), [][]byte{make([]byte, 31)}), + rsp: makeTrillianGetInclusionProofByHashResponse(t, int64(testIndex), [][]byte{make([]byte, testHashLen-1)}), wantErr: true, }, { @@ -187,9 +187,6 @@ func TestCheckGetInclusionProofByHash(t *testing.T) { } } -// TODO: fix hardcoded assumed test hash value len of 32? - -// TODO: TestGetConsistencyProof func TestCheckGetConsistencyProof(t *testing.T) { lp := makeTestLogParameters(t, nil) for _, table := range []struct { @@ -214,7 +211,7 @@ func TestCheckGetConsistencyProof(t *testing.T) { }, { description: "bad response: proof with invalid node hash", - rsp: makeTrillianGetConsistencyProofResponse(t, [][]byte{make([]byte, 31)}), + rsp: makeTrillianGetConsistencyProofResponse(t, [][]byte{make([]byte, testHashLen-1)}), wantErr: true, }, { @@ -270,7 +267,7 @@ func TestCheckGetLatestSignedLogRoot(t *testing.T) { }, { description: "bad trillian response: invalid root hash size", - rsp: makeLatestSignedLogRootResponse(t, 0, 0, make([]byte, 31)), + rsp: makeLatestSignedLogRootResponse(t, 0, 0, make([]byte, testHashLen-1)), wantErr: true, }, { |