Skip to content

Commit

Permalink
chore: Open Source - update testnode
Browse files Browse the repository at this point in the history
  • Loading branch information
epociask committed Aug 13, 2024
2 parents 35a9b31 + e655c8d commit 6cc98d6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions arbitrator/jit/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@

#![cfg(test)]

// use wasmer::{imports, Instance, Module, Store, Value};
use wasmer::{imports, Instance, Module, Store, Value};

// #[test]
// fn test_crate() -> eyre::Result<()> {
// // Adapted from https://docs.rs/wasmer/3.1.0/wasmer/index.html
#[test]
fn test_crate() -> eyre::Result<()> {
// Adapted from https://docs.rs/wasmer/3.1.0/wasmer/index.html

// let source = std::fs::read("programs/pure/main.wat")?;
let source = std::fs::read("programs/pure/main.wat")?;

// let mut store = Store::default();
// let module = Module::new(&store, source)?;
// let imports = imports! {};
// let instance = Instance::new(&mut store, &module, &imports)?;
let mut store = Store::default();
let module = Module::new(&store, source)?;
let imports = imports! {};
let instance = Instance::new(&mut store, &module, &imports)?;

// let add_one = instance.exports.get_function("add_one")?;
// let result = add_one.call(&mut store, &[Value::I32(42)])?;
// assert_eq!(result[0], Value::I32(43));
// Ok(())
// }
let add_one = instance.exports.get_function("add_one")?;
let result = add_one.call(&mut store, &[Value::I32(42)])?;
assert_eq!(result[0], Value::I32(43));
Ok(())
}

0 comments on commit 6cc98d6

Please sign in to comment.