// 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 l182_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l182_assert_return_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 l183_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l183_assert_return_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 l184_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l184_assert_return_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 l185_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l185_assert_return_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 l187_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l187_assert_return_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 l188_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l188_assert_return_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 l189_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l189_assert_return_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 l190_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l190_assert_return_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 l192_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l192_assert_return_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 l193_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l193_assert_return_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 l194_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l194_assert_return_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 l195_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l195_assert_return_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 l197_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l197_assert_return_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 l198_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l198_assert_return_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 l199_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l199_assert_return_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 l200_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l200_assert_return_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 l202_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l202_assert_return_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 l203_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l203_assert_return_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 l204_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l204_assert_return_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 l206_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l206_assert_return_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 l207_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l207_assert_return_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 l208_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l208_assert_return_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 l210_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l210_assert_return_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 l211_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l211_assert_return_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 l212_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l212_assert_return_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 l214_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l214_assert_return_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 l215_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l215_assert_return_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 l217_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l217_assert_return_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 l218_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l218_assert_return_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 l220_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l220_assert_return_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 l221_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l221_assert_return_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 l224_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l224_assert_return_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 l225_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l225_assert_return_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 l226_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l226_assert_return_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 l230_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l230_assert_return_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 l232_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l232_assert_return_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 l233_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l233_assert_return_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 l234_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l234_assert_return_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 l236_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l236_assert_return_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 l237_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l237_assert_return_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 l238_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l238_assert_return_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 l240_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l240_assert_return_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 l241_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l241_assert_return_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 l242_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { println!("Executing function {}", "l242_assert_return_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 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 l182_assert_return_invoke(&result_object, &vm_context); l183_assert_return_invoke(&result_object, &vm_context); l184_assert_return_invoke(&result_object, &vm_context); l185_assert_return_invoke(&result_object, &vm_context); l187_assert_return_invoke(&result_object, &vm_context); l188_assert_return_invoke(&result_object, &vm_context); l189_assert_return_invoke(&result_object, &vm_context); l190_assert_return_invoke(&result_object, &vm_context); l192_assert_return_invoke(&result_object, &vm_context); l193_assert_return_invoke(&result_object, &vm_context); l194_assert_return_invoke(&result_object, &vm_context); l195_assert_return_invoke(&result_object, &vm_context); l197_assert_return_invoke(&result_object, &vm_context); l198_assert_return_invoke(&result_object, &vm_context); l199_assert_return_invoke(&result_object, &vm_context); l200_assert_return_invoke(&result_object, &vm_context); l202_assert_return_invoke(&result_object, &vm_context); l203_assert_return_invoke(&result_object, &vm_context); l204_assert_return_invoke(&result_object, &vm_context); l206_assert_return_invoke(&result_object, &vm_context); l207_assert_return_invoke(&result_object, &vm_context); l208_assert_return_invoke(&result_object, &vm_context); l210_assert_return_invoke(&result_object, &vm_context); l211_assert_return_invoke(&result_object, &vm_context); l212_assert_return_invoke(&result_object, &vm_context); l214_assert_return_invoke(&result_object, &vm_context); l215_assert_return_invoke(&result_object, &vm_context); l217_assert_return_invoke(&result_object, &vm_context); l218_assert_return_invoke(&result_object, &vm_context); l220_assert_return_invoke(&result_object, &vm_context); l221_assert_return_invoke(&result_object, &vm_context); l224_assert_return_invoke(&result_object, &vm_context); l225_assert_return_invoke(&result_object, &vm_context); l226_assert_return_invoke(&result_object, &vm_context); l230_assert_return_invoke(&result_object, &vm_context); l232_assert_return_invoke(&result_object, &vm_context); l233_assert_return_invoke(&result_object, &vm_context); l234_assert_return_invoke(&result_object, &vm_context); l236_assert_return_invoke(&result_object, &vm_context); l237_assert_return_invoke(&result_object, &vm_context); l238_assert_return_invoke(&result_object, &vm_context); l240_assert_return_invoke(&result_object, &vm_context); l241_assert_return_invoke(&result_object, &vm_context); l242_assert_return_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 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 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 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 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 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 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 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 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 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 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 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 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 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 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"); }