diff --git a/utils/decimal_test.go b/utils/decimal_test.go index 8b7df1b14..2877089f4 100644 --- a/utils/decimal_test.go +++ b/utils/decimal_test.go @@ -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) } } -*/ diff --git a/utils/map_test.go b/utils/map_test.go index 54e35d935..6a4cbd621 100644 --- a/utils/map_test.go +++ b/utils/map_test.go @@ -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) } }