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

Function multiple_modules

crates/wizer/tests/all/component.rs:412–515  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

410
411#[tokio::test]
412async fn multiple_modules() -> Result<()> {
413 wizen_and_run_wat(
414 100 + 101 + 200 + 201 + 7 + 112,
415 r#"(component
416 (core module $a
417 (memory 1)
418 (global $g (export "g") (mut i32) (i32.const 0))
419
420 (func (export "init")
421 i32.const 200
422 i32.const 100
423 i32.store
424 i32.const 300
425 i32.const 101
426 i32.store
427 )
428
429 (func (export "run") (param i32) (result i32)
430 i32.const 200
431 i32.load
432 i32.const 300
433 i32.load
434 i32.add
435 global.get $g
436 i32.add
437 )
438 )
439 (core instance $a (instantiate $a))
440
441 (core module $b
442 (import "a" "g" (global $g (mut i32)))
443 (import "a" "init" (func $init))
444 (import "a" "run" (func $run (param i32) (result i32)))
445 (memory (export "mem") 1)
446 (func (export "init")
447 call $init
448 i32.const 400
449 i32.const 200
450 i32.store
451 i32.const 500
452 i32.const 201
453 i32.store
454
455 i32.const 111
456 global.set $g
457 )
458 (func (export "run") (param i32) (result i32)
459 i32.const 400
460 i32.load
461 i32.const 500
462 i32.load
463 i32.add
464 i32.const 0
465 call $run
466 i32.add
467 )
468 )
469 (core instance $b (instantiate $b (with "a" (instance $a))))

Callers

nothing calls this directly

Calls 2

wizen_and_run_watFunction · 0.85
OkFunction · 0.85

Tested by

no test coverage detected