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

     1  package wire
     2  
     3  import (
     4  	"encoding/binary"
     5  	"testing"
     6  
     7  	"github.com/apernet/quic-go/internal/protocol"
     8  	"github.com/apernet/quic-go/quicvarint"
     9  
    10  	. "github.com/onsi/ginkgo/v2"
    11  	. "github.com/onsi/gomega"
    12  )
    13  
    14  func TestWire(t *testing.T) {
    15  	RegisterFailHandler(Fail)
    16  	RunSpecs(t, "Wire Suite")
    17  }
    18  
    19  func encodeVarInt(i uint64) []byte {
    20  	return quicvarint.Append(nil, i)
    21  }
    22  
    23  func appendVersion(data []byte, v protocol.Version) []byte {
    24  	offset := len(data)
    25  	data = append(data, []byte{0, 0, 0, 0}...)
    26  	binary.BigEndian.PutUint32(data[offset:], uint32(v))
    27  	return data
    28  }