test: move ato{l,i} tests to x.rs

This commit is contained in:
Lars-Magnus Skog
2019-05-13 14:54:06 +02:00
parent 26d6e41c7d
commit 4183141424
2 changed files with 13 additions and 24 deletions

View File

@@ -76,3 +76,16 @@ pub use libc::atof;
pub unsafe fn atof(nptr: *mut libc::c_char) -> libc::c_double {
libc::strtod(nptr, std::ptr::null_mut())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_atox() {
unsafe {
assert_eq!(atol(b"\x00" as *const u8 as *const libc::c_char), 0);
assert_eq!(atoi(b"\x00" as *const u8 as *const libc::c_char), 0);
}
}
}