Test.Torch is a simple library (or framework) for unit test.

  As Library:

  I assume You want to implement a function that can't find way to
  test using QuickCheck because for example return type is wrapped by
  IO or some monads, but for some arguments, you know collect return
  values. It is time to use Test.Torch. let its function like this:

  > f :: Int -> IO Bool
  > f n = some_complecated_process

  And you know that @f 1@ is same as @return True@, and @f 0@ is same
  as @return False@.

  You can write unit test monadic way (this monad is acutually
  Writer monad, and Tests are treated as Monoid).

  > test_for_f = do
  >   b <- liftIO $ f 1 -- you can do IO Action in test using liftIO
  >   ok b "f 1 is same as return True"
  >   b' <- liftIO $ f 0
  >   notOk b' "f 2 is same as return False"

  Then run it.

  > test = run test_for_f

  Test report is displayed to terminal. If second test failed,

  > Running 2 tests.
  > .f
  > 1 test(s) failed.
  > f 2 is same as return False: failed.

  This output means that @f 2@ returned True.

  If all tests are passed,

  > Running 2 tests.
  > ..
  > Ok, All tests passed.

  Output this.

  As Framework:

  If you think this is not a good format, You can improve output
  format. define some 'Hook', call it with your test by
  'makeReportWithHook'. 'Hook' also has monadic interface.

  And you can also create your own test constructor, with defining
  'Test', 'Failure', and some 'Builder'.


module Test.Torch (

  ok, notOk
, is, isn't

, isBottom, isn'tBottom

, run

) where

import Test.Torch.Build (ok,notOk,is,isn't,isBottom,isn'tBottom,Builder)
import Test.Torch.Run (run)

-- Nothing export but haddock needs this
import Test.Torch.Types hiding (run)
import Test.Torch.Report