math_test.go 367 Bytes
Newer Older
1
package strategy
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

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()
	}
}