add parallel benchmark

pull/59/head
joeybloggs 10 years ago
parent ad39bb92dd
commit 81ce302975
  1. 18
      validator_test.go

@ -2377,3 +2377,21 @@ func BenchmarkValidateStruct(b *testing.B) {
validate.Struct(invalidFoo) 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)
}
})
}

Loading…
Cancel
Save