()
| 733 | |
| 734 | #[tokio::test] |
| 735 | async fn accept_bulk_memory_data_count() -> Result<()> { |
| 736 | let mut module = wasm_encoder::Module::new(); |
| 737 | let mut types = wasm_encoder::TypeSection::new(); |
| 738 | types.ty().func_type(&wasm_encoder::FuncType::new( |
| 739 | vec![], |
| 740 | vec![wasm_encoder::ValType::I32], |
| 741 | )); |
| 742 | types |
| 743 | .ty() |
| 744 | .func_type(&wasm_encoder::FuncType::new(vec![], vec![])); |
| 745 | module.section(&types); |
| 746 | |
| 747 | let mut functions = wasm_encoder::FunctionSection::new(); |
| 748 | functions.function(0); |
| 749 | functions.function(1); |
| 750 | module.section(&functions); |
| 751 | |
| 752 | let mut memory = wasm_encoder::MemorySection::new(); |
| 753 | memory.memory(wasm_encoder::MemoryType { |
| 754 | minimum: 1, |
| 755 | maximum: Some(1), |
| 756 | memory64: false, |
| 757 | shared: false, |
| 758 | page_size_log2: None, |
| 759 | }); |
| 760 | module.section(&memory); |
| 761 | |
| 762 | let mut exports = wasm_encoder::ExportSection::new(); |
| 763 | exports.export("run", wasm_encoder::ExportKind::Func, 0); |
| 764 | exports.export("wizer-initialize", wasm_encoder::ExportKind::Func, 1); |
| 765 | module.section(&exports); |
| 766 | |
| 767 | module.section(&wasm_encoder::DataCountSection { count: 2 }); |
| 768 | |
| 769 | let mut code = wasm_encoder::CodeSection::new(); |
| 770 | let mut func = wasm_encoder::Function::new(vec![]); |
| 771 | func.instruction(&wasm_encoder::Instruction::I32Const(42)); |
| 772 | func.instruction(&wasm_encoder::Instruction::End); |
| 773 | code.function(&func); |
| 774 | |
| 775 | let mut func = wasm_encoder::Function::new(vec![]); |
| 776 | func.instruction(&wasm_encoder::Instruction::End); |
| 777 | code.function(&func); |
| 778 | |
| 779 | module.section(&code); |
| 780 | |
| 781 | // We're expecting these two data segments to be merge into one, which will exercise wizer's |
| 782 | // ability to output the correct data count (1 instead of 2 above). |
| 783 | let mut data = wasm_encoder::DataSection::new(); |
| 784 | data.active(0, &ConstExpr::i32_const(0), vec![0, 1, 2, 3]); |
| 785 | data.active(0, &ConstExpr::i32_const(4), vec![5, 6, 7, 8]); |
| 786 | module.section(&data); |
| 787 | |
| 788 | wizen_and_run_wasm("run", &[], 42, &module.finish(), get_wizer()) |
| 789 | .await |
| 790 | .unwrap(); |
| 791 | Ok(()) |
| 792 | } |
nothing calls this directly
no test coverage detected