uquic/internal/wire/wire_suite_test.go

31 lines
618 B
Go

package wire
import (
"bytes"
"encoding/binary"
"testing"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/quicvarint"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestWire(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Wire Suite")
}
func encodeVarInt(i uint64) []byte {
b := &bytes.Buffer{}
quicvarint.Write(b, i)
return b.Bytes()
}
func appendVersion(data []byte, v protocol.VersionNumber) []byte {
offset := len(data)
data = append(data, []byte{0, 0, 0, 0}...)
binary.BigEndian.PutUint32(data[offset:], uint32(v))
return data
}