MCPcopy
hub / github.com/labstack/echo / BenchmarkValueBinder_BindInt64_10_fields

Function BenchmarkValueBinder_BindInt64_10_fields

binder_test.go:2995–3031  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

2993}
2994
2995func BenchmarkValueBinder_BindInt64_10_fields(b *testing.B) {
2996 type Opts struct {
2997 String string `query:"string"`
2998 Strings []string `query:"strings"`
2999 Int64 int64 `query:"int64"`
3000 Uint64 uint64 `query:"uint64"`
3001 Int32 int32 `query:"int32"`
3002 Uint32 uint32 `query:"uint32"`
3003 Int16 int16 `query:"int16"`
3004 Uint16 uint16 `query:"uint16"`
3005 Int8 int8 `query:"int8"`
3006 Uint8 uint8 `query:"uint8"`
3007 }
3008 c := createTestContext("/search?int64=1&int32=2&int16=3&int8=4&string=test&uint64=5&uint32=6&uint16=7&uint8=8&strings=first&strings=second", nil, nil)
3009
3010 b.ReportAllocs()
3011 b.ResetTimer()
3012 binder := QueryParamsBinder(c)
3013 for i := 0; i < b.N; i++ {
3014 var dest Opts
3015 _ = binder.
3016 Int64("int64", &dest.Int64).
3017 Int32("int32", &dest.Int32).
3018 Int16("int16", &dest.Int16).
3019 Int8("int8", &dest.Int8).
3020 String("string", &dest.String).
3021 Uint64("int64", &dest.Uint64).
3022 Uint32("int32", &dest.Uint32).
3023 Uint16("int16", &dest.Uint16).
3024 Uint8("int8", &dest.Uint8).
3025 Strings("strings", &dest.Strings).
3026 BindError()
3027 if dest.Int64 != 1 {
3028 b.Fatalf("int64!=1")
3029 }
3030 }
3031}
3032
3033func TestValueBinder_TimeError(t *testing.T) {
3034 var testCases = []struct {

Callers

nothing calls this directly

Calls 13

createTestContextFunction · 0.85
QueryParamsBinderFunction · 0.85
BindErrorMethod · 0.80
StringsMethod · 0.80
Uint8Method · 0.80
Uint16Method · 0.80
Uint32Method · 0.80
Uint64Method · 0.80
Int8Method · 0.80
Int16Method · 0.80
Int32Method · 0.80
Int64Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…