1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-10-30 11:54:01 -04:00

Rust: add test

This commit is contained in:
Alex Kotov 2022-01-25 04:00:09 +05:00
parent dd5c045d4c
commit de8f417fc2
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -42,6 +42,12 @@ mod tests {
let result =
unsafe { CStr::from_ptr(buffer.as_ptr()) }.to_str().unwrap();
assert_eq!(result, "123");
let mut buffer: [i8; 1000] = [0; 1000];
unsafe { kernaux_itoa(-0x123, buffer.as_mut_ptr(), 'x' as c_int) };
let result =
unsafe { CStr::from_ptr(buffer.as_ptr()) }.to_str().unwrap();
assert_eq!(result, "-123");
}
#[test]