--------------------------------------------------------------------------- Property: searchKeys is deterministic and bounded on arbitrary bytes --------------------------------------------------------------------------- reqproof:proptest searchKeys Verifies: SYS-REQ-001 [property]
(t *testing.T)
| 592 | // reqproof:proptest searchKeys |
| 593 | // Verifies: SYS-REQ-001 [property] |
| 594 | func TestPropertySearchKeysDeterminism(t *testing.T) { |
| 595 | r := newRNG(jsonSeed + 7) |
| 596 | const iterations = 2000 |
| 597 | for i := 0; i < iterations; i++ { |
| 598 | raw := randomBytes(r, 64) |
| 599 | key := randKey(r) |
| 600 | a := searchKeys(raw, key) |
| 601 | b := searchKeys(raw, key) |
| 602 | if a != b { |
| 603 | t.Fatalf("searchKeys non-deterministic on input %q key=%q: %d vs %d", raw, key, a, b) |
| 604 | } |
| 605 | // Result is either -1 (not found) or a valid index into raw. |
| 606 | if a != -1 && (a < 0 || a >= len(raw)) { |
| 607 | t.Fatalf("searchKeys returned out-of-range index %d on input %q (len=%d)", a, raw, len(raw)) |
| 608 | } |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | // --------------------------------------------------------------------------- |
| 613 | // Property: findKeyStart is deterministic on arbitrary bytes |
nothing calls this directly
no test coverage detected