mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
cosmetic changes in tests
This commit is contained in:
parent
0d29bdc499
commit
540941117e
9 changed files with 58 additions and 58 deletions
|
@ -51,14 +51,14 @@ var _ = Describe("Packet", func() {
|
|||
|
||||
It("gets all StreamFrames", func() {
|
||||
streamFrames := packet.GetStreamFramesForRetransmission()
|
||||
Expect(len(streamFrames)).To(Equal(2))
|
||||
Expect(streamFrames).To(HaveLen(2))
|
||||
Expect(streamFrames).To(ContainElement(streamFrame1))
|
||||
Expect(streamFrames).To(ContainElement(streamFrame2))
|
||||
})
|
||||
|
||||
It("gets all control frames", func() {
|
||||
controlFrames := packet.GetControlFramesForRetransmission()
|
||||
Expect(len(controlFrames)).To(Equal(2))
|
||||
Expect(controlFrames).To(HaveLen(2))
|
||||
Expect(controlFrames).To(ContainElement(rstStreamFrame))
|
||||
Expect(controlFrames).To(ContainElement(windowUpdateFrame))
|
||||
})
|
||||
|
@ -81,7 +81,7 @@ var _ = Describe("Packet", func() {
|
|||
Frames: []frames.Frame{ackFrame1, rstStreamFrame},
|
||||
}
|
||||
streamFrames := packet.GetStreamFramesForRetransmission()
|
||||
Expect(len(streamFrames)).To(Equal(0))
|
||||
Expect(streamFrames).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("returns an empty slice of control frames if no applicable control frames are queued", func() {
|
||||
|
@ -91,7 +91,7 @@ var _ = Describe("Packet", func() {
|
|||
Frames: []frames.Frame{streamFrame1, ackFrame1, stopWaitingFrame},
|
||||
}
|
||||
controlFrames := packet.GetControlFramesForRetransmission()
|
||||
Expect(len(controlFrames)).To(Equal(0))
|
||||
Expect(controlFrames).To(BeEmpty())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -116,7 +116,7 @@ var _ = Describe("receivedPacketHandler", func() {
|
|||
Expect(handler.largestObserved).To(Equal(protocol.PacketNumber(99)))
|
||||
Expect(handler.highestInOrderObserved).To(Equal(protocol.PacketNumber(99)))
|
||||
nackRanges, entropy := handler.getNackRanges()
|
||||
Expect(len(nackRanges)).To(Equal(0))
|
||||
Expect(nackRanges).To(BeEmpty())
|
||||
Expect(entropy).To(Equal(expectedEntropy))
|
||||
})
|
||||
|
||||
|
@ -132,7 +132,7 @@ var _ = Describe("receivedPacketHandler", func() {
|
|||
}
|
||||
Expect(handler.largestObserved).To(Equal(protocol.PacketNumber(9)))
|
||||
nackRanges, entropy := handler.getNackRanges()
|
||||
Expect(len(nackRanges)).To(Equal(1))
|
||||
Expect(nackRanges).To(HaveLen(1))
|
||||
Expect(nackRanges[0]).To(Equal(frames.NackRange{FirstPacketNumber: 5, LastPacketNumber: 5}))
|
||||
Expect(handler.highestInOrderObserved).To(Equal(protocol.PacketNumber(4)))
|
||||
Expect(entropy).To(Equal(expectedEntropy))
|
||||
|
@ -153,7 +153,7 @@ var _ = Describe("receivedPacketHandler", func() {
|
|||
}
|
||||
Expect(handler.largestObserved).To(Equal(protocol.PacketNumber(11)))
|
||||
nackRanges, entropy := handler.getNackRanges()
|
||||
Expect(len(nackRanges)).To(Equal(1))
|
||||
Expect(nackRanges).To(HaveLen(1))
|
||||
Expect(nackRanges[0]).To(Equal(frames.NackRange{FirstPacketNumber: 5, LastPacketNumber: 6}))
|
||||
Expect(handler.highestInOrderObserved).To(Equal(protocol.PacketNumber(4)))
|
||||
Expect(entropy).To(Equal(expectedEntropy))
|
||||
|
@ -174,7 +174,7 @@ var _ = Describe("receivedPacketHandler", func() {
|
|||
}
|
||||
Expect(handler.largestObserved).To(Equal(protocol.PacketNumber(9)))
|
||||
nackRanges, entropy := handler.getNackRanges()
|
||||
Expect(len(nackRanges)).To(Equal(2))
|
||||
Expect(nackRanges).To(HaveLen(2))
|
||||
Expect(nackRanges[0]).To(Equal(frames.NackRange{FirstPacketNumber: 7, LastPacketNumber: 7}))
|
||||
Expect(nackRanges[1]).To(Equal(frames.NackRange{FirstPacketNumber: 3, LastPacketNumber: 3}))
|
||||
Expect(handler.highestInOrderObserved).To(Equal(protocol.PacketNumber(2)))
|
||||
|
@ -193,7 +193,7 @@ var _ = Describe("receivedPacketHandler", func() {
|
|||
}
|
||||
Expect(handler.largestObserved).To(Equal(protocol.PacketNumber(9)))
|
||||
nackRanges, entropy := handler.getNackRanges()
|
||||
Expect(len(nackRanges)).To(Equal(2))
|
||||
Expect(nackRanges).To(HaveLen(2))
|
||||
Expect(nackRanges[0]).To(Equal(frames.NackRange{FirstPacketNumber: 7, LastPacketNumber: 8}))
|
||||
Expect(nackRanges[1]).To(Equal(frames.NackRange{FirstPacketNumber: 2, LastPacketNumber: 4}))
|
||||
Expect(handler.highestInOrderObserved).To(Equal(protocol.PacketNumber(1)))
|
||||
|
@ -236,7 +236,7 @@ var _ = Describe("receivedPacketHandler", func() {
|
|||
err = handler.ReceivedStopWaiting(&frames.StopWaitingFrame{Entropy: 0, LeastUnacked: protocol.PacketNumber(10)})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
ranges, _ = handler.getNackRanges()
|
||||
Expect(ranges).To(HaveLen(0))
|
||||
Expect(ranges).To(BeEmpty())
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -329,12 +329,12 @@ var _ = Describe("receivedPacketHandler", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
ack, _ := handler.GetAckFrame(true)
|
||||
Expect(ack).ToNot(BeNil())
|
||||
Expect(len(ack.NackRanges)).To(Equal(1))
|
||||
Expect(ack.NackRanges).To(HaveLen(1))
|
||||
err = handler.ReceivedPacket(protocol.PacketNumber(2), false)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
ack, _ = handler.GetAckFrame(true)
|
||||
Expect(ack).ToNot(BeNil())
|
||||
Expect(len(ack.NackRanges)).To(Equal(0))
|
||||
Expect(ack.NackRanges).To(BeEmpty())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -228,7 +228,7 @@ var _ = Describe("SentPacketHandler", func() {
|
|||
Expect(acked[1].PacketNumber).To(Equal(protocol.PacketNumber(2)))
|
||||
Expect(acked[2].PacketNumber).To(Equal(protocol.PacketNumber(3)))
|
||||
Expect(acked[3].PacketNumber).To(Equal(protocol.PacketNumber(4)))
|
||||
Expect(lost).To(HaveLen(0))
|
||||
Expect(lost).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("completely processes an ACK with a NACK range", func() {
|
||||
|
@ -263,7 +263,7 @@ var _ = Describe("SentPacketHandler", func() {
|
|||
Expect(acked[1].PacketNumber).To(Equal(protocol.PacketNumber(2)))
|
||||
Expect(acked[2].PacketNumber).To(Equal(protocol.PacketNumber(6)))
|
||||
Expect(acked[3].PacketNumber).To(Equal(protocol.PacketNumber(4)))
|
||||
Expect(lost).To(HaveLen(0))
|
||||
Expect(lost).To(BeEmpty())
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -375,7 +375,7 @@ var _ = Describe("SentPacketHandler", func() {
|
|||
handler.nackPacket(2)
|
||||
handler.nackPacket(2)
|
||||
Expect(handler.HasPacketForRetransmission()).To(BeTrue())
|
||||
Expect(len(handler.retransmissionQueue)).To(Equal(1))
|
||||
Expect(handler.retransmissionQueue).To(HaveLen(1))
|
||||
Expect(handler.retransmissionQueue[0].PacketNumber).To(Equal(protocol.PacketNumber(2)))
|
||||
})
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ var _ = Describe("AckFrame", func() {
|
|||
frame, err := ParseAckFrame(b, 32)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.HasNACK()).To(Equal(true))
|
||||
Expect(len(frame.NackRanges)).To(Equal(1))
|
||||
Expect(frame.NackRanges).To(HaveLen(1))
|
||||
Expect(frame.LargestObserved).To(Equal(protocol.PacketNumber(3)))
|
||||
Expect(frame.NackRanges[0]).To(Equal(NackRange{FirstPacketNumber: 1, LastPacketNumber: 2}))
|
||||
Expect(b.Len()).To(Equal(0))
|
||||
|
@ -54,7 +54,7 @@ var _ = Describe("AckFrame", func() {
|
|||
frame, err := ParseAckFrame(b, 31)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.HasNACK()).To(Equal(true))
|
||||
Expect(len(frame.NackRanges)).To(Equal(1))
|
||||
Expect(frame.NackRanges).To(HaveLen(1))
|
||||
Expect(frame.LargestObserved).To(Equal(protocol.PacketNumber(3)))
|
||||
Expect(frame.NackRanges[0]).To(Equal(NackRange{FirstPacketNumber: 1, LastPacketNumber: 2}))
|
||||
Expect(b.Len()).To(Equal(0))
|
||||
|
@ -67,7 +67,7 @@ var _ = Describe("AckFrame", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.LargestObserved).To(Equal(protocol.PacketNumber(0xDECAFBAD1337)))
|
||||
Expect(frame.HasNACK()).To(Equal(true))
|
||||
Expect(len(frame.NackRanges)).To(Equal(1))
|
||||
Expect(frame.NackRanges).To(HaveLen(1))
|
||||
Expect(frame.NackRanges[0]).To(Equal(NackRange{FirstPacketNumber: protocol.PacketNumber(0xDECAFBAD1337 - 0xDEADBEEFCAFE - rangeLength), LastPacketNumber: 0xDECAFBAD1337 - 0xDEADBEEFCAFE}))
|
||||
Expect(b.Len()).To(Equal(0))
|
||||
})
|
||||
|
@ -78,7 +78,7 @@ var _ = Describe("AckFrame", func() {
|
|||
frame, err := ParseAckFrame(b, 32)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.HasNACK()).To(Equal(true))
|
||||
Expect(len(frame.NackRanges)).To(Equal(3))
|
||||
Expect(frame.NackRanges).To(HaveLen(3))
|
||||
Expect(frame.NackRanges[0]).To(Equal(NackRange{FirstPacketNumber: 8, LastPacketNumber: 14}))
|
||||
Expect(frame.NackRanges[1]).To(Equal(NackRange{FirstPacketNumber: 4, LastPacketNumber: 6}))
|
||||
Expect(frame.NackRanges[2]).To(Equal(NackRange{FirstPacketNumber: 2, LastPacketNumber: 2}))
|
||||
|
@ -107,7 +107,7 @@ var _ = Describe("AckFrame", func() {
|
|||
frame, err := ParseAckFrame(b, 32)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.LargestObserved).To(Equal(protocol.PacketNumber(302)))
|
||||
Expect(len(frame.NackRanges)).To(Equal(1))
|
||||
Expect(frame.NackRanges).To(HaveLen(1))
|
||||
Expect(frame.NackRanges[0]).To(Equal(NackRange{FirstPacketNumber: 2, LastPacketNumber: 301}))
|
||||
})
|
||||
|
||||
|
@ -116,7 +116,7 @@ var _ = Describe("AckFrame", func() {
|
|||
frame, err := ParseAckFrame(b, 32)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.LargestObserved).To(Equal(protocol.PacketNumber(1302)))
|
||||
Expect(len(frame.NackRanges)).To(Equal(1))
|
||||
Expect(frame.NackRanges).To(HaveLen(1))
|
||||
Expect(frame.NackRanges[0]).To(Equal(NackRange{FirstPacketNumber: 2, LastPacketNumber: 1301}))
|
||||
})
|
||||
|
||||
|
@ -125,7 +125,7 @@ var _ = Describe("AckFrame", func() {
|
|||
frame, err := ParseAckFrame(b, 32)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.LargestObserved).To(Equal(protocol.PacketNumber(803)))
|
||||
Expect(len(frame.NackRanges)).To(Equal(2))
|
||||
Expect(frame.NackRanges).To(HaveLen(2))
|
||||
Expect(frame.NackRanges[0]).To(Equal(NackRange{FirstPacketNumber: 403, LastPacketNumber: 802}))
|
||||
Expect(frame.NackRanges[1]).To(Equal(NackRange{FirstPacketNumber: 2, LastPacketNumber: 401}))
|
||||
})
|
||||
|
@ -522,7 +522,7 @@ var _ = Describe("AckFrame", func() {
|
|||
frame, err := ParseAckFrame(r, 32)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.LargestObserved).To(Equal(frameOrig.LargestObserved))
|
||||
Expect(len(frame.NackRanges)).To(Equal(len(frameOrig.NackRanges)))
|
||||
Expect(frame.NackRanges).To(HaveLen(len(frameOrig.NackRanges)))
|
||||
Expect(frame.NackRanges).To(Equal(frameOrig.NackRanges))
|
||||
})
|
||||
|
||||
|
@ -542,7 +542,7 @@ var _ = Describe("AckFrame", func() {
|
|||
frame, err := ParseAckFrame(r, 32)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.LargestObserved).To(Equal(frameOrig.LargestObserved))
|
||||
Expect(len(frame.NackRanges)).To(Equal(len(frameOrig.NackRanges)))
|
||||
Expect(frame.NackRanges).To(HaveLen(len(frameOrig.NackRanges)))
|
||||
Expect(frame.NackRanges).To(Equal(frameOrig.NackRanges))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -24,7 +24,7 @@ var _ = Describe("ConnectionCloseFrame", func() {
|
|||
frame, err := ParseConnectionCloseFrame(b)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.ErrorCode).To(Equal(protocol.ErrorCode(0xDECAFBAD)))
|
||||
Expect(len(frame.ReasonPhrase)).To(Equal(0))
|
||||
Expect(frame.ReasonPhrase).To(BeEmpty())
|
||||
Expect(b.Len()).To(Equal(0))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -80,7 +80,7 @@ var _ = Describe("Packet packer", func() {
|
|||
Expect(p).ToNot(BeNil())
|
||||
b := &bytes.Buffer{}
|
||||
f.Write(b, 0)
|
||||
Expect(len(p.frames)).To(Equal(1))
|
||||
Expect(p.frames).To(HaveLen(1))
|
||||
Expect(p.raw).To(ContainSubstring(string(b.Bytes())))
|
||||
})
|
||||
|
||||
|
@ -99,8 +99,8 @@ var _ = Describe("Packet packer", func() {
|
|||
p, err := packer.PackPacket(nil, []frames.Frame{&frames.ConnectionCloseFrame{}}, false)
|
||||
Expect(p).ToNot(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(p.frames)).To(Equal(1))
|
||||
Expect(p.raw).NotTo(HaveLen(0))
|
||||
Expect(p.frames).To(HaveLen(1))
|
||||
Expect(p.raw).NotTo(BeEmpty())
|
||||
})
|
||||
|
||||
It("packs a StopWaitingFrame first", func() {
|
||||
|
@ -108,7 +108,7 @@ var _ = Describe("Packet packer", func() {
|
|||
p, err := packer.PackPacket(swf, []frames.Frame{&frames.ConnectionCloseFrame{}}, false)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(p).ToNot(BeNil())
|
||||
Expect(len(p.frames)).To(Equal(2))
|
||||
Expect(p.frames).To(HaveLen(2))
|
||||
Expect(p.frames[0]).To(Equal(swf))
|
||||
})
|
||||
|
||||
|
@ -140,10 +140,10 @@ var _ = Describe("Packet packer", func() {
|
|||
packer.controlFrames = controlFrames
|
||||
payloadFrames, err := packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(maxFramesPerPacket))
|
||||
Expect(payloadFrames).To(HaveLen(maxFramesPerPacket))
|
||||
payloadFrames, err = packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(BeZero())
|
||||
Expect(payloadFrames).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("packs a lot of control frames into 2 packets if they don't fit into one", func() {
|
||||
|
@ -159,10 +159,10 @@ var _ = Describe("Packet packer", func() {
|
|||
packer.controlFrames = controlFrames
|
||||
payloadFrames, err := packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(maxFramesPerPacket))
|
||||
Expect(payloadFrames).To(HaveLen(maxFramesPerPacket))
|
||||
payloadFrames, err = packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(10))
|
||||
Expect(payloadFrames).To(HaveLen(10))
|
||||
})
|
||||
|
||||
It("only increases the packet number when there is an actual packet to send", func() {
|
||||
|
@ -230,10 +230,10 @@ var _ = Describe("Packet packer", func() {
|
|||
packer.controlFrames = controlFrames
|
||||
payloadFrames, err := packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(maxFramesPerPacket))
|
||||
Expect(payloadFrames).To(HaveLen(maxFramesPerPacket))
|
||||
payloadFrames, err = packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(10))
|
||||
Expect(payloadFrames).To(HaveLen(10))
|
||||
})
|
||||
|
||||
It("only packs a WindowUpdateFrame once", func() {
|
||||
|
@ -263,11 +263,11 @@ var _ = Describe("Packet packer", func() {
|
|||
packer.AddStreamFrame(f)
|
||||
payloadFrames, err := packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(1))
|
||||
Expect(payloadFrames).To(HaveLen(1))
|
||||
Expect(payloadFrames[0].(*frames.StreamFrame).DataLenPresent).To(BeFalse())
|
||||
payloadFrames, err = packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(0))
|
||||
Expect(payloadFrames).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("correctly handles a stream frame with one byte less than maximum size", func() {
|
||||
|
@ -284,8 +284,8 @@ var _ = Describe("Packet packer", func() {
|
|||
packer.AddStreamFrame(f2)
|
||||
p, err := packer.PackPacket(nil, []frames.Frame{}, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(protocol.ByteCount(len(p.raw))).To(Equal(protocol.MaxPacketSize - 1))
|
||||
Expect(len(p.frames)).To(Equal(1))
|
||||
Expect(p.raw).To(HaveLen(int(protocol.MaxPacketSize - 1)))
|
||||
Expect(p.frames).To(HaveLen(1))
|
||||
Expect(p.frames[0].(*frames.StreamFrame).DataLenPresent).To(BeFalse())
|
||||
p, err = packer.PackPacket(nil, []frames.Frame{}, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
@ -315,7 +315,7 @@ var _ = Describe("Packet packer", func() {
|
|||
f1.Write(b, 0)
|
||||
f2.Write(b, 0)
|
||||
f3.Write(b, 0)
|
||||
Expect(len(p.frames)).To(Equal(3))
|
||||
Expect(p.frames).To(HaveLen(3))
|
||||
Expect(p.frames[0].(*frames.StreamFrame).DataLenPresent).To(BeTrue())
|
||||
Expect(p.frames[1].(*frames.StreamFrame).DataLenPresent).To(BeTrue())
|
||||
Expect(p.frames[2].(*frames.StreamFrame).DataLenPresent).To(BeFalse())
|
||||
|
@ -335,17 +335,17 @@ var _ = Describe("Packet packer", func() {
|
|||
packer.AddStreamFrame(f)
|
||||
payloadFrames, err := packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(1))
|
||||
Expect(payloadFrames).To(HaveLen(1))
|
||||
Expect(payloadFrames[0].(*frames.StreamFrame).DataLenPresent).To(BeFalse())
|
||||
Expect(protocol.ByteCount(len(payloadFrames[0].(*frames.StreamFrame).Data))).To(Equal(maxStreamFrameDataLen))
|
||||
Expect(payloadFrames[0].(*frames.StreamFrame).Data).To(HaveLen(int(maxStreamFrameDataLen)))
|
||||
payloadFrames, err = packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(1))
|
||||
Expect(len(payloadFrames[0].(*frames.StreamFrame).Data)).To(Equal(200))
|
||||
Expect(payloadFrames).To(HaveLen(1))
|
||||
Expect(payloadFrames[0].(*frames.StreamFrame).Data).To(HaveLen(200))
|
||||
Expect(payloadFrames[0].(*frames.StreamFrame).DataLenPresent).To(BeFalse())
|
||||
payloadFrames, err = packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(0))
|
||||
Expect(payloadFrames).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("packs 2 stream frames that are too big for one packet correctly", func() {
|
||||
|
@ -362,17 +362,17 @@ var _ = Describe("Packet packer", func() {
|
|||
packer.AddStreamFrame(f2)
|
||||
p, err := packer.PackPacket(nil, []frames.Frame{}, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(p.frames)).To(Equal(1))
|
||||
Expect(p.frames).To(HaveLen(1))
|
||||
Expect(p.frames[0].(*frames.StreamFrame).DataLenPresent).To(BeFalse())
|
||||
Expect(protocol.ByteCount(len(p.raw))).To(Equal(protocol.MaxPacketSize))
|
||||
Expect(p.raw).To(HaveLen(int(protocol.MaxPacketSize)))
|
||||
p, err = packer.PackPacket(nil, []frames.Frame{}, true)
|
||||
Expect(len(p.frames)).To(Equal(2))
|
||||
Expect(p.frames).To(HaveLen(2))
|
||||
Expect(p.frames[0].(*frames.StreamFrame).DataLenPresent).To(BeTrue())
|
||||
Expect(p.frames[1].(*frames.StreamFrame).DataLenPresent).To(BeFalse())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(protocol.ByteCount(len(p.raw))).To(Equal(protocol.MaxPacketSize))
|
||||
Expect(p.raw).To(HaveLen(int(protocol.MaxPacketSize)))
|
||||
p, err = packer.PackPacket(nil, []frames.Frame{}, true)
|
||||
Expect(len(p.frames)).To(Equal(1))
|
||||
Expect(p.frames).To(HaveLen(1))
|
||||
Expect(p.frames[0].(*frames.StreamFrame).DataLenPresent).To(BeFalse())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(p).ToNot(BeNil())
|
||||
|
@ -391,7 +391,7 @@ var _ = Describe("Packet packer", func() {
|
|||
p, err := packer.PackPacket(nil, []frames.Frame{}, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(p).ToNot(BeNil())
|
||||
Expect(protocol.ByteCount(len(p.raw))).To(Equal(protocol.MaxPacketSize))
|
||||
Expect(p.raw).To(HaveLen(int(protocol.MaxPacketSize)))
|
||||
})
|
||||
|
||||
It("splits a stream frame larger than the maximum size", func() {
|
||||
|
@ -405,10 +405,10 @@ var _ = Describe("Packet packer", func() {
|
|||
packer.AddStreamFrame(f)
|
||||
payloadFrames, err := packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(1))
|
||||
Expect(payloadFrames).To(HaveLen(1))
|
||||
payloadFrames, err = packer.composeNextPacket(nil, publicHeaderLen, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(payloadFrames)).To(Equal(1))
|
||||
Expect(payloadFrames).To(HaveLen(1))
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ var _ = Describe("Packet unpacker", func() {
|
|||
packet, err := unpacker.Unpack(hdrBin, hdr, r)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(packet.entropyBit).To(BeTrue())
|
||||
Expect(packet.frames).To(HaveLen(0))
|
||||
Expect(packet.frames).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("unpacks stream frames", func() {
|
||||
|
@ -68,7 +68,7 @@ var _ = Describe("Packet unpacker", func() {
|
|||
setReader(buf.Bytes())
|
||||
packet, err := unpacker.Unpack(hdrBin, hdr, r)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(packet.frames)).To(Equal(1))
|
||||
Expect(packet.frames).To(HaveLen(1))
|
||||
readFrame := packet.frames[0].(*frames.AckFrame)
|
||||
Expect(readFrame.LargestObserved).To(Equal(protocol.PacketNumber(0x13)))
|
||||
Expect(readFrame.Entropy).To(Equal(byte(0x37)))
|
||||
|
@ -84,7 +84,7 @@ var _ = Describe("Packet unpacker", func() {
|
|||
setReader([]byte{0, 0, 0})
|
||||
packet, err := unpacker.Unpack(hdrBin, hdr, r)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(packet.frames).To(HaveLen(0))
|
||||
Expect(packet.frames).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("unpacks RST_STREAM frames", func() {
|
||||
|
|
|
@ -498,7 +498,7 @@ var _ = Describe("Session", func() {
|
|||
}}
|
||||
Expect(session.receivedPackets).NotTo(Receive())
|
||||
session.tryDecryptingQueuedPackets()
|
||||
Expect(session.undecryptablePackets).To(HaveLen(0))
|
||||
Expect(session.undecryptablePackets).To(BeEmpty())
|
||||
Expect(session.receivedPackets).To(Receive())
|
||||
})
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ var _ = Describe("Stream", func() {
|
|||
}()
|
||||
|
||||
n, err := str.Write([]byte{0xDE, 0xCA, 0xFB, 0xAD})
|
||||
Expect(len(handler.frames)).To(Equal(2))
|
||||
Expect(handler.frames).To(HaveLen(2))
|
||||
Expect(b).To(BeTrue())
|
||||
Expect(n).To(Equal(4))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue