mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-05-15 00:31:28 +00:00
Old test uncommented
This commit is contained in:
parent
e9ec5e8aa8
commit
93b61bc2dc
@ -2,6 +2,7 @@ use elements::{MemoryType, TableType, GlobalType, Type};
|
|||||||
use elements::{BlockType, ValueType};
|
use elements::{BlockType, ValueType};
|
||||||
use validation::Error;
|
use validation::Error;
|
||||||
|
|
||||||
|
#[derive(Default, Debug)]
|
||||||
pub struct ModuleContext {
|
pub struct ModuleContext {
|
||||||
pub memories: Vec<MemoryType>,
|
pub memories: Vec<MemoryType>,
|
||||||
pub tables: Vec<TableType>,
|
pub tables: Vec<TableType>,
|
||||||
|
@ -16,6 +16,7 @@ mod func;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Error(String);
|
pub struct Error(String);
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
@ -182,8 +183,6 @@ fn prepare_context(module: &Module) -> Result<ModuleContext, Error> {
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
// Fill elements with imported values.
|
// Fill elements with imported values.
|
||||||
|
|
||||||
// TODO: Use Func::type_ref?
|
|
||||||
let mut func_type_indexes = Vec::new();
|
let mut func_type_indexes = Vec::new();
|
||||||
let mut tables = Vec::new();
|
let mut tables = Vec::new();
|
||||||
let mut memories = Vec::new();
|
let mut memories = Vec::new();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use elements::{MemoryType, TableType, GlobalType, Type};
|
use elements::{MemoryType, TableType, GlobalType, Type};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct ValidatedModule {
|
pub struct ValidatedModule {
|
||||||
pub memories: Vec<MemoryType>,
|
pub memories: Vec<MemoryType>,
|
||||||
pub tables: Vec<TableType>,
|
pub tables: Vec<TableType>,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::validate_module;
|
use super::validate_module;
|
||||||
use builder::module;
|
use builder::module;
|
||||||
use elements::{External, GlobalEntry, GlobalType, ImportEntry, InitExpr, MemoryType,
|
use elements::{External, GlobalEntry, GlobalType, ImportEntry, InitExpr, MemoryType,
|
||||||
Opcode, Opcodes, TableType, ValueType};
|
Opcode, Opcodes, TableType, ValueType, BlockType};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty_is_valid() {
|
fn empty_is_valid() {
|
||||||
@ -275,23 +275,25 @@ fn globals() {
|
|||||||
assert!(validate_module(&m).is_err());
|
assert!(validate_module(&m).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: pepyakin
|
#[test]
|
||||||
// #[test]
|
fn if_else_with_return_type_validation() {
|
||||||
// fn if_else_with_return_type_validation() {
|
let m = module()
|
||||||
// let module_instance = ModuleInstance::new(Weak::default(), "test".into(), module().build()).unwrap();
|
.function()
|
||||||
// let mut context = FunctionValidationContext::new(&module_instance, None, &[], 1024, 1024, FunctionSignature::Module(&FunctionType::default()));
|
.signature().build()
|
||||||
|
.body().with_opcodes(Opcodes::new(vec![
|
||||||
// Validator::validate_function(&mut context, BlockType::NoResult, &[
|
Opcode::I32Const(1),
|
||||||
// Opcode::I32Const(1),
|
Opcode::If(BlockType::NoResult),
|
||||||
// Opcode::If(BlockType::NoResult),
|
Opcode::I32Const(1),
|
||||||
// Opcode::I32Const(1),
|
Opcode::If(BlockType::Value(ValueType::I32)),
|
||||||
// Opcode::If(BlockType::Value(ValueType::I32)),
|
Opcode::I32Const(1),
|
||||||
// Opcode::I32Const(1),
|
Opcode::Else,
|
||||||
// Opcode::Else,
|
Opcode::I32Const(2),
|
||||||
// Opcode::I32Const(2),
|
Opcode::End,
|
||||||
// Opcode::End,
|
Opcode::Drop,
|
||||||
// Opcode::Drop,
|
Opcode::End,
|
||||||
// Opcode::End,
|
Opcode::End,
|
||||||
// Opcode::End,
|
])).build()
|
||||||
// ]).unwrap();
|
.build()
|
||||||
// }
|
.build();
|
||||||
|
validate_module(&m).unwrap();
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user