wasmer/lib/runtime/tests/spectests/globals.rs
2019-01-09 20:32:02 -05:00

911 lines
31 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/globals.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 4
fn create_module_1() -> Box<Instance> {
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 (;0;) (i32.const 0) 26))
";
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 182
fn c1_l182_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c1_l182_action_invoke");
let result = instance.call("get-a", &[]);
assert_eq!(result, Ok(Some(Value::I32(-2 as i32))));
result.map(|_| ())
}
// Line 183
fn c2_l183_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c2_l183_action_invoke");
let result = instance.call("get-b", &[]);
assert_eq!(result, Ok(Some(Value::I64(-5 as i64))));
result.map(|_| ())
}
// Line 184
fn c3_l184_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c3_l184_action_invoke");
let result = instance.call("get-x", &[]);
assert_eq!(result, Ok(Some(Value::I32(-12 as i32))));
result.map(|_| ())
}
// Line 185
fn c4_l185_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c4_l185_action_invoke");
let result = instance.call("get-y", &[]);
assert_eq!(result, Ok(Some(Value::I64(-15 as i64))));
result.map(|_| ())
}
// Line 187
fn c5_l187_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c5_l187_action_invoke");
let result = instance.call("get-1", &[]);
assert_eq!(result, Ok(Some(Value::F32((-3.0f32)))));
result.map(|_| ())
}
// Line 188
fn c6_l188_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c6_l188_action_invoke");
let result = instance.call("get-2", &[]);
assert_eq!(result, Ok(Some(Value::F64((-4.0f64)))));
result.map(|_| ())
}
// Line 189
fn c7_l189_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c7_l189_action_invoke");
let result = instance.call("get-5", &[]);
assert_eq!(result, Ok(Some(Value::F32((-13.0f32)))));
result.map(|_| ())
}
// Line 190
fn c8_l190_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c8_l190_action_invoke");
let result = instance.call("get-6", &[]);
assert_eq!(result, Ok(Some(Value::F64((-14.0f64)))));
result.map(|_| ())
}
// Line 192
fn c9_l192_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c9_l192_action_invoke");
let result = instance.call("set-x", &[Value::I32(6 as i32)]);
assert_eq!(result, Ok(None));
result.map(|_| ())
}
// Line 193
fn c10_l193_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c10_l193_action_invoke");
let result = instance.call("set-y", &[Value::I64(7 as i64)]);
assert_eq!(result, Ok(None));
result.map(|_| ())
}
// Line 194
fn c11_l194_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c11_l194_action_invoke");
let result = instance.call("set-5", &[Value::F32((8.0f32))]);
assert_eq!(result, Ok(None));
result.map(|_| ())
}
// Line 195
fn c12_l195_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c12_l195_action_invoke");
let result = instance.call("set-6", &[Value::F64((9.0f64))]);
assert_eq!(result, Ok(None));
result.map(|_| ())
}
// Line 197
fn c13_l197_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c13_l197_action_invoke");
let result = instance.call("get-x", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 198
fn c14_l198_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c14_l198_action_invoke");
let result = instance.call("get-y", &[]);
assert_eq!(result, Ok(Some(Value::I64(7 as i64))));
result.map(|_| ())
}
// Line 199
fn c15_l199_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c15_l199_action_invoke");
let result = instance.call("get-5", &[]);
assert_eq!(result, Ok(Some(Value::F32((8.0f32)))));
result.map(|_| ())
}
// Line 200
fn c16_l200_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c16_l200_action_invoke");
let result = instance.call("get-6", &[]);
assert_eq!(result, Ok(Some(Value::F64((9.0f64)))));
result.map(|_| ())
}
// Line 202
fn c17_l202_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c17_l202_action_invoke");
let result = instance.call("as-select-first", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 203
fn c18_l203_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c18_l203_action_invoke");
let result = instance.call("as-select-mid", &[]);
assert_eq!(result, Ok(Some(Value::I32(2 as i32))));
result.map(|_| ())
}
// Line 204
fn c19_l204_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c19_l204_action_invoke");
let result = instance.call("as-select-last", &[]);
assert_eq!(result, Ok(Some(Value::I32(2 as i32))));
result.map(|_| ())
}
// Line 206
fn c20_l206_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c20_l206_action_invoke");
let result = instance.call("as-loop-first", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 207
fn c21_l207_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c21_l207_action_invoke");
let result = instance.call("as-loop-mid", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 208
fn c22_l208_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c22_l208_action_invoke");
let result = instance.call("as-loop-last", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 210
fn c23_l210_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c23_l210_action_invoke");
let result = instance.call("as-if-condition", &[]);
assert_eq!(result, Ok(Some(Value::I32(2 as i32))));
result.map(|_| ())
}
// Line 211
fn c24_l211_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c24_l211_action_invoke");
let result = instance.call("as-if-then", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 212
fn c25_l212_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c25_l212_action_invoke");
let result = instance.call("as-if-else", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 214
fn c26_l214_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c26_l214_action_invoke");
let result = instance.call("as-br_if-first", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 215
fn c27_l215_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c27_l215_action_invoke");
let result = instance.call("as-br_if-last", &[]);
assert_eq!(result, Ok(Some(Value::I32(2 as i32))));
result.map(|_| ())
}
// Line 217
fn c28_l217_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c28_l217_action_invoke");
let result = instance.call("as-br_table-first", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 218
fn c29_l218_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c29_l218_action_invoke");
let result = instance.call("as-br_table-last", &[]);
assert_eq!(result, Ok(Some(Value::I32(2 as i32))));
result.map(|_| ())
}
// Line 220
fn c30_l220_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c30_l220_action_invoke");
let result = instance.call("as-call_indirect-first", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 221
fn c31_l221_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c31_l221_action_invoke");
let result = instance.call("as-call_indirect-mid", &[]);
assert_eq!(result, Ok(Some(Value::I32(2 as i32))));
result.map(|_| ())
}
// Line 222
fn c32_l222_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c32_l222_action_invoke");
let result = instance.call("as-call_indirect-last", &[]);
result.map(|_| ())
}
#[test]
fn c32_l222_assert_trap() {
let mut instance = create_module_1();
let result = c32_l222_action_invoke(&mut*instance);
assert!(result.is_err());
}
// Line 224
fn c33_l224_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c33_l224_action_invoke");
let result = instance.call("as-store-first", &[]);
assert_eq!(result, Ok(None));
result.map(|_| ())
}
// Line 225
fn c34_l225_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c34_l225_action_invoke");
let result = instance.call("as-store-last", &[]);
assert_eq!(result, Ok(None));
result.map(|_| ())
}
// Line 226
fn c35_l226_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c35_l226_action_invoke");
let result = instance.call("as-load-operand", &[]);
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
result.map(|_| ())
}
// Line 227
fn c36_l227_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c36_l227_action_invoke");
let result = instance.call("as-memory.grow-value", &[]);
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
result.map(|_| ())
}
// Line 229
fn c37_l229_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c37_l229_action_invoke");
let result = instance.call("as-call-value", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 231
fn c38_l231_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c38_l231_action_invoke");
let result = instance.call("as-return-value", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 232
fn c39_l232_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c39_l232_action_invoke");
let result = instance.call("as-drop-operand", &[]);
assert_eq!(result, Ok(None));
result.map(|_| ())
}
// Line 233
fn c40_l233_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c40_l233_action_invoke");
let result = instance.call("as-br-value", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 235
fn c41_l235_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c41_l235_action_invoke");
let result = instance.call("as-set_local-value", &[Value::I32(1 as i32)]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 236
fn c42_l236_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c42_l236_action_invoke");
let result = instance.call("as-tee_local-value", &[Value::I32(1 as i32)]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 237
fn c43_l237_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c43_l237_action_invoke");
let result = instance.call("as-set_global-value", &[]);
assert_eq!(result, Ok(Some(Value::I32(6 as i32))));
result.map(|_| ())
}
// Line 239
fn c44_l239_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c44_l239_action_invoke");
let result = instance.call("as-unary-operand", &[]);
assert_eq!(result, Ok(Some(Value::I32(0 as i32))));
result.map(|_| ())
}
// Line 240
fn c45_l240_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c45_l240_action_invoke");
let result = instance.call("as-binary-operand", &[]);
assert_eq!(result, Ok(Some(Value::I32(36 as i32))));
result.map(|_| ())
}
// Line 241
fn c46_l241_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c46_l241_action_invoke");
let result = instance.call("as-compare-operand", &[]);
assert_eq!(result, Ok(Some(Value::I32(1 as i32))));
result.map(|_| ())
}
// Line 244
#[test]
fn c47_l244_assert_invalid() {
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 module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 256
#[test]
fn c48_l256_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 10, 1, 125, 0, 67, 0, 0, 0, 0, 140, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 261
#[test]
fn c49_l261_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 6, 1, 125, 0, 32, 0, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 266
#[test]
fn c50_l266_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 10, 1, 125, 0, 67, 0, 0, 128, 63, 140, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 271
#[test]
fn c51_l271_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 7, 1, 127, 0, 65, 0, 1, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 276
#[test]
fn c52_l276_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 5, 1, 127, 0, 1, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 281
#[test]
fn c53_l281_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 9, 1, 127, 0, 67, 0, 0, 0, 0, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 286
#[test]
fn c54_l286_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 8, 1, 127, 0, 65, 0, 65, 0, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 291
#[test]
fn c55_l291_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 11, 2, 127, 0, 65, 0, 11, 126, 0, 35, 1, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 297
#[test]
fn c56_l297_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 4, 1, 127, 0, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 302
#[test]
fn c57_l302_assert_invalid() {
let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 6, 6, 1, 127, 0, 35, 0, 11];
let module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 307
#[test]
fn c58_l307_assert_invalid() {
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 module = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(module.is_err(), "WASM should not compile as is invalid");
}
// Line 311
#[test]
fn test_module_1() {
let mut instance = create_module_1();
// We group the calls together
start_module_1(&mut instance);
c1_l182_action_invoke(&mut instance);
c2_l183_action_invoke(&mut instance);
c3_l184_action_invoke(&mut instance);
c4_l185_action_invoke(&mut instance);
c5_l187_action_invoke(&mut instance);
c6_l188_action_invoke(&mut instance);
c7_l189_action_invoke(&mut instance);
c8_l190_action_invoke(&mut instance);
c9_l192_action_invoke(&mut instance);
c10_l193_action_invoke(&mut instance);
c11_l194_action_invoke(&mut instance);
c12_l195_action_invoke(&mut instance);
c13_l197_action_invoke(&mut instance);
c14_l198_action_invoke(&mut instance);
c15_l199_action_invoke(&mut instance);
c16_l200_action_invoke(&mut instance);
c17_l202_action_invoke(&mut instance);
c18_l203_action_invoke(&mut instance);
c19_l204_action_invoke(&mut instance);
c20_l206_action_invoke(&mut instance);
c21_l207_action_invoke(&mut instance);
c22_l208_action_invoke(&mut instance);
c23_l210_action_invoke(&mut instance);
c24_l211_action_invoke(&mut instance);
c25_l212_action_invoke(&mut instance);
c26_l214_action_invoke(&mut instance);
c27_l215_action_invoke(&mut instance);
c28_l217_action_invoke(&mut instance);
c29_l218_action_invoke(&mut instance);
c30_l220_action_invoke(&mut instance);
c31_l221_action_invoke(&mut instance);
c33_l224_action_invoke(&mut instance);
c34_l225_action_invoke(&mut instance);
c35_l226_action_invoke(&mut instance);
c36_l227_action_invoke(&mut instance);
c37_l229_action_invoke(&mut instance);
c38_l231_action_invoke(&mut instance);
c39_l232_action_invoke(&mut instance);
c40_l233_action_invoke(&mut instance);
c41_l235_action_invoke(&mut instance);
c42_l236_action_invoke(&mut instance);
c43_l237_action_invoke(&mut instance);
c44_l239_action_invoke(&mut instance);
c45_l240_action_invoke(&mut instance);
c46_l241_action_invoke(&mut instance);
}
fn create_module_2() -> Box<Instance> {
let module_str = "(module
(type (;0;) (func (result i32)))
(import \"spectest\" \"global_i32\" (global (;0;) i32))
(func (;0;) (type 0) (result i32)
get_global 0)
(func (;1;) (type 0) (result i32)
get_global 1)
(global (;1;) i32 (get_global 0))
(export \"get-0\" (func 0))
(export \"get-0-ref\" (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_2(instance: &mut Instance) {
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
//instance.start();
}
// Line 318
fn c60_l318_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c60_l318_action_invoke");
let result = instance.call("get-0", &[]);
assert_eq!(result, Ok(Some(Value::I32(666 as i32))));
result.map(|_| ())
}
// Line 319
fn c61_l319_action_invoke(instance: &mut Instance) -> Result<(), String> {
println!("Executing function {}", "c61_l319_action_invoke");
let result = instance.call("get-0-ref", &[]);
assert_eq!(result, Ok(Some(Value::I32(666 as i32))));
result.map(|_| ())
}
// Line 322
#[test]
fn c62_l322_assert_malformed() {
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 = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(compilation.is_err(), "WASM should not compile as is malformed");
}
// Line 335
#[test]
fn c63_l335_assert_malformed() {
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 = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(compilation.is_err(), "WASM should not compile as is malformed");
}
// Line 348
#[test]
fn test_module_2() {
let mut instance = create_module_2();
// We group the calls together
start_module_2(&mut instance);
c60_l318_action_invoke(&mut instance);
c61_l319_action_invoke(&mut instance);
}
fn create_module_3() -> Box<Instance> {
let module_str = "(module
(global (;0;) i32 (i32.const 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 352
#[test]
fn c65_l352_assert_malformed() {
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 = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(compilation.is_err(), "WASM should not compile as is malformed");
}
// Line 364
#[test]
fn c66_l364_assert_malformed() {
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 = wasmer_runtime::compile(&wasm_binary, &CraneliftCompiler::new());
assert!(compilation.is_err(), "WASM should not compile as is malformed");
}
#[test]
fn test_module_3() {
let mut instance = create_module_3();
// We group the calls together
start_module_3(&mut instance);
}