mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add test for method from utils
This commit is contained in:
committed by
Dan Christian Bogos
parent
acf2e39e87
commit
18e510d415
@@ -115,6 +115,43 @@ func TestAsSlice(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAsOrderedSlice(t *testing.T) {
|
||||
s := StringSet{}
|
||||
eOut := make([]string, 0)
|
||||
if rcv := s.AsOrderedSlice(); !reflect.DeepEqual(eOut, rcv) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
|
||||
}
|
||||
s = StringSet{
|
||||
"test3": struct{}{},
|
||||
"test12": struct{}{},
|
||||
"test2": struct{}{}}
|
||||
eOut = []string{"test12", "test2", "test3"}
|
||||
rcv := s.AsOrderedSlice()
|
||||
if !reflect.DeepEqual(eOut, rcv) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetSha1(t *testing.T) {
|
||||
s := StringSet{
|
||||
"test3": struct{}{},
|
||||
"test12": struct{}{},
|
||||
"test2": struct{}{}}
|
||||
eOut := "8fbb49ecf2ee4116bc492505865d2125a78f2161"
|
||||
if rcv := s.Sha1(); rcv != eOut {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
|
||||
}
|
||||
|
||||
s2 := StringSet{
|
||||
"test2": struct{}{},
|
||||
"test3": struct{}{},
|
||||
"test12": struct{}{},
|
||||
}
|
||||
if rcv := s2.Sha1(); rcv != eOut {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSize(t *testing.T) {
|
||||
s := StringSet{}
|
||||
if rcv := s.Size(); rcv != 0 {
|
||||
|
||||
Reference in New Issue
Block a user