summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVuong <3168632+vuon9@users.noreply.github.com>2022-01-30 12:21:44 +0700
committerVuong <3168632+vuon9@users.noreply.github.com>2022-01-30 12:21:44 +0700
commit4039bc1b0858c033700e67364657c1f3fa110401 (patch)
tree35a56a71c117bf680734bfeaa3166d098b1abe63
parentf0b936db9d1deaf96e7a0dfe52ea57afa44b3294 (diff)
Improve test for readable purpose
-rw-r--r--cointop/util_test.go86
1 files changed, 43 insertions, 43 deletions
diff --git a/cointop/util_test.go b/cointop/util_test.go
index 449940f..9809640 100644
--- a/cointop/util_test.go
+++ b/cointop/util_test.go
@@ -3,35 +3,6 @@ package cointop
import "testing"
func Test_getStructHash(t *testing.T) {
- type SCoin struct {
- Name string
- Properties struct {
- P7D int
- P10D int
- }
- }
- type SCoin1 struct {
- Name string
- Properties struct {
- P7D int
- P10D int
- }
- }
- type SCoin2 struct {
- Name interface{}
- Properties struct {
- P7D int
- P10D int
- }
- }
- type SCoin3 struct {
- Name string
- Age int
- Properties *struct {
- P7D int
- P10D int
- }
- }
type args struct {
str1 interface{}
str2 interface{}
@@ -45,32 +16,61 @@ func Test_getStructHash(t *testing.T) {
{
name: "the same structs",
args: args{
- str1: SCoin{},
- str2: SCoin{},
- },
- want: true,
- },
- {
- name: "different structs but have similar fields",
- args: args{
- str1: SCoin{},
- str2: SCoin1{},
+ str1: struct {
+ Name string
+ Properties struct {
+ P7D int
+ P10D int
+ }
+ }{},
+ str2: struct {
+ Name string
+ Properties struct {
+ P7D int
+ P10D int
+ }
+ }{},
},
want: true,
},
{
name: "different structs but have similar fields and different field type",
args: args{
- str1: SCoin{},
- str2: SCoin2{},
+ str1: struct {
+ Name string
+ Properties struct {
+ P7D int
+ P10D int
+ }
+ }{},
+ str2: struct {
+ Name rune
+ Properties struct {
+ P7D int
+ P10D int
+ }
+ }{},
},
want: false,
},
{
name: "different structs and different fields",
args: args{
- str1: SCoin{},
- str2: SCoin3{},
+ str1: struct {
+ Name string
+ Properties struct {
+ P7D int
+ P10D int
+ }
+ }{},
+ str2: struct {
+ Name string
+ Age int
+ Properties struct {
+ P7D int
+ P10D int
+ }
+ }{},
},
want: false,
},