ganeti
Safe HaskellNone

Test.Ganeti.BasicTypes

Description

Unittests for ganeti-htools.

Synopsis

Arbitrary instances

Test cases

prop_functor_id :: Result Int -> Property Source #

Tests the functor identity law:

fmap id == id

prop_functor_composition :: Result Int -> Fun Int Int -> Fun Int Int -> Property Source #

Tests the functor composition law:

fmap (f . g)  ==  fmap f . fmap g

prop_applicative_identity :: Result Int -> Property Source #

Tests the applicative identity law:

pure id <*> v = v

prop_applicative_composition :: Result (Fun Int Int) -> Result (Fun Int Int) -> Result Int -> Property Source #

Tests the applicative composition law:

pure (.) <*> u <*> v <*> w = u <*> (v <*> w)

prop_applicative_homomorphism :: Fun Int Int -> Int -> Property Source #

Tests the applicative homomorphism law:

pure f <*> pure x = pure (f x)

prop_applicative_interchange :: Result (Fun Int Int) -> Int -> Property Source #

Tests the applicative interchange law:

u <*> pure y = pure ($ y) <*> u

prop_applicative_functor :: Fun Int Int -> Result Int -> Property Source #

Tests the applicative/functor correspondence:

fmap f x = pure f <*> x

prop_applicative_monad :: Int -> Result (Fun Int Int) -> Property Source #

Tests the applicative/monad correspondence:

pure = return
(<*>) = ap

prop_monad_laws :: Int -> Result Int -> Fun Int (Result Int) -> Fun Int (Result Int) -> Property Source #

Tests the monad laws:

return a >>= k == k a
m >>= return == m
m >>= (\x -> k x >>= h) == (m >>= k) >>= h

prop_monadplus_mzero :: Result Int -> Fun Int (Result Int) -> Property Source #

Tests the monad plus laws:

mzero >>= f = mzero
v >> mzero = mzero

Orphan instances

Arbitrary a => Arbitrary (Result a) # 
Instance details

Methods

arbitrary :: Gen (Result a)

shrink :: Result a -> [Result a]