mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
only skip packet numbers in the application data packet number space
This commit is contained in:
parent
e8e6c7b47e
commit
416d88990b
3 changed files with 67 additions and 24 deletions
|
@ -6,16 +6,29 @@ import (
|
|||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Packet Number Generator", func() {
|
||||
var png *packetNumberGenerator
|
||||
var _ = Describe("Sequential Packet Number Generator", func() {
|
||||
It("generates sequential packet numbers", func() {
|
||||
const initialPN protocol.PacketNumber = 123
|
||||
png := newSequentialPacketNumberGenerator(initialPN)
|
||||
|
||||
for i := initialPN; i < initialPN+1000; i++ {
|
||||
Expect(png.Peek()).To(Equal(i))
|
||||
Expect(png.Peek()).To(Equal(i))
|
||||
Expect(png.Pop()).To(Equal(i))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
var _ = Describe("Skipping Packet Number Generator", func() {
|
||||
var png *skippingPacketNumberGenerator
|
||||
const initialPN protocol.PacketNumber = 8
|
||||
|
||||
BeforeEach(func() {
|
||||
png = newPacketNumberGenerator(initialPN, 100)
|
||||
png = newSkippingPacketNumberGenerator(initialPN, 100).(*skippingPacketNumberGenerator)
|
||||
})
|
||||
|
||||
It("can be initialized to return any first packet number", func() {
|
||||
png = newPacketNumberGenerator(12345, 100)
|
||||
png = newSkippingPacketNumberGenerator(12345, 100).(*skippingPacketNumberGenerator)
|
||||
Expect(png.Pop()).To(Equal(protocol.PacketNumber(12345)))
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue