Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/matching/clamp_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/matching/clamp_test.go |
| Original SHA-256 | 622e82997072312837b2e6b64c4c7f48483c2dee6fc2638dd6fae13bda292758 |
| Git blob SHA | 47b64903f1bf23e43969205d6431900528e4e78f |
| Reading-copy SHA-256 | 622e82997072312837b2e6b64c4c7f48483c2dee6fc2638dd6fae13bda292758 |
Every recorded occurrence
These 3 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/modules/matching/clamp_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/matching/clamp_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/matching/clamp_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
Recovered source transcript
Download complete source text ↓27 lines · 0.9 KB
package matching
import "testing"
// TestClampMaxCandidates proves the slate candidate cap is bounded on both ends: a non positive request
// defaults, an in range request passes through, and an oversized or hostile request is clamped to the hard
// bound so a single slate generation can never balloon the transaction or the member count. A stress finding
// motivated this: MaxCandidates had no upper clamp.
func TestClampMaxCandidates(t *testing.T) {
cases := []struct{ in, want int32 }{
{0, defaultMaxCandidates},
{-1, defaultMaxCandidates},
{-1000000, defaultMaxCandidates},
{1, 1},
{499, 499},
{defaultMaxCandidates, defaultMaxCandidates},
{maxSlateCandidates, maxSlateCandidates},
{maxSlateCandidates + 1, maxSlateCandidates},
{1000000, maxSlateCandidates},
}
for _, c := range cases {
if got := clampMaxCandidates(c.in); got != c.want {
t.Errorf("clampMaxCandidates(%d) = %d, want %d", c.in, got, c.want)
}
}
}