Skip to content

Commit

Permalink
fix bug: Counters.DeepEqual handling of nil maps
Browse files Browse the repository at this point in the history
a nil psMap was considered unequal to an empty psMap
  • Loading branch information
rade committed May 29, 2017
1 parent bdfba29 commit 6523664
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions report/counters.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,11 @@ func (c Counters) String() string {

// DeepEqual tests equality with other Counters
func (c Counters) DeepEqual(d Counters) bool {
if (c.psMap == nil) != (d.psMap == nil) {
if c.Size() != d.Size() {
return false
} else if c.psMap == nil && d.psMap == nil {
return true
}

if c.psMap.Size() != d.psMap.Size() {
return false
if c.Size() == 0 {
return true
}

equal := true
Expand Down

0 comments on commit 6523664

Please sign in to comment.