diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-07-06 21:18:14 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-07-06 21:18:14 -0700 |
commit | 459bb4531f92f8663afb6f36aa9be5b789bd591f (patch) | |
tree | f14e6c06b8e5c63612d1ff36f8cab40ae8a99d20 /vendor/golang.org/x/net/http2/flow_test.go | |
parent | 34a3fe426b33a63f2d8e02d4a70c88f137fa5410 (diff) |
Update vendor dependencies
Diffstat (limited to 'vendor/golang.org/x/net/http2/flow_test.go')
-rw-r--r-- | vendor/golang.org/x/net/http2/flow_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/golang.org/x/net/http2/flow_test.go b/vendor/golang.org/x/net/http2/flow_test.go index 859adf5..7ae82c7 100644 --- a/vendor/golang.org/x/net/http2/flow_test.go +++ b/vendor/golang.org/x/net/http2/flow_test.go @@ -49,5 +49,39 @@ func TestFlowAdd(t *testing.T) { if f.add(1) { t.Fatal("adding 1 to max shouldn't be allowed") } +} + +func TestFlowAddOverflow(t *testing.T) { + var f flow + if !f.add(0) { + t.Fatal("failed to add 0") + } + if !f.add(-1) { + t.Fatal("failed to add -1") + } + if !f.add(0) { + t.Fatal("failed to add 0") + } + if !f.add(1) { + t.Fatal("failed to add 1") + } + if !f.add(1) { + t.Fatal("failed to add 1") + } + if !f.add(0) { + t.Fatal("failed to add 0") + } + if !f.add(-3) { + t.Fatal("failed to add -3") + } + if got, want := f.available(), int32(-2); got != want { + t.Fatalf("size = %d; want %d", got, want) + } + if !f.add(1<<31 - 1) { + t.Fatal("failed to add 2^31-1") + } + if got, want := f.available(), int32(1+-3+(1<<31-1)); got != want { + t.Fatalf("size = %d; want %d", got, want) + } } |