extrapolate 0.4.2 → 0.4.4
raw patch · 12 files changed
+35/−40 lines, 12 filesdep ~expressdep ~leancheckdep ~speculatePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: express, leancheck, speculate
API changes (from Hackage documentation)
+ Test.Extrapolate.Expr: infixr 3 -&&-
- Test.Extrapolate: (+|) :: () => [a] -> [a] -> [a]
+ Test.Extrapolate: (+|) :: [a] -> [a] -> [a]
- Test.Extrapolate: (><) :: () => [[a]] -> [[b]] -> [[(a, b)]]
+ Test.Extrapolate: (><) :: [[a]] -> [[b]] -> [[(a, b)]]
- Test.Extrapolate: (\/) :: () => [[a]] -> [[a]] -> [[a]]
+ Test.Extrapolate: (\/) :: [[a]] -> [[a]] -> [[a]]
- Test.Extrapolate: (\\//) :: () => [[a]] -> [[a]] -> [[a]]
+ Test.Extrapolate: (\\//) :: [[a]] -> [[a]] -> [[a]]
- Test.Extrapolate: addWeight :: () => [[a]] -> Int -> [[a]]
+ Test.Extrapolate: addWeight :: [[a]] -> Int -> [[a]]
- Test.Extrapolate: bagsOf :: () => [[a]] -> [[[a]]]
+ Test.Extrapolate: bagsOf :: [[a]] -> [[[a]]]
- Test.Extrapolate: concatMapT :: () => (a -> [[b]]) -> [[a]] -> [[b]]
+ Test.Extrapolate: concatMapT :: (a -> [[b]]) -> [[a]] -> [[b]]
- Test.Extrapolate: concatT :: () => [[[[a]]]] -> [[a]]
+ Test.Extrapolate: concatT :: [[[[a]]]] -> [[a]]
- Test.Extrapolate: cons0 :: () => a -> [[a]]
+ Test.Extrapolate: cons0 :: a -> [[a]]
- Test.Extrapolate: delay :: () => [[a]] -> [[a]]
+ Test.Extrapolate: delay :: [[a]] -> [[a]]
- Test.Extrapolate: filterT :: () => (a -> Bool) -> [[a]] -> [[a]]
+ Test.Extrapolate: filterT :: (a -> Bool) -> [[a]] -> [[a]]
- Test.Extrapolate: listsOf :: () => [[a]] -> [[[a]]]
+ Test.Extrapolate: listsOf :: [[a]] -> [[[a]]]
- Test.Extrapolate: listsOfLength :: () => Int -> [[a]] -> [[[a]]]
+ Test.Extrapolate: listsOfLength :: Int -> [[a]] -> [[[a]]]
- Test.Extrapolate: mapT :: () => (a -> b) -> [[a]] -> [[b]]
+ Test.Extrapolate: mapT :: (a -> b) -> [[a]] -> [[b]]
- Test.Extrapolate: noDupListsOf :: () => [[a]] -> [[[a]]]
+ Test.Extrapolate: noDupListsOf :: [[a]] -> [[[a]]]
- Test.Extrapolate: normalizeT :: () => [[a]] -> [[a]]
+ Test.Extrapolate: normalizeT :: [[a]] -> [[a]]
- Test.Extrapolate: ofWeight :: () => [[a]] -> Int -> [[a]]
+ Test.Extrapolate: ofWeight :: [[a]] -> Int -> [[a]]
- Test.Extrapolate: product3With :: () => (a -> b -> c -> d) -> [[a]] -> [[b]] -> [[c]] -> [[d]]
+ Test.Extrapolate: product3With :: (a -> b -> c -> d) -> [[a]] -> [[b]] -> [[c]] -> [[d]]
- Test.Extrapolate: productMaybeWith :: () => (a -> b -> Maybe c) -> [[a]] -> [[b]] -> [[c]]
+ Test.Extrapolate: productMaybeWith :: (a -> b -> Maybe c) -> [[a]] -> [[b]] -> [[c]]
- Test.Extrapolate: products :: () => [[[a]]] -> [[[a]]]
+ Test.Extrapolate: products :: [[[a]]] -> [[[a]]]
- Test.Extrapolate: reset :: () => [[a]] -> [[a]]
+ Test.Extrapolate: reset :: [[a]] -> [[a]]
- Test.Extrapolate: setsOf :: () => [[a]] -> [[[a]]]
+ Test.Extrapolate: setsOf :: [[a]] -> [[[a]]]
- Test.Extrapolate: suchThat :: () => [[a]] -> (a -> Bool) -> [[a]]
+ Test.Extrapolate: suchThat :: [[a]] -> (a -> Bool) -> [[a]]
- Test.Extrapolate: toTiers :: () => [a] -> [[a]]
+ Test.Extrapolate: toTiers :: [a] -> [[a]]
- Test.Extrapolate.Core: (+|) :: () => [a] -> [a] -> [a]
+ Test.Extrapolate.Core: (+|) :: [a] -> [a] -> [a]
- Test.Extrapolate.Core: (><) :: () => [[a]] -> [[b]] -> [[(a, b)]]
+ Test.Extrapolate.Core: (><) :: [[a]] -> [[b]] -> [[(a, b)]]
- Test.Extrapolate.Core: (\/) :: () => [[a]] -> [[a]] -> [[a]]
+ Test.Extrapolate.Core: (\/) :: [[a]] -> [[a]] -> [[a]]
- Test.Extrapolate.Core: (\\//) :: () => [[a]] -> [[a]] -> [[a]]
+ Test.Extrapolate.Core: (\\//) :: [[a]] -> [[a]] -> [[a]]
- Test.Extrapolate.Core: addWeight :: () => [[a]] -> Int -> [[a]]
+ Test.Extrapolate.Core: addWeight :: [[a]] -> Int -> [[a]]
- Test.Extrapolate.Core: bagsOf :: () => [[a]] -> [[[a]]]
+ Test.Extrapolate.Core: bagsOf :: [[a]] -> [[[a]]]
- Test.Extrapolate.Core: concatMapT :: () => (a -> [[b]]) -> [[a]] -> [[b]]
+ Test.Extrapolate.Core: concatMapT :: (a -> [[b]]) -> [[a]] -> [[b]]
- Test.Extrapolate.Core: concatT :: () => [[[[a]]]] -> [[a]]
+ Test.Extrapolate.Core: concatT :: [[[[a]]]] -> [[a]]
- Test.Extrapolate.Core: cons0 :: () => a -> [[a]]
+ Test.Extrapolate.Core: cons0 :: a -> [[a]]
- Test.Extrapolate.Core: delay :: () => [[a]] -> [[a]]
+ Test.Extrapolate.Core: delay :: [[a]] -> [[a]]
- Test.Extrapolate.Core: filterT :: () => (a -> Bool) -> [[a]] -> [[a]]
+ Test.Extrapolate.Core: filterT :: (a -> Bool) -> [[a]] -> [[a]]
- Test.Extrapolate.Core: listsOf :: () => [[a]] -> [[[a]]]
+ Test.Extrapolate.Core: listsOf :: [[a]] -> [[[a]]]
- Test.Extrapolate.Core: listsOfLength :: () => Int -> [[a]] -> [[[a]]]
+ Test.Extrapolate.Core: listsOfLength :: Int -> [[a]] -> [[[a]]]
- Test.Extrapolate.Core: mapT :: () => (a -> b) -> [[a]] -> [[b]]
+ Test.Extrapolate.Core: mapT :: (a -> b) -> [[a]] -> [[b]]
- Test.Extrapolate.Core: noDupListsOf :: () => [[a]] -> [[[a]]]
+ Test.Extrapolate.Core: noDupListsOf :: [[a]] -> [[[a]]]
- Test.Extrapolate.Core: normalizeT :: () => [[a]] -> [[a]]
+ Test.Extrapolate.Core: normalizeT :: [[a]] -> [[a]]
- Test.Extrapolate.Core: ofWeight :: () => [[a]] -> Int -> [[a]]
+ Test.Extrapolate.Core: ofWeight :: [[a]] -> Int -> [[a]]
- Test.Extrapolate.Core: product3With :: () => (a -> b -> c -> d) -> [[a]] -> [[b]] -> [[c]] -> [[d]]
+ Test.Extrapolate.Core: product3With :: (a -> b -> c -> d) -> [[a]] -> [[b]] -> [[c]] -> [[d]]
- Test.Extrapolate.Core: productMaybeWith :: () => (a -> b -> Maybe c) -> [[a]] -> [[b]] -> [[c]]
+ Test.Extrapolate.Core: productMaybeWith :: (a -> b -> Maybe c) -> [[a]] -> [[b]] -> [[c]]
- Test.Extrapolate.Core: products :: () => [[[a]]] -> [[[a]]]
+ Test.Extrapolate.Core: products :: [[[a]]] -> [[[a]]]
- Test.Extrapolate.Core: reset :: () => [[a]] -> [[a]]
+ Test.Extrapolate.Core: reset :: [[a]] -> [[a]]
- Test.Extrapolate.Core: setsOf :: () => [[a]] -> [[[a]]]
+ Test.Extrapolate.Core: setsOf :: [[a]] -> [[[a]]]
- Test.Extrapolate.Core: suchThat :: () => [[a]] -> (a -> Bool) -> [[a]]
+ Test.Extrapolate.Core: suchThat :: [[a]] -> (a -> Bool) -> [[a]]
- Test.Extrapolate.Core: toTiers :: () => [a] -> [[a]]
+ Test.Extrapolate.Core: toTiers :: [a] -> [[a]]
- Test.Extrapolate.Speculation: theoryAndReprConds :: Int -> (Expr -> Expr -> Bool) -> [[Expr]] -> (Thy, [Expr])
+ Test.Extrapolate.Speculation: theoryAndReprConds :: (Expr -> Expr -> Bool) -> Int -> [[Expr]] -> (Thy, [Expr])
Files
- .travis.yml +1/−1
- extrapolate.cabal +5/−5
- mk/ghcdeps +2/−1
- mk/haddock-i +1/−1
- mk/haskell.mk +8/−2
- mk/install-on +4/−1
- src/Test/Extrapolate/ConditionalGeneralization.hs +2/−2
- src/Test/Extrapolate/Expr.hs +1/−1
- src/Test/Extrapolate/Speculation.hs +6/−21
- stack.yaml +3/−3
- test/sdist +1/−1
- test/step-by-step.hs +1/−1
.travis.yml view
@@ -34,7 +34,7 @@ - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' - stack config set system-ghc --global true - stack --version-- cabal install leancheck express speculate || cabal install leancheck express speculate --lib+- cabal install leancheck express speculate || cabal v1-install leancheck express speculate script: - make && make test
extrapolate.cabal view
@@ -1,5 +1,5 @@ name: extrapolate-version: 0.4.2+version: 0.4.4 synopsis: generalize counter-examples of test properties description: Extrapolate is a tool able to provide generalized counter-examples of test@@ -84,7 +84,7 @@ source-repository this type: git location: https://github.com/rudymatela/extrapolate- tag: v0.4.2+ tag: v0.4.4 library exposed-modules: Test.Extrapolate@@ -101,10 +101,10 @@ , Test.Extrapolate.Utils other-extensions: TemplateHaskell, CPP build-depends: base >= 4 && < 5- , leancheck >= 0.9.3+ , leancheck >= 0.9.4 , template-haskell- , speculate >= 0.4.2- , express >= 0.1.3+ , speculate >= 0.4.6+ , express >= 0.1.6 hs-source-dirs: src default-language: Haskell2010
mk/ghcdeps view
@@ -2,7 +2,7 @@ # # ghcdeps: generate Haskell make dependencies for compiling with GHC. #-# Copyright (c) 2015-2020 Rudy Matela.+# Copyright (c) 2015-2021 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # From a list of files provided on standard input,@@ -46,4 +46,5 @@ rm -f tmp.mk done | sort |+grep -v "^Loaded package environment from " | sed -e 's, *, \\\n ,g'
mk/haddock-i view
@@ -2,7 +2,7 @@ # # haddock-i: list haddock's -i parameters. #-# Copyright (c) 2015-2020 Rudy Matela.+# Copyright (c) 2015-2021 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # $ haddock-i <package1> <package2> ... <packageN>
mk/haskell.mk view
@@ -1,6 +1,6 @@ # Implicit rules for compiling Haskell code. #-# Copyright (c) 2015-2020 Rudy Matela.+# Copyright (c) 2015-2021 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # You can optionally configure the "Configuration variables" below in your main@@ -80,7 +80,8 @@ # Cleaning rule (add as a clean dependency)-.PHONY: clean-hi-o+clean-hs: clean-hi-o clean-haddock clean-cabal clean-stack+ clean-hi-o: find $(ALL_HSS) | sed -e 's/hs$$/o/' | xargs rm -f find $(ALL_HSS) | sed -e 's/hs$$/hi/' | xargs rm -f@@ -113,6 +114,11 @@ $(HADDOCK_HLNK_SRC) \ $(HADDOCKFLAGS) +clean-cabal:+ rm -rf dist/ dist-newstyle/ cabal.project.local cabal.project.local~++clean-stack:+ rm -rf .stack-work/ stack.yaml.lock # lists all Haskell source files list-all-hss:
mk/install-on view
@@ -2,9 +2,12 @@ # # mk/install-on: install or updates the mk folder on a Haskell project #+# Copyright (c) 2019-2021 Rudy Matela.+# Distributed under the 3-Clause BSD licence.+# # usage: ./mk/install-on path/to/project #-# This assumes a few things:+# This script assumes that: # # * tests are stored in a "test/" folder # * sources are stored in a "src/" folder
src/Test/Extrapolate/ConditionalGeneralization.hs view
@@ -28,7 +28,7 @@ conditionalCounterExampleGeneralizations :: Int -> [[Expr]] -> (Expr -> [Expr]) -> (Expr -> Expr -> Expr) -> Expr -> [Expr]-conditionalCounterExampleGeneralizations maxCondSize atoms grounds (-==-) e =+conditionalCounterExampleGeneralizations maxConditionSize atoms grounds (-==-) e = [ canonicalize $ g -&&- wc | g <- fastCandidateGeneralizations isListable e , let wc = weakestCondition' g@@ -38,7 +38,7 @@ where isListable = not . null . grounds . holeAsTypeOf weakestCondition' = weakestCondition- (theoryAndReprConds maxCondSize (===) atoms)+ (theoryAndReprConds (===) maxConditionSize atoms) grounds e1 === e2 = isTrue grounds $ e1 -==- e2
src/Test/Extrapolate/Expr.hs view
@@ -48,7 +48,7 @@ unand :: Expr -> (Expr,Expr) unand ((op :$ e1) :$ e2) | op == andE = (e1,e2)-unand _ = error "unimply: not an implication"+unand _ = error "unand: not an implication" -- | /O(n)/. -- Replaces the function in the given 'Expr'.
src/Test/Extrapolate/Speculation.hs view
@@ -30,27 +30,12 @@ import Test.Extrapolate.Utils import Test.Extrapolate.Expr --- Generates expression schemas and a theory-theoryAndReprsFromPropAndAtoms :: Int -> (Expr -> Expr -> Bool) -> [[Expr]] -> (Thy,[[Expr]])-theoryAndReprsFromPropAndAtoms maxConditionSize (===) ess =- theoryAndRepresentativesFromAtoms- maxConditionSize compareExpr (const True) (===) ess- where- compareExpr :: Expr -> Expr -> Ordering- compareExpr = compareComplexity <> lexicompareBy cmp- e1 `cmp` e2 | arity e1 == 0 && arity e2 /= 0 = LT- e1 `cmp` e2 | arity e1 /= 0 && arity e2 == 0 = GT- e1 `cmp` e2 = compareIndex (concat ess) e1 e2 <> e1 `compare` e2--- NOTE: "concat ess" may be an infinite list. This function assumes--- that the symbols will appear on the list eventually for termination. If I--- am correct this ivariant is assured by the rest of the code.--theoryAndReprExprs :: Int -> (Expr -> Expr -> Bool) -> [[Expr]] -> (Thy,[Expr])-theoryAndReprExprs maxConditionSize (===) =+theoryAndReprExprs :: (Expr -> Expr -> Bool) -> Int -> [[Expr]] -> (Thy,[Expr])+theoryAndReprExprs (===) maxConditionSize = (\(thy,ess) -> (thy, concat $ take maxConditionSize ess))- . theoryAndReprsFromPropAndAtoms maxConditionSize (===)+ . theoryAndRepresentativesFromAtoms (===) maxConditionSize -theoryAndReprConds :: Int -> (Expr -> Expr -> Bool) -> [[Expr]] -> (Thy, [Expr])-theoryAndReprConds maxConditionSize (===) ess = (thy, filter (\c -> typ c == boolTy) es)+theoryAndReprConds :: (Expr -> Expr -> Bool) -> Int -> [[Expr]] -> (Thy, [Expr])+theoryAndReprConds (===) maxConditionSize ess = (thy, filter (\c -> typ c == boolTy) es) where- (thy,es) = theoryAndReprExprs maxConditionSize (===) ess+ (thy,es) = theoryAndReprExprs (===) maxConditionSize ess
stack.yaml view
@@ -4,6 +4,6 @@ - . extra-deps:-- leancheck-0.9.3-- speculate-0.4.2-- express-0.1.3+- leancheck-0.9.4+- speculate-0.4.6+- express-0.1.6
test/sdist view
@@ -2,7 +2,7 @@ # # test/sdist: tests the package generated by "cabal sdist". #-# Copyright (c) 2015-2020 Rudy Matela.+# Copyright (c) 2015-2021 Rudy Matela. # Distributed under the 3-Clause BSD licence. set -xe
test/step-by-step.hs view
@@ -115,7 +115,7 @@ ] thyes :: (Thy,[Expr])-thyes = theoryAndReprConds (testableMaxConditionSize prop) (===) (testableAtoms prop)+thyes = theoryAndReprConds (===) (testableMaxConditionSize prop) (testableAtoms prop) where e1 === e2 = isTrue grounds $ e1 -==- e2 grounds = testableGrounds prop