curl2info/base_test.go

27 lines
584 B
Go
Raw Normal View History

2018-11-22 15:05:42 +00:00
package curl2info
import (
"strconv"
"testing"
)
func TestPQueue(t *testing.T) {
2018-11-23 07:30:52 +00:00
PQExec := newPQueueExecute()
PQExec.Push(&parseFunction{Priority: 5})
PQExec.Push(&parseFunction{Priority: 10})
PQExec.Push(&parseFunction{Priority: 4})
PQExec.Push(&parseFunction{Priority: 4})
PQExec.Push(&parseFunction{Priority: 20})
PQExec.Push(&parseFunction{Priority: 10})
PQExec.Push(&parseFunction{Priority: 15})
2018-11-22 15:05:42 +00:00
content := ""
for PQExec.Len() > 0 {
content += strconv.Itoa(PQExec.Pop().Priority)
2018-11-22 15:05:42 +00:00
content += " "
}
if content != "4 4 5 10 10 15 20 " {
t.Error(content)
}
}