-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d4bc60
commit 0f9d4fe
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} |