PriorityQueue test move to struture_test.go

This commit is contained in:
huangsimin 2018-12-06 15:54:20 +08:00
parent 2127db6ce2
commit 4fc3a91d35
2 changed files with 25 additions and 25 deletions

View File

@ -1,26 +1 @@
package curl2info
import (
"strconv"
"testing"
)
func TestPQueue(t *testing.T) {
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})
content := ""
for PQExec.Len() > 0 {
content += strconv.Itoa(PQExec.Pop().Priority)
content += " "
}
if content != "4 4 5 10 10 15 20 " {
t.Error(content)
}
}

View File

@ -1 +1,26 @@
package curl2info
import (
"strconv"
"testing"
)
func TestPQueue(t *testing.T) {
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})
content := ""
for PQExec.Len() > 0 {
content += strconv.Itoa(PQExec.Pop().Priority)
content += " "
}
if content != "4 4 5 10 10 15 20 " {
t.Error(content)
}
}