Files
wasmer/lib/runtime/tests/spectests/comments.rs

112 lines
3.2 KiB
Rust
Raw Normal View History

2019-01-09 01:06:24 -05:00
// 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/comments.wast
#![allow(
warnings,
dead_code
)]
2019-01-12 17:52:14 -05:00
use std::{f32, f64};
2019-01-12 17:53:17 -05:00
use wabt::wat2wasm;
2019-01-09 01:06:24 -05:00
2019-01-12 17:52:14 -05:00
use wasmer_clif_backend::CraneliftCompiler;
2019-01-12 17:53:17 -05:00
use wasmer_runtime::types::Value;
use wasmer_runtime::{module::Module, Instance};
2019-01-12 17:52:14 -05:00
2019-01-12 17:53:17 -05:00
use crate::spectests::_common::{generate_imports, NaNCheck};
2019-01-09 01:06:24 -05:00
// Line 10
2019-01-12 17:52:14 -05:00
fn create_module_1() -> Instance {
2019-01-09 01:06:24 -05:00
let module_str = "(module)
";
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
2019-01-12 17:53:17 -05:00
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new())
.expect("WASM can't be compiled");
module
2019-01-12 22:02:19 -05:00
.instantiate(&generate_imports())
2019-01-12 17:53:17 -05:00
.expect("WASM can't be instantiated")
2019-01-09 01:06:24 -05:00
}
fn start_module_1(instance: &mut Instance) {
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
//instance.start();
}
// Line 52
#[test]
fn test_module_1() {
let mut instance = create_module_1();
// We group the calls together
start_module_1(&mut instance);
}
2019-01-12 17:52:14 -05:00
fn create_module_2() -> Instance {
2019-01-09 01:06:24 -05:00
let module_str = "(module)
";
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
2019-01-12 17:53:17 -05:00
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new())
.expect("WASM can't be compiled");
module
2019-01-12 22:02:19 -05:00
.instantiate(&generate_imports())
2019-01-12 17:53:17 -05:00
.expect("WASM can't be instantiated")
2019-01-09 01:06:24 -05:00
}
fn start_module_2(instance: &mut Instance) {
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
//instance.start();
}
// Line 62
#[test]
fn test_module_2() {
let mut instance = create_module_2();
// We group the calls together
start_module_2(&mut instance);
}
2019-01-12 17:52:14 -05:00
fn create_module_3() -> Instance {
2019-01-09 01:06:24 -05:00
let module_str = "(module)
";
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
2019-01-12 17:53:17 -05:00
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new())
.expect("WASM can't be compiled");
module
2019-01-12 22:02:19 -05:00
.instantiate(&generate_imports())
2019-01-12 17:53:17 -05:00
.expect("WASM can't be instantiated")
2019-01-09 01:06:24 -05:00
}
fn start_module_3(instance: &mut Instance) {
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
//instance.start();
}
// Line 71
#[test]
fn test_module_3() {
let mut instance = create_module_3();
// We group the calls together
start_module_3(&mut instance);
}
2019-01-12 17:52:14 -05:00
fn create_module_4() -> Instance {
2019-01-09 01:06:24 -05:00
let module_str = "(module)
";
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
2019-01-12 17:53:17 -05:00
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new())
.expect("WASM can't be compiled");
module
2019-01-12 22:02:19 -05:00
.instantiate(&generate_imports())
2019-01-12 17:53:17 -05:00
.expect("WASM can't be instantiated")
2019-01-09 01:06:24 -05:00
}
fn start_module_4(instance: &mut Instance) {
// TODO Review is explicit start needed? Start now called in runtime::Instance::new()
//instance.start();
}
#[test]
fn test_module_4() {
let mut instance = create_module_4();
// We group the calls together
start_module_4(&mut instance);
}