-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | SDP QuickCheck support -- -- Arbitrary instances for SDP structures @package sdp-quickcheck @version 0.2 -- | Test.SDP.Arbitrary is service module that provides -- Arbitrary instances for sdp structures. module Test.SDP.Arbitrary -- | SArray# is immutable pseudo-primitive Int-indexed lazy -- boxed array type. -- -- SArray# isn't real Haskell primitive (like GHC.Exts -- types) but for reliability and stability, I made it inaccessible to -- direct work. data SArray# e -- | SBytes# is immutable pseudo-primitive Int-indexed strict -- unboxed array type. -- -- SBytes# isn't real Haskell primitive (like GHC.Exts -- types) but for reliability and stability, I made it inaccessible to -- direct work. data SBytes# e -- | AnyBorder is template, that appends arbitrary bounds to any -- structure. -- -- data AnyBorder (rep :: Type -> Type) i e AnyBorder :: !i -> !i -> !rep e -> AnyBorder (rep :: Type -> Type) i e -- | AnyChunks is list of data chunks. AnyChunks shouldn't contain -- empty chunks, so the AnyChunks constructor is made private (see -- fromChunks and fromChunksM). -- -- data AnyChunks (rep :: Type -> Type) e instance Test.QuickCheck.Arbitrary.Arbitrary SDP.Finite.E instance (Test.QuickCheck.Arbitrary.Arbitrary i, Test.QuickCheck.Arbitrary.Arbitrary i') => Test.QuickCheck.Arbitrary.Arbitrary (i' SDP.Finite.:& i) instance Test.QuickCheck.Arbitrary.Arbitrary e => Test.QuickCheck.Arbitrary.Arbitrary (SDP.Prim.SArray.SArray# e) instance (SDP.Unboxed.Unboxed e, Test.QuickCheck.Arbitrary.Arbitrary e) => Test.QuickCheck.Arbitrary.Arbitrary (SDP.Prim.SBytes.SBytes# e) instance (SDP.Linear.Bordered1 rep GHC.Types.Int e, SDP.Linear.Linear1 rep e, Test.QuickCheck.Arbitrary.Arbitrary e) => Test.QuickCheck.Arbitrary.Arbitrary (SDP.Templates.AnyChunks.AnyChunks rep e) instance (SDP.Index.Index i, SDP.Linear.Bordered1 rep GHC.Types.Int e, Test.QuickCheck.Arbitrary.Arbitrary (rep e)) => Test.QuickCheck.Arbitrary.Arbitrary (SDP.Templates.AnyBorder.AnyBorder rep i e) -- | Test.SDP.Eq provides basic test suite for Eq -- instances. module Test.SDP.Eq -- | TestEq is service type synonym for more comfortable quickCheck using. type TestEq l = l -> l -> l -> Bool -- | eqTest is basic test suite for Eq instances. eqTest :: Eq l => l -> l -> l -> Bool -- | Test.SDP.Estimate provides basic test suite for -- Estimate instances. module Test.SDP.Estimate -- | TestEstimate is service type synonym for more comfortable quickCheck -- using. type TestEstimate e = Int -> e -> e -> Bool -- | estimateTest is basic test suite for Estimate instances. estimateTest :: Bordered b i => Int -> b -> b -> Bool -- | Test.SDP.Gen provides newtypes for QuickCheck. module Test.SDP.Gen -- | Short is newtype of short data structures [0, 100) in QuickCheck -- properties. -- -- Short is the equivalent of the standard Arbitrary definition: -- arbitrary = fromList <$> arbitrary. newtype Short a Short :: a -> Short a -- | Medium is newtype of medium data structures in QuickCheck properties. -- The Arbitrary Medium instance must create a random-sized structure -- from the range [100, 1024). -- -- Medium is useful in testing as a compromise between speed and -- reliability: structures are too short for stress tests, but still -- human readable and enough fast for auto-testing. newtype Medium a Medium :: a -> Medium a -- | Long is newtype of large data structures (>= 1024) in QuickCheck -- properties. Since Large can generate really huge numbers, the maximum -- length is limited by 16384 - [1024, 16384). -- -- Long is primarily intended for benchmarks, although a large range of -- lengths makes them not very convenient for a pure comparison of -- several algorithms (but for this can be used vector[Of] and generate). -- Long works well with Unrolled and ByteList, since only the shortest of -- the allowed structures may fit in one standard chunk (1024 elements). newtype Long a Long :: a -> Long a -- | linearLargeA is version of linearA, which generates -- Large Ints. linearLargeA :: Linear l Int => Int -> Gen l -- | linearA is overloaded vector. linearA :: (Linear l e, Arbitrary e) => Int -> Gen l -- | orderA returns a simple comparator that can be used to test the -- behavior of higher-order functions (for example, when comparing the -- results of takeWhile for different structures). orderA :: Ord e => Gen (e -> e -> Bool) instance GHC.Show.Show a => GHC.Show.Show (Test.SDP.Gen.Short a) instance GHC.Read.Read a => GHC.Read.Read (Test.SDP.Gen.Short a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.SDP.Gen.Short a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.SDP.Gen.Short a) instance GHC.Show.Show a => GHC.Show.Show (Test.SDP.Gen.Medium a) instance GHC.Read.Read a => GHC.Read.Read (Test.SDP.Gen.Medium a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.SDP.Gen.Medium a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.SDP.Gen.Medium a) instance GHC.Show.Show a => GHC.Show.Show (Test.SDP.Gen.Long a) instance GHC.Read.Read a => GHC.Read.Read (Test.SDP.Gen.Long a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.SDP.Gen.Long a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.SDP.Gen.Long a) instance (SDP.Linear.Linear l e, Test.QuickCheck.Arbitrary.Arbitrary e) => Test.QuickCheck.Arbitrary.Arbitrary (Test.SDP.Gen.Long l) instance (SDP.Linear.Linear l e, Test.QuickCheck.Arbitrary.Arbitrary e) => Test.QuickCheck.Arbitrary.Arbitrary (Test.SDP.Gen.Medium l) instance (SDP.Linear.Linear l e, Test.QuickCheck.Arbitrary.Arbitrary e) => Test.QuickCheck.Arbitrary.Arbitrary (Test.SDP.Gen.Short l) -- | Test.SDP.Index provides basic test suite for Index -- class. module Test.SDP.Index -- | TestShape is service type synonym for more comfortable -- quickCheck using. type TestShape s = s -> Bool -- | shapeTest r sh is default Shape test, where -- r is expected rank for this shape type. Note that -- shapeTest also checks rank undefined -- case, to make sure rank is correct. shapeTest :: (Shape s, Eq s, Eq (DimInit s), Eq (DimLast s)) => Int -> s -> Bool -- | TestIndex is service type synonym for more comfortable quickCheck -- using. type TestIndex i = (i, i) -> i -> Bool -- | indexTest is complex test, that includes all other tests. May -- crash with very big numbers (Word64, Integer) because the tested -- functions are limited by size of type Int. In practice, structures of -- such sizes would take more memory than the address space of computers -- can accommodate. indexTest :: Index i => (i, i) -> i -> Bool -- | basicIndexTest checks relations of rank, size and -- sizes. basicIndexTest :: Index i => (i, i) -> i -> Bool -- | inBoundsTest checks relations of inBounds and other -- range functions. inBoundsTest :: Index i => (i, i) -> i -> Bool -- | rangeTest checks relations of inRange, -- isOverflow, isUnderflow and isEmpty. rangeTest :: Index i => (i, i) -> i -> Bool -- | prevTest checks relations of prev and range. prevTest :: Index i => (i, i) -> Bool -- | nextTest checks relations of next and range. nextTest :: Index i => (i, i) -> Bool -- | dumbSizeTest is O(n) (may be very long) test, that checks -- relation of range size and range length. dumbSizeTest :: Index i => (i, i) -> Bool -- | Test.SDP.Indexed provides simple set of test for -- Indexed class. module Test.SDP.Indexed -- | TestIndexed is service type synonym for more comfortable quickCheck -- using. type TestIndexed l i = i -> l -> Bool -- | TestIndexed1 is service type synonym for more comfortable quickCheck -- using. type TestIndexed1 l i e = i -> l e -> Bool -- | TestIndexed2 is service type synonym for more comfortable quickCheck -- using. type TestIndexed2 l i e = i -> l i e -> Bool -- | indexedTest is complex test, that includes all other tests. indexedTest :: (Bordered l i, Indexed l i e, Eq e, Eq l) => i -> l -> Bool -- | basicIndexedTest checks relations of isNull, -- safeElem and inRange. basicIndexedTest :: (Bordered l i, Indexed l i e) => i -> l -> Bool -- | assocIndexedTest checks relations of assoc, -- assocs, (.$), (*$) and (//). assocIndexedTest :: (Bordered l i, Indexed l i e, Eq e, Eq l) => i -> l -> Bool -- | readIndexedTest checks relations of listL, (.!), -- (!) and (!?). readIndexedTest :: (Bordered l i, Indexed l i e, Eq e) => i -> l -> Bool -- | Test.SDP.Linear provides basic test suite for Linear -- class. module Test.SDP.Linear -- | TestLinear is service type synonym for more comfortable -- quickCheck using. type TestLinear l e = Int -> e -> l -> Bool -- | TestLinear1 is service type synonym for more comfortable -- quickCheck using. type TestLinear1 f e = Int -> e -> f e -> Bool -- | TestLinear2 is service type synonym for more comfortable -- quickCheck using. type TestLinear2 f i e = Int -> e -> f i e -> Bool -- | linearTest is complex test, that includes all ther tests. linearTest :: (Linear l e, Eq e, Eq l, Bordered l i) => Int -> e -> l -> Bool -- | deconstructionLinearTest checks relations of isNull, -- head, last, init and tail. deconstructionLinearTest :: (Linear l e, Eq e) => l -> Bool -- | constructionLinearTest checks relations of toHead, -- toLast and fromList. constructionLinearTest :: (Linear l e, Eq l) => e -> l -> Bool -- | basicLinearTest checks relations of isNull, -- lzero, single and fromList. basicLinearTest :: (Linear l e, Eq l) => e -> l -> Bool -- | replicateTest checks rules of replicate. replicateTest :: (Linear l e, Eq l, Bordered l i) => Int -> e -> l -> Bool -- | reverseTest checks rules of reverse, listL and -- listR. reverseTest :: (Linear l e, Eq e) => l -> Bool -- | concatTest checks rules of (++) and concat. concatTest :: (Linear l e, Eq e, Eq l) => l -> Bool -- | Test.SDP.Ord provides basic test suite for Ord -- instances. module Test.SDP.Ord -- | TestOrd is service type synonym for more comfortable quickCheck using. type TestOrd l = l -> l -> l -> Bool -- | ordTest is basic test suite for Ord instances. ordTest :: Ord l => l -> l -> l -> Bool -- | lexicographicOrdTest checks Linear structures for lexicographic -- order. lexicographicOrdTest :: (Linear l e, Ord l, Ord e) => l -> l -> Bool -- | Test.SDP.Set provides basic test quite for Set class. module Test.SDP.Set -- | TestSet is service type synonym for more comfortable quickCheck using. type TestSet s o = o -> s -> s -> Bool -- | TestSet1 is service type synonym for more comfortable quickCheck -- using. type TestSet1 s o = o -> s o -> s o -> Bool -- | setTest is complex test, that includes all other tests. Note -- that setTest requires any (Set s o) => s, not -- necessarily a set (may contain any data). setTest :: (Set s o, Linear s o, Ord s, Ord o) => o -> s -> s -> Bool -- | basicSetTest checks relations of set, (/?\) and -- (\?/). Note that basicSetTest requires any (Set s o) -- => s, not necessarily a set (may contain any data). basicSetTest :: (Set s o, Nullable s, Eq s, Ord o) => s -> Bool -- | insdelSetTest checks rules of insert and delete. -- Note that insdelSetTest requires a set, not any (Set -- s o) => s. insdelSetTest :: (Set s o, Eq s, Ord o) => o -> s -> Bool -- | lookupSetTest checks relations of lookupLT, -- lookupGT, lookupLE and lookupGE. Note that -- lookupSetTest requires a set, not any (Set s o) => -- s. lookupSetTest :: (Set s o, Linear s o, Ord o) => o -> s -> Bool -- | unintSetTest checks the laws of union (\/) and -- intersection (/\). Note that unintSetTest requires any -- (Set s o) => s, not necessarily a set (may contain -- any data). unintSetTest :: (Set s o, Linear s o, Ord o) => s -> s -> Bool -- | diffSetTest checks laws of difference (\\) and symmetric -- difference (\^/). Note that diffSetTest requires a set, not any -- (Set s o) => s diffSetTest :: (Set s o, Linear s o, Ord o) => s -> s -> Bool -- | elemSetTest checks relations of member and -- isSubseqOf. Note that elemSetTest requires any (Set -- s o) => s, not necessarily a set (may contain any data). elemSetTest :: (Set s o, Linear s o, Ord o) => o -> s -> Bool -- | Test.SDP.Sort provides simple test for Sort class. module Test.SDP.Sort -- | sortTest is just sorted . sort synonym. Please note -- that for default definition of Arbitrary generates very short -- structures and this isn't enough for verification (if the length of -- the structure is less than 65, then TimSort uses InsertionSort). sortTest :: (Sort s e, Split s e, Bordered s i, Ord e) => Medium s -> Bool -- | Test.SDP.Split is service module that provides Split -- tests. module Test.SDP.Split -- | TestSplit is service type synonym for more comfortable -- quickCheck using. type TestSplit s = Int -> s -> Bool -- | TestSplit1 is service type synonym for more comfortable -- quickCheck using. type TestSplit1 s e = Int -> s e -> Bool -- | TestSplit2 is service type synonym for more comfortable -- quickCheck using. type TestSplit2 s i e = Int -> s i e -> Bool -- | splitTest f n xs is default Split test, where -- f is arbitrary predicate (e.g. "Test.SDP.Gen.orderA"). splitTest :: (Split s e, Eq e, Eq s, Bordered s i) => (e -> Bool) -> TestSplit s -- | basicSplitTest checks take, drop, sans, -- keep, split and divide correctness and relations. basicSplitTest :: (Split s e, Eq e, Eq s, Bordered s i) => TestSplit s -- | whileSplitTest checks takeWhile, dropWhile, -- takeEnd, dropEnd, spanl, spanr, -- breakl and breakr correctness and relations. whileSplitTest :: (Split s e, Eq e, Eq s, Bordered s i) => (e -> Bool) -> s -> Bool -- | Test.SDP reexports all tests in sdp-quickcheck -- (except Test.SDP.Index) module Test.SDP