Coverage for examples/gcd.py: 33%

9 statements  

« prev     ^ index     » next       coverage.py v7.11.3, created at 2025-12-01 19:40 +0000

1# Example of instantiating a wasm module and calling an export on it 

2 

3from wasmtime import Store, Module, Instance 

4 

5def run(): 

6 store = Store() 

7 module = Module.from_file(store.engine, './examples/gcd.wat') 

8 instance = Instance(store, module, []) 

9 gcd = instance.exports(store)["gcd"] 

10 

11 print("gcd(6, 27) = %d" % gcd(store, 6, 27)) 

12 

13if __name__ == '__main__': 

14 run()