use piecrust::{ContractData, Error, SessionData, VM, contract_bytecode};
const OWNER: [u8; 32] = [0u8; 32];
const LIMIT: u64 = 1_000_000;
#[test]
pub fn debug() -> Result<(), Error> {
let vm = VM::ephemeral()?;
let mut session = vm.session(SessionData::builder())?;
let id = session.deploy(
contract_bytecode!("debugger"),
ContractData::builder().owner(OWNER),
LIMIT,
)?;
session.call::<_, ()>(id, "debug", &String::from("Hello world"), LIMIT)?;
session.with_debug(|dbg| {
assert_eq!(dbg, &[String::from("What a string! Hello world")])
});
Ok(())
}