From 33c42788bf3ed39859d69963823ac6c698a00306 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Fri, 2 Mar 2012 18:19:59 +0200 Subject: [PATCH] more tests --- timespans/destinations_test.go | 10 ++++++++++ timespans/tariff_plans_test.go | 21 +++++++++++++++++++++ timespans/test.kch | Bin 6299040 -> 6299040 bytes timespans/userbudget_test.go | 13 +++++++++++++ 4 files changed, 44 insertions(+) diff --git a/timespans/destinations_test.go b/timespans/destinations_test.go index a4630ab03..113355053 100644 --- a/timespans/destinations_test.go +++ b/timespans/destinations_test.go @@ -22,6 +22,16 @@ import ( "testing" ) +func TestDestinationStoreRestore(t *testing.T) { + nationale = &Destination{Id: "nat", Prefixes: []string{"0257", "0256", "0723"}} + s := nationale.store() + d1 := &Destination{Id: "nat"} + d1.restore(s) + if d1.store() != s { + t.Errorf("Expected %q was %q", s, d1.store()) + } +} + func TestDestinationKyotoStore(t *testing.T) { getter, _ := NewKyotoStorage("test.kch") defer getter.Close() diff --git a/timespans/tariff_plans_test.go b/timespans/tariff_plans_test.go index 28b4cd4c6..52ee2dc9f 100644 --- a/timespans/tariff_plans_test.go +++ b/timespans/tariff_plans_test.go @@ -23,6 +23,27 @@ import ( "testing" ) +func TestTariffPlanStoreRestore(t *testing.T) { + b1 := &MinuteBucket{Seconds: 10, Priority: 10, Price: 0.01, DestinationId: "nationale"} + b2 := &MinuteBucket{Seconds: 100, Priority: 20, Price: 0.0, DestinationId: "retea"} + rcb := &RecivedCallBonus{Credit: 100} + vd := &VolumeDiscount{100, 10} + seara := &TariffPlan{Id: "seara_voo", + SmsCredit: 100, + ReceivedCallSecondsLimit: 0, + RecivedCallBonus: rcb, + MinuteBuckets: []*MinuteBucket{b1, b2}, + VolumeDiscountThresholds: []*VolumeDiscount{vd}} + s := seara.store() + tp1 := &TariffPlan{Id: "seara_voo"} + tp1.restore(s) + if tp1.store() != s { + t.Errorf("Expected %q was %q", s, tp1.store()) + } +} + + + func TestTariffPlanKyotoStore(t *testing.T) { getter, _ := NewKyotoStorage("test.kch") defer getter.Close() diff --git a/timespans/test.kch b/timespans/test.kch index d7a0230fd86e2f0f7075b05ab470f7d1f60b8304..efa620ffab41967aaa3844cc8ebd7cf74966c3c7 100644 GIT binary patch delta 248 zcmYkrM>0bJ0DxhgXwiGr=q*q5r}r*;CmS<%W{d+^d>62?%^~dE$r%_c|2Kc;>n%6) z`N&IFxea*ojkT&Rw{4<=Tx~ ockVrWrX#Uk-$hPeQ)|gN6(nF>1`X z2}vnwlcr3YF>B7e1sRK$EL*W^P1d>%o3?D*v1`x11BZ?rJ8|mFxeJ%BT)T1W&b