Skip to content

Commit

Permalink
Change wasm call method
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 23, 2024
1 parent 08d1bbc commit 24f65ab
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions docs/_static/test-c.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,15 @@
for (let p = 1; p < 10000; p++) {
if ([12, ].includes(p)) continue;
const formattedQuestion = `${p}`.padStart(4, '0');
const func = wasm[`_p${formattedQuestion}`];
if (func === undefined) continue;
if (wasm[`_p${formattedQuestion}`] === undefined) continue;
let expected = get_js_answer(p);
if (typeof expected === 'bigint') {
expected = Number(expected);
}
describe(`run test ${p}`, function() {
this.timeout(Infinity);
it(`should return ${expected}`, () => {
let answer = func();
if (typeof expected === 'string') {
answer = wasm.UTF8ToString(answer);
}
let answer = wasm.ccall(`p${formattedQuestion}`, typeof expected, [], []);
console.log(p, answer, expected);
if (answer !== expected) {
throw new Error();
Expand Down

0 comments on commit 24f65ab

Please sign in to comment.