MCPcopy Create free account
hub / github.com/nodejs/node / TestImported

Function TestImported

deps/v8/test/mjsunit/wasm/globals.js:49–61  ·  view source on GitHub ↗
(type, val, expected)

Source from the content-addressed store, hash-verified

47})();
48
49function TestImported(type, val, expected) {
50 print("TestImported " + type + "(" + val +")" + " = " + expected);
51 var builder = new WasmModuleBuilder();
52 var sig = makeSig([], [type]);
53 var g = builder.addImportedGlobal("uuu", "foo", type);
54 builder.addFunction("main", sig)
55 .addBody([kExprGlobalGet, g])
56 .exportAs("main");
57 builder.addGlobal(kWasmI32, false, false); // pad
58
59 var instance = builder.instantiate({uuu: {foo: val}});
60 assertEquals(expected, instance.exports.main());
61}
62
63TestImported(kWasmI32, 300.1, 300);
64TestImported(kWasmF32, 87234.87238, Math.fround(87234.87238));

Callers 1

globals.jsFile · 0.85

Calls 10

addImportedGlobalMethod · 0.95
addFunctionMethod · 0.95
addGlobalMethod · 0.95
instantiateMethod · 0.95
makeSigFunction · 0.70
printFunction · 0.50
assertEqualsFunction · 0.50
exportAsMethod · 0.45
addBodyMethod · 0.45
mainMethod · 0.45

Tested by

no test coverage detected