2020-08-11 10:26:54 +00:00
|
|
|
package messagepool
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestBlockProbability(t *testing.T) {
|
|
|
|
mp := &MessagePool{}
|
2020-08-11 17:47:50 +00:00
|
|
|
bp := mp.blockProbabilities(1 - 0.15)
|
|
|
|
t.Logf("%+v\n", bp)
|
|
|
|
for i := 0; i < len(bp)-1; i++ {
|
|
|
|
if bp[i] < bp[i+1] {
|
|
|
|
t.Fatalf("expected decreasing block probabilities for this quality: %d %f %f",
|
|
|
|
i, bp[i], bp[i+1])
|
|
|
|
}
|
|
|
|
}
|
2020-08-11 10:26:54 +00:00
|
|
|
}
|