TLT-0.5.0.0: Testing in monads and transformers without explicit specs

Test.TLT.Standard

Description

Standard assertion vocabulary for the TLT testing system. See TLT for more information.

Synopsis

# Documentation

(@==-) :: (Monad m, Eq a, Show a) => a -> a -> Assertion m infix 1 Source #

Assert that two values are equal. This assertion takes an expected and an actual value; see (@==) to compare the result of a monadic computation to an expected value.

##### Examples
test :: Monad m => TLT m ()
test = do
"Make sure that 2 is still equal to itself" ~: 2 @==- 2
"Make sure that there are four lights" ~: 4 @==- length lights

(@==) :: (Monad m, Eq a, Show a) => a -> m a -> Assertion m infix 1 Source #

Assert that a calculated value is as expected. This assertion compare the result of a monadic computation to an expected value; see (@==-) to compare an actual value to the expected value.

##### Examples
test :: Monad m => TLT m ()
test = do
"Make sure that 2 is still equal to itself" ~: 2 @== return 2
"Make sure that there are four lights" ~: 4 @== countLights
-- where countLights :: m Int

(@/=-) :: (Monad m, Eq a, Show a) => a -> a -> Assertion m infix 1 Source #

Assert that two values are not equal. This assertion takes an expected and an actual value; see (@/=) to compare the result of a monadic computation to an expected value.

(@/=) :: (Monad m, Eq a, Show a) => a -> m a -> Assertion m infix 1 Source #

Assert that a calculated value differs from some known value. This assertion compares the result of a monadic computation to an expected value; see (@/=-) to compare an actual value to the expected value.

(@<-) :: (Monad m, Ord a, Show a) => a -> a -> Assertion m infix 1 Source #

Assert that a given boundary is strictly less than some value. This assertion takes an expected and an actual value; see (@<) to compare the result of a monadic computation to an expected value.

(@<) :: (Monad m, Ord a, Show a) => a -> m a -> Assertion m infix 1 Source #

Assert that a given, constant boundary is strictly less than some calculated value. This assertion compares the result of a /monadic computation/ to an expected value; see (@<-) to compare an actual value to the expected value.

(@>-) :: (Monad m, Ord a, Show a) => a -> a -> Assertion m infix 1 Source #

Assert that a given boundary is strictly less than some value. This assertion takes an expected and an actual value; see (@>) to compare the result of a monadic computation to an expected value.

(@>) :: (Monad m, Ord a, Show a) => a -> m a -> Assertion m infix 1 Source #

Assert that a given, constant boundary is strictly less than some calculated value. This assertion compares the result of a /monadic computation/ to an expected value; see (@>-) to compare an actual value to the expected value.

(@<=-) :: (Monad m, Ord a, Show a) => a -> a -> Assertion m infix 1 Source #

Assert that a given boundary is strictly less than some value. This assertion takes an expected and an actual value; see (@<=) to compare the result of a monadic computation to an expected value.

(@<=) :: (Monad m, Ord a, Show a) => a -> m a -> Assertion m infix 1 Source #

Assert that a given, constant boundary is strictly less than some calculated value. This assertion compares the result of a /monadic computation/ to an expected value; see (@<=-) to compare an actual value to the expected value.

(@>=-) :: (Monad m, Ord a, Show a) => a -> a -> Assertion m infix 1 Source #

Assert that a given boundary is strictly less than some value. This assertion takes an expected and an actual value; see (@>=) to compare the result of a monadic computation to an expected value.

(@>=) :: (Monad m, Ord a, Show a) => a -> m a -> Assertion m infix 1 Source #

Assert that a given, constant boundary is strictly less than some calculated value. This assertion compares the result of a /monadic computation/ to an expected value; see (@>=-) to compare an actual value to the expected value.

emptyP :: (Monad m, Traversable t) => t a -> Assertion m Source #

Assert that a pure traversable structure (such as a list) is empty.

empty :: (Monad m, Traversable t) => m (t a) -> Assertion m Source #

Assert that a traversable structure (such as a list) returned from a computation is empty.

nonemptyP :: (Monad m, Traversable t) => t a -> Assertion m Source #

Assert that a pure traversable structure (such as a list) is nonempty.

nonempty :: (Monad m, Traversable t) => m (t a) -> Assertion m Source #

Assert that a traversable structure (such as a list) returned from a computation is non-empty.

nothingP :: Monad m => Maybe a -> Assertion m Source #

Assert that a Maybe value is Nothing.

nothing :: Monad m => m (Maybe a) -> Assertion m Source #

Assert that a Maybe result of a computation is Nothing.