xref: /third_party/node/test/es-module/test-wasm-simple.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/es-module/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst buffer = fixtures.readSync('simple.wasm');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciassert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciWebAssembly.instantiate(buffer, {}).then((results) => {
121cb0ef41Sopenharmony_ci  // Exported function should add two numbers.
131cb0ef41Sopenharmony_ci  assert.strictEqual(
141cb0ef41Sopenharmony_ci    results.instance.exports.add(10, 20),
151cb0ef41Sopenharmony_ci    30
161cb0ef41Sopenharmony_ci  );
171cb0ef41Sopenharmony_ci});
18

Indexes created Thu Nov 07 10:32:03 CST 2024