mirror of https://github.com/tailix/libkernaux.git
Rust: Import unsafe funcs
This commit is contained in:
parent
01ee4fdf25
commit
a9275430f2
|
@ -1 +1,3 @@
|
|||
mod ntoa;
|
||||
|
||||
pub use ntoa::*;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::ffi::CStr;
|
||||
|
||||
use kernaux_sys::{utoa10, UTOA10_BUFFER_SIZE};
|
||||
|
||||
#[test]
|
||||
fn test_utoa10() {
|
||||
let mut buffer: [i8; UTOA10_BUFFER_SIZE] = [0; UTOA10_BUFFER_SIZE];
|
||||
unsafe { utoa10(123, buffer.as_mut_ptr()) };
|
||||
let result =
|
||||
unsafe { CStr::from_ptr(buffer.as_ptr()) }.to_str().unwrap();
|
||||
assert_eq!(result, "123");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue