mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Updated orderednavigablemap tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
b6a2434969
commit
d2fdb60482
@@ -86,7 +86,7 @@ func TestNewServerCodec(t *testing.T) {
|
||||
if err = codec.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
runtime.Gosched()
|
||||
if cnt, err := anz.db.DocCount(); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -946,9 +946,25 @@ func TestOrderedNavigableMapOrderedFields(t *testing.T) {
|
||||
PathItems: PathItems{{Field: "Field1"}, {Field: "Field2", Index: StringPointer("0")}},
|
||||
Path: "Field1.Field2[0]",
|
||||
}, NewNMData("1003"))
|
||||
nm.Set(&FullPath{
|
||||
PathItems: PathItems{{Field: "Field1"}, {Field: "Field3", Index: StringPointer("0")}},
|
||||
Path: "Field1.Field3[0]",
|
||||
}, NewNMData("1004"))
|
||||
nm.Set(&FullPath{
|
||||
PathItems: PathItems{{Field: "Field5"}},
|
||||
Path: "Field5",
|
||||
}, NewNMData("1005"))
|
||||
nm.Set(&FullPath{
|
||||
PathItems: PathItems{{Field: "Field6"}},
|
||||
Path: "Field6",
|
||||
}, NewNMData("1006"))
|
||||
nm.Remove(&FullPath{
|
||||
PathItems: PathItems{{Field: "Field5"}},
|
||||
Path: "Field5",
|
||||
})
|
||||
exp := []interface{}{"1003", "1004", "1006"}
|
||||
rcv := nm.OrderedFields()
|
||||
newRcv := rcv[0].(string)
|
||||
if newRcv != "1003" {
|
||||
t.Errorf("Expected %+v, received %+v", "1003", newRcv)
|
||||
if !reflect.DeepEqual(exp, rcv) {
|
||||
t.Errorf("Expected %+v, received %+v", exp, rcv)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,9 +167,6 @@ func TestPathItemsSlice(t *testing.T) {
|
||||
func TestNewFullPath(t *testing.T) {
|
||||
expected := &FullPath{
|
||||
PathItems: []PathItem{
|
||||
{
|
||||
Field: EmptyString,
|
||||
},
|
||||
{
|
||||
Field: "test",
|
||||
},
|
||||
@@ -177,9 +174,9 @@ func TestNewFullPath(t *testing.T) {
|
||||
Field: "path",
|
||||
},
|
||||
},
|
||||
Path: "/test/path",
|
||||
Path: "test.path",
|
||||
}
|
||||
if rcv := NewFullPath("/test/path", Slash); !reflect.DeepEqual(rcv, expected) {
|
||||
if rcv := NewFullPath("test.path", NestingSep); !reflect.DeepEqual(rcv, expected) {
|
||||
t.Errorf("Expected %+v \n, received %+v", ToJSON(expected), ToJSON(rcv))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user