Skip to content

Commit

Permalink
Correct script typo
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 21, 2024
1 parent 2c21389 commit 2282d30
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 76 deletions.
74 changes: 36 additions & 38 deletions docs/_static/test-c.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,46 @@
import * as wasm from './dist/c-lib.js';
mocha.setup('bdd');
window.onload = function() {
init().then(() => {
for (let p = 1; p < 10000; p++) {
const formattedQuestion = `${p}`.padStart(4, '0');
const func = wasm[`_p${formattedQuestion}`];
if (func === undefined) continue;
const expected = wasm._get_answer(p);
describe(`run test ${p}`, function() {
this.timeout(Infinity);
it(`should return ${expected}`, async () => {
const answer = func();
console.log(p, answer, expected);
if (answer !== expected) {
throw new Error();
}
});
for (let p = 1; p < 10000; p++) {
const formattedQuestion = `${p}`.padStart(4, '0');
const func = wasm[`_p${formattedQuestion}`];
if (func === undefined) continue;
const expected = wasm._get_answer(p);
describe(`run test ${p}`, function() {
this.timeout(Infinity);
it(`should return ${expected}`, async () => {
const answer = func();
console.log(p, answer, expected);
if (answer !== expected) {
throw new Error();
}
});
}
const runner = mocha.run();
let failedTests = [];

runner.on('end', function() {
window.mochaResults = runner.stats;
window.mochaResults.reports = failedTests;
});
}
const runner = mocha.run();
let failedTests = [];

runner.on('fail', function(test, err){
const flattenTitles = function(test){
let titles = [];
while (test.parent.title){
titles.push(test.parent.title);
test = test.parent;
}
return titles.reverse();
};
runner.on('end', function() {
window.mochaResults = runner.stats;
window.mochaResults.reports = failedTests;
});

failedTests.push({
name: test.title,
result: false,
message: err.message,
stack: err.stack,
titles: flattenTitles(test)
});
runner.on('fail', function(test, err){
const flattenTitles = function(test){
let titles = [];
while (test.parent.title){
titles.push(test.parent.title);
test = test.parent;
}
return titles.reverse();
};

failedTests.push({
name: test.title,
result: false,
message: err.message,
stack: err.stack,
titles: flattenTitles(test)
});
});
};
Expand Down
74 changes: 36 additions & 38 deletions docs/_static/test-cp.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,46 @@
import * as wasm from './dist/cp-lib.js';
mocha.setup('bdd');
window.onload = function() {
init().then(() => {
for (let p = 1; p < 10000; p++) {
const formattedQuestion = `${p}`.padStart(4, '0');
const func = wasm[`_p${formattedQuestion}`];
if (func === undefined) continue;
const expected = wasm._get_answer(p);
describe(`run test ${p}`, function() {
this.timeout(Infinity);
it(`should return ${expected}`, async () => {
const answer = func();
console.log(p, answer, expected);
if (answer !== expected) {
throw new Error();
}
});
for (let p = 1; p < 10000; p++) {
const formattedQuestion = `${p}`.padStart(4, '0');
const func = wasm[`_p${formattedQuestion}`];
if (func === undefined) continue;
const expected = wasm._get_answer(p);
describe(`run test ${p}`, function() {
this.timeout(Infinity);
it(`should return ${expected}`, async () => {
const answer = func();
console.log(p, answer, expected);
if (answer !== expected) {
throw new Error();
}
});
}
const runner = mocha.run();
let failedTests = [];

runner.on('end', function() {
window.mochaResults = runner.stats;
window.mochaResults.reports = failedTests;
});
}
const runner = mocha.run();
let failedTests = [];

runner.on('fail', function(test, err){
const flattenTitles = function(test){
let titles = [];
while (test.parent.title){
titles.push(test.parent.title);
test = test.parent;
}
return titles.reverse();
};
runner.on('end', function() {
window.mochaResults = runner.stats;
window.mochaResults.reports = failedTests;
});

failedTests.push({
name: test.title,
result: false,
message: err.message,
stack: err.stack,
titles: flattenTitles(test)
});
runner.on('fail', function(test, err){
const flattenTitles = function(test){
let titles = [];
while (test.parent.title){
titles.push(test.parent.title);
test = test.parent;
}
return titles.reverse();
};

failedTests.push({
name: test.title,
result: false,
message: err.message,
stack: err.stack,
titles: flattenTitles(test)
});
});
};
Expand Down

0 comments on commit 2282d30

Please sign in to comment.