mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-15 23:25:41 +00:00
1708 lines
58 KiB
Rust
1708 lines
58 KiB
Rust
// Rust test file autogenerated with cargo build (build/spectests.rs).
|
|
// Please do NOT modify it by hand, as it will be reset on next build.
|
|
// Test based on spectests/int_exprs.wast
|
|
#![allow(
|
|
warnings,
|
|
dead_code
|
|
)]
|
|
use wabt::wat2wasm;
|
|
use std::{f32, f64};
|
|
|
|
use wasmer_runtime::types::Value;
|
|
use wasmer_runtime::{Instance, module::Module};
|
|
use wasmer_clif_backend::CraneliftCompiler;
|
|
|
|
use crate::spectests::_common::{
|
|
spectest_importobject,
|
|
NaNCheck,
|
|
};
|
|
|
|
|
|
// Line 6
|
|
fn create_module_1() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32 i32) (result i32)))
|
|
(type (;1;) (func (param i64 i64) (result i32)))
|
|
(func (;0;) (type 0) (param i32 i32) (result i32)
|
|
get_local 0
|
|
i32.const 1
|
|
i32.add
|
|
get_local 1
|
|
i32.const 1
|
|
i32.add
|
|
i32.lt_s)
|
|
(func (;1;) (type 0) (param i32 i32) (result i32)
|
|
get_local 0
|
|
i32.const 1
|
|
i32.add
|
|
get_local 1
|
|
i32.const 1
|
|
i32.add
|
|
i32.lt_u)
|
|
(func (;2;) (type 1) (param i64 i64) (result i32)
|
|
get_local 0
|
|
i64.const 1
|
|
i64.add
|
|
get_local 1
|
|
i64.const 1
|
|
i64.add
|
|
i64.lt_s)
|
|
(func (;3;) (type 1) (param i64 i64) (result i32)
|
|
get_local 0
|
|
i64.const 1
|
|
i64.add
|
|
get_local 1
|
|
i64.const 1
|
|
i64.add
|
|
i64.lt_u)
|
|
(export \"i32.no_fold_cmp_s_offset\" (func 0))
|
|
(export \"i32.no_fold_cmp_u_offset\" (func 1))
|
|
(export \"i64.no_fold_cmp_s_offset\" (func 2))
|
|
(export \"i64.no_fold_cmp_u_offset\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_1(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 18
|
|
fn c1_l18_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c1_l18_action_invoke");
|
|
let result = instance.call("i32.no_fold_cmp_s_offset", &[Value::I32(2147483647 as i32), Value::I32(0 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 19
|
|
fn c2_l19_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c2_l19_action_invoke");
|
|
let result = instance.call("i32.no_fold_cmp_u_offset", &[Value::I32(-1 as i32), Value::I32(0 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 20
|
|
fn c3_l20_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c3_l20_action_invoke");
|
|
let result = instance.call("i64.no_fold_cmp_s_offset", &[Value::I64(9223372036854775807 as i64), Value::I64(0 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 21
|
|
fn c4_l21_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c4_l21_action_invoke");
|
|
let result = instance.call("i64.no_fold_cmp_u_offset", &[Value::I64(-1 as i64), Value::I64(0 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 25
|
|
|
|
#[test]
|
|
fn test_module_1() {
|
|
let mut instance = create_module_1();
|
|
// We group the calls together
|
|
start_module_1(&mut instance);
|
|
c1_l18_action_invoke(&mut instance);
|
|
c2_l19_action_invoke(&mut instance);
|
|
c3_l20_action_invoke(&mut instance);
|
|
c4_l21_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_2() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i64) (result i64)
|
|
get_local 0
|
|
i32.wrap/i64
|
|
i64.extend_s/i32)
|
|
(export \"i64.no_fold_wrap_extend_s\" (func 0)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_2(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 30
|
|
fn c6_l30_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c6_l30_action_invoke");
|
|
let result = instance.call("i64.no_fold_wrap_extend_s", &[Value::I64(4538991236898928 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(1079009392 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 31
|
|
fn c7_l31_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c7_l31_action_invoke");
|
|
let result = instance.call("i64.no_fold_wrap_extend_s", &[Value::I64(45230338458316960 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(-790564704 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 35
|
|
|
|
#[test]
|
|
fn test_module_2() {
|
|
let mut instance = create_module_2();
|
|
// We group the calls together
|
|
start_module_2(&mut instance);
|
|
c6_l30_action_invoke(&mut instance);
|
|
c7_l31_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_3() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i64) (result i64)
|
|
get_local 0
|
|
i32.wrap/i64
|
|
i64.extend_u/i32)
|
|
(export \"i64.no_fold_wrap_extend_u\" (func 0)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_3(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 40
|
|
fn c9_l40_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c9_l40_action_invoke");
|
|
let result = instance.call("i64.no_fold_wrap_extend_u", &[Value::I64(4538991236898928 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(1079009392 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 44
|
|
|
|
#[test]
|
|
fn test_module_3() {
|
|
let mut instance = create_module_3();
|
|
// We group the calls together
|
|
start_module_3(&mut instance);
|
|
c9_l40_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_4() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 1
|
|
i32.shl
|
|
i32.const 1
|
|
i32.shr_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 1
|
|
i32.shl
|
|
i32.const 1
|
|
i32.shr_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 1
|
|
i64.shl
|
|
i64.const 1
|
|
i64.shr_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 1
|
|
i64.shl
|
|
i64.const 1
|
|
i64.shr_u)
|
|
(export \"i32.no_fold_shl_shr_s\" (func 0))
|
|
(export \"i32.no_fold_shl_shr_u\" (func 1))
|
|
(export \"i64.no_fold_shl_shr_s\" (func 2))
|
|
(export \"i64.no_fold_shl_shr_u\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_4(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 56
|
|
fn c11_l56_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c11_l56_action_invoke");
|
|
let result = instance.call("i32.no_fold_shl_shr_s", &[Value::I32(-2147483648 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 57
|
|
fn c12_l57_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c12_l57_action_invoke");
|
|
let result = instance.call("i32.no_fold_shl_shr_u", &[Value::I32(-2147483648 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 58
|
|
fn c13_l58_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c13_l58_action_invoke");
|
|
let result = instance.call("i64.no_fold_shl_shr_s", &[Value::I64(-9223372036854775808 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 59
|
|
fn c14_l59_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c14_l59_action_invoke");
|
|
let result = instance.call("i64.no_fold_shl_shr_u", &[Value::I64(-9223372036854775808 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 63
|
|
|
|
#[test]
|
|
fn test_module_4() {
|
|
let mut instance = create_module_4();
|
|
// We group the calls together
|
|
start_module_4(&mut instance);
|
|
c11_l56_action_invoke(&mut instance);
|
|
c12_l57_action_invoke(&mut instance);
|
|
c13_l58_action_invoke(&mut instance);
|
|
c14_l59_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_5() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 1
|
|
i32.shr_s
|
|
i32.const 1
|
|
i32.shl)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 1
|
|
i32.shr_u
|
|
i32.const 1
|
|
i32.shl)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 1
|
|
i64.shr_s
|
|
i64.const 1
|
|
i64.shl)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 1
|
|
i64.shr_u
|
|
i64.const 1
|
|
i64.shl)
|
|
(export \"i32.no_fold_shr_s_shl\" (func 0))
|
|
(export \"i32.no_fold_shr_u_shl\" (func 1))
|
|
(export \"i64.no_fold_shr_s_shl\" (func 2))
|
|
(export \"i64.no_fold_shr_u_shl\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_5(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 75
|
|
fn c16_l75_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c16_l75_action_invoke");
|
|
let result = instance.call("i32.no_fold_shr_s_shl", &[Value::I32(1 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 76
|
|
fn c17_l76_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c17_l76_action_invoke");
|
|
let result = instance.call("i32.no_fold_shr_u_shl", &[Value::I32(1 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 77
|
|
fn c18_l77_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c18_l77_action_invoke");
|
|
let result = instance.call("i64.no_fold_shr_s_shl", &[Value::I64(1 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 78
|
|
fn c19_l78_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c19_l78_action_invoke");
|
|
let result = instance.call("i64.no_fold_shr_u_shl", &[Value::I64(1 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 82
|
|
|
|
#[test]
|
|
fn test_module_5() {
|
|
let mut instance = create_module_5();
|
|
// We group the calls together
|
|
start_module_5(&mut instance);
|
|
c16_l75_action_invoke(&mut instance);
|
|
c17_l76_action_invoke(&mut instance);
|
|
c18_l77_action_invoke(&mut instance);
|
|
c19_l78_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_6() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 6
|
|
i32.div_s
|
|
i32.const 6
|
|
i32.mul)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 6
|
|
i32.div_u
|
|
i32.const 6
|
|
i32.mul)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 6
|
|
i64.div_s
|
|
i64.const 6
|
|
i64.mul)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 6
|
|
i64.div_u
|
|
i64.const 6
|
|
i64.mul)
|
|
(export \"i32.no_fold_div_s_mul\" (func 0))
|
|
(export \"i32.no_fold_div_u_mul\" (func 1))
|
|
(export \"i64.no_fold_div_s_mul\" (func 2))
|
|
(export \"i64.no_fold_div_u_mul\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_6(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 94
|
|
fn c21_l94_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c21_l94_action_invoke");
|
|
let result = instance.call("i32.no_fold_div_s_mul", &[Value::I32(1 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 95
|
|
fn c22_l95_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c22_l95_action_invoke");
|
|
let result = instance.call("i32.no_fold_div_u_mul", &[Value::I32(1 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 96
|
|
fn c23_l96_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c23_l96_action_invoke");
|
|
let result = instance.call("i64.no_fold_div_s_mul", &[Value::I64(1 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 97
|
|
fn c24_l97_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c24_l97_action_invoke");
|
|
let result = instance.call("i64.no_fold_div_u_mul", &[Value::I64(1 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 101
|
|
|
|
#[test]
|
|
fn test_module_6() {
|
|
let mut instance = create_module_6();
|
|
// We group the calls together
|
|
start_module_6(&mut instance);
|
|
c21_l94_action_invoke(&mut instance);
|
|
c22_l95_action_invoke(&mut instance);
|
|
c23_l96_action_invoke(&mut instance);
|
|
c24_l97_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_7() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
get_local 0
|
|
i32.div_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
get_local 0
|
|
i32.div_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
get_local 0
|
|
i64.div_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
get_local 0
|
|
i64.div_u)
|
|
(export \"i32.no_fold_div_s_self\" (func 0))
|
|
(export \"i32.no_fold_div_u_self\" (func 1))
|
|
(export \"i64.no_fold_div_s_self\" (func 2))
|
|
(export \"i64.no_fold_div_u_self\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_7(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 113
|
|
fn c26_l113_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c26_l113_action_invoke");
|
|
let result = instance.call("i32.no_fold_div_s_self", &[Value::I32(0 as i32)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c26_l113_assert_trap() {
|
|
let mut instance = create_module_7();
|
|
let result = c26_l113_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 114
|
|
fn c27_l114_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c27_l114_action_invoke");
|
|
let result = instance.call("i32.no_fold_div_u_self", &[Value::I32(0 as i32)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c27_l114_assert_trap() {
|
|
let mut instance = create_module_7();
|
|
let result = c27_l114_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 115
|
|
fn c28_l115_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c28_l115_action_invoke");
|
|
let result = instance.call("i64.no_fold_div_s_self", &[Value::I64(0 as i64)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c28_l115_assert_trap() {
|
|
let mut instance = create_module_7();
|
|
let result = c28_l115_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 116
|
|
fn c29_l116_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c29_l116_action_invoke");
|
|
let result = instance.call("i64.no_fold_div_u_self", &[Value::I64(0 as i64)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c29_l116_assert_trap() {
|
|
let mut instance = create_module_7();
|
|
let result = c29_l116_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 120
|
|
|
|
#[test]
|
|
fn test_module_7() {
|
|
let mut instance = create_module_7();
|
|
// We group the calls together
|
|
start_module_7(&mut instance);
|
|
}
|
|
fn create_module_8() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
get_local 0
|
|
i32.rem_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
get_local 0
|
|
i32.rem_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
get_local 0
|
|
i64.rem_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
get_local 0
|
|
i64.rem_u)
|
|
(export \"i32.no_fold_rem_s_self\" (func 0))
|
|
(export \"i32.no_fold_rem_u_self\" (func 1))
|
|
(export \"i64.no_fold_rem_s_self\" (func 2))
|
|
(export \"i64.no_fold_rem_u_self\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_8(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 132
|
|
fn c31_l132_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c31_l132_action_invoke");
|
|
let result = instance.call("i32.no_fold_rem_s_self", &[Value::I32(0 as i32)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c31_l132_assert_trap() {
|
|
let mut instance = create_module_8();
|
|
let result = c31_l132_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 133
|
|
fn c32_l133_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c32_l133_action_invoke");
|
|
let result = instance.call("i32.no_fold_rem_u_self", &[Value::I32(0 as i32)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c32_l133_assert_trap() {
|
|
let mut instance = create_module_8();
|
|
let result = c32_l133_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 134
|
|
fn c33_l134_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c33_l134_action_invoke");
|
|
let result = instance.call("i64.no_fold_rem_s_self", &[Value::I64(0 as i64)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c33_l134_assert_trap() {
|
|
let mut instance = create_module_8();
|
|
let result = c33_l134_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 135
|
|
fn c34_l135_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c34_l135_action_invoke");
|
|
let result = instance.call("i64.no_fold_rem_u_self", &[Value::I64(0 as i64)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c34_l135_assert_trap() {
|
|
let mut instance = create_module_8();
|
|
let result = c34_l135_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 139
|
|
|
|
#[test]
|
|
fn test_module_8() {
|
|
let mut instance = create_module_8();
|
|
// We group the calls together
|
|
start_module_8(&mut instance);
|
|
}
|
|
fn create_module_9() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 6
|
|
i32.mul
|
|
i32.const 6
|
|
i32.div_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 6
|
|
i32.mul
|
|
i32.const 6
|
|
i32.div_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 6
|
|
i64.mul
|
|
i64.const 6
|
|
i64.div_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 6
|
|
i64.mul
|
|
i64.const 6
|
|
i64.div_u)
|
|
(export \"i32.no_fold_mul_div_s\" (func 0))
|
|
(export \"i32.no_fold_mul_div_u\" (func 1))
|
|
(export \"i64.no_fold_mul_div_s\" (func 2))
|
|
(export \"i64.no_fold_mul_div_u\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_9(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 151
|
|
fn c36_l151_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c36_l151_action_invoke");
|
|
let result = instance.call("i32.no_fold_mul_div_s", &[Value::I32(-2147483648 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 152
|
|
fn c37_l152_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c37_l152_action_invoke");
|
|
let result = instance.call("i32.no_fold_mul_div_u", &[Value::I32(-2147483648 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 153
|
|
fn c38_l153_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c38_l153_action_invoke");
|
|
let result = instance.call("i64.no_fold_mul_div_s", &[Value::I64(-9223372036854775808 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 154
|
|
fn c39_l154_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c39_l154_action_invoke");
|
|
let result = instance.call("i64.no_fold_mul_div_u", &[Value::I64(-9223372036854775808 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 158
|
|
|
|
#[test]
|
|
fn test_module_9() {
|
|
let mut instance = create_module_9();
|
|
// We group the calls together
|
|
start_module_9(&mut instance);
|
|
c36_l151_action_invoke(&mut instance);
|
|
c37_l152_action_invoke(&mut instance);
|
|
c38_l153_action_invoke(&mut instance);
|
|
c39_l154_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_10() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 2
|
|
i32.div_s)
|
|
(func (;1;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 2
|
|
i64.div_s)
|
|
(export \"i32.no_fold_div_s_2\" (func 0))
|
|
(export \"i64.no_fold_div_s_2\" (func 1)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_10(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 166
|
|
fn c41_l166_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c41_l166_action_invoke");
|
|
let result = instance.call("i32.no_fold_div_s_2", &[Value::I32(-11 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(-5 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 167
|
|
fn c42_l167_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c42_l167_action_invoke");
|
|
let result = instance.call("i64.no_fold_div_s_2", &[Value::I64(-11 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(-5 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 171
|
|
|
|
#[test]
|
|
fn test_module_10() {
|
|
let mut instance = create_module_10();
|
|
// We group the calls together
|
|
start_module_10(&mut instance);
|
|
c41_l166_action_invoke(&mut instance);
|
|
c42_l167_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_11() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 2
|
|
i32.rem_s)
|
|
(func (;1;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 2
|
|
i64.rem_s)
|
|
(export \"i32.no_fold_rem_s_2\" (func 0))
|
|
(export \"i64.no_fold_rem_s_2\" (func 1)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_11(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 179
|
|
fn c44_l179_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c44_l179_action_invoke");
|
|
let result = instance.call("i32.no_fold_rem_s_2", &[Value::I32(-11 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(-1 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 180
|
|
fn c45_l180_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c45_l180_action_invoke");
|
|
let result = instance.call("i64.no_fold_rem_s_2", &[Value::I64(-11 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(-1 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 184
|
|
|
|
#[test]
|
|
fn test_module_11() {
|
|
let mut instance = create_module_11();
|
|
// We group the calls together
|
|
start_module_11(&mut instance);
|
|
c44_l179_action_invoke(&mut instance);
|
|
c45_l180_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_12() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 0
|
|
i32.div_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 0
|
|
i32.div_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 0
|
|
i64.div_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 0
|
|
i64.div_u)
|
|
(export \"i32.div_s_0\" (func 0))
|
|
(export \"i32.div_u_0\" (func 1))
|
|
(export \"i64.div_s_0\" (func 2))
|
|
(export \"i64.div_u_0\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_12(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 196
|
|
fn c47_l196_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c47_l196_action_invoke");
|
|
let result = instance.call("i32.div_s_0", &[Value::I32(71 as i32)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c47_l196_assert_trap() {
|
|
let mut instance = create_module_12();
|
|
let result = c47_l196_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 197
|
|
fn c48_l197_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c48_l197_action_invoke");
|
|
let result = instance.call("i32.div_u_0", &[Value::I32(71 as i32)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c48_l197_assert_trap() {
|
|
let mut instance = create_module_12();
|
|
let result = c48_l197_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 198
|
|
fn c49_l198_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c49_l198_action_invoke");
|
|
let result = instance.call("i64.div_s_0", &[Value::I64(71 as i64)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c49_l198_assert_trap() {
|
|
let mut instance = create_module_12();
|
|
let result = c49_l198_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 199
|
|
fn c50_l199_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c50_l199_action_invoke");
|
|
let result = instance.call("i64.div_u_0", &[Value::I64(71 as i64)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c50_l199_assert_trap() {
|
|
let mut instance = create_module_12();
|
|
let result = c50_l199_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 203
|
|
|
|
#[test]
|
|
fn test_module_12() {
|
|
let mut instance = create_module_12();
|
|
// We group the calls together
|
|
start_module_12(&mut instance);
|
|
}
|
|
fn create_module_13() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 3
|
|
i32.div_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 3
|
|
i32.div_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 3
|
|
i64.div_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 3
|
|
i64.div_u)
|
|
(export \"i32.div_s_3\" (func 0))
|
|
(export \"i32.div_u_3\" (func 1))
|
|
(export \"i64.div_s_3\" (func 2))
|
|
(export \"i64.div_u_3\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_13(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 215
|
|
fn c52_l215_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c52_l215_action_invoke");
|
|
let result = instance.call("i32.div_s_3", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(23 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 216
|
|
fn c53_l216_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c53_l216_action_invoke");
|
|
let result = instance.call("i32.div_s_3", &[Value::I32(1610612736 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(536870912 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 217
|
|
fn c54_l217_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c54_l217_action_invoke");
|
|
let result = instance.call("i32.div_u_3", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(23 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 218
|
|
fn c55_l218_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c55_l218_action_invoke");
|
|
let result = instance.call("i32.div_u_3", &[Value::I32(-1073741824 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(1073741824 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 219
|
|
fn c56_l219_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c56_l219_action_invoke");
|
|
let result = instance.call("i64.div_s_3", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(23 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 220
|
|
fn c57_l220_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c57_l220_action_invoke");
|
|
let result = instance.call("i64.div_s_3", &[Value::I64(3458764513820540928 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(1152921504606846976 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 221
|
|
fn c58_l221_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c58_l221_action_invoke");
|
|
let result = instance.call("i64.div_u_3", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(23 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 222
|
|
fn c59_l222_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c59_l222_action_invoke");
|
|
let result = instance.call("i64.div_u_3", &[Value::I64(-4611686018427387904 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(4611686018427387904 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 226
|
|
|
|
#[test]
|
|
fn test_module_13() {
|
|
let mut instance = create_module_13();
|
|
// We group the calls together
|
|
start_module_13(&mut instance);
|
|
c52_l215_action_invoke(&mut instance);
|
|
c53_l216_action_invoke(&mut instance);
|
|
c54_l217_action_invoke(&mut instance);
|
|
c55_l218_action_invoke(&mut instance);
|
|
c56_l219_action_invoke(&mut instance);
|
|
c57_l220_action_invoke(&mut instance);
|
|
c58_l221_action_invoke(&mut instance);
|
|
c59_l222_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_14() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 5
|
|
i32.div_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 5
|
|
i32.div_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 5
|
|
i64.div_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 5
|
|
i64.div_u)
|
|
(export \"i32.div_s_5\" (func 0))
|
|
(export \"i32.div_u_5\" (func 1))
|
|
(export \"i64.div_s_5\" (func 2))
|
|
(export \"i64.div_u_5\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_14(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 238
|
|
fn c61_l238_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c61_l238_action_invoke");
|
|
let result = instance.call("i32.div_s_5", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(14 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 239
|
|
fn c62_l239_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c62_l239_action_invoke");
|
|
let result = instance.call("i32.div_s_5", &[Value::I32(1342177280 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(268435456 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 240
|
|
fn c63_l240_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c63_l240_action_invoke");
|
|
let result = instance.call("i32.div_u_5", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(14 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 241
|
|
fn c64_l241_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c64_l241_action_invoke");
|
|
let result = instance.call("i32.div_u_5", &[Value::I32(-1610612736 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(536870912 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 242
|
|
fn c65_l242_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c65_l242_action_invoke");
|
|
let result = instance.call("i64.div_s_5", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(14 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 243
|
|
fn c66_l243_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c66_l243_action_invoke");
|
|
let result = instance.call("i64.div_s_5", &[Value::I64(5764607523034234880 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(1152921504606846976 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 244
|
|
fn c67_l244_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c67_l244_action_invoke");
|
|
let result = instance.call("i64.div_u_5", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(14 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 245
|
|
fn c68_l245_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c68_l245_action_invoke");
|
|
let result = instance.call("i64.div_u_5", &[Value::I64(-6917529027641081856 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(2305843009213693952 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 249
|
|
|
|
#[test]
|
|
fn test_module_14() {
|
|
let mut instance = create_module_14();
|
|
// We group the calls together
|
|
start_module_14(&mut instance);
|
|
c61_l238_action_invoke(&mut instance);
|
|
c62_l239_action_invoke(&mut instance);
|
|
c63_l240_action_invoke(&mut instance);
|
|
c64_l241_action_invoke(&mut instance);
|
|
c65_l242_action_invoke(&mut instance);
|
|
c66_l243_action_invoke(&mut instance);
|
|
c67_l244_action_invoke(&mut instance);
|
|
c68_l245_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_15() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 7
|
|
i32.div_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 7
|
|
i32.div_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 7
|
|
i64.div_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 7
|
|
i64.div_u)
|
|
(export \"i32.div_s_7\" (func 0))
|
|
(export \"i32.div_u_7\" (func 1))
|
|
(export \"i64.div_s_7\" (func 2))
|
|
(export \"i64.div_u_7\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_15(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 261
|
|
fn c70_l261_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c70_l261_action_invoke");
|
|
let result = instance.call("i32.div_s_7", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(10 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 262
|
|
fn c71_l262_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c71_l262_action_invoke");
|
|
let result = instance.call("i32.div_s_7", &[Value::I32(1879048192 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(268435456 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 263
|
|
fn c72_l263_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c72_l263_action_invoke");
|
|
let result = instance.call("i32.div_u_7", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(10 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 264
|
|
fn c73_l264_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c73_l264_action_invoke");
|
|
let result = instance.call("i32.div_u_7", &[Value::I32(-536870912 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(536870912 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 265
|
|
fn c74_l265_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c74_l265_action_invoke");
|
|
let result = instance.call("i64.div_s_7", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(10 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 266
|
|
fn c75_l266_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c75_l266_action_invoke");
|
|
let result = instance.call("i64.div_s_7", &[Value::I64(8070450532247928832 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(1152921504606846976 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 267
|
|
fn c76_l267_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c76_l267_action_invoke");
|
|
let result = instance.call("i64.div_u_7", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(10 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 268
|
|
fn c77_l268_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c77_l268_action_invoke");
|
|
let result = instance.call("i64.div_u_7", &[Value::I64(-2305843009213693952 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(2305843009213693952 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 272
|
|
|
|
#[test]
|
|
fn test_module_15() {
|
|
let mut instance = create_module_15();
|
|
// We group the calls together
|
|
start_module_15(&mut instance);
|
|
c70_l261_action_invoke(&mut instance);
|
|
c71_l262_action_invoke(&mut instance);
|
|
c72_l263_action_invoke(&mut instance);
|
|
c73_l264_action_invoke(&mut instance);
|
|
c74_l265_action_invoke(&mut instance);
|
|
c75_l266_action_invoke(&mut instance);
|
|
c76_l267_action_invoke(&mut instance);
|
|
c77_l268_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_16() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 3
|
|
i32.rem_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 3
|
|
i32.rem_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 3
|
|
i64.rem_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 3
|
|
i64.rem_u)
|
|
(export \"i32.rem_s_3\" (func 0))
|
|
(export \"i32.rem_u_3\" (func 1))
|
|
(export \"i64.rem_s_3\" (func 2))
|
|
(export \"i64.rem_u_3\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_16(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 284
|
|
fn c79_l284_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c79_l284_action_invoke");
|
|
let result = instance.call("i32.rem_s_3", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(2 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 285
|
|
fn c80_l285_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c80_l285_action_invoke");
|
|
let result = instance.call("i32.rem_s_3", &[Value::I32(1610612736 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 286
|
|
fn c81_l286_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c81_l286_action_invoke");
|
|
let result = instance.call("i32.rem_u_3", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(2 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 287
|
|
fn c82_l287_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c82_l287_action_invoke");
|
|
let result = instance.call("i32.rem_u_3", &[Value::I32(-1073741824 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 288
|
|
fn c83_l288_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c83_l288_action_invoke");
|
|
let result = instance.call("i64.rem_s_3", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(2 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 289
|
|
fn c84_l289_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c84_l289_action_invoke");
|
|
let result = instance.call("i64.rem_s_3", &[Value::I64(3458764513820540928 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 290
|
|
fn c85_l290_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c85_l290_action_invoke");
|
|
let result = instance.call("i64.rem_u_3", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(2 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 291
|
|
fn c86_l291_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c86_l291_action_invoke");
|
|
let result = instance.call("i64.rem_u_3", &[Value::I64(-4611686018427387904 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 295
|
|
|
|
#[test]
|
|
fn test_module_16() {
|
|
let mut instance = create_module_16();
|
|
// We group the calls together
|
|
start_module_16(&mut instance);
|
|
c79_l284_action_invoke(&mut instance);
|
|
c80_l285_action_invoke(&mut instance);
|
|
c81_l286_action_invoke(&mut instance);
|
|
c82_l287_action_invoke(&mut instance);
|
|
c83_l288_action_invoke(&mut instance);
|
|
c84_l289_action_invoke(&mut instance);
|
|
c85_l290_action_invoke(&mut instance);
|
|
c86_l291_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_17() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 5
|
|
i32.rem_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 5
|
|
i32.rem_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 5
|
|
i64.rem_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 5
|
|
i64.rem_u)
|
|
(export \"i32.rem_s_5\" (func 0))
|
|
(export \"i32.rem_u_5\" (func 1))
|
|
(export \"i64.rem_s_5\" (func 2))
|
|
(export \"i64.rem_u_5\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_17(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 307
|
|
fn c88_l307_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c88_l307_action_invoke");
|
|
let result = instance.call("i32.rem_s_5", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 308
|
|
fn c89_l308_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c89_l308_action_invoke");
|
|
let result = instance.call("i32.rem_s_5", &[Value::I32(1342177280 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 309
|
|
fn c90_l309_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c90_l309_action_invoke");
|
|
let result = instance.call("i32.rem_u_5", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 310
|
|
fn c91_l310_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c91_l310_action_invoke");
|
|
let result = instance.call("i32.rem_u_5", &[Value::I32(-1610612736 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 311
|
|
fn c92_l311_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c92_l311_action_invoke");
|
|
let result = instance.call("i64.rem_s_5", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(1 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 312
|
|
fn c93_l312_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c93_l312_action_invoke");
|
|
let result = instance.call("i64.rem_s_5", &[Value::I64(5764607523034234880 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 313
|
|
fn c94_l313_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c94_l313_action_invoke");
|
|
let result = instance.call("i64.rem_u_5", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(1 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 314
|
|
fn c95_l314_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c95_l314_action_invoke");
|
|
let result = instance.call("i64.rem_u_5", &[Value::I64(-6917529027641081856 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 318
|
|
|
|
#[test]
|
|
fn test_module_17() {
|
|
let mut instance = create_module_17();
|
|
// We group the calls together
|
|
start_module_17(&mut instance);
|
|
c88_l307_action_invoke(&mut instance);
|
|
c89_l308_action_invoke(&mut instance);
|
|
c90_l309_action_invoke(&mut instance);
|
|
c91_l310_action_invoke(&mut instance);
|
|
c92_l311_action_invoke(&mut instance);
|
|
c93_l312_action_invoke(&mut instance);
|
|
c94_l313_action_invoke(&mut instance);
|
|
c95_l314_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_18() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 7
|
|
i32.rem_s)
|
|
(func (;1;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const 7
|
|
i32.rem_u)
|
|
(func (;2;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 7
|
|
i64.rem_s)
|
|
(func (;3;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const 7
|
|
i64.rem_u)
|
|
(export \"i32.rem_s_7\" (func 0))
|
|
(export \"i32.rem_u_7\" (func 1))
|
|
(export \"i64.rem_s_7\" (func 2))
|
|
(export \"i64.rem_u_7\" (func 3)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_18(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 330
|
|
fn c97_l330_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c97_l330_action_invoke");
|
|
let result = instance.call("i32.rem_s_7", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 331
|
|
fn c98_l331_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c98_l331_action_invoke");
|
|
let result = instance.call("i32.rem_s_7", &[Value::I32(1879048192 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 332
|
|
fn c99_l332_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c99_l332_action_invoke");
|
|
let result = instance.call("i32.rem_u_7", &[Value::I32(71 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 333
|
|
fn c100_l333_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c100_l333_action_invoke");
|
|
let result = instance.call("i32.rem_u_7", &[Value::I32(-536870912 as i32)]);
|
|
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 334
|
|
fn c101_l334_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c101_l334_action_invoke");
|
|
let result = instance.call("i64.rem_s_7", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(1 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 335
|
|
fn c102_l335_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c102_l335_action_invoke");
|
|
let result = instance.call("i64.rem_s_7", &[Value::I64(8070450532247928832 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 336
|
|
fn c103_l336_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c103_l336_action_invoke");
|
|
let result = instance.call("i64.rem_u_7", &[Value::I64(71 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(1 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 337
|
|
fn c104_l337_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c104_l337_action_invoke");
|
|
let result = instance.call("i64.rem_u_7", &[Value::I64(-2305843009213693952 as i64)]);
|
|
assert_eq!(result, Ok(Some(Value::I64(0 as i64))));
|
|
result.map(|_| ())
|
|
}
|
|
|
|
// Line 341
|
|
|
|
#[test]
|
|
fn test_module_18() {
|
|
let mut instance = create_module_18();
|
|
// We group the calls together
|
|
start_module_18(&mut instance);
|
|
c97_l330_action_invoke(&mut instance);
|
|
c98_l331_action_invoke(&mut instance);
|
|
c99_l332_action_invoke(&mut instance);
|
|
c100_l333_action_invoke(&mut instance);
|
|
c101_l334_action_invoke(&mut instance);
|
|
c102_l335_action_invoke(&mut instance);
|
|
c103_l336_action_invoke(&mut instance);
|
|
c104_l337_action_invoke(&mut instance);
|
|
}
|
|
fn create_module_19() -> Box<Instance> {
|
|
let module_str = "(module
|
|
(type (;0;) (func (param i32) (result i32)))
|
|
(type (;1;) (func (param i64) (result i64)))
|
|
(func (;0;) (type 0) (param i32) (result i32)
|
|
get_local 0
|
|
i32.const -1
|
|
i32.div_s)
|
|
(func (;1;) (type 1) (param i64) (result i64)
|
|
get_local 0
|
|
i64.const -1
|
|
i64.div_s)
|
|
(export \"i32.no_fold_div_neg1\" (func 0))
|
|
(export \"i64.no_fold_div_neg1\" (func 1)))
|
|
";
|
|
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
|
module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated")
|
|
}
|
|
|
|
fn start_module_19(instance: &mut Instance) {
|
|
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
|
|
//instance.start();
|
|
}
|
|
|
|
// Line 349
|
|
fn c106_l349_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c106_l349_action_invoke");
|
|
let result = instance.call("i32.no_fold_div_neg1", &[Value::I32(-2147483648 as i32)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c106_l349_assert_trap() {
|
|
let mut instance = create_module_19();
|
|
let result = c106_l349_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
// Line 350
|
|
fn c107_l350_action_invoke(instance: &mut Instance) -> Result<(), String> {
|
|
println!("Executing function {}", "c107_l350_action_invoke");
|
|
let result = instance.call("i64.no_fold_div_neg1", &[Value::I64(-9223372036854775808 as i64)]);
|
|
|
|
result.map(|_| ())
|
|
}
|
|
|
|
#[test]
|
|
fn c107_l350_assert_trap() {
|
|
let mut instance = create_module_19();
|
|
let result = c107_l350_action_invoke(&mut*instance);
|
|
assert!(result.is_err());
|
|
}
|
|
|
|
#[test]
|
|
fn test_module_19() {
|
|
let mut instance = create_module_19();
|
|
// We group the calls together
|
|
start_module_19(&mut instance);
|
|
}
|