(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func TestByteSemaphoreCapChangeDown1(t *testing.T) { |
| 50 | t.Parallel() |
| 51 | |
| 52 | // Things should make sense when capacity is adjusted down |
| 53 | |
| 54 | s := New(100) |
| 55 | |
| 56 | s.Take(75) |
| 57 | if s.available != 25 { |
| 58 | t.Error("bad state after take") |
| 59 | } |
| 60 | |
| 61 | s.SetCapacity(90) |
| 62 | if s.available != 15 { |
| 63 | t.Error("bad state after adjust") |
| 64 | } |
| 65 | |
| 66 | s.Give(75) |
| 67 | if s.available != 90 { |
| 68 | t.Error("bad state after give") |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | func TestByteSemaphoreCapChangeDown2(t *testing.T) { |
| 73 | t.Parallel() |
nothing calls this directly
no test coverage detected