winery-1.0.1: Sustainable serialisation library

Copyright(c) Fumiaki Kinoshita 2019
LicenseBSD3
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

Data.Winery.Test

Contents

Description

Maintainer : Fumiaki Kinoshita fumiexcel@gmail.com

A test framework that allows you to test all related Serialise instances with automatically-generated test cases

Synopsis

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.

Minimal complete definition

Nothing

Methods

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
TestGen Bool Source # 
Instance details

Defined in Data.Winery.Test

TestGen Char Source # 
Instance details

Defined in Data.Winery.Test

TestGen Double Source # 
Instance details

Defined in Data.Winery.Test

TestGen Int Source # 
Instance details

Defined in Data.Winery.Test

TestGen () Source # 
Instance details

Defined in Data.Winery.Test

Tested a => TestGen [a] Source # 
Instance details

Defined in Data.Winery.Test

TestGen a => TestGen (Identity a) Source # 
Instance details

Defined in Data.Winery.Test

Tested a => TestGen (Seq a) Source # 
Instance details

Defined in Data.Winery.Test

(Unbox a, Tested a) => TestGen (Vector a) Source # 
Instance details

Defined in Data.Winery.Test

Tested a => TestGen (Vector a) Source # 
Instance details

Defined in Data.Winery.Test

(Tested a, Tested b) => TestGen (Either a b) Source # 
Instance details

Defined in Data.Winery.Test

(Tested a, Tested b) => TestGen (a, b) Source # 
Instance details

Defined in Data.Winery.Test

Methods

genTestCases :: [(a, b)] Source #

inheritedTests :: Proxy (a, b) -> Map TypeRep [Test] Source #

(Hashable k, Tested k, Tested a) => TestGen (HashMap k a) Source # 
Instance details

Defined in Data.Winery.Test

(Tested a, Tested b, Tested c) => TestGen (a, b, c) Source # 
Instance details

Defined in Data.Winery.Test

Methods

genTestCases :: [(a, b, c)] Source #

inheritedTests :: Proxy (a, b, c) -> Map TypeRep [Test] Source #

(Tested a, Tested b, Tested c, Tested d) => TestGen (a, b, c, d) Source # 
Instance details

Defined in Data.Winery.Test

Methods

genTestCases :: [(a, b, c, d)] Source #

inheritedTests :: Proxy (a, b, c, d) -> Map TypeRep [Test] Source #

printTests :: forall a. (TestGen a, Serialise a, Show a) => IO () Source #

Generate test cases and print them to the standard output.

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."/

Methods

testCases :: [Test] Source #

List of test cases for the type.

Instances
Tested Bool Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

Tested Char Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

Tested Double Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

Tested Int Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

Tested () Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

Tested a => Tested [a] Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

Tested a => Tested (Identity a) Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

Tested a => Tested (Seq a) Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

(Unbox a, Tested a) => Tested (Vector a) Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

Tested a => Tested (Vector a) Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

(Tested a, Tested b) => Tested (Either a b) Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

(Tested a, Tested b) => Tested (a, b) Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

(Hashable k, Tested k, Tested a) => Tested (HashMap k a) Source # 
Instance details

Defined in Data.Winery.Test

Methods

testCases :: [Test] Source #

testCase Source #

Arguments

:: (Show a, Eq a, Serialise a) 
=> Schema

the schema

-> ByteString

serialised

-> a

expected

-> Test 

Construct a test case.

Running tests

allTests :: forall a. (TestGen a, Tested a) => Map TypeRep [Test] Source #

Gather all test cases involved in the specified type.

mergeTests :: Map TypeRep [Test] -> Test Source #

Merge multiple tests into one.