27 lines
568 B
Go
27 lines
568 B
Go
package curl2info
|
|
|
|
import (
|
|
"strconv"
|
|
"testing"
|
|
)
|
|
|
|
func TestPQueue(t *testing.T) {
|
|
PQExec := newPQueueExecute()
|
|
PQExec.Push(&parseFunction{Prioty: 5})
|
|
PQExec.Push(&parseFunction{Prioty: 10})
|
|
PQExec.Push(&parseFunction{Prioty: 4})
|
|
PQExec.Push(&parseFunction{Prioty: 4})
|
|
PQExec.Push(&parseFunction{Prioty: 20})
|
|
PQExec.Push(&parseFunction{Prioty: 10})
|
|
PQExec.Push(&parseFunction{Prioty: 15})
|
|
|
|
content := ""
|
|
for PQExec.Len() > 0 {
|
|
content += strconv.Itoa(PQExec.Pop().Prioty)
|
|
content += " "
|
|
}
|
|
if content != "4 4 5 10 10 15 20 " {
|
|
t.Error(content)
|
|
}
|
|
}
|