2018-10-28 21:50:57 +01:00
|
|
|
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
|
|
|
|
// Please do NOT modify it by hand, as it will be reseted on next build.
|
|
|
|
// Test based on spectests/globals.wast
|
|
|
|
#![allow(
|
|
|
|
warnings,
|
|
|
|
dead_code
|
|
|
|
)]
|
|
|
|
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
|
|
|
use super::_common::spectest_importobject;
|
|
|
|
use wabt::wat2wasm;
|
|
|
|
|
|
|
|
|
|
|
|
// Line 4
|
|
|
|
fn create_module_1() -> ResultObject {
|
|
|
|
let module_str = "(module
|
|
|
|
(type (;0;) (func (param i32 i32) (result i32)))
|
|
|
|
(type (;1;) (func (result i32)))
|
|
|
|
(type (;2;) (func (result i64)))
|
|
|
|
(type (;3;) (func (param i32)))
|
|
|
|
(type (;4;) (func (param i64)))
|
|
|
|
(type (;5;) (func (result f32)))
|
|
|
|
(type (;6;) (func (result f64)))
|
|
|
|
(type (;7;) (func (param f32)))
|
|
|
|
(type (;8;) (func (param f64)))
|
|
|
|
(type (;9;) (func))
|
|
|
|
(type (;10;) (func (param i32) (result i32)))
|
|
|
|
(func (;0;) (type 1) (result i32)
|
|
|
|
get_global 0)
|
|
|
|
(func (;1;) (type 2) (result i64)
|
|
|
|
get_global 3)
|
|
|
|
(func (;2;) (type 1) (result i32)
|
|
|
|
get_global 4)
|
|
|
|
(func (;3;) (type 2) (result i64)
|
|
|
|
get_global 7)
|
|
|
|
(func (;4;) (type 3) (param i32)
|
|
|
|
get_local 0
|
|
|
|
set_global 4)
|
|
|
|
(func (;5;) (type 4) (param i64)
|
|
|
|
get_local 0
|
|
|
|
set_global 7)
|
|
|
|
(func (;6;) (type 5) (result f32)
|
|
|
|
get_global 1)
|
|
|
|
(func (;7;) (type 6) (result f64)
|
|
|
|
get_global 2)
|
|
|
|
(func (;8;) (type 5) (result f32)
|
|
|
|
get_global 5)
|
|
|
|
(func (;9;) (type 6) (result f64)
|
|
|
|
get_global 6)
|
|
|
|
(func (;10;) (type 7) (param f32)
|
|
|
|
get_local 0
|
|
|
|
set_global 5)
|
|
|
|
(func (;11;) (type 8) (param f64)
|
|
|
|
get_local 0
|
|
|
|
set_global 6)
|
|
|
|
(func (;12;) (type 9))
|
|
|
|
(func (;13;) (type 1) (result i32)
|
|
|
|
get_global 4
|
|
|
|
i32.const 2
|
|
|
|
i32.const 3
|
|
|
|
select)
|
|
|
|
(func (;14;) (type 1) (result i32)
|
|
|
|
i32.const 2
|
|
|
|
get_global 4
|
|
|
|
i32.const 3
|
|
|
|
select)
|
|
|
|
(func (;15;) (type 1) (result i32)
|
|
|
|
i32.const 2
|
|
|
|
i32.const 3
|
|
|
|
get_global 4
|
|
|
|
select)
|
|
|
|
(func (;16;) (type 1) (result i32)
|
|
|
|
loop (result i32) ;; label = @1
|
|
|
|
get_global 4
|
|
|
|
call 12
|
|
|
|
call 12
|
|
|
|
end)
|
|
|
|
(func (;17;) (type 1) (result i32)
|
|
|
|
loop (result i32) ;; label = @1
|
|
|
|
call 12
|
|
|
|
get_global 4
|
|
|
|
call 12
|
|
|
|
end)
|
|
|
|
(func (;18;) (type 1) (result i32)
|
|
|
|
loop (result i32) ;; label = @1
|
|
|
|
call 12
|
|
|
|
call 12
|
|
|
|
get_global 4
|
|
|
|
end)
|
|
|
|
(func (;19;) (type 1) (result i32)
|
|
|
|
get_global 4
|
|
|
|
if (result i32) ;; label = @1
|
|
|
|
call 12
|
|
|
|
i32.const 2
|
|
|
|
else
|
|
|
|
call 12
|
|
|
|
i32.const 3
|
|
|
|
end)
|
|
|
|
(func (;20;) (type 1) (result i32)
|
|
|
|
i32.const 1
|
|
|
|
if (result i32) ;; label = @1
|
|
|
|
get_global 4
|
|
|
|
else
|
|
|
|
i32.const 2
|
|
|
|
end)
|
|
|
|
(func (;21;) (type 1) (result i32)
|
|
|
|
i32.const 0
|
|
|
|
if (result i32) ;; label = @1
|
|
|
|
i32.const 2
|
|
|
|
else
|
|
|
|
get_global 4
|
|
|
|
end)
|
|
|
|
(func (;22;) (type 1) (result i32)
|
|
|
|
block (result i32) ;; label = @1
|
|
|
|
get_global 4
|
|
|
|
i32.const 2
|
|
|
|
br_if 0 (;@1;)
|
|
|
|
i32.const 3
|
|
|
|
return
|
|
|
|
end)
|
|
|
|
(func (;23;) (type 1) (result i32)
|
|
|
|
block (result i32) ;; label = @1
|
|
|
|
i32.const 2
|
|
|
|
get_global 4
|
|
|
|
br_if 0 (;@1;)
|
|
|
|
i32.const 3
|
|
|
|
return
|
|
|
|
end)
|
|
|
|
(func (;24;) (type 1) (result i32)
|
|
|
|
block (result i32) ;; label = @1
|
|
|
|
get_global 4
|
|
|
|
i32.const 2
|
|
|
|
br_table 0 (;@1;) 0 (;@1;)
|
|
|
|
end)
|
|
|
|
(func (;25;) (type 1) (result i32)
|
|
|
|
block (result i32) ;; label = @1
|
|
|
|
i32.const 2
|
|
|
|
get_global 4
|
|
|
|
br_table 0 (;@1;) 0 (;@1;)
|
|
|
|
end)
|
|
|
|
(func (;26;) (type 0) (param i32 i32) (result i32)
|
|
|
|
get_local 0)
|
|
|
|
(func (;27;) (type 1) (result i32)
|
|
|
|
block (result i32) ;; label = @1
|
|
|
|
get_global 4
|
|
|
|
i32.const 2
|
|
|
|
i32.const 0
|
|
|
|
call_indirect (type 0)
|
|
|
|
end)
|
|
|
|
(func (;28;) (type 1) (result i32)
|
|
|
|
block (result i32) ;; label = @1
|
|
|
|
i32.const 2
|
|
|
|
get_global 4
|
|
|
|
i32.const 0
|
|
|
|
call_indirect (type 0)
|
|
|
|
end)
|
|
|
|
(func (;29;) (type 1) (result i32)
|
|
|
|
block (result i32) ;; label = @1
|
|
|
|
i32.const 2
|
|
|
|
i32.const 0
|
|
|
|
get_global 4
|
|
|
|
call_indirect (type 0)
|
|
|
|
end)
|
|
|
|
(func (;30;) (type 9)
|
|
|
|
get_global 4
|
|
|
|
i32.const 1
|
|
|
|
i32.store)
|
|
|
|
(func (;31;) (type 9)
|
|
|
|
i32.const 0
|
|
|
|
get_global 4
|
|
|
|
i32.store)
|
|
|
|
(func (;32;) (type 1) (result i32)
|
|
|
|
get_global 4
|
|
|
|
i32.load)
|
|
|
|
(func (;33;) (type 1) (result i32)
|
|
|
|
get_global 4
|
|
|
|
memory.grow)
|
|
|
|
(func (;34;) (type 10) (param i32) (result i32)
|
|
|
|
get_local 0)
|
|
|
|
(func (;35;) (type 1) (result i32)
|
|
|
|
get_global 4
|
|
|
|
call 34)
|
|
|
|
(func (;36;) (type 1) (result i32)
|
|
|
|
get_global 4
|
|
|
|
return)
|
|
|
|
(func (;37;) (type 9)
|
|
|
|
get_global 4
|
|
|
|
drop)
|
|
|
|
(func (;38;) (type 1) (result i32)
|
|
|
|
block (result i32) ;; label = @1
|
|
|
|
get_global 4
|
|
|
|
br 0 (;@1;)
|
|
|
|
end)
|
|
|
|
(func (;39;) (type 10) (param i32) (result i32)
|
|
|
|
get_global 4
|
|
|
|
set_local 0
|
|
|
|
get_local 0)
|
|
|
|
(func (;40;) (type 10) (param i32) (result i32)
|
|
|
|
get_global 4
|
|
|
|
tee_local 0)
|
|
|
|
(func (;41;) (type 1) (result i32)
|
|
|
|
get_global 4
|
|
|
|
set_global 4
|
|
|
|
get_global 4)
|
|
|
|
(func (;42;) (type 1) (result i32)
|
|
|
|
get_global 4
|
|
|
|
i32.eqz)
|
|
|
|
(func (;43;) (type 1) (result i32)
|
|
|
|
get_global 4
|
|
|
|
get_global 4
|
|
|
|
i32.mul)
|
|
|
|
(func (;44;) (type 1) (result i32)
|
|
|
|
get_global 0
|
|
|
|
i32.const 1
|
|
|
|
i32.gt_u)
|
|
|
|
(table (;0;) 1 1 anyfunc)
|
|
|
|
(memory (;0;) 1)
|
|
|
|
(global (;0;) i32 (i32.const -2))
|
|
|
|
(global (;1;) f32 (f32.const -0x1.8p+1 (;=-3;)))
|
|
|
|
(global (;2;) f64 (f64.const -0x1p+2 (;=-4;)))
|
|
|
|
(global (;3;) i64 (i64.const -5))
|
|
|
|
(global (;4;) (mut i32) (i32.const -12))
|
|
|
|
(global (;5;) (mut f32) (f32.const -0x1.ap+3 (;=-13;)))
|
|
|
|
(global (;6;) (mut f64) (f64.const -0x1.cp+3 (;=-14;)))
|
|
|
|
(global (;7;) (mut i64) (i64.const -15))
|
|
|
|
(export \"get-a\" (func 0))
|
|
|
|
(export \"get-b\" (func 1))
|
|
|
|
(export \"get-x\" (func 2))
|
|
|
|
(export \"get-y\" (func 3))
|
|
|
|
(export \"set-x\" (func 4))
|
|
|
|
(export \"set-y\" (func 5))
|
|
|
|
(export \"get-1\" (func 6))
|
|
|
|
(export \"get-2\" (func 7))
|
|
|
|
(export \"get-5\" (func 8))
|
|
|
|
(export \"get-6\" (func 9))
|
|
|
|
(export \"set-5\" (func 10))
|
|
|
|
(export \"set-6\" (func 11))
|
|
|
|
(export \"as-select-first\" (func 13))
|
|
|
|
(export \"as-select-mid\" (func 14))
|
|
|
|
(export \"as-select-last\" (func 15))
|
|
|
|
(export \"as-loop-first\" (func 16))
|
|
|
|
(export \"as-loop-mid\" (func 17))
|
|
|
|
(export \"as-loop-last\" (func 18))
|
|
|
|
(export \"as-if-condition\" (func 19))
|
|
|
|
(export \"as-if-then\" (func 20))
|
|
|
|
(export \"as-if-else\" (func 21))
|
|
|
|
(export \"as-br_if-first\" (func 22))
|
|
|
|
(export \"as-br_if-last\" (func 23))
|
|
|
|
(export \"as-br_table-first\" (func 24))
|
|
|
|
(export \"as-br_table-last\" (func 25))
|
|
|
|
(export \"as-call_indirect-first\" (func 27))
|
|
|
|
(export \"as-call_indirect-mid\" (func 28))
|
|
|
|
(export \"as-call_indirect-last\" (func 29))
|
|
|
|
(export \"as-store-first\" (func 30))
|
|
|
|
(export \"as-store-last\" (func 31))
|
|
|
|
(export \"as-load-operand\" (func 32))
|
|
|
|
(export \"as-memory.grow-value\" (func 33))
|
|
|
|
(export \"as-call-value\" (func 35))
|
|
|
|
(export \"as-return-value\" (func 36))
|
|
|
|
(export \"as-drop-operand\" (func 37))
|
|
|
|
(export \"as-br-value\" (func 38))
|
|
|
|
(export \"as-set_local-value\" (func 39))
|
|
|
|
(export \"as-tee_local-value\" (func 40))
|
|
|
|
(export \"as-set_global-value\" (func 41))
|
|
|
|
(export \"as-unary-operand\" (func 42))
|
|
|
|
(export \"as-binary-operand\" (func 43))
|
|
|
|
(export \"as-compare-operand\" (func 44))
|
|
|
|
(elem (i32.const 0) 26))
|
|
|
|
";
|
|
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
|
|
instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 182
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l182_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l182_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-a") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, -2 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 183
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l183_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l183_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-b") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, -5 as i64);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 184
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l184_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l184_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-x") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, -12 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 185
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l185_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l185_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-y") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, -15 as i64);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 187
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l187_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l187_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-1") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> f32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, -3.0 as f32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 188
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l188_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l188_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-2") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, -4.0 as f64);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 189
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l189_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l189_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-5") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> f32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, -13.0 as f32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 190
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l190_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l190_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-6") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, -14.0 as f64);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 192
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l192_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l192_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("set-x") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(i32, &VmCtx) = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(6 as i32, &vm_context);
|
|
|
|
assert_eq!(result, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 193
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l193_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l193_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("set-y") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(i64, &VmCtx) = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(7 as i64, &vm_context);
|
|
|
|
assert_eq!(result, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 194
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l194_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l194_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("set-5") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(f32, &VmCtx) = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(8.0 as f32, &vm_context);
|
|
|
|
assert_eq!(result, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 195
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l195_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l195_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("set-6") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(f64, &VmCtx) = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(9.0 as f64, &vm_context);
|
|
|
|
assert_eq!(result, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 197
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l197_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l197_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-x") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 198
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l198_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l198_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-y") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 7 as i64);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 199
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l199_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l199_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-5") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> f32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 8.0 as f32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 200
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l200_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l200_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("get-6") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 9.0 as f64);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 202
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l202_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l202_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-select-first") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 203
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l203_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l203_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-select-mid") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 2 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 204
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l204_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l204_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-select-last") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 2 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 206
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l206_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l206_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-loop-first") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 207
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l207_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l207_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-loop-mid") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 208
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l208_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l208_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-loop-last") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 210
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l210_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l210_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-if-condition") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 2 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 211
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l211_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l211_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-if-then") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 212
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l212_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l212_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-if-else") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 214
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l214_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l214_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-br_if-first") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 215
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l215_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l215_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-br_if-last") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 2 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 217
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l217_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l217_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-br_table-first") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 218
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l218_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l218_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-br_table-last") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 2 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 220
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l220_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l220_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-call_indirect-first") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 221
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l221_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l221_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-call_indirect-mid") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 2 as i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 222
|
|
|
|
|
|
|
|
// Line 224
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l224_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l224_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-store-first") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 225
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l225_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l225_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-store-last") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Line 226
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l226_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l226_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-load-operand") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 1 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 230
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l230_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l230_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-call-value") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 232
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l232_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l232_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-return-value") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 233
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l233_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l233_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-drop-operand") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, ());
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 234
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l234_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l234_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-br-value") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 236
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l236_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l236_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-set_local-value") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(1 as i32, &vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 237
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l237_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l237_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-tee_local-value") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(1 as i32, &vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 238
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l238_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l238_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-set_global-value") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 6 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 240
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l240_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l240_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-unary-operand") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 0 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 241
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l241_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l241_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-binary-operand") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 36 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 242
|
2018-10-29 14:33:00 +01:00
|
|
|
fn l242_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
|
|
|
println!("Executing function {}", "l242_action_invoke");
|
2018-10-28 21:50:57 +01:00
|
|
|
let func_index = match result_object.module.info.exports.get("as-compare-operand") {
|
|
|
|
Some(&Export::Function(index)) => index,
|
|
|
|
_ => panic!("Function not found"),
|
|
|
|
};
|
|
|
|
let invoke_fn: fn(&VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index);
|
|
|
|
let result = invoke_fn(&vm_context);
|
|
|
|
assert_eq!(result, 1 as i32);
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 245
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l245_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 6, 9, 1, 125, 0, 67, 0, 0, 0, 0, 11, 10, 8, 1, 6, 0, 65, 1, 36, 0, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 250
|
2018-10-28 21:50:57 +01:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_module_1() {
|
|
|
|
let result_object = create_module_1();
|
|
|
|
let vm_context = result_object.instance.generate_context();
|
|
|
|
// We group the calls together
|
2018-10-29 14:33:00 +01:00
|
|
|
l182_action_invoke(&result_object, &vm_context);
|
|
|
|
l183_action_invoke(&result_object, &vm_context);
|
|
|
|
l184_action_invoke(&result_object, &vm_context);
|
|
|
|
l185_action_invoke(&result_object, &vm_context);
|
|
|
|
l187_action_invoke(&result_object, &vm_context);
|
|
|
|
l188_action_invoke(&result_object, &vm_context);
|
|
|
|
l189_action_invoke(&result_object, &vm_context);
|
|
|
|
l190_action_invoke(&result_object, &vm_context);
|
|
|
|
l192_action_invoke(&result_object, &vm_context);
|
|
|
|
l193_action_invoke(&result_object, &vm_context);
|
|
|
|
l194_action_invoke(&result_object, &vm_context);
|
|
|
|
l195_action_invoke(&result_object, &vm_context);
|
|
|
|
l197_action_invoke(&result_object, &vm_context);
|
|
|
|
l198_action_invoke(&result_object, &vm_context);
|
|
|
|
l199_action_invoke(&result_object, &vm_context);
|
|
|
|
l200_action_invoke(&result_object, &vm_context);
|
|
|
|
l202_action_invoke(&result_object, &vm_context);
|
|
|
|
l203_action_invoke(&result_object, &vm_context);
|
|
|
|
l204_action_invoke(&result_object, &vm_context);
|
|
|
|
l206_action_invoke(&result_object, &vm_context);
|
|
|
|
l207_action_invoke(&result_object, &vm_context);
|
|
|
|
l208_action_invoke(&result_object, &vm_context);
|
|
|
|
l210_action_invoke(&result_object, &vm_context);
|
|
|
|
l211_action_invoke(&result_object, &vm_context);
|
|
|
|
l212_action_invoke(&result_object, &vm_context);
|
|
|
|
l214_action_invoke(&result_object, &vm_context);
|
|
|
|
l215_action_invoke(&result_object, &vm_context);
|
|
|
|
l217_action_invoke(&result_object, &vm_context);
|
|
|
|
l218_action_invoke(&result_object, &vm_context);
|
|
|
|
l220_action_invoke(&result_object, &vm_context);
|
|
|
|
l221_action_invoke(&result_object, &vm_context);
|
|
|
|
l224_action_invoke(&result_object, &vm_context);
|
|
|
|
l225_action_invoke(&result_object, &vm_context);
|
|
|
|
l226_action_invoke(&result_object, &vm_context);
|
|
|
|
l230_action_invoke(&result_object, &vm_context);
|
|
|
|
l232_action_invoke(&result_object, &vm_context);
|
|
|
|
l233_action_invoke(&result_object, &vm_context);
|
|
|
|
l234_action_invoke(&result_object, &vm_context);
|
|
|
|
l236_action_invoke(&result_object, &vm_context);
|
|
|
|
l237_action_invoke(&result_object, &vm_context);
|
|
|
|
l238_action_invoke(&result_object, &vm_context);
|
|
|
|
l240_action_invoke(&result_object, &vm_context);
|
|
|
|
l241_action_invoke(&result_object, &vm_context);
|
|
|
|
l242_action_invoke(&result_object, &vm_context);
|
2018-10-28 21:50:57 +01:00
|
|
|
}
|
|
|
|
fn create_module_2() -> ResultObject {
|
|
|
|
let module_str = "(module
|
|
|
|
(global (;0;) (mut f32) (f32.const 0x0p+0 (;=0;)))
|
|
|
|
(export \"a\" (global 0)))
|
|
|
|
";
|
|
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
|
|
instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated")
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 251
|
2018-10-28 21:50:57 +01:00
|
|
|
fn create_module_3() -> ResultObject {
|
|
|
|
let module_str = "(module
|
|
|
|
(global (;0;) (mut f32) (f32.const 0x0p+0 (;=0;)))
|
|
|
|
(export \"a\" (global 0)))
|
|
|
|
";
|
|
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
|
|
instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated")
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 254
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l254_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 10, 1, 125, 0, 67, 0, 0, 0, 0, 140, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 259
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l259_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 6, 1, 125, 0, 32, 0, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 264
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l264_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 10, 1, 125, 0, 67, 0, 0, 128, 63, 140, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 269
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l269_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 7, 1, 127, 0, 65, 0, 1, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 274
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l274_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 5, 1, 127, 0, 1, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 279
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l279_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 9, 1, 127, 0, 67, 0, 0, 0, 0, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 284
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l284_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 8, 1, 127, 0, 65, 0, 65, 0, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 289
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l289_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 4, 1, 127, 0, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 294
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l294_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 6, 1, 127, 0, 35, 0, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 299
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l299_assert_invalid() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 11, 2, 127, 0, 35, 1, 11, 127, 0, 65, 0, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is invalid");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 303
|
2018-10-28 21:50:57 +01:00
|
|
|
fn create_module_4() -> ResultObject {
|
|
|
|
let module_str = "(module
|
|
|
|
(import \"spectest\" \"global_i32\" (global (;0;) i32)))
|
|
|
|
";
|
|
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
|
|
instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated")
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 307
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l307_assert_malformed() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 2, 148, 128, 128, 128, 0, 1, 8, 115, 112, 101, 99, 116, 101, 115, 116, 10, 103, 108, 111, 98, 97, 108, 95, 105, 51, 50, 3, 127, 2];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is malformed");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 320
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l320_assert_malformed() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 2, 148, 128, 128, 128, 0, 1, 8, 115, 112, 101, 99, 116, 101, 115, 116, 10, 103, 108, 111, 98, 97, 108, 95, 105, 51, 50, 3, 127, 255];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is malformed");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 333
|
2018-10-28 21:50:57 +01:00
|
|
|
fn create_module_5() -> ResultObject {
|
|
|
|
let module_str = "(module
|
|
|
|
(global (;0;) i32 (i32.const 0)))
|
|
|
|
";
|
|
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
|
|
instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated")
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 337
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l337_assert_malformed() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 134, 128, 128, 128, 0, 1, 127, 2, 65, 0, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is malformed");
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:07:36 +01:00
|
|
|
// Line 349
|
2018-10-28 21:50:57 +01:00
|
|
|
#[test]
|
2018-10-29 14:07:36 +01:00
|
|
|
fn l349_assert_malformed() {
|
2018-10-28 21:50:57 +01:00
|
|
|
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 134, 128, 128, 128, 0, 1, 127, 255, 65, 0, 11];
|
|
|
|
let compilation = compile(wasm_binary.to_vec());
|
|
|
|
assert!(compilation.is_err(), "WASM should not compile as is malformed");
|
|
|
|
}
|