mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
Merge branch 'master' of https://github.com/cgrates/cgrates
This commit is contained in:
@@ -749,9 +749,10 @@ func (apl Actions) Sort() {
|
||||
}
|
||||
|
||||
func (apl *Actions) Clone() (interface{}, error) {
|
||||
cln := new(Actions)
|
||||
if err := utils.Clone(*apl, cln); err != nil {
|
||||
|
||||
var cln Actions
|
||||
if err := utils.Clone(apl, &cln); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return interface{}(cln), nil
|
||||
return cln, nil
|
||||
}
|
||||
|
||||
@@ -2338,7 +2338,7 @@ func TestClonedAction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClonedActions(t *testing.T) {
|
||||
actions := &Actions{
|
||||
actions := Actions{
|
||||
&Action{
|
||||
Id: "RECUR_FOR_V3HSILLMILLD1G",
|
||||
ActionType: TOPUP,
|
||||
@@ -2367,14 +2367,49 @@ func TestClonedActions(t *testing.T) {
|
||||
t.Error("error cloning actions: ", err)
|
||||
}
|
||||
|
||||
clonedActions := clone.(*Actions)
|
||||
|
||||
if !reflect.DeepEqual(actions, clonedActions) {
|
||||
t.Error("error cloning actions: ", utils.ToIJSON(clonedActions))
|
||||
if !reflect.DeepEqual(actions, clone) {
|
||||
t.Error("error cloning actions: ", utils.ToIJSON(clone))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
func TestCacheGetClonedActions(t *testing.T) {
|
||||
actions := Actions{
|
||||
&Action{
|
||||
Id: "RECUR_FOR_V3HSILLMILLD1G",
|
||||
ActionType: TOPUP,
|
||||
Balance: &BalanceFilter{
|
||||
ID: utils.StringPointer("*default"),
|
||||
Value: &utils.ValueFormula{Static: 1},
|
||||
Type: utils.StringPointer(utils.MONETARY),
|
||||
},
|
||||
Weight: float64(30),
|
||||
},
|
||||
&Action{
|
||||
Id: "RECUR_FOR_V3HSILLMILLD5G",
|
||||
ActionType: DEBIT,
|
||||
Balance: &BalanceFilter{
|
||||
ID: utils.StringPointer("*default"),
|
||||
Value: &utils.ValueFormula{Static: 2},
|
||||
Type: utils.StringPointer(utils.MONETARY),
|
||||
},
|
||||
Weight: float64(20),
|
||||
},
|
||||
}
|
||||
cache.Set("MYTEST", actions, true, "")
|
||||
clned, err := cache.GetCloned("MYTEST")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
aCloned := clned.(Actions)
|
||||
if !reflect.DeepEqual(actions, aCloned) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", actions, aCloned)
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**************** Benchmarks ********************************/
|
||||
|
||||
func BenchmarkUUID(b *testing.B) {
|
||||
|
||||
Reference in New Issue
Block a user