@mark1russell7/rigor-bench 0.2.21 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -0
- package/build/code-stamp.d.ts +66 -0
- package/build/code-stamp.d.ts.map +1 -0
- package/build/code-stamp.js +215 -0
- package/build/code-stamp.js.map +1 -0
- package/build/index.d.ts +66 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +105 -1
- package/build/index.js.map +1 -1
- package/build/supervise.js +1 -1
- package/package.json +16 -3
package/build/index.js
CHANGED
|
@@ -2295,6 +2295,110 @@ function trueOutcome(ratio, verdict = {}) {
|
|
|
2295
2295
|
if ((verdict.rule ?? "difference") === "difference" && Math.abs(Math.log(ratio)) <= verdictMargin(verdict)) return "same";
|
|
2296
2296
|
return ratio < 1 ? "faster" : ratio > 1 ? "slower" : "same";
|
|
2297
2297
|
}
|
|
2298
|
+
// src/results.ts
|
|
2299
|
+
const keyOf = (row) => JSON.stringify([
|
|
2300
|
+
row.case,
|
|
2301
|
+
row.base,
|
|
2302
|
+
row.head
|
|
2303
|
+
]);
|
|
2304
|
+
/** This function checks the parsed content of a file of rows. A row with an empty field, or the same row two times, stops the read with an error. */
|
|
2305
|
+
function resultRows(content) {
|
|
2306
|
+
if (!Array.isArray(content)) throw new Error("resultRows: the rows are an array.");
|
|
2307
|
+
const known = /* @__PURE__ */ new Set();
|
|
2308
|
+
return content.map((item, index) => {
|
|
2309
|
+
const row = typeof item === "object" && item !== null ? item : {};
|
|
2310
|
+
const where = `resultRows: row ${String(index)}`;
|
|
2311
|
+
const { case: name, base, head, reason } = row;
|
|
2312
|
+
if (typeof name !== "string" || name === "") throw new Error(`${where} has no case.`);
|
|
2313
|
+
if (typeof base !== "string" || base === "") throw new Error(`${where} has no hash of the base.`);
|
|
2314
|
+
if (typeof head !== "string" || head === "") throw new Error(`${where} has no hash of the head.`);
|
|
2315
|
+
if (typeof reason !== "string" || reason.trim() === "") throw new Error(`${where} has no reason.`);
|
|
2316
|
+
const key = keyOf({
|
|
2317
|
+
case: name,
|
|
2318
|
+
base,
|
|
2319
|
+
head
|
|
2320
|
+
});
|
|
2321
|
+
if (known.has(key)) throw new Error(`${where} repeats the case ${JSON.stringify(name)} with the same hashes.`);
|
|
2322
|
+
known.add(key);
|
|
2323
|
+
return {
|
|
2324
|
+
case: name,
|
|
2325
|
+
base,
|
|
2326
|
+
head,
|
|
2327
|
+
reason
|
|
2328
|
+
};
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
/** This function tells which side of a run differs from a row. */
|
|
2332
|
+
function moved(item, row) {
|
|
2333
|
+
if (item.base !== row.base && item.head !== row.head) return "both sides moved";
|
|
2334
|
+
return item.base !== row.base ? "the base moved" : "the head moved";
|
|
2335
|
+
}
|
|
2336
|
+
/** This function gives the line of a case that no row accepts. */
|
|
2337
|
+
function refusal(item, live, spent) {
|
|
2338
|
+
const start = `The case ${JSON.stringify(item.case)} gives two different results`;
|
|
2339
|
+
if (spent.has(keyOf(item))) return `${start}, and the base already has the row of this change, so that row is spent. Delete that row in its own pull request, then add the row again.`;
|
|
2340
|
+
const others = live.filter((row) => row.case === item.case);
|
|
2341
|
+
const read = `base ${item.base} and head ${item.head}`;
|
|
2342
|
+
if (others.length > 0) return `${start}: ${read}. ${others.map((row) => `A row accepts base ${row.base} and head ${row.head}, so ${moved(item, row)}.`).join(" ")}`;
|
|
2343
|
+
return `${start}, and no row accepts them. To accept this change, add the row ${JSON.stringify({
|
|
2344
|
+
case: item.case,
|
|
2345
|
+
base: item.base,
|
|
2346
|
+
head: item.head,
|
|
2347
|
+
reason: "the reason for the change"
|
|
2348
|
+
})} in this pull request.`;
|
|
2349
|
+
}
|
|
2350
|
+
/**
|
|
2351
|
+
* This function gives the verdict over the results of a run. A case with two different results passes only with a new row of its exact hashes.
|
|
2352
|
+
* The verdict reads results only, so an accepted case still needs its time verdict.
|
|
2353
|
+
*/
|
|
2354
|
+
function resultVerdict(results, rows) {
|
|
2355
|
+
const spentKeys = new Set(rows.base.map(keyOf));
|
|
2356
|
+
const live = rows.head.filter((row) => !spentKeys.has(keyOf(row)));
|
|
2357
|
+
const used = /* @__PURE__ */ new Set();
|
|
2358
|
+
const cases = results.filter((item) => item.base !== item.head).map((item) => {
|
|
2359
|
+
const row = live.find((other) => keyOf(other) === keyOf(item));
|
|
2360
|
+
if (row === void 0) return {
|
|
2361
|
+
case: item.case,
|
|
2362
|
+
base: item.base,
|
|
2363
|
+
head: item.head,
|
|
2364
|
+
outcome: "refused",
|
|
2365
|
+
line: refusal(item, live, spentKeys)
|
|
2366
|
+
};
|
|
2367
|
+
used.add(keyOf(row));
|
|
2368
|
+
return {
|
|
2369
|
+
case: item.case,
|
|
2370
|
+
base: item.base,
|
|
2371
|
+
head: item.head,
|
|
2372
|
+
outcome: "accepted",
|
|
2373
|
+
line: `The case ${JSON.stringify(item.case)} changes its result from ${item.base} to ${item.head}, and a row accepts this: ${row.reason}`
|
|
2374
|
+
};
|
|
2375
|
+
});
|
|
2376
|
+
const named = new Set(results.map((item) => item.case));
|
|
2377
|
+
const idle = live.filter((row) => !used.has(keyOf(row)));
|
|
2378
|
+
const unused = idle.filter((row) => named.has(row.case)).map((row) => ({
|
|
2379
|
+
row,
|
|
2380
|
+
line: `The new row of the case ${JSON.stringify(row.case)} accepts no change of this run. Delete or correct the row.`
|
|
2381
|
+
}));
|
|
2382
|
+
const absent = idle.filter((row) => !named.has(row.case)).map((row) => ({
|
|
2383
|
+
row,
|
|
2384
|
+
line: `The new row of the case ${JSON.stringify(row.case)} has no read: the case has no result in this run.`
|
|
2385
|
+
}));
|
|
2386
|
+
const spent = rows.head.filter((row) => spentKeys.has(keyOf(row)));
|
|
2387
|
+
const fails = cases.some((item) => item.outcome === "refused") || unused.length > 0 || absent.length > 0;
|
|
2388
|
+
const count = spent.length > 0 ? [`The spent rows: ${String(spent.length)}. The base has them, so they accept nothing.`] : [];
|
|
2389
|
+
return {
|
|
2390
|
+
outcome: fails ? "fail" : "pass",
|
|
2391
|
+
cases,
|
|
2392
|
+
unused,
|
|
2393
|
+
absent,
|
|
2394
|
+
spent,
|
|
2395
|
+
lines: [...[
|
|
2396
|
+
...cases,
|
|
2397
|
+
...unused,
|
|
2398
|
+
...absent
|
|
2399
|
+
].map((item) => item.line), ...count]
|
|
2400
|
+
};
|
|
2401
|
+
}
|
|
2298
2402
|
// src/rounds.ts
|
|
2299
2403
|
/**
|
|
2300
2404
|
* The timed rounds of one case in one process. The two arms first run for a warm-up time. Then the count of calls of
|
|
@@ -2351,6 +2455,6 @@ function timeRounds(arms, options) {
|
|
|
2351
2455
|
sink
|
|
2352
2456
|
};
|
|
2353
2457
|
}
|
|
2354
|
-
export { BUDGET_LOOKS, CEILING_ONLY, GATE_LOOKS, LADDER_FORMAT, UNKNOWN_MODEL, aaBand, aaSpread, armModels, armOrder, armVerdicts, balanceOrders, budgetLookSpend, budgetLooksVerdict, budgetVerdict, caseIntervals, caseRatios, caseTails, checkLadder, checkMeasures, checkPairedTime, controlFactor, firstArm, gateOf, jointClaim, ladderVerdict, limitOnModel, limitVerdict, modelRowText, modelTest, notSlowerVerdict, orderSize, poolRecords, pooledBand, pooledLimitVerdict, pooledVerdict, rungVerdict, tailFalseFails, tailLimitVerdict, timeRounds, timeVerdict, verdictMargin, verdictPower, visibleShift, winClaim };
|
|
2458
|
+
export { BUDGET_LOOKS, CEILING_ONLY, GATE_LOOKS, LADDER_FORMAT, UNKNOWN_MODEL, aaBand, aaSpread, armModels, armOrder, armVerdicts, balanceOrders, budgetLookSpend, budgetLooksVerdict, budgetVerdict, caseIntervals, caseRatios, caseTails, checkLadder, checkMeasures, checkPairedTime, controlFactor, firstArm, gateOf, jointClaim, ladderVerdict, limitOnModel, limitVerdict, modelRowText, modelTest, notSlowerVerdict, orderSize, poolRecords, pooledBand, pooledLimitVerdict, pooledVerdict, resultRows, resultVerdict, rungVerdict, tailFalseFails, tailLimitVerdict, timeRounds, timeVerdict, verdictMargin, verdictPower, visibleShift, winClaim };
|
|
2355
2459
|
|
|
2356
2460
|
//# sourceMappingURL=index.js.map
|