Add test for invalid priority levels to npq.
This commit is contained in:
parent
9f8d0760f1
commit
0840eb9272
@ -48,6 +48,26 @@ func TestSendClosedPanic(t *testing.T) {
|
|||||||
q.Send(1, 1)
|
q.Send(1, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTooLowPriorityPanic(t *testing.T) {
|
||||||
|
testInvalidPriorityPanic(t, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTooHighPriorityPanic(t *testing.T) {
|
||||||
|
testInvalidPriorityPanic(t, 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testInvalidPriorityPanic(t *testing.T, invalid int) {
|
||||||
|
t.Parallel()
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
t.Errorf("sending with invalid priority did not panic")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
q := npq.Make[int, int](4, 1, 2)
|
||||||
|
q.Send(invalid, 1)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func TestRecvClosed(t *testing.T) {
|
func TestRecvClosed(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
q := npq.Make[int, int](4, 1, 2)
|
q := npq.Make[int, int](4, 1, 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user