@@ -570,6 +570,7 @@ func TestBlocking(t *testing.T) {
570
570
)
571
571
572
572
added := make (chan struct {}, initialSize + 1 )
573
+
573
574
for i := 1 ; i <= initialSize + 1 ; i ++ {
574
575
go func (i int ) {
575
576
blockingQueue .OfferWait (i )
@@ -578,6 +579,7 @@ func TestBlocking(t *testing.T) {
578
579
}
579
580
580
581
time .Sleep (time .Millisecond )
582
+
581
583
_ = blockingQueue .Clear ()
582
584
583
585
// one groutine block, and three are added
@@ -586,12 +588,15 @@ func TestBlocking(t *testing.T) {
586
588
}
587
589
588
590
time .Sleep (time .Millisecond )
591
+
589
592
if blockingQueue .Size () != initialSize {
590
593
t .Fatalf ("expected size to be %d, got %d" , initialSize , blockingQueue .Size ())
591
594
}
592
595
593
596
_ = blockingQueue .GetWait ()
597
+
594
598
time .Sleep (time .Millisecond )
599
+
595
600
if blockingQueue .Size () != initialSize {
596
601
t .Fatalf ("expected size to be %d, got %d" , initialSize , blockingQueue .Size ())
597
602
}
@@ -617,6 +622,7 @@ func TestBlocking(t *testing.T) {
617
622
}
618
623
619
624
retrievedElem := make (chan int , initialSize + 1 )
625
+
620
626
for i := 1 ; i <= initialSize + 1 ; i ++ {
621
627
go func () {
622
628
retrievedElem <- blockingQueue .GetWait ()
@@ -636,6 +642,7 @@ func TestBlocking(t *testing.T) {
636
642
}
637
643
638
644
blockingQueue .OfferWait (4 )
645
+
639
646
if e := <- retrievedElem ; e != 4 {
640
647
t .Fatalf ("expected elem to be %d, got %d" , 4 , e )
641
648
}
0 commit comments