The Prove tab gives each routine 3 seconds on the clock, and on a slow or busy machine that runs out before the proof does: claims stay open with nothing to say why. Now the prover marks a unit it ran out of time on (timedOut, and an out-of-time note), checkProperties says when the clock cut its inputs short, and ProofReport.clock carries the budget and the routines it stopped, so a caller can offer more time.
This commit is contained in:
9 files changed
+40
-11
No files matched your search
@@ -23,6 +23,7 @@ Mojo 1.2.0, held to the real compiler on the machine as well as on godbolt.org,
|
||||
|
||||
### Added
|
||||
|
||||
- A proof report says when the time on the clock, not the proof, stopped a routine: `ProofReport.clock` has the budget and the routines it stopped, each such unit has `timedOut` and a note, and `checkProperties` answers `timedOut` when the clock cut its inputs short. The site uses it to offer more time.
|
||||
- `pixi run mojo-local` builds every Mojo program core holds or generates on the pinned local compiler and holds the checker, the interpreter and the translator to it; `pixi run mojo-fuzz` does the same with generated programs.
|
||||
- `pixi run mojo-fuzz --statements` generates whole programs (loops, branches, collections, records, routines with BYREF), builds each with the pinned compiler and holds its output to the pseudo's line by line; `pixi run prove-fuzz` holds the prover to runs of generated programs. `pixi run ci` runs both on a fixed and a moving seed, and `pixi run nightly` runs them longer.
|
||||
- The Mojo interpreter runs what the translator writes: typed list literals, `List[T](slice)`, `ord` and `chr`, std.math's exact functions (`gcd`, `lcm`, `comb`, `hypot`, `fma`, `nextafter`, `ulp`, `copysign`, `isinf` and the others), `atof` of a decimal, and the `match` statement. What it declines on purpose (a fractional power, the transcendental functions, random numbers) says why.
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ The reference's "Limits" and "What stops a run" tables (`src/common/reference.ts
|
||||
- **What the parser reads.** A line inside more than 200 blocks, or brackets, calls, unary operators or types nested more than 200 deep, is one `too-deep` error (`MAX_NESTING` in `parse.ts`); so is a chain of more than 400 operands (`1 + 1 + ...`, `MAX_CHAIN`). The two are counted apart and a chain leans one level per operand, so brackets that each hold a long chain would multiply them; an expression whose tree is taller than 400 levels is therefore `too-deep` as well (`MAX_TREE`, measured where each expression is complete). No later stage (checker, analysis, translators) walks a taller tree; `tests/pseudo-robustness.test.mjs` takes the tallest through every one of them.
|
||||
- **What a run holds.** One collection holds at most 2,000,000 values (an ARRAY's declared size, `FILL`, a range walked by `FOR EACH` or listed for a quantifier), and a text at most 10,000,000 characters (`MAX_VALUES`, `MAX_TEXT` in `interp.ts`); past either the run stops (kind `value`) instead of allocating.
|
||||
- **How long a run goes.** The step limit (20,000 in the app's runs, `maxSteps`) stops a loop that may never end (kind `limit`). The positions FORALL, EXISTS, SUM and sets written by rule visit are counted apart, up to 100 per step allowed, so one quantifier inside another cannot run without end. Calls go 400 deep (`maxDepth`, kind `depth`); a recursion whose call sits inside many nested blocks can exhaust the engine underneath before 400 calls (with ten blocks around the call, somewhere between 200 and 300 calls, varying from run to run), which is the same stop, at the line the run was on.
|
||||
- **The Prove tab's budget.** The verifier's work is counted, not timed (`work` in `logic.ts`): one obligation's proof, one subroutine's paths and invariants, its proofs, and the whole program each have a budget, the same on every machine, and past one the answer is open ("too large to prove here") or the subroutine partial, never proved ([limits.md](limits.md#proving-and-testing)). A wall-clock budget stays behind them as a last resort: `provePseudo` gives the verifier 3 seconds per unit, then tries generated inputs on each routine within a counted budget of steps and also for up to 3 seconds (`checkProperties` with `maxWork` and `budgetMs`): a slow routine is tried on fewer inputs, not waited for. The 3 seconds are the Prove tab's (`PROVE_BUDGET_MS`); a caller gives another with `provePseudo(parsed, { budgetMs })` or `Workspace.proofBudgetMs`, and the command line, `library-check` and the tests give none, so their answers do not depend on the machine ([limits.md](limits.md#proving-and-testing)).
|
||||
- **The Prove tab's budget.** The verifier's work is counted, not timed (`work` in `logic.ts`): one obligation's proof, one subroutine's paths and invariants, its proofs, and the whole program each have a budget, the same on every machine, and past one the answer is open ("too large to prove here") or the subroutine partial, never proved ([limits.md](limits.md#proving-and-testing)). A wall-clock budget stays behind them as a last resort: `provePseudo` gives the verifier 3 seconds per unit, then tries generated inputs on each routine within a counted budget of steps and also for up to 3 seconds (`checkProperties` with `maxWork` and `budgetMs`): a slow routine is tried on fewer inputs, not waited for. The 3 seconds are the Prove tab's (`PROVE_BUDGET_MS`); a caller gives another with `provePseudo(parsed, { budgetMs })` or `Workspace.proofBudgetMs`, and the command line, `library-check` and the tests give none, so their answers do not depend on the machine ([limits.md](limits.md#proving-and-testing)). A report says which routines the clock stopped (`ProofReport.clock`, and `timedOut` and an `out-of-time` note on the unit).
|
||||
- **Recording.** A recorded run (the stepper, the table of values) keeps a picture of the variables after every step, and a picture copies each variable the step changed. A large collection that changes at many steps is copied at each of them, so once the copies of a run come to more than 10,000,000 values (about 80 MB of numbers; `maxRecorded` in `interp.ts`), the trace ends with a step of kind `unrecorded` that says so, and the run goes on without recording: its output, result, stop and line counts are the whole run's. No program of the corpus, the exercises or the lessons comes near it (the largest copies about 42,000). `tests/pseudo-robustness.test.mjs` holds the cut with a small budget.
|
||||
|
||||
- **Checker errors and stops added in the 2026-11 audits** (each in `tests/pseudo-robustness.test.mjs`, `tests/numeric.test.mjs` or `tests/reference.test.mjs`): `too-deep` (the limits above), `literal-range` for a whole-number literal past 2^53 − 1 and a FLOAT or FLOAT32 literal past its largest value, `recursive-type`, `array-of-array`, `array-length` (an ARRAY given a LIST or ARRAY of another length, when both are written as numbers), `bad-member` (a SET of anything but single values). Stops: the collection and text caps, the quantifier positions, an ARRAY given a value of another length at a store, a call or a RETURN, a FOR counter declared with a sized type leaving its type, a partial sum or product of `SUM_OF` or `DOT` past 2^53 − 1, `CHR` of a surrogate half, `TO_FLOAT` or `INPUT` of text that is not a decimal number, and NaN or an infinity passed to a FLOAT parameter from outside without `USE IEEE`.
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ The prover's work is counted, not timed: each term it builds or visits, each cas
|
||||
| The routines of one program the fuzzer tests | `FUZZ_ROUTINES`, `src/common/workspace.ts` | the first 100 | A report with no cases: "Not tested: generated inputs cover the first 100 routines of a program, and this is routine N." |
|
||||
| The fuzzer's work for a whole program | `FUZZ_PROGRAM_INPUTS`, `src/common/workspace.ts` | 600 inputs' worth: 1,800,000 at the default budget | A report with no cases: "Not tested: the routines before this one took all the work the tests of one program may take (1,800,000 steps)." |
|
||||
|
||||
The wall-clock budget the Prove tab gives each subroutine (3 seconds, `PROVE_BUDGET_MS` in `src/services/pseudo.ts`) stays behind these as a last resort. It is the caller's: `provePseudo` and `Workspace.proofBudgetMs` take another, and what has to say the same thing on every machine takes none (`pixi run cli prove` unless `--budget-ms` gives one, `library-check`, the tests), so the counted budgets decide alone. The clock is the one part of a proof that depends on the machine: on CI's runner, where the README's example took more than its 3 seconds (it takes 5 milliseconds on the machine this was written on), 4 of its 6 obligations stayed open. A slow or busy device shows the same in the Prove tab: fewer obligations proved, more open, none wrongly proved. Measured on the machine this was written on: 20 nested `ABS` (or a matho pane `f(x) = ||||...x...||||` of 20 bars) took a 1 GB heap down before, and now ends in 0.1 seconds in a 128 MB heap; a subroutine at `UNIT_WORK` takes 0.7 to 2 seconds, one at `PROOF_WORK` about 1 second, and a program at `PROGRAM_WORK` about 4 seconds, each in a 128 MB heap. The most any program of the corpus takes is 234,000 units for one obligation, 145,000 for one subroutine's paths, 783,000 for its proofs and 886,000 for the whole program. `prove-fuzz` makes larger programs than anyone writes: the most in seeds 9137 and 22051 (800 programs each) are 768,000, 35,000,000 (a subroutine its 1.5-second wall-clock budget had already cut short), 5,100,000 and 38,000,000, and the proved obligations of both seeds are the same with the budgets as without. The cross-check is counted the same way: one input of a routine whose ENSURE nests 8 quantifiers visited 5,000,000 positions (7 seconds) before, and the whole cross-check of a routine now takes at most about 2 seconds; the most any routine of the corpus takes is 347,000 (`match-off-by-one`). The fuzzer runs a routine's inputs within its budget in about a second, a program's in about 2 (a program of 2,000 small routines, the first 100 fuzzed: 2 seconds); the most the corpus takes is 400,000 for one routine (kmers' `kmer_counts` in Mojo), 1,300 for one input, and every corpus program's report is the same as before.
|
||||
The wall-clock budget the Prove tab gives each subroutine (3 seconds, `PROVE_BUDGET_MS` in `src/services/pseudo.ts`) stays behind these as a last resort. It is the caller's: `provePseudo` and `Workspace.proofBudgetMs` take another, and what has to say the same thing on every machine takes none (`pixi run cli prove` unless `--budget-ms` gives one, `library-check`, the tests), so the counted budgets decide alone. The clock is the one part of a proof that depends on the machine: on CI's runner, where the README's example took more than its 3 seconds (it takes 5 milliseconds on the machine this was written on), 4 of its 6 obligations stayed open. A slow or busy device shows the same in the Prove tab: fewer obligations proved, more open, none wrongly proved. The report says when that happened (`clock.stopped` names the routines, each has `timedOut` and a note), and the site lets the reader give the prover more time (its `docs/app.md`). Measured on the machine this was written on: 20 nested `ABS` (or a matho pane `f(x) = ||||...x...||||` of 20 bars) took a 1 GB heap down before, and now ends in 0.1 seconds in a 128 MB heap; a subroutine at `UNIT_WORK` takes 0.7 to 2 seconds, one at `PROOF_WORK` about 1 second, and a program at `PROGRAM_WORK` about 4 seconds, each in a 128 MB heap. The most any program of the corpus takes is 234,000 units for one obligation, 145,000 for one subroutine's paths, 783,000 for its proofs and 886,000 for the whole program. `prove-fuzz` makes larger programs than anyone writes: the most in seeds 9137 and 22051 (800 programs each) are 768,000, 35,000,000 (a subroutine its 1.5-second wall-clock budget had already cut short), 5,100,000 and 38,000,000, and the proved obligations of both seeds are the same with the budgets as without. The cross-check is counted the same way: one input of a routine whose ENSURE nests 8 quantifiers visited 5,000,000 positions (7 seconds) before, and the whole cross-check of a routine now takes at most about 2 seconds; the most any routine of the corpus takes is 347,000 (`match-off-by-one`). The fuzzer runs a routine's inputs within its budget in about a second, a program's in about 2 (a program of 2,000 small routines, the first 100 fuzzed: 2 seconds); the most the corpus takes is 400,000 for one routine (kmers' `kmer_counts` in Mojo), 1,300 for one input, and every corpus program's report is the same as before.
|
||||
|
||||
## What the compiler does
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ const PSEUDO_LIMITS: RefEntry[] = [
|
||||
{ term: '20,000 steps', meaning: 'the steps a run may take here, and 100 positions visited by quantifiers for each (No end in sight)' },
|
||||
{ term: '400 calls deep', meaning: 'the deepest recursion a run follows (Too deep)' },
|
||||
{ term: '10,000,000 recorded values', meaning: 'what the pictures of a recorded run may copy; past it the trace ends with a step that says so and the run goes on without recording, its output and how it ends shown at the end' },
|
||||
{ term: '3 seconds to prove, 3 per routine to try', meaning: 'the Prove tab gives the prover 3 seconds for each routine, then tries generated inputs on each routine for up to 3 seconds; what each found in that time stands, and an obligation the prover could not finish stays open' },
|
||||
{ term: '3 seconds to prove, 3 per routine to try', meaning: 'the Prove tab gives the prover 3 seconds for each routine, then tries generated inputs on each routine for up to 3 seconds; what each found in that time stands, and an obligation the prover could not finish stays open. When the time ran out the tab says so, and its time limit can be raised: a slow or busy device proves less in 3 seconds, never anything wrong' },
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
+7
-1
@@ -93,8 +93,14 @@ export interface Obligation {
|
||||
}
|
||||
|
||||
export interface ProofReport {
|
||||
units: Array<{ name: string; kind: string; line: number; obligations: Obligation[]; inferred: string[]; notes: string[]; partial: boolean }>;
|
||||
/** `timedOut`: the time on the clock ran out on this routine (the prover's paths, or the inputs that cross-check it). */
|
||||
units: Array<{ name: string; kind: string; line: number; obligations: Obligation[]; inferred: string[]; notes: string[]; partial: boolean; timedOut?: boolean }>;
|
||||
counts: { proved: number; broken: number; open: number; total: number };
|
||||
/**
|
||||
* The time on the clock each routine had, in milliseconds (Infinity: none), and the routines it stopped. What the
|
||||
* clock stopped is open, never proved; with more time the same checker may get further.
|
||||
*/
|
||||
clock?: { budgetMs: number; stopped: string[] };
|
||||
}
|
||||
|
||||
export interface PropertyReport {
|
||||
|
||||
@@ -247,7 +247,7 @@ function* allStrings(maxLen, alphabet = DNA) {
|
||||
*
|
||||
* options = { count: 400, seed: 1, exhaustive: 4, reference, generators, alphabet, maxLength, budgetMs, maxWork }
|
||||
* maxWork: the steps and quantifier positions (`visits`) all the runs together may take; past it no more inputs
|
||||
* are tried (the inputs tried so far stand; `cutShort` says so), and a run cut short by it is not a failure. It is
|
||||
* are tried (the inputs tried so far stand; `cutShort` says so, and `timedOut` when it was the clock), and a run cut short by it is not a failure. It is
|
||||
* counted, so it ends at the same input on every machine: one run of a routine whose ENSURE nests quantifiers may
|
||||
* visit 5,000,000 positions, and took 7 seconds. `work` in the result says how much was used.
|
||||
* budgetMs: stop trying inputs after this long, the same way. Without either, every input is tried, however slow
|
||||
@@ -314,8 +314,10 @@ export function checkProperties(program, name, options = {}) {
|
||||
const show = (args) => `${sub.name}(${args.map((a, i) => formatValue(a, sub.params[i].type, { bareChar: true })).join(', ')})`;
|
||||
const started = Date.now();
|
||||
let cutShort = false;
|
||||
// cut short by the clock (budgetMs), not by the work: with more time more inputs would be tried
|
||||
let timedOut = false;
|
||||
for (const args of inputs) {
|
||||
if (opts.budgetMs && Date.now() - started > opts.budgetMs) { cutShort = true; break; }
|
||||
if (opts.budgetMs && Date.now() - started > opts.budgetMs) { cutShort = true; timedOut = true; break; }
|
||||
const k = show(args);
|
||||
if (seen.has(k)) continue;
|
||||
seen.add(k);
|
||||
@@ -343,7 +345,7 @@ export function checkProperties(program, name, options = {}) {
|
||||
if (failures.length >= opts.maxFailures) break;
|
||||
}
|
||||
}
|
||||
return { checked, skipped, failures, name: sub.name, work, ...(cutShort ? { cutShort } : {}) };
|
||||
return { checked, skipped, failures, name: sub.name, work, ...(cutShort ? { cutShort } : {}), ...(timedOut ? { timedOut } : {}) };
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
@@ -91,6 +91,8 @@ export interface UnitReport {
|
||||
inferred: Array<{ line: number; facts: string[] }>;
|
||||
notes: Note[];
|
||||
partial: boolean;
|
||||
/** The time on the clock (`budgetMs`) ran out before every path was followed or every obligation tried. */
|
||||
timedOut: boolean;
|
||||
}
|
||||
export interface Report { units: UnitReport[]; counts: { proved: number; unknown: number; total: number } }
|
||||
|
||||
@@ -258,6 +260,7 @@ class Exec {
|
||||
quiet = 0;
|
||||
deepNoted = false;
|
||||
deadline = 0;
|
||||
timedOut = false;
|
||||
entryEnv: Env = new Map();
|
||||
intArith: unknown = false;
|
||||
floatArith = false;
|
||||
@@ -667,7 +670,7 @@ class Exec {
|
||||
const next: State[] = [];
|
||||
for (const st of cur) next.push(...this.stmt(s, st, ctx));
|
||||
if (next.length > this.opts.maxPaths) { this.partial = true; cur = next.slice(0, this.opts.maxPaths); } else cur = next;
|
||||
if (this.deadline && Date.now() > this.deadline) { this.partial = true; return []; }
|
||||
if (this.deadline && Date.now() > this.deadline) { this.partial = true; this.timedOut = true; return []; }
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
@@ -1283,6 +1286,7 @@ const CLIP = 400;
|
||||
const clip = (s: string): string => (s.length > CLIP ? `${s.slice(0, CLIP)}…` : s);
|
||||
/** Work or size past what the checker can do: its own budget, or the engine's stack or a string or array too long. */
|
||||
const tooLarge = (err: unknown): boolean => err instanceof OutOfWork || err instanceof RangeError;
|
||||
const OUT_OF_TIME_NOTE = 'The checker ran out of time on this subroutine before it was done, so what it did not finish is open, not disproved. Given more time it may prove more.';
|
||||
const TOO_LARGE_NOTE = 'This subroutine is too large to prove here: the checker stopped before the end of it, so nothing in it is marked proved. Every run still checks it.';
|
||||
|
||||
export function verifyUnit(program: Program, unit: Unit, options: VerifyOptions = {}): UnitReport {
|
||||
@@ -1319,7 +1323,7 @@ export function verifyUnit(program: Program, unit: Unit, options: VerifyOptions
|
||||
else {
|
||||
for (const inst of gr.instances) {
|
||||
if (spent) { status = 'unknown'; failing = inst; inst.reason = TOO_LARGE; break; }
|
||||
if (Date.now() > ex.deadline + 2000) { status = 'unknown'; failing = inst; inst.reason = 'the checker ran out of time'; break; }
|
||||
if (Date.now() > ex.deadline + 2000) { ex.timedOut = true; status = 'unknown'; failing = inst; inst.reason = 'the checker ran out of time'; break; }
|
||||
let r: import('./solver.js').ProveResult;
|
||||
try { r = inst.goal ? prove(inst.hyps, inst.goal) : { status: 'unknown', reason: 'there is no goal to prove' }; } catch (err) {
|
||||
if (err instanceof OutOfWork) spent = true;
|
||||
@@ -1354,7 +1358,9 @@ export function verifyUnit(program: Program, unit: Unit, options: VerifyOptions
|
||||
obligations.push({ ...place, status, paths: instances.length, shown, instances: undefined } as Obligation);
|
||||
}
|
||||
obligations.sort((a, b) => (a.line ?? 0) - (b.line ?? 0) || KIND_ORDER.indexOf(a.kind) - KIND_ORDER.indexOf(b.kind));
|
||||
return { name: unit.name, kind: unit.kind, line: unit.node?.line ?? 1, obligations, inferred: ex.inferred, notes: ex.notes, partial: ex.partial };
|
||||
// said once, where it is true: with more time on the clock the same checker may get further
|
||||
if (ex.timedOut) ex.notes.push({ line: unit.node?.line ?? 1, kind: 'out-of-time', text: OUT_OF_TIME_NOTE });
|
||||
return { name: unit.name, kind: unit.kind, line: unit.node?.line ?? 1, obligations, inferred: ex.inferred, notes: ex.notes, partial: ex.partial, timedOut: ex.timedOut };
|
||||
}
|
||||
|
||||
const KIND_ORDER = ['require', 'index', 'key', 'slice', 'divide', 'overflow', 'argument', 'invariant-init', 'invariant-keep', 'decreases-bound', 'decreases-step', 'terminates', 'assert', 'ensure'];
|
||||
|
||||
@@ -136,6 +136,8 @@ export function provePseudo(parsed: Parsed<Study>, options: ProveOptions = {}):
|
||||
// a run breaks is "broken", the rest stay "open".
|
||||
const brokenKeys = new Set<string>();
|
||||
const brokenAt = new Set<string>();
|
||||
// the routines the clock stopped, the prover on its paths or the inputs before all were tried
|
||||
const stopped = new Set<string>(r.units.filter((u: any) => u.timedOut).map((u: any) => u.name as string));
|
||||
// the inputs share a budget of work (steps and quantifier positions), each routine's and the program's: a routine
|
||||
// past it is not tried, and its unproved obligations stay open
|
||||
let left = CROSS_CHECK_PROGRAM;
|
||||
@@ -145,6 +147,7 @@ export function provePseudo(parsed: Parsed<Study>, options: ProveOptions = {}):
|
||||
// and the same wall-clock budget the verifier has, per routine: a slow routine is tried on fewer inputs
|
||||
const pr = checkProperties(s.program, sub.name, { count: 150, budgetMs, maxWork: Math.min(left, CROSS_CHECK_ROUTINE) });
|
||||
left -= (pr as { work?: number }).work ?? 0;
|
||||
if ((pr as { timedOut?: boolean }).timedOut) stopped.add(sub.name);
|
||||
// a failure that says which half of a contract it broke (an INVARIANT before the first pass or after one, a
|
||||
// DECREASES below 0 or not smaller) counts against that obligation only
|
||||
for (const f of pr.failures) { brokenKeys.add(`${f.kind}@${f.line}`); brokenAt.add(`${f.kind}@${f.line}:${f.col}:${f.phase || ''}`); if (!f.phase) for (const ph of ['init', 'keep', 'bound', 'step']) brokenAt.add(`${f.kind}@${f.line}:${f.col}:${ph}`); }
|
||||
@@ -158,7 +161,7 @@ export function provePseudo(parsed: Parsed<Study>, options: ProveOptions = {}):
|
||||
return brokenKeys.has(`${kindKey(o.kind)}@${o.line}`) ? 'broken' : 'open';
|
||||
};
|
||||
const units = r.units.map((u: any) => ({
|
||||
name: u.name, kind: u.kind, line: u.line, partial: !!u.partial,
|
||||
name: u.name, kind: u.kind, line: u.line, partial: !!u.partial, timedOut: stopped.has(u.name),
|
||||
inferred: (u.inferred || []).flatMap((x: any) => (typeof x === 'string' ? [x] : (x.facts || []).map((f: string) => `line ${x.line}: ${f}`))),
|
||||
notes: (u.notes || []).map((n: any) => n.text || String(n)),
|
||||
obligations: u.obligations.map((o: any) => {
|
||||
@@ -179,6 +182,7 @@ export function provePseudo(parsed: Parsed<Study>, options: ProveOptions = {}):
|
||||
open: all.filter((o: any) => o.status === 'open').length,
|
||||
total: all.length,
|
||||
},
|
||||
clock: { budgetMs, stopped: units.filter((u: any) => u.timedOut).map((u: any) => u.name) },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -97,10 +97,20 @@ test('the time on the clock is the caller\'s: run out, it leaves a subroutine pa
|
||||
const src = fs.readFileSync(new URL('../library/pseudo/programs/19-max-subarray.pseudo', import.meta.url), 'utf8');
|
||||
const whole = provePseudo(studyOf(src), NO_CLOCK);
|
||||
assert.deepEqual(whole.counts, { proved: 6, broken: 0, open: 0, total: 6 });
|
||||
assert.deepEqual(whole.clock, { budgetMs: Infinity, stopped: [] });
|
||||
assert.ok(whole.units.every((u) => !u.timedOut && !u.notes.some((n) => /ran out of time/.test(n))));
|
||||
// a clock that has already run out (what 3 seconds were on CI's runner): the subroutine with the loop is partial
|
||||
const cut = provePseudo(studyOf(src), { budgetMs: -1 });
|
||||
assert.equal(cut.units.find((u) => u.name === 'MAX_SUBARRAY').partial, true);
|
||||
assert.ok(cut.counts.proved < 6 && cut.counts.broken === 0, JSON.stringify(cut.counts));
|
||||
// and the report says it was the clock: which routines, with what budget, and a note on each
|
||||
assert.equal(cut.clock.budgetMs, -1);
|
||||
assert.ok(cut.clock.stopped.includes('MAX_SUBARRAY'), JSON.stringify(cut.clock));
|
||||
const stopped = cut.units.find((u) => u.name === 'MAX_SUBARRAY');
|
||||
assert.equal(stopped.timedOut, true);
|
||||
assert.equal(stopped.notes.filter((n) => /ran out of time.*open, not disproved/.test(n)).length, 1);
|
||||
// left out, the clock is the Prove tab's (whether it is reached is the machine's, and not asserted)
|
||||
assert.equal(provePseudo(studyOf(src)).clock.budgetMs, 3000);
|
||||
// a Workspace hands its own on, and proves again when it changes
|
||||
const ws = new Workspace({ sources: { pseudo: src }, lang: 'pseudo' });
|
||||
ws.proofBudgetMs = -1;
|
||||
|
||||
Reference in new issue
Block a user