You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
709 B
Go
56 lines
709 B
Go
2 years ago
|
package startimer
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func TestTimer(t *testing.T) {
|
||
|
tk:= StarTimer{
|
||
|
base: time.Now(),
|
||
|
repeat: []*Repeats{
|
||
|
{
|
||
|
Every: false,
|
||
|
Repeat: []Repeat{
|
||
|
{
|
||
|
Unit: STAR_MINUTE,
|
||
|
Value: 7,
|
||
|
},
|
||
|
{
|
||
|
Unit: STAR_HOUR,
|
||
|
Value: 18,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
Every: false,
|
||
|
Repeat: []Repeat{
|
||
|
{
|
||
|
Unit: STAR_MINUTE,
|
||
|
Value: 15,
|
||
|
},
|
||
|
{
|
||
|
Unit: STAR_HOUR,
|
||
|
Value: 14,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
Every: true,
|
||
|
Repeat: []Repeat{
|
||
|
{
|
||
|
Unit: STAR_HOUR,
|
||
|
Value: 5,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
base:=tk.base
|
||
|
for i:=0;i<10;i++{
|
||
|
base=tk.parseNextDate(base)
|
||
|
fmt.Println(base)
|
||
|
}
|
||
|
}
|