Commit 019f8a66 authored by Stefan Behnel's avatar Stefan Behnel

split posix time tests in the same way as posix/time.pxd file before

parent 4562c6b5
# http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/resource.h.html # http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/resource.h.html
from posix.time cimport timeval from posix.sys_time cimport timeval
from posix.types cimport id_t from posix.types cimport id_t
cdef extern from "sys/resource.h" nogil: cdef extern from "sys/resource.h" nogil:
......
# tag: posix
from posix.sys_time cimport *
def test_itimer(sec, usec):
"""
>>> test_itimer(10, 2)
(10, 2)
"""
cdef itimerval t, gtime
t.it_interval.tv_sec = sec
t.it_interval.tv_usec = usec
t.it_value.tv_sec = sec
t.it_value.tv_usec = usec
ret = setitimer(ITIMER_REAL, &t, NULL)
assert ret == 0
ret = getitimer(ITIMER_REAL, &gtime)
assert ret == 0
t.it_interval.tv_sec = 0
t.it_interval.tv_usec = 0
t.it_value.tv_sec = 0
t.it_value.tv_usec = 0
ret = setitimer(ITIMER_REAL, &t, NULL)
return gtime.it_interval.tv_sec, gtime.it_interval.tv_usec
def test_gettimeofday():
"""
>>> test_gettimeofday()
"""
cdef timeval t
ret = gettimeofday(&t, NULL)
assert ret == 0
...@@ -3,35 +3,6 @@ from libc.stdlib cimport getenv ...@@ -3,35 +3,6 @@ from libc.stdlib cimport getenv
from posix.stdlib cimport setenv, unsetenv from posix.stdlib cimport setenv, unsetenv
from posix.time cimport * from posix.time cimport *
def test_itimer(sec, usec):
"""
>>> test_itimer(10, 2)
(10, 2)
"""
cdef itimerval t, gtime
t.it_interval.tv_sec = sec
t.it_interval.tv_usec = usec
t.it_value.tv_sec = sec
t.it_value.tv_usec = usec
ret = setitimer(ITIMER_REAL, &t, NULL)
assert ret == 0
ret = getitimer(ITIMER_REAL, &gtime)
assert ret == 0
t.it_interval.tv_sec = 0
t.it_interval.tv_usec = 0
t.it_value.tv_sec = 0
t.it_value.tv_usec = 0
ret = setitimer(ITIMER_REAL, &t, NULL)
return gtime.it_interval.tv_sec, gtime.it_interval.tv_usec
def test_gettimeofday():
"""
>>> test_gettimeofday()
"""
cdef timeval t
ret = gettimeofday(&t, NULL)
assert ret == 0
def test_time(): def test_time():
""" """
...@@ -43,6 +14,7 @@ def test_time(): ...@@ -43,6 +14,7 @@ def test_time():
t1 = time(&t2) t1 = time(&t2)
assert t1 == t2 assert t1 == t2
def test_mktime(): def test_mktime():
""" """
tests/run/posix_time.pyx tests/run/posix_time.pyx
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment