MCPcopy
hub / github.com/gin-gonic/gin / BenchmarkMapFormFull

Function BenchmarkMapFormFull

binding/form_mapping_benchmark_test.go:32–49  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

30}
31
32func BenchmarkMapFormFull(b *testing.B) {
33 var s structFull
34 for b.Loop() {
35 err := mapForm(&s, form)
36 if err != nil {
37 b.Fatalf("Error on a form mapping")
38 }
39 }
40 b.StopTimer()
41
42 t := b
43 assert.Equal(t, "mike", s.Name)
44 assert.Equal(t, 25, s.Age)
45 assert.Equal(t, []string{"anna", "nicole"}, s.Friends)
46 assert.Equal(t, "12345678", s.ID.Number)
47 assert.Equal(t, time.Date(2018, 1, 20, 0, 0, 0, 0, time.UTC), s.ID.DateOfIssue)
48 assert.Nil(t, s.Nationality)
49}
50
51type structName struct {
52 Name string `form:"name"`

Callers

nothing calls this directly

Calls 1

mapFormFunction · 0.85

Tested by

no test coverage detected