#[cfg(test)] pub mod test_expose_cpp { #[expose::function] pub fn test_func() -> i32 { 42 } #[expose::function] pub fn test_more_complex(x: i32, y: i32, z: String) -> String { let mut tmp = String::from(z); tmp.push_str(&x.to_string()); tmp.push_str(&y.to_string()); return tmp; } #[expose::function] pub fn test_empty_return() -> i32 { 0 } #[expose::enumeration] #[derive(PartialEq, Debug)] pub enum TestEnum { One, Two, Three } #[test] fn can_call_basic_func() { assert_eq!(42, test_func()); } #[test] fn can_call_more_complex_func() { assert_eq!("hello12", test_more_complex(1, 2, String::from("hello"))); } #[test] fn can_use_exposed_enum() { assert_eq!(TestEnum::One, TestEnum::One); assert_ne!(TestEnum::Two, TestEnum::One); } }