mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
quicvarint: export Min and Max (#3253)
This commit is contained in:
parent
8ecbb05d44
commit
4a9bd794bf
2 changed files with 16 additions and 0 deletions
|
@ -9,6 +9,12 @@ import (
|
|||
|
||||
// taken from the QUIC draft
|
||||
const (
|
||||
// Min is the minimum value allowed for a QUIC varint.
|
||||
Min = 0
|
||||
|
||||
// Max is the maximum allowed value for a QUIC varint (2^62-1).
|
||||
Max = maxVarInt8
|
||||
|
||||
maxVarInt1 = 63
|
||||
maxVarInt2 = 16383
|
||||
maxVarInt4 = 1073741823
|
||||
|
|
|
@ -8,6 +8,16 @@ import (
|
|||
)
|
||||
|
||||
var _ = Describe("Varint encoding / decoding", func() {
|
||||
Context("limits", func() {
|
||||
Specify("Min == 0", func() {
|
||||
Expect(Min).To(Equal(0))
|
||||
})
|
||||
|
||||
Specify("Max == 2^62-1", func() {
|
||||
Expect(uint64(Max)).To(Equal(uint64(1<<62 - 1)))
|
||||
})
|
||||
})
|
||||
|
||||
Context("decoding", func() {
|
||||
It("reads a 1 byte number", func() {
|
||||
b := bytes.NewReader([]byte{0b00011001})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue