mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updated utils/map_test.go and utils/decimal_test.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
1bd762ef77
commit
eb39a5ffff
@@ -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)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user