forked from quic-go/quic-go
@@ -62,6 +62,14 @@ func MaxInt64(a, b int64) int64 {
|
||||
return b
|
||||
}
|
||||
|
||||
// MinByteCount returns the minimum of two ByteCounts
|
||||
func MinByteCount(a, b protocol.ByteCount) protocol.ByteCount {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// MaxDuration returns the max duration
|
||||
func MaxDuration(a, b time.Duration) time.Duration {
|
||||
if a > b {
|
||||
|
||||
@@ -62,6 +62,11 @@ var _ = Describe("Min / Max", func() {
|
||||
Expect(MinInt64(5, 7)).To(Equal(int64(5)))
|
||||
})
|
||||
|
||||
It("returns the minimum ByteCount", func() {
|
||||
Expect(MinByteCount(7, 5)).To(Equal(protocol.ByteCount(5)))
|
||||
Expect(MinByteCount(5, 7)).To(Equal(protocol.ByteCount(5)))
|
||||
})
|
||||
|
||||
It("returns packet number min", func() {
|
||||
Expect(MinPacketNumber(1, 2)).To(Equal(protocol.PacketNumber(1)))
|
||||
Expect(MinPacketNumber(2, 1)).To(Equal(protocol.PacketNumber(1)))
|
||||
|
||||
Reference in New Issue
Block a user