calculate NACK ranges in the correct order expected by the ACK frame writer

fixes #43
This commit is contained in:
Marten Seemann 2016-05-03 18:31:02 +07:00
parent 6700672440
commit 08d96d2a69
2 changed files with 8 additions and 14 deletions

View file

@ -117,8 +117,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[0].FirstPacketNumber).To(Equal(protocol.PacketNumber(5)))
Expect(nackRanges[0].LastPacketNumber).To(Equal(protocol.PacketNumber(5)))
Expect(nackRanges[0]).To(Equal(frames.NackRange{FirstPacketNumber: 5, LastPacketNumber: 5}))
Expect(handler.highestInOrderObserved).To(Equal(protocol.PacketNumber(4)))
Expect(entropy).To(Equal(expectedEntropy))
})
@ -139,8 +138,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[0].FirstPacketNumber).To(Equal(protocol.PacketNumber(5)))
Expect(nackRanges[0].LastPacketNumber).To(Equal(protocol.PacketNumber(6)))
Expect(nackRanges[0]).To(Equal(frames.NackRange{FirstPacketNumber: 5, LastPacketNumber: 6}))
Expect(handler.highestInOrderObserved).To(Equal(protocol.PacketNumber(4)))
Expect(entropy).To(Equal(expectedEntropy))
})
@ -161,10 +159,8 @@ var _ = Describe("receivedPacketHandler", func() {
Expect(handler.largestObserved).To(Equal(protocol.PacketNumber(9)))
nackRanges, entropy := handler.getNackRanges()
Expect(len(nackRanges)).To(Equal(2))
Expect(nackRanges[0].FirstPacketNumber).To(Equal(protocol.PacketNumber(3)))
Expect(nackRanges[0].LastPacketNumber).To(Equal(protocol.PacketNumber(3)))
Expect(nackRanges[1].FirstPacketNumber).To(Equal(protocol.PacketNumber(7)))
Expect(nackRanges[1].LastPacketNumber).To(Equal(protocol.PacketNumber(7)))
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)))
Expect(entropy).To(Equal(expectedEntropy))
})
@ -182,10 +178,8 @@ var _ = Describe("receivedPacketHandler", func() {
Expect(handler.largestObserved).To(Equal(protocol.PacketNumber(9)))
nackRanges, entropy := handler.getNackRanges()
Expect(len(nackRanges)).To(Equal(2))
Expect(nackRanges[0].FirstPacketNumber).To(Equal(protocol.PacketNumber(2)))
Expect(nackRanges[0].LastPacketNumber).To(Equal(protocol.PacketNumber(4)))
Expect(nackRanges[1].FirstPacketNumber).To(Equal(protocol.PacketNumber(7)))
Expect(nackRanges[1].LastPacketNumber).To(Equal(protocol.PacketNumber(8)))
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)))
Expect(entropy).To(Equal(expectedEntropy))
})