Skip to content

Commit 0bc950f

Browse files
committed
Delete linux specific memrchr from tests
1 parent f217d00 commit 0bc950f

4 files changed

Lines changed: 4 additions & 77 deletions

File tree

tests/unit/cstring.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,6 @@ static void test_strpbrk() {
153153
assert(std::strpbrk(buf, "b") == &buf[1]);
154154
}
155155

156-
static void test_memrchr() {
157-
const char data[] = {1, 2, 3, 2, 4};
158-
const void *r = memrchr(data, 2, 5);
159-
assert(r == &data[3]);
160-
assert(memrchr(data, 99, 5) == nullptr);
161-
const void *p = data;
162-
std::size_t n = 5;
163-
assert(memrchr(p, 1, n) == p);
164-
}
165-
166156
static void test_strcasecmp() {
167157
assert(strcasecmp("HELLO", "hello") == 0);
168158
assert(strcasecmp("abc", "abd") < 0);
@@ -188,7 +178,6 @@ int main() {
188178
test_strspn();
189179
test_strstr();
190180
test_strpbrk();
191-
test_memrchr();
192181
test_strcasecmp();
193182
return 0;
194183
}

tests/unit/out/unsafe/cstring.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -371,28 +371,7 @@ pub unsafe fn test_strpbrk_14() {
371371
== (&mut buf[(1) as usize] as *mut u8))
372372
);
373373
}
374-
pub unsafe fn test_memrchr_15() {
375-
let data: [u8; 5] = [1_u8, 2_u8, 3_u8, 2_u8, 4_u8];
376-
let mut r: *const ::libc::c_void = libc::memrchr(
377-
(data.as_ptr() as *const u8 as *const ::libc::c_void) as *const ::libc::c_void,
378-
2,
379-
5_u64 as usize,
380-
) as *const ::libc::c_void;
381-
assert!(((r) == ((&data[(3) as usize] as *const u8) as *const u8 as *const ::libc::c_void)));
382-
assert!((libc::memrchr(
383-
(data.as_ptr() as *const u8 as *const ::libc::c_void) as *const ::libc::c_void,
384-
99,
385-
5_u64 as usize
386-
) as *const ::libc::c_void)
387-
.is_null());
388-
let mut p: *const ::libc::c_void = (data.as_ptr() as *const u8 as *const ::libc::c_void);
389-
let mut n: u64 = 5_u64;
390-
assert!(
391-
((libc::memrchr(p as *const ::libc::c_void, 1, n as usize) as *const ::libc::c_void)
392-
== (p))
393-
);
394-
}
395-
pub unsafe fn test_strcasecmp_16() {
374+
pub unsafe fn test_strcasecmp_15() {
396375
assert!(
397376
((libc::strcasecmp(
398377
b"HELLO\0".as_ptr() as *const i8,
@@ -436,7 +415,6 @@ unsafe fn main_0() -> i32 {
436415
(unsafe { test_strspn_12() });
437416
(unsafe { test_strstr_13() });
438417
(unsafe { test_strpbrk_14() });
439-
(unsafe { test_memrchr_15() });
440-
(unsafe { test_strcasecmp_16() });
418+
(unsafe { test_strcasecmp_15() });
441419
return 0;
442420
}

tests/unit/out/unsafe/string_h.rs

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -495,35 +495,7 @@ pub unsafe fn test_strpbrk_14() {
495495
!= 0)
496496
);
497497
}
498-
pub unsafe fn test_memrchr_15() {
499-
let data: [u8; 5] = [1_u8, 2_u8, 3_u8, 2_u8, 4_u8];
500-
let mut r: *mut ::libc::c_void = libc::memrchr(
501-
(data.as_ptr() as *const u8 as *const ::libc::c_void) as *const ::libc::c_void,
502-
2,
503-
5_u64 as usize,
504-
);
505-
assert!(
506-
((((r) == ((&data[(3) as usize] as *const u8) as *mut u8 as *mut ::libc::c_void)) as i32)
507-
!= 0)
508-
);
509-
assert!(
510-
((((libc::memrchr(
511-
(data.as_ptr() as *const u8 as *const ::libc::c_void) as *const ::libc::c_void,
512-
99,
513-
5_u64 as usize
514-
))
515-
.is_null()) as i32)
516-
!= 0)
517-
);
518-
let mut p: *const ::libc::c_void = (data.as_ptr() as *const u8 as *const ::libc::c_void);
519-
let mut n: u64 = 5_u64;
520-
assert!(
521-
((((libc::memrchr(p as *const ::libc::c_void, 1, n as usize))
522-
== (p as *mut ::libc::c_void as *mut ::libc::c_void)) as i32)
523-
!= 0)
524-
);
525-
}
526-
pub unsafe fn test_strcasecmp_16() {
498+
pub unsafe fn test_strcasecmp_15() {
527499
assert!(
528500
((((libc::strcasecmp(
529501
(b"HELLO\0".as_ptr().cast_mut()).cast_const() as *const i8,
@@ -570,7 +542,6 @@ unsafe fn main_0() -> i32 {
570542
(unsafe { test_strspn_12() });
571543
(unsafe { test_strstr_13() });
572544
(unsafe { test_strpbrk_14() });
573-
(unsafe { test_memrchr_15() });
574-
(unsafe { test_strcasecmp_16() });
545+
(unsafe { test_strcasecmp_15() });
575546
return 0;
576547
}

tests/unit/string_h.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,6 @@ static void test_strpbrk(void) {
153153
assert(strpbrk(buf, "b") == &buf[1]);
154154
}
155155

156-
static void test_memrchr(void) {
157-
const char data[] = {1, 2, 3, 2, 4};
158-
void *r = memrchr(data, 2, 5);
159-
assert(r == &data[3]);
160-
assert(memrchr(data, 99, 5) == NULL);
161-
const void *p = data;
162-
size_t n = 5;
163-
assert(memrchr(p, 1, n) == p);
164-
}
165-
166156
static void test_strcasecmp(void) {
167157
assert(strcasecmp("HELLO", "hello") == 0);
168158
assert(strcasecmp("abc", "abd") < 0);
@@ -188,7 +178,6 @@ int main(void) {
188178
test_strspn();
189179
test_strstr();
190180
test_strpbrk();
191-
test_memrchr();
192181
test_strcasecmp();
193182
return 0;
194183
}

0 commit comments

Comments
 (0)