more integration tests fixes

This commit is contained in:
Radu Ioan Fericean
2016-03-04 21:46:45 +02:00
parent 47778f398d
commit 3123fed480
4 changed files with 24 additions and 11 deletions

View File

@@ -226,7 +226,7 @@ func TestDmtAgentSendCCRInit(t *testing.T) {
}
var acnt *engine.Account
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
eAcntVal := 9.484
eAcntVal := 9.5008
if err := apierRpc.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal {
@@ -265,7 +265,7 @@ func TestDmtAgentSendCCRUpdate(t *testing.T) {
}
var acnt *engine.Account
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
eAcntVal := 9.214
eAcntVal := 9.2518
if err := apierRpc.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal {
@@ -304,7 +304,7 @@ func TestDmtAgentSendCCRUpdate2(t *testing.T) {
}
var acnt *engine.Account
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
eAcntVal := 8.944000
eAcntVal := 9.0028
if err := apierRpc.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if utils.Round(acnt.BalanceMap[utils.MONETARY].GetTotalValue(), 5, utils.ROUNDING_MIDDLE) != eAcntVal {
@@ -345,7 +345,7 @@ func TestDmtAgentSendCCRTerminate(t *testing.T) {
}
var acnt *engine.Account
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
eAcntVal := 9.205
eAcntVal := 9.2435
if err := apierRpc.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { // Should also consider derived charges which double the cost of 6m10s - 2x0.7584

View File

@@ -230,7 +230,7 @@ func TestTutLocalGetCosts(t *testing.T) {
}
if err := tutLocalRpc.Call("Responder.GetCost", cd, &cc); err != nil {
t.Error("Got error on Responder.GetCost: ", err.Error())
} else if cc.Cost != 1.3002 {
} else if cc.Cost != 1.3 {
t.Errorf("Calling Responder.GetCost got callcost: %v", cc.Cost)
}
tStart, _ = utils.ParseDate("2014-08-04T13:00:00Z")
@@ -266,7 +266,7 @@ func TestTutLocalGetCosts(t *testing.T) {
}
if err := tutLocalRpc.Call("Responder.GetCost", cd, &cc); err != nil {
t.Error("Got error on Responder.GetCost: ", err.Error())
} else if cc.Cost != 1.3002 {
} else if cc.Cost != 1.3 {
t.Errorf("Calling Responder.GetCost got callcost: %v", cc.Cost)
}
tStart = time.Date(2014, 8, 4, 13, 0, 0, 0, time.UTC)
@@ -342,7 +342,7 @@ func TestTutLocalGetCosts(t *testing.T) {
}
if err := tutLocalRpc.Call("Responder.GetCost", cd, &cc); err != nil {
t.Error("Got error on Responder.GetCost: ", err.Error())
} else if cc.Cost != 0.327 { //
} else if cc.Cost != 0.3249 { //
t.Errorf("Calling Responder.GetCost got callcost: %s", cc.AsJSON())
}
cd = engine.CallDescriptor{
@@ -357,7 +357,7 @@ func TestTutLocalGetCosts(t *testing.T) {
}
if err := tutLocalRpc.Call("Responder.GetCost", cd, &cc); err != nil {
t.Error("Got error on Responder.GetCost: ", err.Error())
} else if cc.Cost != 1.3002 { //
} else if cc.Cost != 1.3 { //
t.Errorf("Calling Responder.GetCost got callcost: %s", cc.AsJSON())
}
cd = engine.CallDescriptor{
@@ -372,7 +372,7 @@ func TestTutLocalGetCosts(t *testing.T) {
}
if err := tutLocalRpc.Call("Responder.GetCost", cd, &cc); err != nil {
t.Error("Got error on Responder.GetCost: ", err.Error())
} else if cc.Cost != 0.354 { //
} else if cc.Cost != 0.3498 { //
t.Errorf("Calling Responder.GetCost got callcost: %s", cc.AsJSON())
}
}

View File

@@ -138,7 +138,7 @@ func TestSMGMonetaryRefund(t *testing.T) {
}
var acnt *engine.Account
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
eAcntVal := 8.699800
eAcntVal := 8.70001
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal {
@@ -268,7 +268,7 @@ func TestSMGMixedRefund(t *testing.T) {
//var acnt *engine.Account
//attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
eVoiceVal := 90.0
eMoneyVal := 8.739
eMoneyVal := 8.7399
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eVoiceVal ||

View File

@@ -50,6 +50,19 @@ func TestRoundUp(t *testing.T) {
}
}
func TestRoundUpTwice(t *testing.T) {
result := Round(0.641666666667, 4, ROUNDING_UP)
expected := 0.6417
if result != expected {
t.Errorf("Error rounding up: sould be %v was %v", expected, result)
}
result = Round(result, 4, ROUNDING_UP)
expected = 0.6417
if result != expected {
t.Errorf("Error rounding up: sould be %v was %v", expected, result)
}
}
func TestRoundUpMiddle(t *testing.T) {
result := Round(12.5, 0, ROUNDING_UP)
expected := 13.0