mirror of https://github.com/panjf2000/ants.git
🔋Fix some minor mistakes in test cases
This commit is contained in:
parent
26cbd886a9
commit
94763266ad
17
ants_test.go
17
ants_test.go
|
@ -445,12 +445,12 @@ func TestRestCodeCoverage(t *testing.T) {
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
pprem.Submit(demoFunc)
|
pprem.Submit(demoFunc)
|
||||||
}
|
}
|
||||||
t.Logf("pool with pre-malloc, capacity:%d", pprem.Cap())
|
t.Logf("pre-malloc pool, capacity:%d", pprem.Cap())
|
||||||
t.Logf("pool with pre-malloc, running workers number:%d", pprem.Running())
|
t.Logf("pre-malloc pool, running workers number:%d", pprem.Running())
|
||||||
t.Logf("pool with pre-malloc, free workers number:%d", pprem.Free())
|
t.Logf("pre-malloc pool, free workers number:%d", pprem.Free())
|
||||||
pprem.Tune(TestSize)
|
pprem.Tune(TestSize)
|
||||||
pprem.Tune(TestSize / 10)
|
pprem.Tune(TestSize / 10)
|
||||||
t.Logf("pool with pre-malloc, after tuning capacity, capacity:%d, running:%d", p0.Cap(), p0.Running())
|
t.Logf("pre-malloc pool, after tuning capacity, capacity:%d, running:%d", pprem.Cap(), pprem.Running())
|
||||||
|
|
||||||
p, _ := ants.NewPoolWithFunc(TestSize, demoPoolFunc)
|
p, _ := ants.NewPoolWithFunc(TestSize, demoPoolFunc)
|
||||||
defer p.Invoke(Param)
|
defer p.Invoke(Param)
|
||||||
|
@ -473,10 +473,11 @@ func TestRestCodeCoverage(t *testing.T) {
|
||||||
ppremWithFunc.Invoke(Param)
|
ppremWithFunc.Invoke(Param)
|
||||||
}
|
}
|
||||||
time.Sleep(ants.DEFAULT_CLEAN_INTERVAL_TIME * time.Second)
|
time.Sleep(ants.DEFAULT_CLEAN_INTERVAL_TIME * time.Second)
|
||||||
t.Logf("pool with func, capacity:%d", ppremWithFunc.Cap())
|
t.Logf("pre-malloc pool with func, capacity:%d", ppremWithFunc.Cap())
|
||||||
t.Logf("pool with func, running workers number:%d", ppremWithFunc.Running())
|
t.Logf("pre-malloc pool with func, running workers number:%d", ppremWithFunc.Running())
|
||||||
t.Logf("pool with func, free workers number:%d", ppremWithFunc.Free())
|
t.Logf("pre-malloc pool with func, free workers number:%d", ppremWithFunc.Free())
|
||||||
ppremWithFunc.Tune(TestSize)
|
ppremWithFunc.Tune(TestSize)
|
||||||
ppremWithFunc.Tune(TestSize / 10)
|
ppremWithFunc.Tune(TestSize / 10)
|
||||||
t.Logf("pool with func, after tuning capacity, capacity:%d, running:%d", p.Cap(), p.Running())
|
t.Logf("pre-malloc pool with func, after tuning capacity, capacity:%d, running:%d", ppremWithFunc.Cap(),
|
||||||
|
ppremWithFunc.Running())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue