Skip to content

Commit

Permalink
test: make sure sum always returns sane results
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed May 12, 2020
1 parent a2ce4b5 commit ccdaf55
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,18 @@ func TestTooLargeLength(t *testing.T) {
t.Fatal("bad error", err)
}
}

func TestBasicSum(t *testing.T) {
for code, name := range Codes {
defaultLen, ok := DefaultLengths[code]
if !ok {
defaultLen = 32
}
_, err := Sum([]byte("test"), code, defaultLen)
switch err {
case ErrSumNotSupported, nil:
default:
t.Errorf("unexpected error for %s: %s", name, err)
}
}
}

0 comments on commit ccdaf55

Please sign in to comment.