Skip to content

Commit 86e78f3

Browse files
committed
Another small update to tests
1 parent 0598a30 commit 86e78f3

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

src/time.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#All time related types and functions
22

3-
import Base: convert, isless, sleep
3+
import Base: convert, isless
44
export Time, Duration, Rate, to_sec, to_nsec, get_rostime, rossleep
55

66
#Time type definitions

test/pubsub.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ function pose_cb(msg::PoseStamped, msgs::Vector{PoseStamped})
2424
end
2525
pose_cb(PoseStamped(), msgs)
2626

27-
const ros_pub = Publisher{Vector3}("vectors", queue_size = 10)
28-
const ros_sub = Subscriber{PoseStamped}("poses", pose_cb, (msgs,), queue_size = 10)
27+
const ros_pub = Publisher("vectors", Vector3, queue_size = 10)
28+
const ros_sub = Subscriber("poses", PoseStamped, pose_cb, (msgs,), queue_size = 10)
2929

3030
#First message doesn't go out for some reason
3131
publish(ros_pub, Vector3(1.1,2.2,3.3))

test/rospy.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ delete_param("some_param")
1818
#Really just running this stuff for coverage
1919

2020
#Logging
21-
logdebug("%s", "debug")
22-
loginfo("%s", "info")
23-
logwarn("%s", "warn")
24-
logerr("%s", "err")
25-
logfatal("%s", "fatal")
21+
logdebug("testing: %s", "debug")
22+
loginfo("testing: %s", "info")
23+
logwarn("testing: %s", "warn")
24+
logerr("testing: %s", "err")
25+
logfatal("testing: %s", "fatal")
2626
@test ! is_shutdown()
2727

2828
#Generic stuff

test/time.jl

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,25 @@ dt.secs = 3
4040
@test to_sec(dt) == 3.0
4141
@test to_nsec(dt) == 3_000_000_000
4242

43-
@test tt + dt == Time(5.0)
43+
@test dt + tt == Time(5.0)
4444
@test dt + dt == Duration(6.0)
4545

46+
#PyObject stuff
47+
ptt = convert(PyCall.PyObject, tt)
48+
@test ptt[:secs] == 2
49+
@test ptt[:nsecs] == 0
50+
ptt[:nsecs] = 101
51+
tt2 = convert(Time, ptt)
52+
@test to_nsec(tt2) == 2_000_000_101
53+
54+
pdt = convert(PyCall.PyObject, dt)
55+
@test pdt[:secs] == 3
56+
@test pdt[:nsecs] == 0
57+
pdt[:nsecs] = 202
58+
dt2 = convert(Duration, pdt)
59+
@test to_nsec(dt2) == 3_000_000_202
60+
61+
#rostime and sleeping
4662
t1 = get_rostime()
4763
rossleep(0.5)
4864
t2 = get_rostime()
@@ -60,7 +76,7 @@ t3 = RobotOS.now()
6076
@test t3 - t1 >= Duration(0.8)
6177

6278
t1 = get_rostime()
63-
RobotOS.sleep(0.5)
79+
RobotOS.sleep(Duration(0.5))
6480
t2 = get_rostime()
6581
@test t2 - t1 >= Duration(0.4)
6682

0 commit comments

Comments
 (0)