#![crate_name = "objc_test_utils"]
#![crate_type = "lib"]
#[link(name = "Foundation", kind = "framework")]
extern { }
pub enum IntBlock { }
pub enum AddBlock { }
#[link(name="block_utils", kind="static")]
extern {
pub fn get_int_block() -> *mut IntBlock;
pub fn get_int_block_with(i: i32) -> *mut IntBlock;
pub fn get_add_block() -> *mut AddBlock;
pub fn get_add_block_with(i: i32) -> *mut AddBlock;
pub fn invoke_int_block(block: *mut IntBlock) -> i32;
pub fn invoke_add_block(block: *mut AddBlock, a: i32) -> i32;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_int_block() {
unsafe {
assert!(invoke_int_block(get_int_block()) == 7);
assert!(invoke_int_block(get_int_block_with(13)) == 13);
}
}
#[test]
fn test_add_block() {
unsafe {
assert!(invoke_add_block(get_add_block(), 5) == 12);
assert!(invoke_add_block(get_add_block_with(3), 5) == 8);
}
}
}