Skip to content

Commit

Permalink
use time_ns to make tests more reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Mar 2, 2022
1 parent e97208f commit 066f2d1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
33 changes: 33 additions & 0 deletions t
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/test/events.jl b/test/events.jl
index dcacf246..1501ceb6 100644
--- a/test/events.jl
+++ b/test/events.jl
@@ -10,22 +10,22 @@ Base.:(==)(l::Or, r::Or) = l.left == r.left && l.right == r.right
@testset "PriorityObservable" begin
po = PriorityObservable(0)

- first = Observable(0.0)
- second = Observable(0.0)
- third = Observable(0.0)
+ first = Observable(UInt64(0))
+ second = Observable(UInt64(0))
+ third = Observable(UInt64(0))

on(po, priority=1) do x
sleep(0)
- first[] = time()
+ first[] = time_ns()
end
on(po, priority=0) do x
sleep(0)
- second[] = time()
+ second[] = time_ns()
return Consume(isodd(x))
end
on(po, priority=-1) do x
sleep(0)
- third[] = time()
+ third[] = time_ns()
return Consume(false)
end

12 changes: 6 additions & 6 deletions test/events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ Base.:(==)(l::Or, r::Or) = l.left == r.left && l.right == r.right
@testset "PriorityObservable" begin
po = PriorityObservable(0)

first = Observable(0.0)
second = Observable(0.0)
third = Observable(0.0)
first = Observable(UInt64(0))
second = Observable(UInt64(0))
third = Observable(UInt64(0))

on(po, priority=1) do x
sleep(0)
first[] = time()
first[] = time_ns()
end
on(po, priority=0) do x
sleep(0)
second[] = time()
second[] = time_ns()
return Consume(isodd(x))
end
on(po, priority=-1) do x
sleep(0)
third[] = time()
third[] = time_ns()
return Consume(false)
end

Expand Down

0 comments on commit 066f2d1

Please sign in to comment.