1include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
2
3#[cfg(test)]
4mod tests {
5 use super::*;
6 use std::ffi::{CStr, CString};
7 use std::ptr::addr_of_mut;
8
9 type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
10 #[test]
11 fn test_versioninfo() {
12 unsafe {
13 ShowVersionInfo();
14 }
15 }
16
17 #[test]
18 fn test_basepath() -> Result<()> {
19 let input = CString::new("foo.bar.c")?;
20 let mut basepath: Vec<i8> = vec!['\0' as i8; input.to_bytes().len()];
21 let mut baseptr = basepath.as_mut_ptr();
22 let result = unsafe {
23 GetBasePath(input.as_ptr(), addr_of_mut!(baseptr));
24 CStr::from_ptr(baseptr)
25 };
26 assert_eq!(result.to_str()?, "foo.bar");
27 Ok(())
28 }
29}