mirror of
https://github.com/centau/vide.git
synced 2026-10-20 17:34:08 +00:00
Fix springs not finishing when moving to zero (#98)
This commit is contained in:
parent
b010497a01
commit
86dee3c87c
2 changed files with 37 additions and 2 deletions
|
|
@ -2121,6 +2121,32 @@ TEST("spring()", wrap_root(function()
|
|||
CHECK(count == 1) -- check spring was rescheduled correctly
|
||||
end
|
||||
|
||||
do CASE "spring finished at zero"
|
||||
local input = source(1)
|
||||
local output, control = spring(input)
|
||||
|
||||
local count = 0
|
||||
effect(function()
|
||||
output()
|
||||
count += 1
|
||||
end)
|
||||
|
||||
input(0)
|
||||
step(10)
|
||||
CHECK(output() == 0)
|
||||
|
||||
count = 0
|
||||
step(1)
|
||||
CHECK(count == 0) -- check spring is finished
|
||||
|
||||
control { impulse = 1 }
|
||||
step(10)
|
||||
|
||||
count = 0
|
||||
step(1)
|
||||
CHECK(count == 0) -- check spring is finished after impulse at rest
|
||||
end
|
||||
|
||||
do CASE "spring control"
|
||||
local input = source(1)
|
||||
local output, control = spring(input)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue