using time.Duration for rateincrements and groupinterval

This commit is contained in:
Radu Ioan Fericean
2013-08-07 13:29:27 +03:00
parent 0785874357
commit c209dbfb9f
14 changed files with 99 additions and 83 deletions

View File

@@ -43,7 +43,7 @@ func TestSimpleMarshallerApStoreRestore(t *testing.T) {
}
func TestSimpleMarshallerApRestoreFromString(t *testing.T) {
s := "2012-02-01T14:30:01Z|;1,2,3,4,5,6,7,8,9,10,11,12;1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31;1,2,3,4,5,6,0;00:00:00;;10;0;0:0.2:1;60;1;\n"
s := "2012-02-01T14:30:01Z|;1,2,3,4,5,6,7,8,9,10,11,12;1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31;1,2,3,4,5,6,0;00:00:00;;10;0;0:0.2:1s;60;1;\n"
ap := &ActivationPeriod{}
err := ap.Restore(s)
if err != nil || len(ap.Intervals) != 1 {
@@ -142,10 +142,10 @@ func TestIntervalStoreRestore(t *testing.T) {
}
func TestIntervalRestoreFromString(t *testing.T) {
s := ";1,2,3,4,5,6,7,8,9,10,11,12;1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31;1,2,3,4,5,6,0;00:00:00;;10;0;0:0.2:1;60;0;"
s := ";1,2,3,4,5,6,7,8,9,10,11,12;1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31;1,2,3,4,5,6,0;00:00:00;;10;0;0:0.2:1s;60;0;"
i := Interval{}
err := i.Restore(s)
if err != nil || !i.Prices.Equal(PriceGroups{&Price{0, 0.2, 1}}) {
if err != nil || !i.Prices.Equal(PriceGroups{&Price{0, 0.2, 1 * time.Second}}) {
t.Errorf("Error restoring inteval period from string %+v", i)
}
}