30 lines
436 B
Go
30 lines
436 B
Go
|
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())
|
||
|
}
|