This commit is contained in:
Jessie
2024-01-26 21:03:30 -05:00
commit 7c2ba320fa
13 changed files with 547 additions and 0 deletions

11
tests/strlen.rs Normal file
View File

@@ -0,0 +1,11 @@
#[test]
pub fn test_strlen() {
let mut buffer: Vec<u8> = "a".repeat(1000).into();
buffer.push(0);
assert_eq!(unsafe { xrt::strlen(buffer.as_ptr()) }, 1000);
assert_eq!(unsafe { xrt::strlen((&buffer[1..]).as_ptr()) }, 999);
assert_eq!(unsafe { xrt::strlen((&buffer[8..]).as_ptr()) }, 992);
}