Add sanity tests

This commit is contained in:
Jakub Konka
2019-05-14 13:27:46 +02:00
committed by Dan Gohman
parent 7f3c325cdf
commit 9ad16cc702
7 changed files with 79 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
extern crate wasi_common_cbindgen;
pub use wasi_common_cbindgen::wasi_common_cbindgen;
#[wasi_common_cbindgen]
fn mut_args(a: &mut usize) {
*a = *a + 1
}
fn main() {
let mut expected = Box::new(2);
mut_args(expected.as_mut());
let given = unsafe {
let given = Box::new(2);
let raw = Box::into_raw(given);
__wasi_mut_args(raw);
Box::from_raw(raw)
};
assert_eq!(*given, *expected);
}