mirror of
https://github.com/Fishwaldo/validator.git
synced 2025-07-05 20:54:30 +00:00
parent
562e77833a
commit
302c3cffdd
2 changed files with 71 additions and 72 deletions
|
@ -7,7 +7,6 @@ notificaitons:
|
||||||
on_failure: always
|
on_failure: always
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.2
|
|
||||||
- 1.3
|
- 1.3
|
||||||
- 1.4
|
- 1.4
|
||||||
- tip
|
- tip
|
||||||
|
|
|
@ -24,23 +24,23 @@ func BenchmarkValidateStructSimple(b *testing.B) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// func BenchmarkTemplateParallelSimple(b *testing.B) {
|
func BenchmarkTemplateParallelSimple(b *testing.B) {
|
||||||
|
|
||||||
// type Foo struct {
|
type Foo struct {
|
||||||
// StringValue string `validate:"min=5,max=10"`
|
StringValue string `validate:"min=5,max=10"`
|
||||||
// IntValue int `validate:"min=5,max=10"`
|
IntValue int `validate:"min=5,max=10"`
|
||||||
// }
|
}
|
||||||
|
|
||||||
// validFoo := &Foo{StringValue: "Foobar", IntValue: 7}
|
validFoo := &Foo{StringValue: "Foobar", IntValue: 7}
|
||||||
// invalidFoo := &Foo{StringValue: "Fo", IntValue: 3}
|
invalidFoo := &Foo{StringValue: "Fo", IntValue: 3}
|
||||||
|
|
||||||
// b.RunParallel(func(pb *testing.PB) {
|
b.RunParallel(func(pb *testing.PB) {
|
||||||
// for pb.Next() {
|
for pb.Next() {
|
||||||
// validate.Struct(validFoo)
|
validate.Struct(validFoo)
|
||||||
// validate.Struct(invalidFoo)
|
validate.Struct(invalidFoo)
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
|
|
||||||
func BenchmarkValidateStructLarge(b *testing.B) {
|
func BenchmarkValidateStructLarge(b *testing.B) {
|
||||||
|
|
||||||
|
@ -101,63 +101,63 @@ func BenchmarkValidateStructLarge(b *testing.B) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// func BenchmarkTemplateParallelLarge(b *testing.B) {
|
func BenchmarkTemplateParallelLarge(b *testing.B) {
|
||||||
|
|
||||||
// tFail := &TestString{
|
tFail := &TestString{
|
||||||
// Required: "",
|
Required: "",
|
||||||
// Len: "",
|
Len: "",
|
||||||
// Min: "",
|
Min: "",
|
||||||
// Max: "12345678901",
|
Max: "12345678901",
|
||||||
// MinMax: "",
|
MinMax: "",
|
||||||
// Lt: "0123456789",
|
Lt: "0123456789",
|
||||||
// Lte: "01234567890",
|
Lte: "01234567890",
|
||||||
// Gt: "1",
|
Gt: "1",
|
||||||
// Gte: "1",
|
Gte: "1",
|
||||||
// OmitEmpty: "12345678901",
|
OmitEmpty: "12345678901",
|
||||||
// Sub: &SubTest{
|
Sub: &SubTest{
|
||||||
// Test: "",
|
Test: "",
|
||||||
// },
|
},
|
||||||
// Anonymous: struct {
|
Anonymous: struct {
|
||||||
// A string `validate:"required"`
|
A string `validate:"required"`
|
||||||
// }{
|
}{
|
||||||
// A: "",
|
A: "",
|
||||||
// },
|
},
|
||||||
// Iface: &Impl{
|
Iface: &Impl{
|
||||||
// F: "12",
|
F: "12",
|
||||||
// },
|
},
|
||||||
// }
|
}
|
||||||
|
|
||||||
// tSuccess := &TestString{
|
tSuccess := &TestString{
|
||||||
// Required: "Required",
|
Required: "Required",
|
||||||
// Len: "length==10",
|
Len: "length==10",
|
||||||
// Min: "min=1",
|
Min: "min=1",
|
||||||
// Max: "1234567890",
|
Max: "1234567890",
|
||||||
// MinMax: "12345",
|
MinMax: "12345",
|
||||||
// Lt: "012345678",
|
Lt: "012345678",
|
||||||
// Lte: "0123456789",
|
Lte: "0123456789",
|
||||||
// Gt: "01234567890",
|
Gt: "01234567890",
|
||||||
// Gte: "0123456789",
|
Gte: "0123456789",
|
||||||
// OmitEmpty: "",
|
OmitEmpty: "",
|
||||||
// Sub: &SubTest{
|
Sub: &SubTest{
|
||||||
// Test: "1",
|
Test: "1",
|
||||||
// },
|
},
|
||||||
// SubIgnore: &SubTest{
|
SubIgnore: &SubTest{
|
||||||
// Test: "",
|
Test: "",
|
||||||
// },
|
},
|
||||||
// Anonymous: struct {
|
Anonymous: struct {
|
||||||
// A string `validate:"required"`
|
A string `validate:"required"`
|
||||||
// }{
|
}{
|
||||||
// A: "1",
|
A: "1",
|
||||||
// },
|
},
|
||||||
// Iface: &Impl{
|
Iface: &Impl{
|
||||||
// F: "123",
|
F: "123",
|
||||||
// },
|
},
|
||||||
// }
|
}
|
||||||
|
|
||||||
// b.RunParallel(func(pb *testing.PB) {
|
b.RunParallel(func(pb *testing.PB) {
|
||||||
// for pb.Next() {
|
for pb.Next() {
|
||||||
// validate.Struct(tSuccess)
|
validate.Struct(tSuccess)
|
||||||
// validate.Struct(tFail)
|
validate.Struct(tFail)
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue