github.com/tumi8/quic-go@v0.37.4-tum/noninternal/wire/ack_frame_pool_test.go (about)

     1  package wire
     2  
     3  import (
     4  	"math/rand"
     5  	"time"
     6  
     7  	. "github.com/onsi/ginkgo/v2"
     8  	. "github.com/onsi/gomega"
     9  )
    10  
    11  var _ = Describe("ACK Frame (for IETF QUIC)", func() {
    12  	It("gets an ACK frame from the pool", func() {
    13  		for i := 0; i < 100; i++ {
    14  			ack := GetAckFrame()
    15  			Expect(ack.AckRanges).To(BeEmpty())
    16  			Expect(ack.ECNCE).To(BeZero())
    17  			Expect(ack.ECT0).To(BeZero())
    18  			Expect(ack.ECT1).To(BeZero())
    19  			Expect(ack.DelayTime).To(BeZero())
    20  
    21  			ack.AckRanges = make([]AckRange, rand.Intn(10))
    22  			ack.ECNCE = 1
    23  			ack.ECT0 = 2
    24  			ack.ECT1 = 3
    25  			ack.DelayTime = time.Hour
    26  			PutAckFrame(ack)
    27  		}
    28  	})
    29  })