Skip to content

Commit

Permalink
add failing test call-imported-from-other
Browse files Browse the repository at this point in the history
  • Loading branch information
doehyunbaek committed Aug 26, 2024
1 parent 1814545 commit 73ef766
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/core/call-imported-from-other/reference.r3
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
EC;1;callImportedTwice;
IC;0
EC;1;callImportedTwice;
IC;0
IR;0;
IC;0
EC;2;noop;
IR;0;
IR;0;
IC;0
IR;0;
ER
47 changes: 47 additions & 0 deletions tests/core/call-imported-from-other/website/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WebAssembly Test</title>
</head>

<body>
<script>
(async function () {
const startTime = performance.now();
let instance;
let counter_200 = 0
function imported() {
counter_200 += 1
if (counter_200 === 1) {
instance.exports.callImportedTwice();
} else if (counter_200 === 2) {
} else if (counter_200 == 3) {
instance.exports.noop();
}
{
return
}
}
let imports = {
env: {
imported: imported,
},
};
const indexResponse = await fetch("index.wasm");
const indexBinary = await indexResponse.arrayBuffer();
let wasm = await WebAssembly.instantiate(indexBinary, imports);
instance = wasm.instance;
instance.exports.callImportedTwice();
const endTime = performance.now();
const executionTime = endTime - startTime;
const executionTimeElement = document.createElement('p');
executionTimeElement.textContent = `Execution time: ${executionTime} milliseconds`;
document.body.appendChild(executionTimeElement);
})();
</script>
</body>

</html>
Binary file not shown.

0 comments on commit 73ef766

Please sign in to comment.