Skip to content

Commit

Permalink
Add double round trip test
Browse files Browse the repository at this point in the history
  • Loading branch information
acairncross committed Dec 31, 2020
1 parent fd06d0c commit 780f4b2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/Euphrates/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ spec = do
let output = simulate @System (reifySNat baudDuration uartRx) serializedValues
(P.take (P.length values) . catMaybes $ output) `shouldBe` values

it "round trips bits (transmit then receive)" $ do
describe "round trips bits (transmit then receive)" $ do
let spacedValues =
spaceValues (fromIntegral clocksPerBaud) clocksPerIdle values
P.++ P.repeat Nothing
Expand All @@ -80,5 +80,12 @@ spec = do
=> Signal dom (Maybe (BitVector 8))
-> Signal dom (Maybe (BitVector 8))
uartTxRx = reifySNat baudDuration uartRx . fst . reifySNat baudDuration uartTx
let output = simulate @System uartTxRx spacedValues
(P.take (P.length values) . catMaybes $ output) `shouldBe` values

it "once" $ do
let output = simulate @System uartTxRx spacedValues
(P.take (P.length values) . catMaybes $ output) `shouldBe` values

-- Note that this also involves a transmit -> receive
it "twice" $ do
let output = simulate @System (uartTxRx . uartTxRx) spacedValues
(P.take (P.length values) . catMaybes $ output) `shouldBe` values

0 comments on commit 780f4b2

Please sign in to comment.