Skip to content

Commit

Permalink
Unit test for constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelang committed Mar 13, 2019
1 parent 92b5eae commit ddab8eb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bindings/rust/evmc-vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,19 @@ extern "C" fn release_result(result: *const ffi::evmc_result) {
Box::from_raw(result as *mut ffi::evmc_result);
}
}

#[cfg(test)]
mod tests {
use super::*;
use evmc_sys as ffi;
use std::mem::discriminant;

#[test]
fn constructor() {
let result = EvmcResult::new(ffi::evmc_status_code::EVMC_SUCCESS, 420, Some(&[0xde, 0xad, 0xbe, 0xef]));
assert!(result.status() == ffi::evmc_status_code::EVMC_SUCCESS);
assert!(result.gasleft() == 420);
assert!(result.output().is_some());
assert!(result.output().unwrap().len() == 4);
}
}

0 comments on commit ddab8eb

Please sign in to comment.