;;; TOOL: run-gen-spec-js ;;; ARGS: --prefix=%(test_dir)s/gen-spec-empty-prefix.js (module (func (export "no_result")) (func (export "42") (result i32) i32.const 42) (func (export "i32.add") (param i32 i32) (result i32) get_local 0 get_local 1 i32.add) (func (export "i64.add") (param i64 i64) (result i64) get_local 0 get_local 1 i64.add) (func (export "f32.add") (param f32 f32) (result f32) get_local 0 get_local 1 f32.add) (func (export "f64.add") (param f64 f64) (result f64) get_local 0 get_local 1 f64.add) (func (export "nan") (result f32) f32.const nan:0x2)) (assert_return (invoke "no_result")) (assert_return (invoke "42") (i32.const 42)) (assert_return (invoke "i32.add" (i32.const 1) (i32.const 2)) (i32.const 3)) ;; Rewritten to avoid passing i64 values as parameters. (assert_return (invoke "i64.add" (i64.const 1) (i64.const 2)) (i64.const 3)) ;; Normal floats are not rewritten. (assert_return (invoke "f32.add" (f32.const 1) (f32.const 2)) (f32.const 3)) (assert_return (invoke "f64.add" (f64.const 1) (f64.const 2)) (f64.const 3)) ;; Rewritten to avoid passing nan as a parameter. (assert_return (invoke "nan") (f32.const nan:0x2)) (;; STDOUT ;;; // A deliberately empty file for testing. // assert_return.txt:3 let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x24\x07\x60\x00\x00\x60\x00\x01\x7f\x60\x02\x7f\x7f\x01\x7f\x60\x02\x7e\x7e\x01\x7e\x60\x02\x7d\x7d\x01\x7d\x60\x02\x7c\x7c\x01\x7c\x60\x00\x01\x7d\x03\x0a\x09\x00\x01\x02\x03\x04\x05\x06\x00\x00\x07\x56\x09\x09\x6e\x6f\x5f\x72\x65\x73\x75\x6c\x74\x00\x00\x02\x34\x32\x00\x01\x07\x69\x33\x32\x2e\x61\x64\x64\x00\x02\x07\x69\x36\x34\x2e\x61\x64\x64\x00\x03\x07\x66\x33\x32\x2e\x61\x64\x64\x00\x04\x07\x66\x36\x34\x2e\x61\x64\x64\x00\x05\x03\x6e\x61\x6e\x00\x06\x08\x61\x73\x73\x65\x72\x74\x5f\x30\x00\x07\x08\x61\x73\x73\x65\x72\x74\x5f\x31\x00\x08\x0a\x5a\x09\x02\x00\x0b\x04\x00\x41\x2a\x0b\x07\x00\x20\x00\x20\x01\x6a\x0b\x07\x00\x20\x00\x20\x01\x7c\x0b\x07\x00\x20\x00\x20\x01\x92\x0b\x07\x00\x20\x00\x20\x01\xa0\x0b\x07\x00\x43\x02\x00\x80\x7f\x0b\x13\x00\x02\x40\x42\x01\x42\x02\x10\x03\x42\x03\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x14\x00\x02\x40\x10\x06\xbc\x43\x02\x00\x80\x7f\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b"); // assert_return.txt:24 assert_return(() => call($1, "no_result", [])); // assert_return.txt:25 assert_return(() => call($1, "42", []), 42); // assert_return.txt:27 assert_return(() => call($1, "i32.add", [1, 2]), 3); // assert_return.txt:29 assert_return(() => call($1, "assert_0", [])); // assert_return.txt:31 assert_return(() => call($1, "f32.add", [f32(1.0), f32(2.0)]), f32(3.0)); // assert_return.txt:32 assert_return(() => call($1, "f64.add", [1.0, 2.0]), 3.0); // assert_return.txt:35 assert_return(() => call($1, "assert_1", [])); ;;; STDOUT ;;)