MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / sanity

Function sanity

crates/fuzzing/src/generators/single_inst_module.rs:585–608  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

583
584 #[test]
585 fn sanity() {
586 let sut = SingleInstModule {
587 instruction: Instruction::I32Add,
588 parameters: &[ValType::I32, ValType::I32],
589 results: &[ValType::I32],
590 feature: |_| true,
591 canonicalize_nan: None,
592 };
593 let wasm = sut.to_bytes();
594 let wat = wasmprinter::print_bytes(wasm).unwrap();
595 assert_eq!(
596 wat,
597 r#"(module
598 (type (;0;) (func (param i32 i32) (result i32)))
599 (export "test" (func 0))
600 (func (;0;) (type 0) (param i32 i32) (result i32)
601 local.get 0
602 local.get 1
603 i32.add
604 )
605)
606"#
607 )
608 }
609
610 #[test]
611 fn instructions_encode_to_valid_modules() {

Callers

nothing calls this directly

Calls 3

print_bytesFunction · 0.85
to_bytesMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected