Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xujihui1985 committed Aug 15, 2018
1 parent 9d4bc60 commit 0f9d4fe
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
12 changes: 12 additions & 0 deletions reflect/deepequal/deepequal.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package deepequal

type bar struct {
value string
}

type foo struct {
name string
value int32
arr []string
mp map[string]bar
}
35 changes: 35 additions & 0 deletions reflect/deepequal/deepequal_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package deepequal

import (
"reflect"
"testing"

"github.com/stretchr/testify/assert"
)

func Test_DeepEqual(t *testing.T) {
f1 := foo{
value: 22,
name: "sean",
arr: []string{"a", "b"},
mp: map[string]bar{
"hello": bar{
value: "world",
},
},
}

f2 := foo{
name: "sean",
value: 22,
arr: []string{"a", "b"},
mp: map[string]bar{
"hello": bar{
value: "world",
},
},
}

res := reflect.DeepEqual(f1, f2)
assert.Equal(t, res, true, "f1 should eq to f2")
}

0 comments on commit 0f9d4fe

Please sign in to comment.