Test counter merging.

This commit is contained in:
Tom Wilkie
2015-09-23 09:53:40 +00:00
parent f9815afad3
commit cdf051ffe9

View File

@@ -216,6 +216,30 @@ func TestMergeNodes(t *testing.T) {
}),
},
},
"Counters": {
a: report.Nodes{
"1": report.MakeNode().WithCounters(map[string]int{
"a": 13,
"b": 57,
"c": 89,
}),
},
b: report.Nodes{
"1": report.MakeNode().WithCounters(map[string]int{
"a": 78,
"b": 3,
"d": 47,
}),
},
want: report.Nodes{
"1": report.MakeNode().WithCounters(map[string]int{
"a": 91,
"b": 60,
"c": 89,
"d": 47,
}),
},
},
} {
if have := c.a.Merge(c.b); !reflect.DeepEqual(c.want, have) {
t.Errorf("%s: want\n\t%#v, have\n\t%#v", name, c.want, have)