Extending CDRC XML, adding HierarchyPath to configs

This commit is contained in:
DanB
2016-05-07 09:08:56 +02:00
parent d6244aec4a
commit 3b61326ab1
9 changed files with 110 additions and 25 deletions

View File

@@ -20,6 +20,7 @@ package utils
import (
"fmt"
"reflect"
"testing"
"time"
)
@@ -659,3 +660,21 @@ func TestEndOfMonth(t *testing.T) {
t.Errorf("Expected %v was %v", expected, eom)
}
}
func TestParseHierarchyPath(t *testing.T) {
eHP := HierarchyPath([]string{"Root", "CGRateS"})
if hp := ParseHierarchyPath("Root>CGRateS", ""); !reflect.DeepEqual(hp, eHP) {
t.Errorf("Expecting: %+v, received: %+v", eHP, hp)
}
if hp := ParseHierarchyPath("/Root/CGRateS/", ""); !reflect.DeepEqual(hp, eHP) {
t.Errorf("Expecting: %+v, received: %+v", eHP, hp)
}
}
func TestHierarchyPathAsString(t *testing.T) {
eStr := "/Root/CGRateS"
hp := HierarchyPath([]string{"Root", "CGRateS"})
if hpStr := hp.AsString("/", true); hpStr != eStr {
t.Errorf("Expecting: %q, received: %q", eStr, hpStr)
}
}