Skip to content

Commit

Permalink
Revert "Update runtests.jl"
Browse files Browse the repository at this point in the history
This reverts commit d480760.
  • Loading branch information
testercwt committed Jul 25, 2023
1 parent d480760 commit 636fe07
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,17 @@ end
GameZero.scheduler[] = GameZero.Scheduler()
flag=false
f()= (flag=true;nothing)
function _sleep(t)
t1=Base.time_ns()
while true
sleep(0.01)
Base.time_ns()-t1 > t * 1.0e9 && break
end
end

@testset "once" begin
flag=false
schedule_once(f,1)
schedule_once(f,0.5)
@test flag==false
_sleep(0.5)
sleep(0.5)
GameZero.tick!(GameZero.scheduler[])
@test flag==true
flag=false
_sleep(0.5)
sleep(0.5)
GameZero.tick!(GameZero.scheduler[])
@test flag==true
end
Expand All @@ -148,11 +141,11 @@ end
schedule_once(f,1)
schedule_unique(f,0.5)
@test flag==false
_sleep(0.5)
sleep(0.5)
GameZero.tick!(GameZero.scheduler[])
@test flag==true
flag=false
_sleep(0.5)
sleep(0.5)
GameZero.tick!(GameZero.scheduler[])
@test flag==false
end
Expand All @@ -161,11 +154,11 @@ end
flag=false
schedule_interval(f,1)
@test flag==false
_sleep(1)
sleep(1)
GameZero.tick!(GameZero.scheduler[])
@test flag==true
flag=false
_sleep(1)
sleep(1)
GameZero.tick!(GameZero.scheduler[])
@test flag==true
GameZero.clear!(GameZero.scheduler[])
Expand All @@ -179,18 +172,18 @@ end
flag=false
schedule_conti(f,1)
@test flag==false
_sleep(1)
sleep(1)
GameZero.tick!(GameZero.scheduler[])
@test flag==true

flag=false
schedule_conti(f2,1)
@test flag==false
_sleep(1)
sleep(1)
GameZero.tick!(GameZero.scheduler[])
@test flag==true
flag=false
_sleep(0.5)
sleep(0.5)
GameZero.tick!(GameZero.scheduler[])
@test flag==true
end
Expand Down

0 comments on commit 636fe07

Please sign in to comment.