uquic/ackhandler/retransmittable_test.go
Marten Seemann 0f1f1c8d41 implement the MAX_DATA and MAX_STREAM_DATA frames
For gQUIC WINDOW_UPDATEs are converted to MAX_DATA and MAX_STREAM_DATA,
respectively.
2017-11-04 15:22:14 +07:00

45 lines
1.2 KiB
Go

package ackhandler
import (
"reflect"
"github.com/lucas-clemente/quic-go/internal/wire"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("retransmittable frames", func() {
for fl, el := range map[wire.Frame]bool{
&wire.AckFrame{}: false,
&wire.StopWaitingFrame{}: false,
&wire.BlockedFrame{}: true,
&wire.ConnectionCloseFrame{}: true,
&wire.GoawayFrame{}: true,
&wire.PingFrame{}: true,
&wire.RstStreamFrame{}: true,
&wire.StreamFrame{}: true,
&wire.MaxDataFrame{}: true,
&wire.MaxStreamDataFrame{}: true,
} {
f := fl
e := el
fName := reflect.ValueOf(f).Elem().Type().Name()
It("works for "+fName, func() {
Expect(IsFrameRetransmittable(f)).To(Equal(e))
})
It("stripping non-retransmittable frames works for "+fName, func() {
s := []wire.Frame{f}
if e {
Expect(stripNonRetransmittableFrames(s)).To(Equal([]wire.Frame{f}))
} else {
Expect(stripNonRetransmittableFrames(s)).To(BeEmpty())
}
})
It("HasRetransmittableFrames works for "+fName, func() {
Expect(HasRetransmittableFrames([]wire.Frame{f})).To(Equal(e))
})
}
})