Skip to content

Commit

Permalink
fix:use simple loop instead of reflect.DeepEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
RedemptionC committed Sep 5, 2021
1 parent d599180 commit 0c08e97
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core/timetrace_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package core

import (
"reflect"
"testing"
"time"
)
Expand All @@ -18,7 +17,18 @@ func newTestRecTracked(s int) Record {
}

func checkConsistent(t *testing.T, expect, result []*Record) {
if !reflect.DeepEqual(result, expect) {
sameLen := len(result) == len(expect)
sameContent := true

if sameLen {
for i := range result {
if expect[i] != result[i] {
sameContent = false
}
}
}

if !(sameLen && sameContent) {
t.Errorf("should collide with :\n")
for _, r := range expect {
t.Errorf("%v\n", r)
Expand All @@ -28,6 +38,7 @@ func checkConsistent(t *testing.T, expect, result []*Record) {
t.Errorf("%v\n", r)
}
}

}

func TestCollides(t *testing.T) {
Expand Down

0 comments on commit 0c08e97

Please sign in to comment.