36 lines
539 B
Go
36 lines
539 B
Go
|
package scheduler
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"strconv"
|
||
|
"testing"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func TestSchedul(t *testing.T) {
|
||
|
s := Scheduler{}
|
||
|
s.Init()
|
||
|
for i := 0; i < 10; i++ {
|
||
|
s.NewSchedule(strconv.Itoa(i), "3", test)
|
||
|
}
|
||
|
time.Sleep(time.Second * 10)
|
||
|
|
||
|
////update
|
||
|
fmt.Println("update")
|
||
|
for i := 0; i < 10; i++ {
|
||
|
s.UpdateSchedule(strconv.Itoa(i), "1")
|
||
|
}
|
||
|
time.Sleep(time.Second * 10)
|
||
|
|
||
|
//remove
|
||
|
fmt.Println("remove")
|
||
|
for i := 0; i < 9; i++ {
|
||
|
s.RemoveSchedule(strconv.Itoa(i))
|
||
|
}
|
||
|
time.Sleep(time.Second * 10)
|
||
|
}
|
||
|
|
||
|
func test() {
|
||
|
fmt.Println("test")
|
||
|
}
|