From 0967ce7b462bf757d9db6e1e9c3142342464fbba Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Thu, 2 Feb 2012 14:54:52 +0200 Subject: [PATCH] incercare gob --- timeslots/interval_test.go | 4 ++-- timeslots/timeslots.go | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/timeslots/interval_test.go b/timeslots/interval_test.go index 8337afd08..fc4be900c 100644 --- a/timeslots/interval_test.go +++ b/timeslots/interval_test.go @@ -228,7 +228,7 @@ func TestEnclosingMargin(t *testing.T){ } } -/*func TestOutsideMargin(t *testing.T){ +func TestOutsideMargin(t *testing.T){ i := &Interval{WeekDays: []time.Weekday{time.Monday}} t1 := time.Date(2012, time.February, 5, 17, 45, 0, 0, time.UTC) t2 := time.Date(2012, time.February, 5, 18, 10, 0, 0, time.UTC) @@ -237,7 +237,7 @@ func TestEnclosingMargin(t *testing.T){ if result != nil { t.Error("Interval not split correctly") } -}*/ +} func BenchmarkIntervalFull(b *testing.B) { i := &Interval{Month: time.February, MonthDay: 1, WeekDays: []time.Weekday{time.Wednesday, time.Thursday}, StartHour: "14:30", EndHour: "15:00"} diff --git a/timeslots/timeslots.go b/timeslots/timeslots.go index bd46b1fa4..3c6cd2097 100644 --- a/timeslots/timeslots.go +++ b/timeslots/timeslots.go @@ -62,6 +62,25 @@ func (c *Customer) decodeValue(v []byte) { } } +/* +func (c *Customer) encodeValue() (result bytes.Buffer) { + enc := gob.NewEncoder(&result) + err:= enc.Encode(c.ActivationPeriods) + if err != nil { + log.Print("Cannot encode intervals: ", err) + } + return result +} + +func (c *Customer) decodeValue(v bytes.Buffer) { + dec := gob.NewDecoder(&v) + err := dec.Decode(&c.ActivationPeriods) + if err != nil { + log.Print("Cannot decode intervals: ", err) + } +} +*/ + /* A unit in which a call will be split that has a specific price related interval attached to it. */