Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,16 @@
// META: global=window,dedicatedworker,jsshell
// META: script=/wasm/jsapi/assertions.js
function addxy(x, y) {
return x + y
}
test(() => {
var fun = new WebAssembly.Function({parameters: ["i32", "i32"], results: ["i32"]}, addxy);
assert_equals(fun(1, 2), 3)
}, "test calling function")
test(() => {
var fun = new WebAssembly.Function({parameters: ["i32", "i32"], results: ["i32"]}, addxy);
assert_throws_js(TypeError, () => new fun(1, 2));
}, "test constructing function");

View File

@ -0,0 +1,65 @@
// META: global=window,dedicatedworker,jsshell
// META: script=/wasm/jsapi/assertions.js
function addxy(x, y) {
return x + y
}
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_function_name(WebAssembly.Function, "Function", "WebAssembly.Function");
}, "name");
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_function_length(WebAssembly.Function, 2, "WebAssembly.Function");
}, "length");
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function());
const argument = {parameters: [], results: []};
assert_throws_js(TypeError, () => new WebAssembly.Function(argument));
}, "Too few arguments");
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
const arguments = [{parameters: ["i32", "i32"], results: ["i32"]}, addxy];
assert_throws_js(TypeError, () => WebAssembly.Function(...arguments));
}, "Calling");
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
var fun = new WebAssembly.Function({parameters: ["i32", "i32"], results: ["i32"]}, addxy);
assert_true(fun instanceof WebAssembly.Function)
}, "construct with JS function")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: []}, addxy))
}, "fail with missing results")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({results: []}, addxy))
}, "fail with missing parameters")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: [1], results: [true]}, addxy))
}, "fail with non-string parameters & results")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: ["invalid"], results: ["invalid"]}, addxy))
}, "fail with non-existent parameter and result type")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: [], results: []}, 72))
}, "fail with non-function object")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: [], results: []}, {}))
}, "fail to construct with non-callable object")

View File

@ -0,0 +1,30 @@
// META: global=window,dedicatedworker,jsshell
// META: script=/wasm/jsapi/assertions.js
function testfunc(n) {}
test(() => {
var table = new WebAssembly.Table({element: "anyfunc", initial: 3})
var func1 = new WebAssembly.Function({parameters: ["i32"], results: []}, testfunc)
table.set(0, func1)
var func2 = new WebAssembly.Function({parameters: ["f32"], results: []}, testfunc)
table.set(1, func2)
var func3 = new WebAssembly.Function({parameters: ["i64"], results: []}, testfunc)
table.set(2, func3)
var first = table.get(0)
assert_true(first instanceof WebAssembly.Function)
assert_equals(first, func1)
assert_equals(first.type().parameters[0], func1.type().parameters[0])
var second = table.get(1)
assert_true(second instanceof WebAssembly.Function)
assert_equals(second, func2)
assert_equals(second.type().parameters[0], func2.type().parameters[0])
var third = table.get(2)
assert_true(third instanceof WebAssembly.Function)
assert_equals(third, func3)
assert_equals(third.type().parameters[0], func3.type().parameters[0])
}, "Test insertion into table")

View File

@ -0,0 +1,28 @@
// META: global=window,dedicatedworker,jsshell
// META: script=/wasm/jsapi/assertions.js
function addNumbers(x, y, z) {
return x+y+z;
}
function doNothing() {}
function assert_function(functype, func) {
var wasmFunc = new WebAssembly.Function(functype, func);
assert_equals(functype.parameters.length, wasmFunc.type().parameters.length);
for(let i = 0; i < functype.parameters.length; i++) {
assert_equals(functype.parameters[i], wasmFunc.type().parameters[i]);
}
assert_equals(functype.results.length, wasmFunc.type().results.length);
for(let i = 0; i < functype.results.length; i++) {
assert_equals(functype.results[i], wasmFunc.type().results[i]);
}
}
test(() => {
assert_function({results: [], parameters: []}, doNothing);
}, "Check empty results and parameters")
test(() => {
assert_function({results: ["f64"], parameters: ["i32", "i64", "f32"]}, addNumbers)
}, "Check all types")