From daa0b027ec35ccf2722e1d8a828770668c60e65a Mon Sep 17 00:00:00 2001 From: Al Cutter Date: Thu, 14 Dec 2023 18:22:13 +0000 Subject: [PATCH] Test --- client/client_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/client_test.go b/client/client_test.go index 5499f72..b3625a4 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -48,7 +48,7 @@ func mustMakeVerifier(vs string) note.Verifier { func mustLoadTestCheckpoints() ([][]byte, []log.Checkpoint) { raws, cps := make([][]byte, 0), make([]log.Checkpoint, 0) - for i := 1; ; i++ { + for i := 0; ; i++ { cpName := fmt.Sprintf("checkpoint.%d", i) r, err := testLogFetcher(context.Background(), cpName) if err != nil { @@ -335,3 +335,16 @@ func TestNodeCacheHandlesInvalidRequest(t *testing.T) { t.Error("got no error, want error because ID is out of range") } } + +func TestHandleZeroRoot(t *testing.T) { + zeroCP := testCheckpoints[0] + if zeroCP.Size != 0 { + t.Fatal("BadData: checkpoint has non-zero size") + } + if len(zeroCP.Hash) == 0 { + t.Fatal("BadTestData: checkpoint.0 has empty root hash") + } + if _, err := NewProofBuilder(context.Background(), zeroCP, rfc6962.DefaultHasher.HashChildren, testLogFetcher); err != nil { + t.Fatalf("NewProofBuilder: %v", err) + } +}