Skip to content

Commit

Permalink
Add benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Jul 23, 2024
1 parent 6c4b17e commit d8d3815
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions bagit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,29 @@ import (
"gotest.tools/v3/fs"
)

func setUp(t *testing.T) *bagit.BagIt {
t.Helper()
func setUp(tb testing.TB) *bagit.BagIt {
tb.Helper()

b, err := bagit.NewBagIt()
assert.NilError(t, err)
assert.NilError(tb, err)

t.Cleanup(func() {
assert.NilError(t, b.Cleanup())
tb.Cleanup(func() {
assert.NilError(tb, b.Cleanup())
})

return b
}

func BenchmarkValidate(b *testing.B) {
bagit := setUp(b)

b.ResetTimer()

for i := 0; i < b.N; i++ {
_ = bagit.Validate("internal/testdata/valid-bag")
}
}

func TestConcurrency(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit d8d3815

Please sign in to comment.