Skip to content

Commit

Permalink
add: bench
Browse files Browse the repository at this point in the history
  • Loading branch information
sshaplygin committed Jan 7, 2024
1 parent 93d6133 commit 83feaec
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bik/bik_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,14 @@ func Test_Exists(t *testing.T) {

assert.True(t, is)
}

func BenchmarkValidateCorrect(b *testing.B) {
for i := 0; i < b.N; i++ {
_, _ = Validate("044525225")
}
}
func BenchmarkGenerate(b *testing.B) {
for i := 0; i < b.N; i++ {
Generate()
}
}
12 changes: 12 additions & 0 deletions inn/inn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,18 @@ func TestGenerate(t *testing.T) {
})
}

func BenchmarkValidateCorrectLegal(b *testing.B) {
for i := 0; i < b.N; i++ {
_, _ = Validate("7707083893")
}
}

func BenchmarkValidateCorrectPhysical(b *testing.B) {
for i := 0; i < b.N; i++ {
_, _ = Validate("526317984689")
}
}

func BenchmarkGenerate(b *testing.B) {
for i := 0; i < b.N; i++ {
Generate()
Expand Down
11 changes: 11 additions & 0 deletions kpp/kpp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,14 @@ func Test_Generate(t *testing.T) {

assert.True(t, isValid)
}

func BenchmarkValidateCorrect(b *testing.B) {
for i := 0; i < b.N; i++ {
_, _ = Validate("775001001")
}
}
func BenchmarkGenerate(b *testing.B) {
for i := 0; i < b.N; i++ {
Generate()
}
}

0 comments on commit 83feaec

Please sign in to comment.