Copyright | (c) Fumiaki Kinoshita 2019 |
---|---|
License | BSD3 |
Stability | Experimental |
Safe Haskell | None |
Language | Haskell2010 |
Maintainer : Fumiaki Kinoshita fumiexcel@gmail.com
A test framework that allows you to test all related Serialise instances with automatically-generated test cases
Synopsis
- class Typeable a => TestGen a where
- genTestCases :: [a]
- inheritedTests :: Proxy a -> Map TypeRep [Test]
- printTests :: forall a. (TestGen a, Serialise a, Show a) => IO ()
- buildTestGroups :: forall a. (TestGen a, Serialise a) => [(Schema, [(ByteString, a)])]
- class TestGen a => Tested a where
- testCases :: [Test]
- testGroups :: [(Schema, [(ByteString, a)])]
- testCase :: (Show a, Eq a, Serialise a) => Schema -> ByteString -> a -> Test
- allTests :: forall a. (TestGen a, Tested a) => Map TypeRep [Test]
- mergeTests :: Map TypeRep [Test] -> Test
Generating tests
class Typeable a => TestGen a where Source #
A class to provide test values and gather tests for its components. It is recommended to use the generic default methods.
Nothing
genTestCases :: [a] Source #
A list of values that can be used as test cases. It should contain at least one value as long as there is a non-bottom value in the type.
inheritedTests :: Proxy a -> Map TypeRep [Test] Source #
Inherited set of test cases for each type it involves.
genTestCases :: (Generic a, GTestGen (Rep a)) => [a] Source #
A list of values that can be used as test cases. It should contain at least one value as long as there is a non-bottom value in the type.
inheritedTests :: GTestGen (Rep a) => Proxy a -> Map TypeRep [Test] Source #
Inherited set of test cases for each type it involves.
Instances
printTests :: forall a. (TestGen a, Serialise a, Show a) => IO () Source #
Generate test cases and print them to the standard output.
buildTestGroups :: forall a. (TestGen a, Serialise a) => [(Schema, [(ByteString, a)])] Source #
Test cases
class TestGen a => Tested a where Source #
Types with concrete test cases.
/"Doubt is useful, it keeps faith a living thing. After all, you cannot know the strength of your faith until it has been tested."/
List of test cases for the type.
testCases :: (Serialise a, Eq a, Show a) => [Test] Source #
List of test cases for the type.
testGroups :: [(Schema, [(ByteString, a)])] Source #
Instances
Construct a test case.