MCPcopy Create free account
hub / github.com/imroc/req / TestTakeInflows

Function TestTakeInflows

internal/http2/flow_test.go:51–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestTakeInflows(t *testing.T) {
52 var f1, f2 inflow
53 f1.init(1000)
54 f2.init(500)
55 if !takeInflows(&f1, &f2, 400) {
56 t.Fatal("takeInflows(400) should succeed")
57 }
58 if f1.avail != 600 {
59 t.Fatalf("f1.avail = %d, want 600", f1.avail)
60 }
61 if f2.avail != 100 {
62 t.Fatalf("f2.avail = %d, want 100", f2.avail)
63 }
64 if takeInflows(&f1, &f2, 200) {
65 t.Fatal("takeInflows(200) should fail (f2 only has 100)")
66 }
67}
68
69func TestOutflowAvailable(t *testing.T) {
70 var conn outflow

Callers

nothing calls this directly

Calls 2

initMethod · 0.95
takeInflowsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…