algo/go/09_queue/CircularQueue_test.go
2018-10-11 22:33:32 +08:00

38 lines
521 B
Go

package _9_queue
import "testing"
func TestCircularQueue_EnQueue(t *testing.T) {
q := NewCircularQueue(5)
q.EnQueue(1)
q.EnQueue(2)
q.EnQueue(3)
q.EnQueue(4)
q.EnQueue(5)
q.EnQueue(6)
t.Log(q)
}
func TestCircularQueue_DeQueue(t *testing.T) {
q := NewCircularQueue(5)
q.EnQueue(1)
q.EnQueue(2)
q.EnQueue(3)
q.EnQueue(4)
q.EnQueue(5)
q.EnQueue(6)
t.Log(q)
t.Log(q.DeQueue())
t.Log(q)
q.EnQueue(5)
t.Log(q)
q.DeQueue()
t.Log(q)
q.DeQueue()
t.Log(q)
q.DeQueue()
t.Log(q)
q.DeQueue()
t.Log(q)
}