diff --git a/validator_test.go b/validator_test.go index 9a71573..aed06a9 100644 --- a/validator_test.go +++ b/validator_test.go @@ -2377,3 +2377,21 @@ func BenchmarkValidateStruct(b *testing.B) { validate.Struct(invalidFoo) } } + +func BenchmarkTemplateParallel(b *testing.B) { + + type Foo struct { + StringValue string `validate:"min=5,max=10"` + IntValue int `validate:"min=5,max=10"` + } + + validFoo := &Foo{StringValue: "Foobar", IntValue: 7} + invalidFoo := &Foo{StringValue: "Fo", IntValue: 3} + + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + validate.Struct(validFoo) + validate.Struct(invalidFoo) + } + }) +}