Initial commit
Test / gate (push) Failing after 19m0s

This commit is contained in:
alexm committed 2026-11-12 22:23:54 -05:00
commit 401084bab3
265 files changed
+69224

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
// SPDX-FileCopyrightText: 2026 Scientific Computing Studio, LLC
// SPDX-License-Identifier: Apache-2.0
// Every exercise file is checked here, so adding one is safe.
import test from 'node:test';
import assert from 'node:assert/strict';
import { EXERCISES } from '../dist/exercises/index.js';
import template from '../dist/exercises/_template.js';
import { Workspace } from '../dist/common/workspace.js';
import { PROBLEMS, problemById, workForProblem } from '../dist/common/problems.js';
test('exercise ids are unique, URL-safe, and the template is not registered', () => {
const ids = EXERCISES.map((e) => e.id);
assert.equal(new Set(ids).size, ids.length);
for (const id of ids) assert.match(id, /^[a-z0-9]+(-[a-z0-9]+)*$/, id);
assert.ok(!ids.includes(template.id));
});
test('every exercise with an expected answer produces it', () => {
for (const p of PROBLEMS) {
if (!p.expect) continue;
const st = workForProblem(p);
if (st.sources.pseudo) st.lang = 'pseudo';
const s = new Workspace(st);
const tr = s.trace();
assert.ok(tr && !tr.error, `${p.id}: ${s.runError || tr?.error?.message}`);
const last = tr.output.at(-1);
assert.ok(last.endsWith(` returned ${p.expect}`), `${p.id}: expected …returned ${p.expect}, got ${last}`);
}
});
test('the template itself is a valid exercise', () => {
const s = new Workspace(workForProblem({ ...template, lang: 'pseudo' }));
const tr = s.trace();
assert.ok(tr && !tr.error, s.runError || tr?.error?.message);
assert.ok(tr.output.at(-1).endsWith(`returned ${template.expect}`));
assert.equal(s.proof().report.counts.open + s.proof().report.counts.broken, 0);
});