Skip to content

Commit

Permalink
Add regression test for #365
Browse files Browse the repository at this point in the history
  • Loading branch information
turion committed Oct 27, 2024
1 parent 3ecb50a commit 582fe5e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions rhine/test/Clock/FixedStep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

module Clock.FixedStep where

-- base
import Data.List (sort)
import Data.Maybe (catMaybes)

-- vector-sized
import Data.Vector.Sized (toList)

Expand All @@ -12,8 +16,13 @@ import Test.Tasty (testGroup)
-- tasty-hunit
import Test.Tasty.HUnit (testCase, (@?=))

-- monad-schedule
import Control.Monad.Schedule.Trans (runScheduleIO)

-- rhine
import FRP.Rhine

-- rhine (test)
import Util

tests =
Expand Down Expand Up @@ -50,4 +59,13 @@ tests =
, Nothing
, Just ([24, 21, 18, 15], 24)
]
, testGroup
"Schedule"
[ testCase "Can schedule two FixedStep clocks" $ do
let f300 = absoluteS @@ FixedStep @300
let f500 = absoluteS @@ FixedStep @500
output <- runScheduleIO @_ @Integer $ runRhine (f300 +@+ f500) $ replicate 10 ()
let timestamps = either id id <$> catMaybes output
timestamps @?= sort timestamps
]
]

0 comments on commit 582fe5e

Please sign in to comment.