Skip to content

Commit

Permalink
test-network: added debugging tracers to the utils module
Browse files Browse the repository at this point in the history
  • Loading branch information
coot committed Sep 22, 2020
1 parent 394fd81 commit 75c759f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ouroboros-network/test/Test/Ouroboros/Network/Utils.hs
Expand Up @@ -3,8 +3,13 @@
module Test.Ouroboros.Network.Utils where

import Control.Monad.Class.MonadTime
import Control.Monad.Class.MonadSay
import Control.Tracer (Tracer (..))

import Test.QuickCheck

import Debug.Trace (traceShowM)


newtype Delay = Delay { getDelay :: DiffTime }
deriving Show
Expand All @@ -20,3 +25,13 @@ instance Arbitrary Delay where
shrink (Delay delay) | delay >= 0.1 = [ Delay (delay - 0.1) ]
| otherwise = []


--
-- Debugging tools
--

debugTracer :: ( Show a, Applicative m) => Tracer m a
debugTracer = Tracer traceShowM

sayTracer :: ( Show a, MonadSay m) => Tracer m a
sayTracer = Tracer (say . show)

0 comments on commit 75c759f

Please sign in to comment.