github.com/zignig/go-ipfs@v0.0.0-20141111235910-c9e5fdf55a52/exchange/bitswap/strategy/math_test.go (about)

     1  package strategy
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestProbabilitySendDecreasesAsRatioIncreases(t *testing.T) {
     8  	grateful := debtRatio{BytesSent: 0, BytesRecv: 10000}
     9  	pWhenGrateful := probabilitySend(grateful.Value())
    10  
    11  	abused := debtRatio{BytesSent: 10000, BytesRecv: 0}
    12  	pWhenAbused := probabilitySend(abused.Value())
    13  
    14  	if pWhenGrateful < pWhenAbused {
    15  		t.Fail()
    16  	}
    17  }