diff --git a/spec/src/lib.rs b/spec/src/lib.rs index f15f971..589c3c6 100644 --- a/spec/src/lib.rs +++ b/spec/src/lib.rs @@ -18,20 +18,69 @@ run_test!("address", wasm_address); run_test!("align", wasm_align); run_test!("binary", wasm_binary); run_test!("block", wasm_block); +run_test!("br", wasm_br); +run_test!("br_if", wasm_br_if); +run_test!("br_table", wasm_br_table); +run_test!("break-drop", wasm_break_drop); +run_test!("call", wasm_call); run_test!("call_indirect", wasm_call_indirect); +run_test!("comments", wasm_comments); run_test!("const", wasm_const); +run_test!("conversions", wasm_conversions); run_test!("custom_section", wasm_custom_section); +run_test!("elem", wasm_elem); +run_test!("endianness", wasm_endianness); +run_test!("exports", wasm_exports); +run_test!("f32", wasm_f32); +run_test!("f32_bitwise", wasm_f32_bitwise); +run_test!("f32_cmp", wasm_f32_cmp); +run_test!("f64", wasm_f64); +run_test!("f64_bitwise", wasm_f64_bitwise); +run_test!("f64_cmp", wasm_f64_cmp); +run_test!("fac", wasm_fac); +run_test!("float_exprs", wasm_float_exprs); run_test!("float_literals", wasm_float_literals); +run_test!("float_memory", wasm_float_memory); +run_test!("float_misc", wasm_float_misc); +run_test!("forward", wasm_forward); run_test!("func", wasm_func); +run_test!("func_ptrs", wasm_func_ptrs); +run_test!("get_local", wasm_get_local); run_test!("globals", wasm_globals); +run_test!("i32", wasm_i32); +run_test!("i64", wasm_i64); run_test!("if", wasm_if); run_test!("imports", wasm_imports); +run_test!("inline-module", inline_module); +run_test!("int_exprs", wasm_int_exprs); run_test!("int_literals", wasm_int_literals); +run_test!("labels", wasm_labels); +run_test!("left-to-right", wasm_left_to_right); +run_test!("linking", wasm_linking); run_test!("loop", wasm_loop); run_test!("memory", wasm_memory); +run_test!("memory_redundancy", wasm_memory_redundancy); +run_test!("memory_trap", wasm_memory_trap); +run_test!("names", wasm_names); +run_test!("nop", wasm_nop); +run_test!("resizing", wasm_resizing); +run_test!("return", wasm_return); +run_test!("select", wasm_select); +run_test!("set_local", wasm_set_local); +run_test!("skip-stack-guard-page", wasm_skip_stack_guard_page); +run_test!("stack", wasm_stack); +run_test!("start", wasm_start); +run_test!("store_retval", wasm_store_retval); +run_test!("switch", wasm_switch); +run_test!("tee_local", wasm_tee_local); run_test!("token", wasm_token); +run_test!("traps", wasm_traps); run_test!("type", wasm_type); +run_test!("typecheck", wasm_typecheck); +run_test!("unreachable", wasm_unreachable); +run_test!("unreached-invalid", wasm_unreached_invalid); +run_test!("unwind", wasm_unwind); run_test!("utf8-custom-section-id", wasm_utf8_custom_section_id); -run_test!("utf8-import-field", wasm_import_field); -run_test!("utf8-import-module", wasm_import_module); -run_test!("utf8-invalid-encoding", wasm_invalid_encoding); \ No newline at end of file +run_test!("utf8-import-field", wasm_utf8_import_field); +run_test!("utf8-import-module", wasm_utf8_import_module); +run_test!("utf8-invalid-encoding", wasm_utf8_invalid_encoding); \ No newline at end of file diff --git a/spec/src/run.rs b/spec/src/run.rs index 7fe568d..9bb4d62 100644 --- a/spec/src/run.rs +++ b/spec/src/run.rs @@ -7,14 +7,21 @@ pub fn spec(path: &str) { match kind { CommandKind::AssertMalformed { module, .. } => { - let module_load = deserialize_buffer::( + match deserialize_buffer::( &module.into_vec().expect("Invalid filename provided") - ); - match module_load { + ) { Ok(_) => panic!("Expected invalid module definition, got some module!"), Err(e) => println!("assert_invalid at line {} - success ({:?})", line, e), } } + CommandKind::Module { module, .. } => { + match deserialize_buffer::( + &module.into_vec().expect("Invalid filename provided") + ) { + Ok(_) => println!("module at line {} - parsed ok", line), + Err(e) => panic!("Valid module reported error ({:?})", e), + } + } _ => { // Skipping interpreted } diff --git a/src/elements/mod.rs b/src/elements/mod.rs index e29b73b..24c77d4 100644 --- a/src/elements/mod.rs +++ b/src/elements/mod.rs @@ -132,7 +132,7 @@ pub enum Error { UnknownFunctionForm(u8), /// Invalid varint7 (should be in -64..63 range) InvalidVarInt7(u8), - /// Amount of code and signatures does not match + /// Number of function body entries and signatures does not match InconsistentCode, } @@ -166,7 +166,7 @@ impl fmt::Display for Error { Error::InvalidMemoryReference(ref mem_ref) => write!(f, "Invalid memory reference ({})", mem_ref), Error::InvalidTableReference(ref table_ref) => write!(f, "Invalid table reference ({})", table_ref), Error::UnknownFunctionForm(ref form) => write!(f, "Unknown function form ({})", form), - Error::InconsistentCode => write!(f, "Amount of code and signatures does not match"), + Error::InconsistentCode => write!(f, "Number of function body entries and signatures does not match"), } } } @@ -199,7 +199,7 @@ impl error::Error for Error { Error::InvalidMemoryReference(_) => "Invalid memory reference", Error::InvalidTableReference(_) => "Invalid table reference", Error::UnknownFunctionForm(_) => "Unknown function form", - Error::InconsistentCode => "Amount of code and signatures does not match", + Error::InconsistentCode => "Number of function body entries and signatures does not match", } } }