wasmer/src/spectests/globals.rs

1011 lines
38 KiB
Rust
Raw Normal View History

// 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
fn c1_l182_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c1_l182_action_invoke");
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
fn c2_l183_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c2_l183_action_invoke");
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
fn c3_l184_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c3_l184_action_invoke");
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
fn c4_l185_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c4_l185_action_invoke");
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
fn c5_l187_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c5_l187_action_invoke");
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
fn c6_l188_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c6_l188_action_invoke");
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
fn c7_l189_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c7_l189_action_invoke");
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
fn c8_l190_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c8_l190_action_invoke");
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
fn c9_l192_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c9_l192_action_invoke");
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
fn c10_l193_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c10_l193_action_invoke");
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
fn c11_l194_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c11_l194_action_invoke");
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
fn c12_l195_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c12_l195_action_invoke");
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
fn c13_l197_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c13_l197_action_invoke");
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
fn c14_l198_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c14_l198_action_invoke");
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
fn c15_l199_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c15_l199_action_invoke");
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
fn c16_l200_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c16_l200_action_invoke");
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
fn c17_l202_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c17_l202_action_invoke");
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
fn c18_l203_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c18_l203_action_invoke");
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
fn c19_l204_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c19_l204_action_invoke");
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
fn c20_l206_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c20_l206_action_invoke");
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
fn c21_l207_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c21_l207_action_invoke");
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
fn c22_l208_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c22_l208_action_invoke");
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
fn c23_l210_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c23_l210_action_invoke");
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
fn c24_l211_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c24_l211_action_invoke");
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
fn c25_l212_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c25_l212_action_invoke");
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
fn c26_l214_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c26_l214_action_invoke");
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
fn c27_l215_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c27_l215_action_invoke");
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
fn c28_l217_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c28_l217_action_invoke");
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
fn c29_l218_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c29_l218_action_invoke");
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
fn c30_l220_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c30_l220_action_invoke");
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
fn c31_l221_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c31_l221_action_invoke");
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
fn c33_l224_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c33_l224_action_invoke");
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
fn c34_l225_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c34_l225_action_invoke");
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
fn c35_l226_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c35_l226_action_invoke");
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);
}
// Line 230
fn c36_l230_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c36_l230_action_invoke");
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);
}
// Line 232
fn c37_l232_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c37_l232_action_invoke");
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);
}
// Line 233
fn c38_l233_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c38_l233_action_invoke");
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, ());
}
// Line 234
fn c39_l234_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c39_l234_action_invoke");
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);
}
// Line 236
fn c40_l236_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c40_l236_action_invoke");
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);
}
// Line 237
fn c41_l237_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c41_l237_action_invoke");
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);
}
// Line 238
fn c42_l238_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c42_l238_action_invoke");
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);
}
// Line 240
fn c43_l240_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c43_l240_action_invoke");
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);
}
// Line 241
fn c44_l241_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c44_l241_action_invoke");
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);
}
// Line 242
fn c45_l242_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
println!("Executing function {}", "c45_l242_action_invoke");
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);
}
// Line 245
#[test]
fn c46_l245_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 compilation = compile(wasm_binary.to_vec());
assert!(compilation.is_err(), "WASM should not compile as is invalid");
}
// Line 250
#[test]
fn test_module_1() {
let result_object = create_module_1();
let vm_context = result_object.instance.generate_context();
// We group the calls together
c1_l182_action_invoke(&result_object, &vm_context);
c2_l183_action_invoke(&result_object, &vm_context);
c3_l184_action_invoke(&result_object, &vm_context);
c4_l185_action_invoke(&result_object, &vm_context);
c5_l187_action_invoke(&result_object, &vm_context);
c6_l188_action_invoke(&result_object, &vm_context);
c7_l189_action_invoke(&result_object, &vm_context);
c8_l190_action_invoke(&result_object, &vm_context);
c9_l192_action_invoke(&result_object, &vm_context);
c10_l193_action_invoke(&result_object, &vm_context);
c11_l194_action_invoke(&result_object, &vm_context);
c12_l195_action_invoke(&result_object, &vm_context);
c13_l197_action_invoke(&result_object, &vm_context);
c14_l198_action_invoke(&result_object, &vm_context);
c15_l199_action_invoke(&result_object, &vm_context);
c16_l200_action_invoke(&result_object, &vm_context);
c17_l202_action_invoke(&result_object, &vm_context);
c18_l203_action_invoke(&result_object, &vm_context);
c19_l204_action_invoke(&result_object, &vm_context);
c20_l206_action_invoke(&result_object, &vm_context);
c21_l207_action_invoke(&result_object, &vm_context);
c22_l208_action_invoke(&result_object, &vm_context);
c23_l210_action_invoke(&result_object, &vm_context);
c24_l211_action_invoke(&result_object, &vm_context);
c25_l212_action_invoke(&result_object, &vm_context);
c26_l214_action_invoke(&result_object, &vm_context);
c27_l215_action_invoke(&result_object, &vm_context);
c28_l217_action_invoke(&result_object, &vm_context);
c29_l218_action_invoke(&result_object, &vm_context);
c30_l220_action_invoke(&result_object, &vm_context);
c31_l221_action_invoke(&result_object, &vm_context);
c33_l224_action_invoke(&result_object, &vm_context);
c34_l225_action_invoke(&result_object, &vm_context);
c35_l226_action_invoke(&result_object, &vm_context);
c36_l230_action_invoke(&result_object, &vm_context);
c37_l232_action_invoke(&result_object, &vm_context);
c38_l233_action_invoke(&result_object, &vm_context);
c39_l234_action_invoke(&result_object, &vm_context);
c40_l236_action_invoke(&result_object, &vm_context);
c41_l237_action_invoke(&result_object, &vm_context);
c42_l238_action_invoke(&result_object, &vm_context);
c43_l240_action_invoke(&result_object, &vm_context);
c44_l241_action_invoke(&result_object, &vm_context);
c45_l242_action_invoke(&result_object, &vm_context);
}
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")
}
// Line 251
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")
}
// Line 254
#[test]
fn c49_l254_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 compilation = compile(wasm_binary.to_vec());
assert!(compilation.is_err(), "WASM should not compile as is invalid");
}
// Line 259
#[test]
fn c50_l259_assert_invalid() {
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");
}
// Line 264
#[test]
fn c51_l264_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 compilation = compile(wasm_binary.to_vec());
assert!(compilation.is_err(), "WASM should not compile as is invalid");
}
// Line 269
#[test]
fn c52_l269_assert_invalid() {
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");
}
// Line 274
#[test]
fn c53_l274_assert_invalid() {
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");
}
// Line 279
#[test]
fn c54_l279_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 compilation = compile(wasm_binary.to_vec());
assert!(compilation.is_err(), "WASM should not compile as is invalid");
}
// Line 284
#[test]
fn c55_l284_assert_invalid() {
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");
}
// Line 289
#[test]
fn c56_l289_assert_invalid() {
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");
}
// Line 294
#[test]
fn c57_l294_assert_invalid() {
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");
}
// Line 299
#[test]
fn c58_l299_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 compilation = compile(wasm_binary.to_vec());
assert!(compilation.is_err(), "WASM should not compile as is invalid");
}
// Line 303
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")
}
// Line 307
#[test]
fn c60_l307_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 = compile(wasm_binary.to_vec());
assert!(compilation.is_err(), "WASM should not compile as is malformed");
}
// Line 320
#[test]
fn c61_l320_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 = compile(wasm_binary.to_vec());
assert!(compilation.is_err(), "WASM should not compile as is malformed");
}
// Line 333
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")
}
// Line 337
#[test]
fn c63_l337_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 = compile(wasm_binary.to_vec());
assert!(compilation.is_err(), "WASM should not compile as is malformed");
}
// Line 349
#[test]
fn c64_l349_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 = compile(wasm_binary.to_vec());
assert!(compilation.is_err(), "WASM should not compile as is malformed");
}