github.com/danielpfeifer02/quic-go-prio-packs@v0.41.0-28/internal/wire/wire_suite_test.go (about)

     1  package wire
     2  
     3  import (
     4  	"encoding/binary"
     5  	"testing"
     6  
     7  	"github.com/danielpfeifer02/quic-go-prio-packs/internal/protocol"
     8  	"github.com/danielpfeifer02/quic-go-prio-packs/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  }