Macro sgx_tunittest::rsgx_unit_tests[][src]

macro_rules! rsgx_unit_tests {
    (
        $($f : ident),*
    ) => { ... };
}

This macro works as test case driver.

rsgx_unit_tests! works as a variadic function. It takes a list of test case function as arguments and then execute them sequentially. It prints the statistics on the test result at the end.

One test fails if and only if it panics. For fail test (similar to #[should_panic] in Rust, one should wrap the line which would panic with macro should_panic!.

Here is one sample. For the entire sample, please reference to the sample codes in this project.

#[macro_use]
extern crate sgx_tstd as std;
#[macro_use]
extern crate sgx_unittest;

#[no_mangle]
pub extern "C"
fn test_ecall() -> sgx_status_t {
    rsgx_unit_tests!(foo, bar, zoo);
    sgx_status_t::SGX_SUCCESS
}