Safe Haskell | None |
---|

This module collects the infrastructure used to easily switch between testing ClassLaws with or without partial values. Built around QuickCheck and ChasingBottoms.

- newtype Partial a = Partial {
- unPartial :: a

- class TestablePartial prop where
- propertyPartial :: prop -> Property

- class ArbitraryPartial a where
- arbitraryPartial :: Gen a
- shrinkPartial :: a -> [a]

- showPartial :: String -> (a -> String) -> a -> String
- genPartial :: Int -> Int -> Gen a -> Gen a
- module Test.ChasingBottoms

# Documentation

A modifier to indicate that partial values should be generated (or tested, or both).

Show (Partial Bool) | |

Show (Partial Char) | |

(Enum e, Bounded e, Show (Partial e), Show (Partial b)) => Show (Partial (e -> b)) | |

Show (Partial Int) | |

Show (Partial Ordering) | |

Show (Partial ()) | |

(Show (Partial a), Show (Partial b)) => Show (Partial (a, b)) | |

(Show (Partial a), Show (Partial b), Show (Partial c)) => Show (Partial (a, b, c)) | |

(Bounded a, Enum a, Show (Partial a)) => Show (Partial (Endo a)) | |

(Enum s, Bounded s, Show (Partial a), Show (Partial s)) => Show (Partial (SS s a)) | |

(Enum s, Bounded s, Show (Partial a), Show (Partial s)) => Show (Partial (State s a)) | |

(Show (Partial a), Show (Partial b)) => Show (Partial (Pair a b)) | |

TestablePartial prop => Testable (Partial prop) |

class TestablePartial prop whereSource

Declaring a property for possibly partial values.

propertyPartial :: prop -> PropertySource

TestablePartial Bool | |

TestablePartial Property | |

(ArbitraryPartial a, Show (Partial a), TestablePartial prop) => TestablePartial (a -> prop) |

class ArbitraryPartial a whereSource

We copy the QuickCheck structure to make sure generators of partial values and equality checks handling partial values are used.

arbitraryPartial :: Gen aSource

shrinkPartial :: a -> [a]Source

ArbitraryPartial Bool | |

ArbitraryPartial Char | |

ArbitraryPartial Int | |

ArbitraryPartial Ordering | |

ArbitraryPartial () | |

(Bounded a, Enum a, SemanticOrd a, ArbitraryPartial a) => ArbitraryPartial (Endo a) | |

(Enum e, Bounded e, Eq e, SemanticOrd s, ArbitraryPartial s) => ArbitraryPartial (e -> s) | |

(ArbitraryPartial a, ArbitraryPartial b) => ArbitraryPartial (a, b) | |

(Bounded s, Enum s, Eq s, SemanticOrd s, SemanticOrd a, ArbitraryPartial s, ArbitraryPartial a) => ArbitraryPartial (SS s a) | |

(ArbitraryPartial a, SemanticOrd a, ArbitraryPartial s, SemanticOrd s, Enum s, Bounded s, Eq s) => ArbitraryPartial (State s a) | |

(ArbitraryPartial a, ArbitraryPartial b) => ArbitraryPartial (Pair a b) | |

(ArbitraryPartial a, ArbitraryPartial b, ArbitraryPartial c) => ArbitraryPartial (a, b, c) |

showPartial :: String -> (a -> String) -> a -> StringSource

Helper for showing partial values

genPartial :: Int -> Int -> Gen a -> Gen aSource

Helper for generating partial values: `genPartial ib ia ga`

generates `bottom`

with frequence `ib`

and `ga`

with frequency
`ia`

.

module Test.ChasingBottoms