// 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/float_memory.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 5 fn create_module_1() -> Box { let module_str = "(module (type (;0;) (func (result f32))) (type (;1;) (func (result i32))) (type (;2;) (func)) (func (;0;) (type 0) (result f32) i32.const 0 f32.load) (func (;1;) (type 1) (result i32) i32.const 0 i32.load) (func (;2;) (type 2) i32.const 0 f32.const nan:0x200000 (;=nan;) f32.store) (func (;3;) (type 2) i32.const 0 i32.const 2141192192 i32.store) (func (;4;) (type 2) i32.const 0 i32.const 0 i32.store) (memory (;0;) 1 1) (export \"f32.load\" (func 0)) (export \"i32.load\" (func 1)) (export \"f32.store\" (func 2)) (export \"i32.store\" (func 3)) (export \"reset\" (func 4)) (data (;0;) (i32.const 0) \"\\00\\00\\a0\\7f\")) "; 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 15 fn c1_l15_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c1_l15_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(2141192192 as i32)))); result.map(|_| ()) } // Line 16 fn c2_l16_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c2_l16_action_invoke"); let result = instance.call("f32.load", &[]); let expected = f32::from_bits(2141192192); if let Value::F32(result) = result.clone().unwrap().unwrap() { assert!((result as f32).is_nan()); assert_eq!((result as f32).is_sign_positive(), (expected as f32).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 17 fn c3_l17_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c3_l17_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 18 fn c4_l18_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c4_l18_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(0 as i32)))); result.map(|_| ()) } // Line 19 fn c5_l19_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c5_l19_action_invoke"); let result = instance.call("f32.load", &[]); assert_eq!(result, Ok(Some(Value::F32((0.0f32).to_bits())))); result.map(|_| ()) } // Line 20 fn c6_l20_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c6_l20_action_invoke"); let result = instance.call("f32.store", &[]); result.map(|_| ()) } // Line 21 fn c7_l21_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c7_l21_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(2141192192 as i32)))); result.map(|_| ()) } // Line 22 fn c8_l22_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c8_l22_action_invoke"); let result = instance.call("f32.load", &[]); let expected = f32::from_bits(2141192192); if let Value::F32(result) = result.clone().unwrap().unwrap() { assert!((result as f32).is_nan()); assert_eq!((result as f32).is_sign_positive(), (expected as f32).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 23 fn c9_l23_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c9_l23_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 24 fn c10_l24_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c10_l24_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(0 as i32)))); result.map(|_| ()) } // Line 25 fn c11_l25_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c11_l25_action_invoke"); let result = instance.call("f32.load", &[]); assert_eq!(result, Ok(Some(Value::F32((0.0f32).to_bits())))); result.map(|_| ()) } // Line 26 fn c12_l26_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c12_l26_action_invoke"); let result = instance.call("i32.store", &[]); result.map(|_| ()) } // Line 27 fn c13_l27_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c13_l27_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(2141192192 as i32)))); result.map(|_| ()) } // Line 28 fn c14_l28_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c14_l28_action_invoke"); let result = instance.call("f32.load", &[]); let expected = f32::from_bits(2141192192); if let Value::F32(result) = result.clone().unwrap().unwrap() { assert!((result as f32).is_nan()); assert_eq!((result as f32).is_sign_positive(), (expected as f32).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 30 #[test] fn test_module_1() { let mut instance = create_module_1(); // We group the calls together start_module_1(&mut instance); c1_l15_action_invoke(&mut instance); c2_l16_action_invoke(&mut instance); c3_l17_action_invoke(&mut instance); c4_l18_action_invoke(&mut instance); c5_l19_action_invoke(&mut instance); c6_l20_action_invoke(&mut instance); c7_l21_action_invoke(&mut instance); c8_l22_action_invoke(&mut instance); c9_l23_action_invoke(&mut instance); c10_l24_action_invoke(&mut instance); c11_l25_action_invoke(&mut instance); c12_l26_action_invoke(&mut instance); c13_l27_action_invoke(&mut instance); c14_l28_action_invoke(&mut instance); } fn create_module_2() -> Box { let module_str = "(module (type (;0;) (func (result f64))) (type (;1;) (func (result i64))) (type (;2;) (func)) (func (;0;) (type 0) (result f64) i32.const 0 f64.load) (func (;1;) (type 1) (result i64) i32.const 0 i64.load) (func (;2;) (type 2) i32.const 0 f64.const nan:0x4000000000000 (;=nan;) f64.store) (func (;3;) (type 2) i32.const 0 i64.const 9219994337134247936 i64.store) (func (;4;) (type 2) i32.const 0 i64.const 0 i64.store) (memory (;0;) 1 1) (export \"f64.load\" (func 0)) (export \"i64.load\" (func 1)) (export \"f64.store\" (func 2)) (export \"i64.store\" (func 3)) (export \"reset\" (func 4)) (data (;0;) (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\f4\\7f\")) "; 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 40 fn c16_l40_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c16_l40_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(9219994337134247936 as i64)))); result.map(|_| ()) } // Line 41 fn c17_l41_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c17_l41_action_invoke"); let result = instance.call("f64.load", &[]); let expected = f64::from_bits(9219994337134247936); if let Value::F64(result) = result.clone().unwrap().unwrap() { assert!((result as f64).is_nan()); assert_eq!((result as f64).is_sign_positive(), (expected as f64).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 42 fn c18_l42_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c18_l42_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 43 fn c19_l43_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c19_l43_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(0 as i64)))); result.map(|_| ()) } // Line 44 fn c20_l44_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c20_l44_action_invoke"); let result = instance.call("f64.load", &[]); assert_eq!(result, Ok(Some(Value::F64((0.0f64).to_bits())))); result.map(|_| ()) } // Line 45 fn c21_l45_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c21_l45_action_invoke"); let result = instance.call("f64.store", &[]); result.map(|_| ()) } // Line 46 fn c22_l46_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c22_l46_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(9219994337134247936 as i64)))); result.map(|_| ()) } // Line 47 fn c23_l47_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c23_l47_action_invoke"); let result = instance.call("f64.load", &[]); let expected = f64::from_bits(9219994337134247936); if let Value::F64(result) = result.clone().unwrap().unwrap() { assert!((result as f64).is_nan()); assert_eq!((result as f64).is_sign_positive(), (expected as f64).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 48 fn c24_l48_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c24_l48_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 49 fn c25_l49_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c25_l49_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(0 as i64)))); result.map(|_| ()) } // Line 50 fn c26_l50_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c26_l50_action_invoke"); let result = instance.call("f64.load", &[]); assert_eq!(result, Ok(Some(Value::F64((0.0f64).to_bits())))); result.map(|_| ()) } // Line 51 fn c27_l51_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c27_l51_action_invoke"); let result = instance.call("i64.store", &[]); result.map(|_| ()) } // Line 52 fn c28_l52_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c28_l52_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(9219994337134247936 as i64)))); result.map(|_| ()) } // Line 53 fn c29_l53_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c29_l53_action_invoke"); let result = instance.call("f64.load", &[]); let expected = f64::from_bits(9219994337134247936); if let Value::F64(result) = result.clone().unwrap().unwrap() { assert!((result as f64).is_nan()); assert_eq!((result as f64).is_sign_positive(), (expected as f64).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 57 #[test] fn test_module_2() { let mut instance = create_module_2(); // We group the calls together start_module_2(&mut instance); c16_l40_action_invoke(&mut instance); c17_l41_action_invoke(&mut instance); c18_l42_action_invoke(&mut instance); c19_l43_action_invoke(&mut instance); c20_l44_action_invoke(&mut instance); c21_l45_action_invoke(&mut instance); c22_l46_action_invoke(&mut instance); c23_l47_action_invoke(&mut instance); c24_l48_action_invoke(&mut instance); c25_l49_action_invoke(&mut instance); c26_l50_action_invoke(&mut instance); c27_l51_action_invoke(&mut instance); c28_l52_action_invoke(&mut instance); c29_l53_action_invoke(&mut instance); } fn create_module_3() -> Box { let module_str = "(module (type (;0;) (func (result f32))) (type (;1;) (func (result i32))) (type (;2;) (func)) (func (;0;) (type 0) (result f32) i32.const 1 f32.load) (func (;1;) (type 1) (result i32) i32.const 1 i32.load) (func (;2;) (type 2) i32.const 1 f32.const nan:0x200000 (;=nan;) f32.store) (func (;3;) (type 2) i32.const 1 i32.const 2141192192 i32.store) (func (;4;) (type 2) i32.const 1 i32.const 0 i32.store) (memory (;0;) 1 1) (export \"f32.load\" (func 0)) (export \"i32.load\" (func 1)) (export \"f32.store\" (func 2)) (export \"i32.store\" (func 3)) (export \"reset\" (func 4)) (data (;0;) (i32.const 0) \"\\00\\00\\00\\a0\\7f\")) "; 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 67 fn c31_l67_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c31_l67_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(2141192192 as i32)))); result.map(|_| ()) } // Line 68 fn c32_l68_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c32_l68_action_invoke"); let result = instance.call("f32.load", &[]); let expected = f32::from_bits(2141192192); if let Value::F32(result) = result.clone().unwrap().unwrap() { assert!((result as f32).is_nan()); assert_eq!((result as f32).is_sign_positive(), (expected as f32).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 69 fn c33_l69_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c33_l69_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 70 fn c34_l70_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c34_l70_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(0 as i32)))); result.map(|_| ()) } // Line 71 fn c35_l71_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c35_l71_action_invoke"); let result = instance.call("f32.load", &[]); assert_eq!(result, Ok(Some(Value::F32((0.0f32).to_bits())))); result.map(|_| ()) } // Line 72 fn c36_l72_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c36_l72_action_invoke"); let result = instance.call("f32.store", &[]); result.map(|_| ()) } // Line 73 fn c37_l73_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c37_l73_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(2141192192 as i32)))); result.map(|_| ()) } // Line 74 fn c38_l74_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c38_l74_action_invoke"); let result = instance.call("f32.load", &[]); let expected = f32::from_bits(2141192192); if let Value::F32(result) = result.clone().unwrap().unwrap() { assert!((result as f32).is_nan()); assert_eq!((result as f32).is_sign_positive(), (expected as f32).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 75 fn c39_l75_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c39_l75_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 76 fn c40_l76_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c40_l76_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(0 as i32)))); result.map(|_| ()) } // Line 77 fn c41_l77_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c41_l77_action_invoke"); let result = instance.call("f32.load", &[]); assert_eq!(result, Ok(Some(Value::F32((0.0f32).to_bits())))); result.map(|_| ()) } // Line 78 fn c42_l78_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c42_l78_action_invoke"); let result = instance.call("i32.store", &[]); result.map(|_| ()) } // Line 79 fn c43_l79_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c43_l79_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(2141192192 as i32)))); result.map(|_| ()) } // Line 80 fn c44_l80_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c44_l80_action_invoke"); let result = instance.call("f32.load", &[]); let expected = f32::from_bits(2141192192); if let Value::F32(result) = result.clone().unwrap().unwrap() { assert!((result as f32).is_nan()); assert_eq!((result as f32).is_sign_positive(), (expected as f32).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 82 #[test] fn test_module_3() { let mut instance = create_module_3(); // We group the calls together start_module_3(&mut instance); c31_l67_action_invoke(&mut instance); c32_l68_action_invoke(&mut instance); c33_l69_action_invoke(&mut instance); c34_l70_action_invoke(&mut instance); c35_l71_action_invoke(&mut instance); c36_l72_action_invoke(&mut instance); c37_l73_action_invoke(&mut instance); c38_l74_action_invoke(&mut instance); c39_l75_action_invoke(&mut instance); c40_l76_action_invoke(&mut instance); c41_l77_action_invoke(&mut instance); c42_l78_action_invoke(&mut instance); c43_l79_action_invoke(&mut instance); c44_l80_action_invoke(&mut instance); } fn create_module_4() -> Box { let module_str = "(module (type (;0;) (func (result f64))) (type (;1;) (func (result i64))) (type (;2;) (func)) (func (;0;) (type 0) (result f64) i32.const 1 f64.load) (func (;1;) (type 1) (result i64) i32.const 1 i64.load) (func (;2;) (type 2) i32.const 1 f64.const nan:0x4000000000000 (;=nan;) f64.store) (func (;3;) (type 2) i32.const 1 i64.const 9219994337134247936 i64.store) (func (;4;) (type 2) i32.const 1 i64.const 0 i64.store) (memory (;0;) 1 1) (export \"f64.load\" (func 0)) (export \"i64.load\" (func 1)) (export \"f64.store\" (func 2)) (export \"i64.store\" (func 3)) (export \"reset\" (func 4)) (data (;0;) (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\00\\f4\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled"); module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated") } fn start_module_4(instance: &mut Instance) { // TODO Review is explicit start needed? Start now called in runtime::Instance::new() //instance.start(); } // Line 92 fn c46_l92_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c46_l92_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(9219994337134247936 as i64)))); result.map(|_| ()) } // Line 93 fn c47_l93_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c47_l93_action_invoke"); let result = instance.call("f64.load", &[]); let expected = f64::from_bits(9219994337134247936); if let Value::F64(result) = result.clone().unwrap().unwrap() { assert!((result as f64).is_nan()); assert_eq!((result as f64).is_sign_positive(), (expected as f64).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 94 fn c48_l94_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c48_l94_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 95 fn c49_l95_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c49_l95_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(0 as i64)))); result.map(|_| ()) } // Line 96 fn c50_l96_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c50_l96_action_invoke"); let result = instance.call("f64.load", &[]); assert_eq!(result, Ok(Some(Value::F64((0.0f64).to_bits())))); result.map(|_| ()) } // Line 97 fn c51_l97_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c51_l97_action_invoke"); let result = instance.call("f64.store", &[]); result.map(|_| ()) } // Line 98 fn c52_l98_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c52_l98_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(9219994337134247936 as i64)))); result.map(|_| ()) } // Line 99 fn c53_l99_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c53_l99_action_invoke"); let result = instance.call("f64.load", &[]); let expected = f64::from_bits(9219994337134247936); if let Value::F64(result) = result.clone().unwrap().unwrap() { assert!((result as f64).is_nan()); assert_eq!((result as f64).is_sign_positive(), (expected as f64).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 100 fn c54_l100_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c54_l100_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 101 fn c55_l101_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c55_l101_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(0 as i64)))); result.map(|_| ()) } // Line 102 fn c56_l102_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c56_l102_action_invoke"); let result = instance.call("f64.load", &[]); assert_eq!(result, Ok(Some(Value::F64((0.0f64).to_bits())))); result.map(|_| ()) } // Line 103 fn c57_l103_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c57_l103_action_invoke"); let result = instance.call("i64.store", &[]); result.map(|_| ()) } // Line 104 fn c58_l104_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c58_l104_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(9219994337134247936 as i64)))); result.map(|_| ()) } // Line 105 fn c59_l105_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c59_l105_action_invoke"); let result = instance.call("f64.load", &[]); let expected = f64::from_bits(9219994337134247936); if let Value::F64(result) = result.clone().unwrap().unwrap() { assert!((result as f64).is_nan()); assert_eq!((result as f64).is_sign_positive(), (expected as f64).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 109 #[test] fn test_module_4() { let mut instance = create_module_4(); // We group the calls together start_module_4(&mut instance); c46_l92_action_invoke(&mut instance); c47_l93_action_invoke(&mut instance); c48_l94_action_invoke(&mut instance); c49_l95_action_invoke(&mut instance); c50_l96_action_invoke(&mut instance); c51_l97_action_invoke(&mut instance); c52_l98_action_invoke(&mut instance); c53_l99_action_invoke(&mut instance); c54_l100_action_invoke(&mut instance); c55_l101_action_invoke(&mut instance); c56_l102_action_invoke(&mut instance); c57_l103_action_invoke(&mut instance); c58_l104_action_invoke(&mut instance); c59_l105_action_invoke(&mut instance); } fn create_module_5() -> Box { let module_str = "(module (type (;0;) (func (result f32))) (type (;1;) (func (result i32))) (type (;2;) (func)) (func (;0;) (type 0) (result f32) i32.const 0 f32.load) (func (;1;) (type 1) (result i32) i32.const 0 i32.load) (func (;2;) (type 2) i32.const 0 f32.const nan:0x500001 (;=nan;) f32.store) (func (;3;) (type 2) i32.const 0 i32.const 2144337921 i32.store) (func (;4;) (type 2) i32.const 0 i32.const 0 i32.store) (memory (;0;) 1 1) (export \"f32.load\" (func 0)) (export \"i32.load\" (func 1)) (export \"f32.store\" (func 2)) (export \"i32.store\" (func 3)) (export \"reset\" (func 4)) (data (;0;) (i32.const 0) \"\\01\\00\\d0\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled"); module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated") } fn start_module_5(instance: &mut Instance) { // TODO Review is explicit start needed? Start now called in runtime::Instance::new() //instance.start(); } // Line 119 fn c61_l119_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c61_l119_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(2144337921 as i32)))); result.map(|_| ()) } // Line 120 fn c62_l120_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c62_l120_action_invoke"); let result = instance.call("f32.load", &[]); let expected = f32::from_bits(2144337921); if let Value::F32(result) = result.clone().unwrap().unwrap() { assert!((result as f32).is_nan()); assert_eq!((result as f32).is_sign_positive(), (expected as f32).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 121 fn c63_l121_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c63_l121_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 122 fn c64_l122_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c64_l122_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(0 as i32)))); result.map(|_| ()) } // Line 123 fn c65_l123_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c65_l123_action_invoke"); let result = instance.call("f32.load", &[]); assert_eq!(result, Ok(Some(Value::F32((0.0f32).to_bits())))); result.map(|_| ()) } // Line 124 fn c66_l124_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c66_l124_action_invoke"); let result = instance.call("f32.store", &[]); result.map(|_| ()) } // Line 125 fn c67_l125_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c67_l125_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(2144337921 as i32)))); result.map(|_| ()) } // Line 126 fn c68_l126_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c68_l126_action_invoke"); let result = instance.call("f32.load", &[]); let expected = f32::from_bits(2144337921); if let Value::F32(result) = result.clone().unwrap().unwrap() { assert!((result as f32).is_nan()); assert_eq!((result as f32).is_sign_positive(), (expected as f32).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 127 fn c69_l127_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c69_l127_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 128 fn c70_l128_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c70_l128_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(0 as i32)))); result.map(|_| ()) } // Line 129 fn c71_l129_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c71_l129_action_invoke"); let result = instance.call("f32.load", &[]); assert_eq!(result, Ok(Some(Value::F32((0.0f32).to_bits())))); result.map(|_| ()) } // Line 130 fn c72_l130_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c72_l130_action_invoke"); let result = instance.call("i32.store", &[]); result.map(|_| ()) } // Line 131 fn c73_l131_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c73_l131_action_invoke"); let result = instance.call("i32.load", &[]); assert_eq!(result, Ok(Some(Value::I32(2144337921 as i32)))); result.map(|_| ()) } // Line 132 fn c74_l132_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c74_l132_action_invoke"); let result = instance.call("f32.load", &[]); let expected = f32::from_bits(2144337921); if let Value::F32(result) = result.clone().unwrap().unwrap() { assert!((result as f32).is_nan()); assert_eq!((result as f32).is_sign_positive(), (expected as f32).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 134 #[test] fn test_module_5() { let mut instance = create_module_5(); // We group the calls together start_module_5(&mut instance); c61_l119_action_invoke(&mut instance); c62_l120_action_invoke(&mut instance); c63_l121_action_invoke(&mut instance); c64_l122_action_invoke(&mut instance); c65_l123_action_invoke(&mut instance); c66_l124_action_invoke(&mut instance); c67_l125_action_invoke(&mut instance); c68_l126_action_invoke(&mut instance); c69_l127_action_invoke(&mut instance); c70_l128_action_invoke(&mut instance); c71_l129_action_invoke(&mut instance); c72_l130_action_invoke(&mut instance); c73_l131_action_invoke(&mut instance); c74_l132_action_invoke(&mut instance); } fn create_module_6() -> Box { let module_str = "(module (type (;0;) (func (result f64))) (type (;1;) (func (result i64))) (type (;2;) (func)) (func (;0;) (type 0) (result f64) i32.const 0 f64.load) (func (;1;) (type 1) (result i64) i32.const 0 i64.load) (func (;2;) (type 2) i32.const 0 f64.const nan:0xc000000000001 (;=nan;) f64.store) (func (;3;) (type 2) i32.const 0 i64.const 9222246136947933185 i64.store) (func (;4;) (type 2) i32.const 0 i64.const 0 i64.store) (memory (;0;) 1 1) (export \"f64.load\" (func 0)) (export \"i64.load\" (func 1)) (export \"f64.store\" (func 2)) (export \"i64.store\" (func 3)) (export \"reset\" (func 4)) (data (;0;) (i32.const 0) \"\\01\\00\\00\\00\\00\\00\\fc\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled"); module.instantiate(&spectest_importobject()).expect("WASM can't be instantiated") } fn start_module_6(instance: &mut Instance) { // TODO Review is explicit start needed? Start now called in runtime::Instance::new() //instance.start(); } // Line 144 fn c76_l144_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c76_l144_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(9222246136947933185 as i64)))); result.map(|_| ()) } // Line 145 fn c77_l145_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c77_l145_action_invoke"); let result = instance.call("f64.load", &[]); let expected = f64::from_bits(9222246136947933185); if let Value::F64(result) = result.clone().unwrap().unwrap() { assert!((result as f64).is_nan()); assert_eq!((result as f64).is_sign_positive(), (expected as f64).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 146 fn c78_l146_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c78_l146_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 147 fn c79_l147_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c79_l147_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(0 as i64)))); result.map(|_| ()) } // Line 148 fn c80_l148_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c80_l148_action_invoke"); let result = instance.call("f64.load", &[]); assert_eq!(result, Ok(Some(Value::F64((0.0f64).to_bits())))); result.map(|_| ()) } // Line 149 fn c81_l149_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c81_l149_action_invoke"); let result = instance.call("f64.store", &[]); result.map(|_| ()) } // Line 150 fn c82_l150_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c82_l150_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(9222246136947933185 as i64)))); result.map(|_| ()) } // Line 151 fn c83_l151_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c83_l151_action_invoke"); let result = instance.call("f64.load", &[]); let expected = f64::from_bits(9222246136947933185); if let Value::F64(result) = result.clone().unwrap().unwrap() { assert!((result as f64).is_nan()); assert_eq!((result as f64).is_sign_positive(), (expected as f64).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } // Line 152 fn c84_l152_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c84_l152_action_invoke"); let result = instance.call("reset", &[]); result.map(|_| ()) } // Line 153 fn c85_l153_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c85_l153_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(0 as i64)))); result.map(|_| ()) } // Line 154 fn c86_l154_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c86_l154_action_invoke"); let result = instance.call("f64.load", &[]); assert_eq!(result, Ok(Some(Value::F64((0.0f64).to_bits())))); result.map(|_| ()) } // Line 155 fn c87_l155_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c87_l155_action_invoke"); let result = instance.call("i64.store", &[]); result.map(|_| ()) } // Line 156 fn c88_l156_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c88_l156_action_invoke"); let result = instance.call("i64.load", &[]); assert_eq!(result, Ok(Some(Value::I64(9222246136947933185 as i64)))); result.map(|_| ()) } // Line 157 fn c89_l157_action_invoke(instance: &mut Instance) -> Result<(), String> { println!("Executing function {}", "c89_l157_action_invoke"); let result = instance.call("f64.load", &[]); let expected = f64::from_bits(9222246136947933185); if let Value::F64(result) = result.clone().unwrap().unwrap() { assert!((result as f64).is_nan()); assert_eq!((result as f64).is_sign_positive(), (expected as f64).is_sign_positive()); } else { panic!("Unexpected result type {:?}", result); } result.map(|_| ()) } #[test] fn test_module_6() { let mut instance = create_module_6(); // We group the calls together start_module_6(&mut instance); c76_l144_action_invoke(&mut instance); c77_l145_action_invoke(&mut instance); c78_l146_action_invoke(&mut instance); c79_l147_action_invoke(&mut instance); c80_l148_action_invoke(&mut instance); c81_l149_action_invoke(&mut instance); c82_l150_action_invoke(&mut instance); c83_l151_action_invoke(&mut instance); c84_l152_action_invoke(&mut instance); c85_l153_action_invoke(&mut instance); c86_l154_action_invoke(&mut instance); c87_l155_action_invoke(&mut instance); c88_l156_action_invoke(&mut instance); c89_l157_action_invoke(&mut instance); }