Updated utils/map_test.go and utils/decimal_test.go

This commit is contained in:
andronache
2020-11-04 17:14:41 +02:00
committed by Dan Christian Bogos
parent 1bd762ef77
commit eb39a5ffff
2 changed files with 13 additions and 26 deletions

View File

@@ -57,30 +57,18 @@ func TestDecimalFloat64Negative(t *testing.T) {
}
}
/*
func TestDecimalMarshalJSON(t *testing.T) {
expected := []byte("3.27")
func TestDecimalMarshalUnmarshalJSON(t *testing.T) {
a := NewDecimal()
received, err := NewDecimalFromFloat64(3.27).MarshalJSON()
if err != nil {
t.Errorf("Expecting: nil, received: %+v", received)
}
fmt.Println(string(expected))
fmt.Println(string(received))
if !reflect.DeepEqual(expected, received) {
t.Errorf("Expecting: %+v, received: %+v", expected, received)
if err := a.UnmarshalJSON(received); err != nil {
t.Error(err)
}
a.UnmarshalJSON(received)
fmt.Println(a.Float64())
}
func TestDecimalUnmarshalJSON(t *testing.T) {
expected :=
received :=
if !reflect.DeepEqual(expected, received) {
t.Errorf("Expecting: %+v, received: %+v", expected, received)
rcv := a.Float64()
expected := 3.27
if expected != rcv {
t.Errorf("Expecting: %+v, received: %+v", expected, rcv)
}
}
*/

View File

@@ -414,6 +414,8 @@ func TestStringMapIncludes3(t *testing.T) {
func TestStringMapSlice(t *testing.T) {
expected := []string{"test", "test2"}
received := StringMap{"test": true, "test2": true}.Slice()
sort.Strings(received)
sort.Strings(expected)
if !reflect.DeepEqual(expected, received) {
t.Errorf("Expecting: %+v, received: %+v", expected, received)
}
@@ -428,12 +430,10 @@ func TestStringMapClone(t *testing.T) {
}
func TestStringMapString(t *testing.T) {
expected := "test;test2"
received := StringMap{"test": true, "test2": true}.String()
if !reflect.DeepEqual(expected, received) {
t.Errorf("Expecting: %+v, received: %+v", expected, received)
if received != "test;test2" && received != "test2;test" {
t.Errorf("Expecting: test or test2, received: %+v", received)
}
}
func TestStringMapGetOneEmpty(t *testing.T) {
@@ -445,10 +445,9 @@ func TestStringMapGetOneEmpty(t *testing.T) {
}
func TestStringMapGetOneNotEmpty(t *testing.T) {
expected := "test"
received := StringMap{"test": true, "test2": true}.GetOne()
if !reflect.DeepEqual(expected, received) {
t.Errorf("Expecting: %+v, received: %+v", expected, received)
if received != "test" && received != "test2" {
t.Errorf("Expecting: test or test2, received: %+v", received)
}
}