Skip to content

Commit

Permalink
ethdb/dbtest: replace reflect.DeepEqual with slices.Equal (#29382)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuiweixie authored Mar 28, 2024
1 parent 767b00b commit 7aba651
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions ethdb/dbtest/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package dbtest
import (
"bytes"
"crypto/rand"
"reflect"
"slices"
"sort"
"testing"
Expand Down Expand Up @@ -149,7 +148,7 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {
if err := it.Error(); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(got, want) {
if !slices.Equal(got, want) {
t.Errorf("Iterator: got: %s; want: %s", got, want)
}
}
Expand All @@ -160,7 +159,7 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {
if err := it.Error(); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(got, want) {
if !slices.Equal(got, want) {
t.Errorf("IteratorWith(1,nil): got: %s; want: %s", got, want)
}
}
Expand All @@ -171,7 +170,7 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {
if err := it.Error(); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(got, want) {
if !slices.Equal(got, want) {
t.Errorf("IteratorWith(5,nil): got: %s; want: %s", got, want)
}
}
Expand All @@ -182,7 +181,7 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {
if err := it.Error(); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(got, want) {
if !slices.Equal(got, want) {
t.Errorf("IteratorWith(nil,2): got: %s; want: %s", got, want)
}
}
Expand All @@ -193,7 +192,7 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {
if err := it.Error(); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(got, want) {
if !slices.Equal(got, want) {
t.Errorf("IteratorWith(nil,5): got: %s; want: %s", got, want)
}
}
Expand Down Expand Up @@ -262,7 +261,7 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {

{
it := db.NewIterator(nil, nil)
if got, want := iterateKeys(it), []string{"1", "2", "3", "4"}; !reflect.DeepEqual(got, want) {
if got, want := iterateKeys(it), []string{"1", "2", "3", "4"}; !slices.Equal(got, want) {
t.Errorf("got: %s; want: %s", got, want)
}
}
Expand All @@ -286,7 +285,7 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {

{
it := db.NewIterator(nil, nil)
if got, want := iterateKeys(it), []string{"2", "3", "4", "5", "6"}; !reflect.DeepEqual(got, want) {
if got, want := iterateKeys(it), []string{"2", "3", "4", "5", "6"}; !slices.Equal(got, want) {
t.Errorf("got: %s; want: %s", got, want)
}
}
Expand Down Expand Up @@ -314,7 +313,7 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {
}

it := db.NewIterator(nil, nil)
if got := iterateKeys(it); !reflect.DeepEqual(got, want) {
if got := iterateKeys(it); !slices.Equal(got, want) {
t.Errorf("got: %s; want: %s", got, want)
}
})
Expand Down

0 comments on commit 7aba651

Please sign in to comment.