torch-0.1: Simple unit test library (or framework)Source codeContentsIndex
Test.Torch.Build
Synopsis
addTest :: Test t => t -> Builder ()
getTests :: Builder a -> IO Tests
ok :: Bool -> String -> Builder ()
notOk :: Bool -> String -> Builder ()
is :: (Eq a, Show a) => a -> a -> String -> Builder ()
isn't :: (Eq a, Show a) => a -> a -> String -> Builder ()
isBottom :: NFData a => a -> String -> Builder ()
isn'tBottom :: NFData a => a -> String -> Builder ()
data Builder a
runBuilder :: Builder a -> WriterT Tests IO a
Documentation
addTest :: Test t => t -> Builder ()Source
getTests :: Builder a -> IO TestsSource
ok :: Bool -> String -> Builder ()Source
notOk :: Bool -> String -> Builder ()Source

ok and notOk are test for assertion, take a Bool value, and then check whether the value is equal to True or False.

 ok    True  "'ok' succeeds if given value is True"
 notOk False "'notOk' succeeds if given value is False"

Second String argument is the test's name, this is used for telling you what test failed if test was failed usually (and every predefined tests in this module, requires test's name).

is :: (Eq a, Show a) => a -> a -> String -> Builder ()Source
isn't :: (Eq a, Show a) => a -> a -> String -> Builder ()Source

is and isn't are test for equality. First argument is treated as gotten value, and second is expected value.

 is    1 1 "test that checks 1 == 1"
 isn't 1 2 "test that checks 1 /= 2"
 is (fact 10) 3628800 "check if factorial function works..."
isBottom :: NFData a => a -> String -> Builder ()Source
isn'tBottom :: NFData a => a -> String -> Builder ()Source

isBottom and isn'tBottom evaluates given value, and check if it is Bottom (undefined, error, or some exeptions).

 isBottom undefined "for example, this test succeeds"
data Builder a Source
show/hide Instances
runBuilder :: Builder a -> WriterT Tests IO aSource
Produced by Haddock version 2.4.2