11cb0ef41Sopenharmony_ci<!doctype html>
21cb0ef41Sopenharmony_ci<title>Check bindings in JavaScript and WebAssembly cycle (Wasm higher)</title>
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script>
51cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script>
61cb0ef41Sopenharmony_ci<script type=module>
71cb0ef41Sopenharmony_cisetup({ single_test: true });
81cb0ef41Sopenharmony_ciimport * as wasm from "./resources/wasm-js-cycle.wasm";
91cb0ef41Sopenharmony_ciimport * as js from "./resources/wasm-js-cycle.js";
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_cijs.mutateBindings();
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciassert_true(wasm.wasmGlob instanceof WebAssembly.Global);
141cb0ef41Sopenharmony_ciassert_equals(wasm.wasmGlob.valueOf(), 24);
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciassert_true(wasm.wasmFunc instanceof Function);
171cb0ef41Sopenharmony_ciassert_equals(wasm.wasmFunc(), 43);
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ciassert_equals(wasm.incrementGlob(), 43);
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ciconst buf = new Int32Array(wasm.wasmMem.buffer);
221cb0ef41Sopenharmony_ciassert_equals(buf[0], 0);
231cb0ef41Sopenharmony_ciassert_equals(wasm.mutateMem(), 42);
241cb0ef41Sopenharmony_ciassert_equals(buf[0], 42);
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ciassert_equals(wasm.wasmTab.get(0), null);
271cb0ef41Sopenharmony_ciconst ref = wasm.mutateTab();
281cb0ef41Sopenharmony_ciassert_true(ref instanceof Function);
291cb0ef41Sopenharmony_ciassert_equals(wasm.wasmTab.get(0), ref);
301cb0ef41Sopenharmony_ci
311cb0ef41Sopenharmony_cidone();
321cb0ef41Sopenharmony_ci</script>
33