Answer architecture round 1: rows.Options checked whole in internal/rows, Owner and ProveStepUp, neutral pin docs, one walk position, tests of internal/rows and Weighted, and a true README list of Fake's failures

This commit is contained in:
2026-10-05 21:48:33 +02:00
committed by Lillem4n
parent 707cd6b203
commit 29a5314f60
11 changed files with 279 additions and 126 deletions
+13
View File
@@ -38,3 +38,16 @@ func TestCountersCountFromOneEach(t *testing.T) {
t.Fatalf("a new state's Seq = %d, want 1", got)
}
}
func TestWeightedDrawsByWeight(t *testing.T) {
s := New(1)
counts := make([]int, 3)
for i := 0; i < 30000; i++ {
counts[s.Weighted([]float64{1, 2, 6})]++
}
for i, want := range []float64{1.0 / 6, 1.0 / 6, 4.0 / 6} {
if share := float64(counts[i]) / 30000; share < want-0.02 || share > want+0.02 {
t.Errorf("index %d drew a share of %.3f, want about %.3f", i, share, want)
}
}
}