Skip to content

Commit c4c2db1

Browse files
committed
Delete unportable function from tests
1 parent 255058f commit c4c2db1

2 files changed

Lines changed: 15 additions & 38 deletions

File tree

tests/unit/out/unsafe/time_h.rs

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,20 @@ use std::rc::Rc;
99
pub unsafe fn test_time_0() {
1010
assert!(((((libc::time(std::ptr::null_mut())) > (0_i64)) as i32) != 0));
1111
}
12-
pub unsafe fn test_gettimeofday_1() {
13-
let mut tv: timeval = std::mem::zeroed::<timeval>();
14-
tv.tv_sec = 0_i64;
15-
tv.tv_usec = 0_i64;
16-
assert!(
17-
((((libc::gettimeofday(
18-
(&mut tv as *mut timeval),
19-
(0 as *mut ::libc::c_void) as *mut ::libc::timezone
20-
)) == (0)) as i32)
21-
!= 0)
22-
);
23-
assert!(((((tv.tv_sec) > (0_i64)) as i32) != 0));
24-
assert!(((((tv.tv_usec) >= (0_i64)) as i32) != 0));
25-
assert!(((((tv.tv_usec) < (1000000_i64)) as i32) != 0));
26-
}
27-
pub unsafe fn test_clock_gettime_2() {
12+
pub unsafe fn test_clock_gettime_1() {
2813
let mut ts: timespec = std::mem::zeroed::<timespec>();
2914
ts.tv_sec = 0_i64;
3015
ts.tv_nsec = 0_i64;
31-
assert!(((((libc::clock_gettime(1, (&mut ts as *mut timespec))) == (0)) as i32) != 0));
16+
assert!(
17+
((((libc::clock_gettime(1 as ::libc::clockid_t, (&mut ts as *mut timespec))) == (0))
18+
as i32)
19+
!= 0)
20+
);
3221
assert!(((((ts.tv_sec) > (0_i64)) as i32) != 0));
3322
assert!(((((ts.tv_nsec) >= (0_i64)) as i32) != 0));
3423
assert!(((((ts.tv_nsec) < (1000000000_i64)) as i32) != 0));
3524
}
36-
pub unsafe fn test_localtime_r_3() {
25+
pub unsafe fn test_localtime_r_2() {
3726
let mut t: i64 = 0_i64;
3827
let mut tm: tm = std::mem::zeroed::<tm>();
3928
assert!(
@@ -43,7 +32,7 @@ pub unsafe fn test_localtime_r_3() {
4332
);
4433
assert!(((((tm.tm_year) == (70)) as i32) != 0));
4534
}
46-
pub unsafe fn test_gmtime_r_4() {
35+
pub unsafe fn test_gmtime_r_3() {
4736
let mut t: i64 = 0_i64;
4837
let mut tm: tm = std::mem::zeroed::<tm>();
4938
assert!(
@@ -56,7 +45,7 @@ pub unsafe fn test_gmtime_r_4() {
5645
assert!(((((tm.tm_mday) == (1)) as i32) != 0));
5746
assert!(((((tm.tm_hour) == (0)) as i32) != 0));
5847
}
59-
pub unsafe fn test_strftime_5() {
48+
pub unsafe fn test_strftime_4() {
6049
let mut t: i64 = 0_i64;
6150
let mut tm: tm = std::mem::zeroed::<tm>();
6251
libc::gmtime_r((&mut t as *mut i64).cast_const(), (&mut tm as *mut tm));
@@ -79,7 +68,7 @@ pub unsafe fn test_strftime_5() {
7968
!= 0)
8069
);
8170
}
82-
pub unsafe fn test_utimes_6() {
71+
pub unsafe fn test_utimes_5() {
8372
let mut path: *const u8 = (b"/tmp/cpp2rust_utimes_test.tmp\0".as_ptr().cast_mut()).cast_const();
8473
let mut fp: *mut ::std::fs::File =
8574
match std::ffi::CStr::from_ptr((b"wb\0".as_ptr().cast_mut()).cast_const() as *const i8)
@@ -137,11 +126,10 @@ pub fn main() {
137126
}
138127
unsafe fn main_0() -> i32 {
139128
(unsafe { test_time_0() });
140-
(unsafe { test_gettimeofday_1() });
141-
(unsafe { test_clock_gettime_2() });
142-
(unsafe { test_localtime_r_3() });
143-
(unsafe { test_gmtime_r_4() });
144-
(unsafe { test_strftime_5() });
145-
(unsafe { test_utimes_6() });
129+
(unsafe { test_clock_gettime_1() });
130+
(unsafe { test_localtime_r_2() });
131+
(unsafe { test_gmtime_r_3() });
132+
(unsafe { test_strftime_4() });
133+
(unsafe { test_utimes_5() });
146134
return 0;
147135
}

tests/unit/time_h.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99

1010
static void test_time(void) { assert(time(NULL) > 0); }
1111

12-
static void test_gettimeofday(void) {
13-
struct timeval tv;
14-
tv.tv_sec = 0;
15-
tv.tv_usec = 0;
16-
assert(gettimeofday(&tv, NULL) == 0);
17-
assert(tv.tv_sec > 0);
18-
assert(tv.tv_usec >= 0);
19-
assert(tv.tv_usec < 1000000);
20-
}
21-
2212
static void test_clock_gettime(void) {
2313
struct timespec ts;
2414
ts.tv_sec = 0;
@@ -72,7 +62,6 @@ static void test_utimes(void) {
7262

7363
int main(void) {
7464
test_time();
75-
test_gettimeofday();
7665
test_clock_gettime();
7766
test_localtime_r();
7867
test_gmtime_r();

0 commit comments

Comments
 (0)