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

     1  package protocol
     2  
     3  import (
     4  	. "github.com/onsi/ginkgo/v2"
     5  	. "github.com/onsi/gomega"
     6  )
     7  
     8  var _ = Describe("Protocol", func() {
     9  	Context("Long Header Packet Types", func() {
    10  		It("has the correct string representation", func() {
    11  			Expect(PacketTypeInitial.String()).To(Equal("Initial"))
    12  			Expect(PacketTypeRetry.String()).To(Equal("Retry"))
    13  			Expect(PacketTypeHandshake.String()).To(Equal("Handshake"))
    14  			Expect(PacketType0RTT.String()).To(Equal("0-RTT Protected"))
    15  			Expect(PacketType(10).String()).To(Equal("unknown packet type: 10"))
    16  		})
    17  	})
    18  
    19  	It("converts ECN bits from the IP header wire to the correct types", func() {
    20  		Expect(ECN(0)).To(Equal(ECNNon))
    21  		Expect(ECN(0b00000010)).To(Equal(ECT0))
    22  		Expect(ECN(0b00000001)).To(Equal(ECT1))
    23  		Expect(ECN(0b00000011)).To(Equal(ECNCE))
    24  	})
    25  })