Skip to content

Commit

Permalink
Merge pull request #378 from atesgoral/atesgoral/success-checking
Browse files Browse the repository at this point in the history
Success checking
  • Loading branch information
atesgoral authored Jul 5, 2024
2 parents 6c87680 + ebba8fb commit a0dae4f
Show file tree
Hide file tree
Showing 44 changed files with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ function inspect() {

return {
path: parsedPath,
level: level,
source: source,
program: program,
level,
source,
program,
};
} catch (e) {
if (parsedPath) {
Expand All @@ -134,15 +134,15 @@ function benchmark() {

const runs = data.level.examples.slice(0);

inboxGenerator.seed(123);
inboxGenerator.seed(Date.now());

while (runs.length < 10) {
while (runs.length < 100) {
const inbox = inboxGenerator.generate(data.level.number);
const outbox = outboxGenerator.generate(data.level.number, inbox);

runs.push({
inbox: inbox,
outbox: outbox,
inbox,
outbox,
});
}

Expand Down Expand Up @@ -190,6 +190,14 @@ function benchmark() {
throw 'Program always failing';
}

if (data.successRatio !== 1) {
if (runs[0].success && data.path.type !== 'specific') {
throw `Non-specific program failing on novel inputs (${Math.round(
100 * data.successRatio,
)}% pass)`;
}
}

data.averageSteps = successfulRuns.length
? Math.round(
successfulRuns.reduce((totalSteps, run) => {
Expand All @@ -198,7 +206,7 @@ function benchmark() {
)
: 0;
} catch (e) {
console.error(chalk.red(data.path.full));
console.error(chalk.red(file.data.path.full));
console.error(' ', chalk.red(e));
throw e;
}
Expand Down

0 comments on commit a0dae4f

Please sign in to comment.