Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCutter committed Dec 15, 2023
1 parent a607226 commit f2dc401
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}

0 comments on commit f2dc401

Please sign in to comment.