From 9f5df74bd172986b868c21183e5e3e05b302bfac Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Fri, 8 Nov 2019 11:34:19 +0700 Subject: [PATCH] add a test that protocol.MaxStreamCount has the correct value --- internal/protocol/stream_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/protocol/stream_test.go b/internal/protocol/stream_test.go index a8d4654cb..4209f8a0c 100644 --- a/internal/protocol/stream_test.go +++ b/internal/protocol/stream_test.go @@ -56,5 +56,15 @@ var _ = Describe("Stream ID", func() { Expect(StreamNum(100).StreamID(StreamTypeUni, PerspectiveClient)).To(Equal(StreamID(398))) Expect(StreamNum(100).StreamID(StreamTypeUni, PerspectiveServer)).To(Equal(StreamID(399))) }) + + It("has the right value for MaxStreamCount", func() { + const maxStreamID = StreamID(1<<62 - 1) + for _, dir := range []StreamType{StreamTypeUni, StreamTypeBidi} { + for _, pers := range []Perspective{PerspectiveClient, PerspectiveServer} { + Expect(MaxStreamCount.StreamID(dir, pers)).To(BeNumerically("<=", maxStreamID)) + Expect((MaxStreamCount + 1).StreamID(dir, pers)).To(BeNumerically(">", maxStreamID)) + } + } + }) }) })