turn probability eyeballing into an actual test

This commit is contained in:
vyzo 2020-08-11 20:47:50 +03:00
parent a45febc065
commit 9032163c5a

View File

@ -4,5 +4,12 @@ import "testing"
func TestBlockProbability(t *testing.T) { func TestBlockProbability(t *testing.T) {
mp := &MessagePool{} mp := &MessagePool{}
t.Logf("%+v\n", mp.blockProbabilities(1-0.15)) 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])
}
}
} }