crontabex/priority_list_test.go

30 lines
436 B
Go
Raw Normal View History

2018-12-20 10:42:18 +00:00
package crontab
import "testing"
type FL struct {
Node
}
func (fl *FL) Compare(v INode) bool {
return fl.GetValue().(int) > v.GetValue().(int)
}
func TestPriorityInsert(t *testing.T) {
pl := New()
fl := new(FL)
fl.SetValue(12)
pl.InsertValue(fl)
fl = new(FL)
fl.SetValue(123)
pl.InsertValue(fl)
fl = new(FL)
fl.SetValue(1233)
pl.InsertValue(fl)
fl = new(FL)
fl.SetValue(1)
pl.InsertValue(fl)
t.Error(pl.String())
}