mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 11:27:42 +08:00
18 lines
366 B
Go
18 lines
366 B
Go
package bitswap
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestProbabilitySendDecreasesAsRatioIncreases(t *testing.T) {
|
|
grateful := debtRatio{BytesSent: 0, BytesRecv: 10000}
|
|
pWhenGrateful := probabilitySend(grateful.Value())
|
|
|
|
abused := debtRatio{BytesSent: 10000, BytesRecv: 0}
|
|
pWhenAbused := probabilitySend(abused.Value())
|
|
|
|
if pWhenGrateful < pWhenAbused {
|
|
t.Fail()
|
|
}
|
|
}
|