Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Add benchmark for ParseSigned
Browse files Browse the repository at this point in the history
Cherry-picked from #279
  • Loading branch information
pquerna authored and mbyczkowski committed Mar 8, 2020
1 parent 8ec79fd commit 9f8649a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions signing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,3 +583,13 @@ func TestSignerB64(t *testing.T) {
t.Errorf("Input/output do not match, got '%s', expected '%s'", output, input)
}
}

func BenchmarkParseSigned(b *testing.B) {
msg := `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c`
for i := 0; i < b.N; i++ {
_, err := ParseSigned(msg)
if err != nil {
b.Errorf("Error on parse: %s", err)
}
}
}

0 comments on commit 9f8649a

Please sign in to comment.