ChasingBottoms 1.3.1.2 → 1.3.1.3
raw patch · 14 files changed
+81/−46 lines, 14 filesdep ~QuickCheckdep ~basedep ~mtlPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, base, mtl, syb
API changes (from Hackage documentation)
Files
- ChasingBottoms.cabal +27/−12
- LICENCE +1/−1
- Test/ChasingBottoms.hs +1/−1
- Test/ChasingBottoms/Approx.hs +1/−1
- Test/ChasingBottoms/ApproxShow.hs +1/−1
- Test/ChasingBottoms/ContinuousFunctions.hs +6/−4
- Test/ChasingBottoms/ContinuousFunctions/Tests.hs +30/−17
- Test/ChasingBottoms/IsBottom.hs +1/−1
- Test/ChasingBottoms/IsType.hs +1/−1
- Test/ChasingBottoms/Nat.hs +1/−1
- Test/ChasingBottoms/SemanticOrd.hs +3/−2
- Test/ChasingBottoms/SemanticOrd/Tests.hs +2/−2
- Test/ChasingBottoms/TestUtilities/Generators.hs +5/−1
- Test/ChasingBottoms/TimeOut.hs +1/−1
ChasingBottoms.cabal view
@@ -1,8 +1,8 @@ name: ChasingBottoms-version: 1.3.1.2+version: 1.3.1.3 license: MIT license-file: LICENCE-copyright: Copyright (c) Nils Anders Danielsson 2004-2016.+copyright: Copyright (c) Nils Anders Danielsson 2004-2017. author: Nils Anders Danielsson maintainer: http://www.cse.chalmers.se/~nad/ synopsis: For testing partial and infinite values.@@ -117,7 +117,14 @@ the rest requires @Data.Generics@; @isBottom@ only requires exceptions, though. category: Testing-tested-with: GHC == 8.0.1+tested-with: GHC == 6.12.3,+ GHC == 7.0.4,+ GHC == 7.4.2,+ GHC == 7.6.3,+ GHC == 7.8.4,+ GHC == 7.10.3,+ GHC == 8.0.2,+ GHC == 8.2.1 cabal-version: >= 1.9.2 build-type: Simple @@ -138,33 +145,41 @@ other-modules: Test.ChasingBottoms.IsType - build-depends: QuickCheck >= 2.1 && < 2.10,- mtl >= 1.1 && < 2.3,- base >= 4.0 && < 4.10,+ build-depends: QuickCheck >= 2.3 && < 2.11,+ mtl >= 2 && < 2.3,+ base >= 4.2 && < 4.11, containers >= 0.3 && < 0.6, random >= 1.0 && < 1.2,- syb >= 0.1.0.2 && < 0.7+ syb >= 0.1.0.2 && < 0.8 test-suite ChasingBottomsTestSuite type: exitcode-stdio-1.0 main-is: Test/ChasingBottoms/Tests.hs - other-modules: Test.ChasingBottoms.Approx.Tests,+ other-modules: Test.ChasingBottoms.Approx,+ Test.ChasingBottoms.Approx.Tests,+ Test.ChasingBottoms.ApproxShow, Test.ChasingBottoms.ApproxShow.Tests,+ Test.ChasingBottoms.ContinuousFunctions, Test.ChasingBottoms.ContinuousFunctions.Tests,+ Test.ChasingBottoms.IsBottom, Test.ChasingBottoms.IsBottom.Tests,+ Test.ChasingBottoms.IsType, Test.ChasingBottoms.IsType.Tests,+ Test.ChasingBottoms.Nat, Test.ChasingBottoms.Nat.Tests,+ Test.ChasingBottoms.SemanticOrd, Test.ChasingBottoms.SemanticOrd.Tests, Test.ChasingBottoms.TestUtilities, Test.ChasingBottoms.TestUtilities.Generators,+ Test.ChasingBottoms.TimeOut Test.ChasingBottoms.TimeOut.Tests - build-depends: QuickCheck >= 2.1 && < 2.10,- mtl >= 1.1 && < 2.3,- base >= 4.0 && < 4.10,+ build-depends: QuickCheck >= 2.3 && < 2.11,+ mtl >= 2 && < 2.3,+ base >= 4.2 && < 4.11, containers >= 0.3 && < 0.6, random >= 1.0 && < 1.2,- syb >= 0.1.0.2 && < 0.7,+ syb >= 0.1.0.2 && < 0.8, array >= 0.3 && < 0.6
LICENCE view
@@ -1,7 +1,7 @@ I have chosen to distribute this library under the MIT/Expat licence: --------------------------------------------------------------------- -Copyright (c) 2004-2016 Nils Anders Danielsson+Copyright (c) 2004-2017 Nils Anders Danielsson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
Test/ChasingBottoms.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Test.ChasingBottoms--- Copyright : (c) Nils Anders Danielsson 2004-2016+-- Copyright : (c) Nils Anders Danielsson 2004-2017 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/Approx.hs view
@@ -3,7 +3,7 @@ -- | -- Module : Test.ChasingBottoms.Approx--- Copyright : (c) Nils Anders Danielsson 2004-2016+-- Copyright : (c) Nils Anders Danielsson 2004-2017 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/ApproxShow.hs view
@@ -3,7 +3,7 @@ -- | -- Module : Test.ChasingBottoms.ApproxShow--- Copyright : (c) Nils Anders Danielsson 2004-2016+-- Copyright : (c) Nils Anders Danielsson 2004-2017 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/ContinuousFunctions.hs view
@@ -12,7 +12,7 @@ -- | -- Module : Test.ChasingBottoms.ContinuousFunctions--- Copyright : (c) Nils Anders Danielsson 2005-2016+-- Copyright : (c) Nils Anders Danielsson 2005-2017 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/@@ -149,6 +149,9 @@ #if MIN_VERSION_QuickCheck(2,7,0) , infiniteListOf #endif+#if MIN_VERSION_QuickCheck(2,10,0)+ , function+#endif ) #if MIN_VERSION_QuickCheck(2,7,0) import Test.QuickCheck.Gen.Unsafe (promote)@@ -193,9 +196,8 @@ -- | 'PatternMatch' packages up the possible outcomes of a pattern -- match in a style suitable for generating functions. A pattern match -- is a generator ('Gen') transformer based on the top-level--- constructor, and a sequence (see--- <http://www.soi.city.ac.uk/~ross/software/html/Data.Sequence.html>) of--- 'PatternMatch'es based on the children of that constructor.+-- constructor, and a sequence of 'PatternMatch'es based on the+-- children of that constructor. data PatternMatch = PatternMatch { apply :: GenTransformer
Test/ChasingBottoms/ContinuousFunctions/Tests.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable #-}+{-# LANGUAGE CPP, DeriveDataTypeable, MonoLocalBinds, NamedFieldPuns,+ ScopedTypeVariables #-} -- TODO: Tests passed even though for finiteTreeOf and finiteListOf -- transform was only applied once at the top-level!@@ -73,34 +74,45 @@ -- -- How do we test these properties? +type DistributionTest = Int -> [(String, Double)] -> (Bool, String)++testDistribution :: Testable a => DistributionTest -> a -> IO Bool testDistribution test t = do result <- run t let (ok, msg) = apply test result unless ok $ putStrLn msg return ok where- apply test Success{labels = labels} = test labels- apply _ _ = (False, "Test failed.")+#if MIN_VERSION_QuickCheck(2,10,0)+ convert _ labels = labels+#else+ convert numTests labels =+ map (\(x, f) -> (x, fromIntegral f / fromIntegral numTests)) labels+#endif -spread labels = (uniqueShare >= 3%4, "uniqueShare: " ++ show uniqueShare)+ apply test Success{numTests, labels} = test numTests+ (convert numTests labels)+ apply _ _ = (False, "Test failed.")++spread :: DistributionTest+spread numTests labels =+ (uniqueShare >= 3%4, "uniqueShare: " ++ show uniqueShare) where noUniqueArgs = length labels- noArgs = sum $ map snd labels- uniqueShare = noUniqueArgs % noArgs+ uniqueShare = noUniqueArgs % numTests -len max avg short labels =- ( maxLen >= max && averageLen >= avg && shortShare >= 1%10+len :: Integer -> Double -> Integer -> DistributionTest+len max avg short numTests labels =+ ( maxLen >= max && averageLen >= avg && shortShare >= 0.1 , "maxLen: " ++ show maxLen ++ ", averageLen: " ++ show averageLen ++ ", shortShare: " ++ show shortShare ) where- lengths = map (read *** toInteger) labels :: [(Integer, Integer)]- noArgs = sum (map snd lengths)- maxLen = maximum $ map fst lengths- averageLen = sum (map (uncurry (*)) lengths) % noArgs- noShortLists = sum . map snd . filter ((<= short) . fst) $ lengths- shortShare = noShortLists % noArgs+ lengths = map (read *** id) labels :: [(Integer, Double)]+ maxLen = maximum $ map fst lengths+ averageLen = sum $ map (\(n, f) -> fromInteger n * f) lengths+ shortShare = sum . map snd . filter ((<= short) . fst) $ lengths -- | We want to make sure that we can generate many different kinds of -- lazy functions.@@ -184,9 +196,10 @@ theIOTests = [] -- Disabled, because occasionally one or more of the tests failed,- -- and (at the time of writing in 2015) I have no interest in- -- fixing test suite bugs in old, unfinished and experimental- -- code. Known problems:+ -- and (at the time of writing in 2015 and 2017) I have no+ -- interest in fixing test suite bugs in old, unfinished and+ -- experimental code. Known problems (in code that has later been+ -- changed due to changes to QuickCheck): -- * Division by zero, presumably because noArgs is 0. -- * After reducing maxSuccess from 1000 to 100 I once observed -- that "averageLen" was 199 % 100, but if I am not mistaken the
Test/ChasingBottoms/IsBottom.hs view
@@ -5,7 +5,7 @@ -- | -- Module : Test.ChasingBottoms.IsBottom--- Copyright : (c) Nils Anders Danielsson 2004-2016+-- Copyright : (c) Nils Anders Danielsson 2004-2017 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/IsType.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Test.ChasingBottoms.IsType--- Copyright : (c) Nils Anders Danielsson 2004-2016+-- Copyright : (c) Nils Anders Danielsson 2004-2017 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/Nat.hs view
@@ -2,7 +2,7 @@ -- | -- Module : Test.ChasingBottoms.Nat--- Copyright : (c) Nils Anders Danielsson 2004-2016+-- Copyright : (c) Nils Anders Danielsson 2004-2017 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/SemanticOrd.hs view
@@ -1,9 +1,10 @@ {-# LANGUAGE ScopedTypeVariables, RankNTypes,- FlexibleInstances, UndecidableInstances #-}+ FlexibleInstances, UndecidableInstances,+ MonoLocalBinds #-} -- | -- Module : Test.ChasingBottoms.SemanticOrd--- Copyright : (c) Nils Anders Danielsson 2004-2016+-- Copyright : (c) Nils Anders Danielsson 2004-2017 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/SemanticOrd/Tests.hs view
@@ -7,7 +7,7 @@ import Test.ChasingBottoms.SemanticOrd import Test.ChasingBottoms.TestUtilities-import Test.ChasingBottoms.TestUtilities.Generators hiding (tests)+import Test.ChasingBottoms.TestUtilities.Generators as G hiding (tests) import Test.QuickCheck import Data.Generics import Control.Monad@@ -23,7 +23,7 @@ -> [Property] prop_SemanticEq_congruence element notEqualTo coGen = isCongruence element return notEqualTo (==!) (/=!)- (function coGen integer) (==!)+ (G.function coGen integer) (==!) prop_SemanticOrd_partial_order :: (Data a, Show a) => Gen a
Test/ChasingBottoms/TestUtilities/Generators.hs view
@@ -48,7 +48,11 @@ import Test.ChasingBottoms.TestUtilities import Test.QuickCheck #if MIN_VERSION_QuickCheck(2,7,0)- hiding (infiniteListOf)+ hiding ( infiniteListOf+#if MIN_VERSION_QuickCheck(2,10,0)+ , function+#endif+ ) #endif #if MIN_VERSION_QuickCheck(2,7,0) import Test.QuickCheck.Gen.Unsafe (promote)
Test/ChasingBottoms/TimeOut.hs view
@@ -2,7 +2,7 @@ -- | -- Module : Test.ChasingBottoms.TimeOut--- Copyright : (c) Nils Anders Danielsson 2004-2016+-- Copyright : (c) Nils Anders Danielsson 2004-2017 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/