OLD | NEW |
1 package model | 1 package model |
2 | 2 |
3 import ( | 3 import ( |
4 "encoding/json" | 4 "encoding/json" |
5 "errors" | 5 "errors" |
6 "math" | 6 "math" |
7 "strings" | 7 "strings" |
8 ) | 8 ) |
9 | 9 |
10 // FullResult represents "full_results.json". | 10 // FullResult represents "full_results.json". |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if ft == nil { | 148 if ft == nil { |
149 return errors.New("model: UnmarshalJSON: nil *FullTest") | 149 return errors.New("model: UnmarshalJSON: nil *FullTest") |
150 } | 150 } |
151 if *ft == nil { | 151 if *ft == nil { |
152 *ft = FullTest{} | 152 *ft = FullTest{} |
153 } | 153 } |
154 return ft.constructTree(m) | 154 return ft.constructTree(m) |
155 } | 155 } |
156 | 156 |
157 // constructTree constructs the tree of Nodes from the supplied map. | 157 // constructTree constructs the tree of Nodes from the supplied map. |
158 // constructTree returns an error if the receiver is nil. | |
159 func (ft *FullTest) constructTree(m map[string]interface{}) error { | 158 func (ft *FullTest) constructTree(m map[string]interface{}) error { |
160 for k, v := range m { | 159 for k, v := range m { |
161 mm, ok := v.(map[string]interface{}) | 160 mm, ok := v.(map[string]interface{}) |
162 if !ok { | 161 if !ok { |
163 continue | 162 continue |
164 } | 163 } |
165 | 164 |
166 if isFullTestLeaf(mm) { | 165 if isFullTestLeaf(mm) { |
167 l, err := makeFullTestLeaf(mm) | 166 l, err := makeFullTestLeaf(mm) |
168 if err != nil { | 167 if err != nil { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 if err := json.Unmarshal(data, &aux); err != nil { | 311 if err := json.Unmarshal(data, &aux); err != nil { |
313 return err | 312 return err |
314 } | 313 } |
315 l.Actual = strings.Split(aux.Actual, " ") | 314 l.Actual = strings.Split(aux.Actual, " ") |
316 l.Expected = strings.Split(aux.Expected, " ") | 315 l.Expected = strings.Split(aux.Expected, " ") |
317 return nil | 316 return nil |
318 } | 317 } |
319 | 318 |
320 // Times represents "times_ms.json". | 319 // Times represents "times_ms.json". |
321 type Times map[string]float64 | 320 type Times map[string]float64 |
OLD | NEW |