(b *testing.B)
| 943 | } |
| 944 | |
| 945 | func BenchmarkTraversalsByName(b *testing.B) { |
| 946 | type A struct { |
| 947 | Value int |
| 948 | } |
| 949 | |
| 950 | type B struct { |
| 951 | A A |
| 952 | } |
| 953 | |
| 954 | type C struct { |
| 955 | B B |
| 956 | } |
| 957 | |
| 958 | type D struct { |
| 959 | C C |
| 960 | } |
| 961 | |
| 962 | m := NewMapper("") |
| 963 | t := reflect.TypeOf(D{}) |
| 964 | names := []string{"C", "B", "A", "Value"} |
| 965 | |
| 966 | b.ResetTimer() |
| 967 | |
| 968 | for i := 0; i < b.N; i++ { |
| 969 | if l := len(m.TraversalsByName(t, names)); l != len(names) { |
| 970 | b.Errorf("expected %d values, got %d", len(names), l) |
| 971 | } |
| 972 | } |
| 973 | } |
| 974 | |
| 975 | func BenchmarkTraversalsByNameFunc(b *testing.B) { |
| 976 | type A struct { |
nothing calls this directly
no test coverage detected