github.com/apernet/quic-go@v0.43.1-0.20240515053213-5e9e635fd9f0/internal/ackhandler/ack_eliciting_test.go (about)

     1  package ackhandler
     2  
     3  import (
     4  	"reflect"
     5  
     6  	"github.com/apernet/quic-go/internal/wire"
     7  
     8  	. "github.com/onsi/ginkgo/v2"
     9  	. "github.com/onsi/gomega"
    10  )
    11  
    12  var _ = Describe("ack-eliciting frames", func() {
    13  	for fl, el := range map[wire.Frame]bool{
    14  		&wire.AckFrame{}:             false,
    15  		&wire.ConnectionCloseFrame{}: false,
    16  		&wire.DataBlockedFrame{}:     true,
    17  		&wire.PingFrame{}:            true,
    18  		&wire.ResetStreamFrame{}:     true,
    19  		&wire.StreamFrame{}:          true,
    20  		&wire.MaxDataFrame{}:         true,
    21  		&wire.MaxStreamDataFrame{}:   true,
    22  	} {
    23  		f := fl
    24  		e := el
    25  		fName := reflect.ValueOf(f).Elem().Type().Name()
    26  
    27  		It("works for "+fName, func() {
    28  			Expect(IsFrameAckEliciting(f)).To(Equal(e))
    29  		})
    30  
    31  		It("HasAckElicitingFrames works for "+fName, func() {
    32  			Expect(HasAckElicitingFrames([]Frame{{Frame: f}})).To(Equal(e))
    33  		})
    34  	}
    35  })