summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--current-versions.txt62
-rw-r--r--lib/Penny/Brenner/Clear.hs3
-rw-r--r--minimum-versions.txt10
-rw-r--r--penny.cabal36
-rw-r--r--penny.cabal.m44
-rw-r--r--tests/Copper.hs8
-rw-r--r--tests/Copper/Parser.hs66
-rw-r--r--tests/Copper/Render.hs35
-rw-r--r--tests/Lincoln.hs100
-rw-r--r--tests/penny-test.hs47
-rw-r--r--versions.m47
11 files changed, 241 insertions, 137 deletions
diff --git a/current-versions.txt b/current-versions.txt
index 0eb15d7..41512bd 100644
--- a/current-versions.txt
+++ b/current-versions.txt
@@ -1,38 +1,39 @@
This package was tested to work with these dependency
versions and compiler version.
These are the default versions fetched by cabal install.
-Tested as of: 2014-04-16 17:16:55.729949 UTC
-Path to compiler: ghc-7.6.3
-Compiler description: 7.6.3
+Tested as of: 2014-04-16 20:08:02.044754 UTC
+Path to compiler: ghc-7.8.2
+Compiler description: 7.8.2
-/opt/ghc-7.6.3/lib/ghc-7.6.3/package.conf.d:
- Cabal-1.16.0
- array-0.4.0.1
- base-4.6.0.1
+/opt/ghc/7.8.2/lib/ghc-7.8.2/package.conf.d:
+ Cabal-1.18.1.3
+ array-0.5.0.0
+ base-4.7.0.0
bin-package-db-0.0.0.0
- binary-0.5.1.1
- bytestring-0.10.0.2
- containers-0.5.0.0
- deepseq-1.3.0.1
- directory-1.2.0.1
- filepath-1.3.0.1
- (ghc-7.6.3)
- ghc-prim-0.3.0.0
- (haskell2010-1.1.1.0)
- (haskell98-2.0.0.2)
- hoopl-3.9.0.0
- hpc-0.6.0.0
- integer-gmp-0.5.0.0
- old-locale-1.0.0.5
- old-time-1.1.0.1
- pretty-1.1.1.0
- process-1.1.0.2
+ binary-0.7.1.0
rts-1.0
- template-haskell-2.8.0.0
- time-1.4.0.1
- unix-2.6.0.1
+ bytestring-0.10.4.0
+ containers-0.5.5.1
+ deepseq-1.3.0.2
+ directory-1.2.1.0
+ filepath-1.3.0.2
+ (ghc-7.8.2)
+ ghc-prim-0.3.1.0
+ (haskell2010-1.1.2.0)
+ (haskell98-2.0.0.3)
+ hoopl-3.10.0.1
+ hpc-0.6.0.1
+ integer-gmp-0.5.1.0
+ old-locale-1.0.0.6
+ old-time-1.1.0.2
+ pretty-1.1.1.1
+ process-1.2.0.0
+ template-haskell-2.9.0.0
+ time-1.4.2
+ transformers-0.3.0.0
+ unix-2.7.0.1
-/home/massysett/penny/sunlight-10948/db:
+/home/massysett/penny/sunlight-27946/db:
MonadRandom-0.1.13
QuickCheck-2.6
action-permutations-0.0.0.1
@@ -48,7 +49,6 @@ Compiler description: 7.6.3
distributive-0.4.3.1
either-4.1.1
hashable-1.2.1.0
- haskell-lexer-1.0
matchers-0.18.0.0
monad-control-0.3.2.3
mtl-2.1.3.1
@@ -57,9 +57,8 @@ Compiler description: 7.6.3
ofx-0.4.0.2
optparse-applicative-0.8.0.1
parsec-3.1.5
- penny-0.32.0.8
+ penny-0.32.0.10
prednote-0.22.0.2
- pretty-show-1.6.7
rainbow-0.14.0.0
rainbox-0.4.0.2
random-1.0.1.1
@@ -75,7 +74,6 @@ Compiler description: 7.6.3
tasty-quickcheck-0.8
terminfo-0.4.0.0
text-1.1.0.1
- transformers-0.3.0.0
transformers-base-0.4.1
transformers-compat-0.1.1.1
unbounded-delays-0.1.0.7
diff --git a/lib/Penny/Brenner/Clear.hs b/lib/Penny/Brenner/Clear.hs
index a822f3c..a51aaf1 100644
--- a/lib/Penny/Brenner/Clear.hs
+++ b/lib/Penny/Brenner/Clear.hs
@@ -17,7 +17,6 @@ import qualified Control.Monad.Trans.Maybe as MT
import Control.Monad.Trans.Class (lift)
import qualified Penny.Copper as C
import qualified Penny.Copper.Render as R
-import Text.Show.Pretty (ppShow)
import qualified Penny.Brenner.Types as Y
import qualified Penny.Brenner.Util as U
@@ -94,7 +93,7 @@ runClear c os = do
led'' = map C.stripMeta led'
when (not (Set.null left))
(fail $ "some postings were not cleared. "
- ++ "Those not cleared:\n" ++ ppShow left)
+ ++ "Those not cleared:\n" ++ show left)
case mapM (R.item Nothing) led'' of
Nothing ->
fail "could not render resulting ledger."
diff --git a/minimum-versions.txt b/minimum-versions.txt
index e2658a2..620b438 100644
--- a/minimum-versions.txt
+++ b/minimum-versions.txt
@@ -1,7 +1,7 @@
This package was tested to work with these dependency
versions and compiler version.
These are the minimum versions given in the .cabal file.
-Tested as of: 2014-04-16 17:16:55.729949 UTC
+Tested as of: 2014-04-16 20:08:02.044754 UTC
Path to compiler: ghc-7.4.1
Compiler description: 7.4.1
@@ -33,7 +33,7 @@ Compiler description: 7.4.1
time-1.4
unix-2.5.1.0
-/home/massysett/penny/sunlight-10948/db:
+/home/massysett/penny/sunlight-27946/db:
MonadRandom-0.1.13
QuickCheck-2.6
action-permutations-0.0.0.0
@@ -45,7 +45,6 @@ Compiler description: 7.4.1
comonad-3.1
contravariant-0.2.0.1
either-3.4.1
- haskell-lexer-1.0
matchers-0.18.0.0
mtl-2.1.3.1
multiarg-0.24.0.4
@@ -53,9 +52,8 @@ Compiler description: 7.4.1
ofx-0.4.0.2
optparse-applicative-0.8.0.1
parsec-3.1.3
- penny-0.32.0.8
+ penny-0.32.0.10
prednote-0.22.0.2
- pretty-show-1.5
rainbow-0.14.0.0
rainbox-0.4.0.2
random-1.0.0.0
@@ -67,7 +65,7 @@ Compiler description: 7.4.1
split-0.2.2
stm-2.4.3
tagged-0.7.1
- tasty-0.8.0.4
+ tasty-0.8
tasty-quickcheck-0.8
terminfo-0.4.0.0
text-0.11.3.1
diff --git a/penny.cabal b/penny.cabal
index 51d3598..55c3c8c 100644
--- a/penny.cabal
+++ b/penny.cabal
@@ -3,7 +3,7 @@
-- penny.cabal for you.
Name: penny
-Version: 0.32.0.8
+Version: 0.32.0.10
Cabal-version: >=1.14
Build-Type: Simple
License: BSD3
@@ -49,7 +49,7 @@ source-repository head
Library
Build-depends:
- base >= 4.5.0.0 && < 4.7
+ base >= 4.5.0.0 && < 4.8
-- Do not try to put comments on same line as data; Cabal does
-- not allow this.
@@ -80,7 +80,6 @@ Library
, cereal >= 0.3.5.2 && < 0.5
, contravariant >= 0.2.0.1 && < 0.5
, either >= 3.4.1 && < 4.2
- , pretty-show >= 1.5 && < 1.7
, semigroups >= 0.9.2 && < 0.14
Exposed-modules:
@@ -189,15 +188,16 @@ Test-Suite penny-test
-- http://stackoverflow.com/questions/6711151
build-depends:
- penny == 0.32.0.8
- , base >= 4.5.0.0 && < 4.7
+ penny == 0.32.0.10
+ , base >= 4.5.0.0 && < 4.8
-- Packages I maintain
- , multiarg >= 0.24.0.4 && < 0.27.0.0
, anonymous-sums >= 0.4.0.0 && < 0.5
-- Other packages
, QuickCheck >= 2.6 && < 2.7
+ , tasty >= 0.8 && < 0.9
+ , tasty-quickcheck >= 0.8 && < 0.9
, random-shuffle == 0.0.4
, parsec >= 3.1.3 && < 3.2
, semigroups >= 0.9.2 && < 0.14
@@ -217,8 +217,8 @@ Executable penny-gibberish
if flag(build-gibberish)
build-depends:
- penny == 0.32.0.8
- , base >= 4.5.0.0 && < 4.7
+ penny == 0.32.0.10
+ , base >= 4.5.0.0 && < 4.8
-- Packages I maintain
, multiarg >= 0.24.0.4 && < 0.27.0.0
@@ -243,8 +243,8 @@ Flag build-gibberish
Executable penny
Build-depends:
- penny ==0.32.0.8
- , base >= 4.5.0.0 && < 4.7
+ penny ==0.32.0.10
+ , base >= 4.5.0.0 && < 4.8
hs-source-dirs: bin
Main-is: penny-main.hs
@@ -263,8 +263,8 @@ Flag build-penny
Executable penny-selloff
Build-depends:
- penny == 0.32.0.8
- , base >= 4.5.0.0 && < 4.7
+ penny == 0.32.0.10
+ , base >= 4.5.0.0 && < 4.8
other-modules: Paths_penny
hs-source-dirs: bin
@@ -283,8 +283,8 @@ Flag build-selloff
Executable penny-diff
Build-depends:
- penny == 0.32.0.8
- , base >= 4.5.0.0 && < 4.7
+ penny == 0.32.0.10
+ , base >= 4.5.0.0 && < 4.8
hs-source-dirs: bin
Main-is: penny-diff.hs
@@ -303,8 +303,8 @@ Flag build-diff
Executable penny-reprint
Build-depends:
- penny == 0.32.0.8
- , base >= 4.5.0.0 && < 4.7
+ penny == 0.32.0.10
+ , base >= 4.5.0.0 && < 4.8
hs-source-dirs: bin
main-is: penny-reprint.hs
@@ -320,8 +320,8 @@ Flag build-reprint
Executable penny-reconcile
Build-depends:
- penny == 0.32.0.8
- , base >= 4.5.0.0 && < 4.7
+ penny == 0.32.0.10
+ , base >= 4.5.0.0 && < 4.8
hs-source-dirs: bin
main-is: penny-reconcile.hs
diff --git a/penny.cabal.m4 b/penny.cabal.m4
index acd9461..1704bdf 100644
--- a/penny.cabal.m4
+++ b/penny.cabal.m4
@@ -80,7 +80,6 @@ Library
, cereal >= pv_cereal && < pv_cereal_max
, contravariant >= pv_contravariant && < pv_contravariant_max
, either >= pv_either && < pv_either_max
- , pretty-show >= pv_pretty_show && < pv_pretty_show_max
, semigroups >= pv_semigroups && < pv_semigroups_max
Exposed-modules:
@@ -193,11 +192,12 @@ Test-Suite penny-test
, base >= pv_base && < pv_base_max
-- Packages I maintain
- , multiarg >= pv_multiarg && < pv_multiarg_max
, anonymous-sums >= pv_anonymous_sums && < pv_anonymous_sums_max
-- Other packages
, QuickCheck >= pv_QuickCheck && < pv_QuickCheck_max
+ , tasty >= pv_tasty && < pv_tasty_max
+ , tasty-quickcheck >= pv_tasty_quickcheck && < pv_tasty_quickcheck_max
, random-shuffle == pv_random_shuffle
, parsec >= pv_parsec && < pv_parsec_max
, semigroups >= pv_semigroups && < pv_semigroups_max
diff --git a/tests/Copper.hs b/tests/Copper.hs
index 892a133..8ce67ed 100644
--- a/tests/Copper.hs
+++ b/tests/Copper.hs
@@ -2,7 +2,9 @@ module Copper where
import qualified Copper.Parser as P
import qualified Copper.Render as R
-import qualified Test.QuickCheck as Q
+import Test.Tasty (testGroup, TestTree)
+
+testTree :: TestTree
+testTree = testGroup "Copper"
+ [ P.testTree, R.testTree ]
-tests :: [(Q.Property -> IO Q.Result) -> IO Bool]
-tests = [P.runTests, R.runTests]
diff --git a/tests/Copper/Parser.hs b/tests/Copper/Parser.hs
index c16b11b..7ad846c 100644
--- a/tests/Copper/Parser.hs
+++ b/tests/Copper/Parser.hs
@@ -1,5 +1,4 @@
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
-{-# LANGUAGE TemplateHaskell #-}
module Copper.Parser where
import Control.Applicative ((<*))
@@ -9,12 +8,13 @@ import qualified Penny.Copper as C
import qualified Penny.Lincoln as L
import Penny.Lincoln ((==~))
import qualified Test.QuickCheck as Q
-import qualified Test.QuickCheck.All as A
import qualified Test.QuickCheck.Property as QCP
import Test.QuickCheck (Gen)
import qualified Text.Parsec as P
import qualified Text.Parsec.Text as P
import qualified Data.Text as X
+import Test.Tasty.QuickCheck (testProperty)
+import Test.Tasty (testGroup, TestTree)
parseProp
:: (Eq b, Show b)
@@ -300,6 +300,62 @@ prop_transaction = do
&& (fmap fst es' ==~ es)
return $ doParse' CP.transaction (show (tlc, es)) pd x
-runTests :: (Q.Property -> IO Q.Result) -> IO Bool
-runTests = $(A.forAllProperties)
-
+testTree :: TestTree
+testTree = testGroup "Parser"
+ [ testProperty "prop_lvl1SubAcct" prop_lvl1SubAcct
+ , testProperty "prop_lvl1FirstSubAcct" prop_lvl1FirstSubAcct
+ , testProperty "prop_lvl1OtherSubAcct" prop_lvl1OtherSubAcct
+ , testProperty "prop_lvl1Acct" prop_lvl1Acct
+ , testProperty "prop_quotedLvl1Acct" prop_quotedLvl1Acct
+ , testProperty "prop_lvl2FirstSubAcct" prop_lvl2FirstSubAcct
+ , testProperty "prop_lvl2OtherSubAcct" prop_lvl2OtherSubAcct
+ , testProperty "prop_lvl2Acct" prop_lvl2Acct
+ , testProperty "prop_ledgerAcct" prop_ledgerAcct
+ , testProperty "prop_lvl1Cmdty" prop_lvl1Cmdty
+ , testProperty "prop_quotedLvl1Cmdty" prop_quotedLvl1Cmdty
+ , testProperty "prop_lvl2Cmdty" prop_lvl2Cmdty
+ , testProperty "prop_lvl3Cmdty" prop_lvl3Cmdty
+ , testProperty "prop_qtyRep" prop_qtyRep
+ , testProperty "prop_leftCmdtyLvl1Amt" prop_leftCmdtyLvl1Amt
+ , testProperty "prop_leftCmdtyLvl3Amt" prop_leftCmdtyLvl3Amt
+ , testProperty "prop_leftSideCmdtyAmt" prop_leftSideCmdtyAmt
+ , testProperty "prop_rightSideCmdtyAmt" prop_rightSideCmdtyAmt
+ , testProperty "prop_amount" prop_amount
+ , testProperty "prop_comment" prop_comment
+ , testProperty "prop_year" prop_year
+ , testProperty "prop_month" prop_month
+ , testProperty "prop_day" prop_day
+ , testProperty "prop_date" prop_date
+ , testProperty "prop_hours" prop_hours
+ , testProperty "prop_minutes" prop_minutes
+ , testProperty "prop_seconds" prop_seconds
+ , testProperty "prop_time" prop_time
+ , testProperty "prop_tzNumber" prop_tzNumber
+ , testProperty "prop_timeZone" prop_timeZone
+ , testProperty "prop_timeWithZone" prop_timeWithZone
+ , testProperty "prop_dateTime" prop_dateTime
+ , testProperty "prop_debit" prop_debit
+ , testProperty "prop_credit" prop_credit
+ , testProperty "prop_drCr" prop_drCr
+ , testProperty "prop_entry" prop_entry
+ , testProperty "prop_flag" prop_flag
+ , testProperty "prop_postingMemoLine" prop_postingMemoLine
+ , testProperty "prop_postingMemo" prop_postingMemo
+ , testProperty "prop_transactionMemoLine" prop_transactionMemoLine
+ , testProperty "prop_transactionMemo" prop_transactionMemo
+ , testProperty "prop_number" prop_number
+ , testProperty "prop_lvl1Payee" prop_lvl1Payee
+ , testProperty "prop_quotedLvl1Payee" prop_quotedLvl1Payee
+ , testProperty "prop_lvl2Payee" prop_lvl2Payee
+ , testProperty "prop_fromCmdty" prop_fromCmdty
+ , testProperty "prop_price" prop_price
+ , testProperty "prop_tag" prop_tag
+ , testProperty "prop_tags" prop_tags
+ , testProperty "prop_topLinePayee" prop_topLinePayee
+ , testProperty "prop_topLineFlagNum" prop_topLineFlagNum
+ , testProperty "prop_topLineCore" prop_topLineCore
+ , testProperty "prop_flagNumPayee" prop_flagNumPayee
+ , testProperty "prop_postingAcct" prop_postingAcct
+ , testProperty "prop_posting" prop_posting
+ , testProperty "prop_transaction" prop_transaction
+ ]
diff --git a/tests/Copper/Render.hs b/tests/Copper/Render.hs
index 55db134..f6f1a81 100644
--- a/tests/Copper/Render.hs
+++ b/tests/Copper/Render.hs
@@ -1,6 +1,5 @@
{-# OPTIONS_GHC -fno-warn-missing-signatures
-fno-warn-orphans #-}
-{-# LANGUAGE TemplateHaskell #-}
module Copper.Render where
import Control.Applicative ((<*))
@@ -13,10 +12,11 @@ import Penny.Lincoln ((==~))
import qualified Text.Parsec as Ps
import qualified Text.Parsec.Text as Ps
import qualified Test.QuickCheck as Q
-import qualified Test.QuickCheck.All as A
import qualified Test.QuickCheck.Property as QCP
-import Test.QuickCheck (Gen, arbitrary, Arbitrary)
+import Test.QuickCheck (Gen, arbitrary)
import Data.Text (Text)
+import Test.Tasty.QuickCheck (testProperty)
+import Test.Tasty (testGroup, TestTree)
renParse
:: (Eq a, Show a)
@@ -173,5 +173,30 @@ priceEq (L.PricePoint xdt xpr xsd xsb _)
(L.PricePoint ydt ypr ysd ysb _)
= xdt == ydt && xpr ==~ ypr && xsd == ysd && xsb == ysb
-runTests :: (Q.Property -> IO Q.Result) -> IO Bool
-runTests = $(A.forAllProperties)
+testTree :: TestTree
+testTree = testGroup "Render"
+ [ testProperty "prop_quotedLvl1Acct" prop_quotedLvl1Acct
+ , testProperty "prop_lvl2Acct" prop_lvl2Acct
+ , testProperty "prop_ledgerAcct" prop_ledgerAcct
+ , testProperty "prop_quotedLvl1Cmdty" prop_quotedLvl1Cmdty
+ , testProperty "prop_lvl2Cmdty" prop_lvl2Cmdty
+ , testProperty "prop_lvl3Cmdty" prop_lvl3Cmdty
+ , testProperty "prop_qtyRep" prop_qtyRep
+ , testProperty "prop_amount" prop_amount
+ , testProperty "prop_comment" prop_comment
+ , testProperty "prop_dateTime" prop_dateTime
+ , testProperty "prop_entry" prop_entry
+ , testProperty "prop_flag" prop_flag
+ , testProperty "prop_postingMemoLine" prop_postingMemoLine
+ , testProperty "prop_postingMemo" prop_postingMemo
+ , testProperty "prop_transactionMemoLine" prop_transactionMemoLine
+ , testProperty "prop_transactionMemo" prop_transactionMemo
+ , testProperty "prop_number" prop_number
+ , testProperty "prop_quotedLvl1Payee" prop_quotedLvl1Payee
+ , testProperty "prop_lvl2Payee" prop_lvl2Payee
+ , testProperty "prop_price" prop_price
+ , testProperty "prop_tag" prop_tag
+ , testProperty "prop_tags" prop_tags
+ , testProperty "prop_topLineCore" prop_topLineCore
+ , testProperty "prop_transaction" prop_transaction
+ ]
diff --git a/tests/Lincoln.hs b/tests/Lincoln.hs
index 72cd9f3..a60e7a8 100644
--- a/tests/Lincoln.hs
+++ b/tests/Lincoln.hs
@@ -1,5 +1,5 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
-{-# LANGUAGE TemplateHaskell, GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Lincoln where
@@ -15,7 +15,6 @@ import qualified Data.Time as T
import qualified Test.QuickCheck as Q
import qualified Test.QuickCheck.Gen as QG
import qualified Test.QuickCheck.Property as QCP
-import qualified Test.QuickCheck.All as A
import Test.QuickCheck (Gen, Arbitrary, arbitrary, (==>))
import qualified Penny.Lincoln as L
import Penny.Lincoln.Equivalent ((==~))
@@ -23,6 +22,8 @@ import Data.Text (Text)
import qualified Data.Text as X
import System.Random.Shuffle (shuffle')
import qualified Data.Sums as Su
+import Test.Tasty.QuickCheck (testProperty)
+import Test.Tasty (testGroup, TestTree)
--
-- # Qty
@@ -525,7 +526,7 @@ prop_balEntries
-- | 'views' gives as many views as there were postings
-prop_numViews :: L.Ents m -> Bool
+prop_numViews :: L.Ents Integer -> Bool
prop_numViews t = (length . L.views $ t) == (length . L.unEnts $ t)
newtype NonRestricted a = NonRestricted
@@ -553,11 +554,11 @@ instance Arbitrary a => Arbitrary (L.Ents a) where
, genRestricted ]
-- | Ents always have at least two postings
-prop_twoPostings :: L.Ents a -> Bool
+prop_twoPostings :: L.Ents Integer -> Bool
prop_twoPostings e = length (L.unEnts e) > 1
-- | Ents are always balanced
-prop_balanced :: L.Ents a -> Bool
+prop_balanced :: L.Ents Integer -> Bool
prop_balanced
= (== L.Balanced)
. L.entriesToBalanced
@@ -566,7 +567,7 @@ prop_balanced
. L.unEnts
-- | Ents contain no more than one inferred posting
-prop_inferred :: L.Ents a -> Bool
+prop_inferred :: L.Ents Integer -> Bool
prop_inferred t =
(length . filter id . map L.inferred . L.unEnts $ t)
< 2
@@ -578,7 +579,7 @@ newtype BalQtys = BalQtys { _unBalQtys :: ([L.Qty], [L.Qty]) }
-- the 'Arbitrary' instance of 'NonRestricted' is behaving as it
-- should.
-prop_ents :: NonRestricted a -> Bool
+prop_ents :: NonRestricted Integer -> Bool
prop_ents (NonRestricted ls)
= isJust
. L.ents
@@ -586,7 +587,7 @@ prop_ents (NonRestricted ls)
$ ls
-- | NonRestricted makes ents with two postings
-prop_entsTwoPostings :: NonRestricted a -> Bool
+prop_entsTwoPostings :: NonRestricted Integer -> Bool
prop_entsTwoPostings (NonRestricted ls)
= case L.ents . map (first (fmap Right)) $ ls of
Nothing -> False
@@ -597,9 +598,9 @@ prop_entsTwoPostings (NonRestricted ls)
prop_rEnts
:: L.Commodity
-> L.DrCr
- -> (L.Qty, a)
- -> [(L.Qty, a)]
- -> a
+ -> (L.Qty, Integer)
+ -> [(L.Qty, Integer)]
+ -> Integer
-> Bool
prop_rEnts c dc pr ls mt =
let t = L.rEnts c dc (first Right pr) (map (first Right) ls) mt
@@ -628,7 +629,7 @@ instance Arbitrary a => Arbitrary (NotInferable a) where
arbitrary = NotInferable <$> genNotInferable
-- | 'ents' fails when given non-inferable entries
-prop_entsNonInferable :: Arbitrary a => NotInferable a -> Bool
+prop_entsNonInferable :: NotInferable Integer -> Bool
prop_entsNonInferable (NotInferable ls) =
isNothing . L.ents . map (first (fmap Right)) $ ls
@@ -707,8 +708,21 @@ prop_addBalancesCommutative x y = (x <> y) == (y <> x)
-- | Adding Balances is associative
prop_addBalancesAssociative
- :: L.Balance -> L.Balance -> L.Balance -> Bool
-prop_addBalancesAssociative x y z = (x <> (y <> z)) == ((x <> y) <> z)
+ :: L.Balance -> L.Balance -> L.Balance -> Q.Property
+prop_addBalancesAssociative x y z = Q.printTestCase desc good
+ where
+ lhs = x <> (y <> z)
+ rhs = (x <> y) <> z
+ good = lhs == rhs
+ desc = labeledList [ ("x", show x), ("y", show y),
+ ("z", show z), ("lhs", show lhs),
+ ("rhs", show rhs) ]
+
+labeledList :: [(String, String)] -> String
+labeledList = concat . map f
+ where
+ f (lbl, s) = lbl ++ ": " ++ s ++ "\n"
+
-- | A mempty balance behaves as it should
prop_balMempty :: L.Balance -> Bool
@@ -937,9 +951,57 @@ prop_noEntsNotInferableGroup nib mayMayEnt = do
return . isNothing . L.ents . map (first (fmap Right))
$ esWithInts
---
--- # runTests
---
-runTests :: (Q.Property -> IO Q.Result) -> IO Bool
-runTests = $(A.forAllProperties)
+testTree :: TestTree
+testTree = testGroup "Lincoln"
+ [ testProperty "prop_genMutate" prop_genMutate
+ , testProperty "prop_genEquivalent" prop_genEquivalent
+ , testProperty "prop_significand" prop_significand
+ , testProperty "prop_exponent" prop_exponent
+ , testProperty "prop_newQtySucceeds" prop_newQtySucceeds
+ , testProperty "prop_qtyToRep" prop_qtyToRep
+ , testProperty "prop_genBalQtysTotalX" prop_genBalQtysTotalX
+ , testProperty "prop_genBalQtys" prop_genBalQtys
+ , testProperty "prop_commutative" prop_commutative
+ , testProperty "prop_addSubtract" prop_addSubtract
+ , testProperty "prop_addValid" prop_addValid
+ , testProperty "prop_multValid" prop_multValid
+ , testProperty "prop_genOneValid" prop_genOneValid
+ , testProperty "prop_multIdentity" prop_multIdentity
+ , testProperty "prop_newQtyBadSignificand" prop_newQtyBadSignificand
+ , testProperty "prop_newQtyBadPlaces" prop_newQtyBadPlaces
+ , testProperty "prop_differenceValid" prop_differenceValid
+ , testProperty "prop_allocateValid" prop_allocateValid
+ , testProperty "prop_genNotEquivalent" prop_genNotEquivalent
+ , testProperty "prop_newQty" prop_newQty
+ , testProperty "prop_sumAllocate" prop_sumAllocate
+ , testProperty "prop_numAllocate" prop_numAllocate
+ , testProperty "prop_sumLargestRemainder" prop_sumLargestRemainder
+ , testProperty "prop_genEntries" prop_genEntries
+ , testProperty "prop_balEntries" prop_balEntries
+ , testProperty "prop_numViews" prop_numViews
+ , testProperty "prop_twoPostings" prop_twoPostings
+ , testProperty "prop_balanced" prop_balanced
+ , testProperty "prop_inferred" prop_inferred
+ , testProperty "prop_ents" prop_ents
+ , testProperty "prop_entsTwoPostings" prop_entsTwoPostings
+ , testProperty "prop_rEnts" prop_rEnts
+ , testProperty "prop_entsNonInferable" prop_entsNonInferable
+ , testProperty "prop_price" prop_price
+ , testProperty "prop_newPriceDifferent" prop_newPriceDifferent
+ , testProperty "prop_newPriceSame" prop_newPriceSame
+ , testProperty "prop_addBalancesCommutative" prop_addBalancesCommutative
+ , testProperty "prop_addBalancesAssociative" prop_addBalancesAssociative
+ , testProperty "prop_balMempty" prop_balMempty
+ , testProperty "prop_emptyBalance" prop_emptyBalance
+ , testProperty "prop_entriesSameCommodity" prop_entriesSameCommodity
+ , testProperty "prop_entriesTwoCommodities" prop_entriesTwoCommodities
+ , testProperty "prop_mutateCommodity" prop_mutateCommodity
+ , testProperty "prop_notInferableFromBalanced" prop_notInferableFromBalanced
+ , testProperty "prop_inferableMutatedDrCr" prop_inferableMutatedDrCr
+ , testProperty "prop_inferableMutatedQty" prop_inferableMutatedQty
+ , testProperty "prop_balEntriesBalanced" prop_balEntriesBalanced
+ , testProperty "prop_balEntriesAndInferable" prop_balEntriesAndInferable
+ , testProperty "prop_balEntriesAndNotInferable" prop_balEntriesAndNotInferable
+ , testProperty "prop_noEntsNotInferableGroup" prop_noEntsNotInferableGroup
+ ]
diff --git a/tests/penny-test.hs b/tests/penny-test.hs
index 204a632..0b80d57 100644
--- a/tests/penny-test.hs
+++ b/tests/penny-test.hs
@@ -2,48 +2,11 @@ module Main where
import qualified Lincoln as L
import qualified Copper as C
-import qualified System.Console.MultiArg as MA
-import qualified System.Exit as Exit
-import qualified Test.QuickCheck as Q
+import Test.Tasty (testGroup, TestTree, defaultMain)
-help :: String -> String
-help pn = unlines
- [ "usage: " ++ pn ++ "[options]"
- , "runs all QuickCheck tests for Penny."
- , "Returns 0 if all tests succeeded, non-zero otherwise."
- , "Options:"
- , "--size, -s INT"
- , " Limit QuickCheck size parameter to INT"
- , "--count, -n INT"
- , " Maximum number of successful tests needed"
- ]
-
-options :: [MA.OptSpec (Q.Args -> Q.Args)]
-options =
- [ MA.OptSpec ["size"] "s" . MA.OneArg $ \s -> do
- i <- MA.reader s
- let f a = a { Q.maxSize = i }
- return f
-
- , MA.OptSpec ["count"] "n" . MA.OneArg $ \s -> do
- i <- MA.reader s
- let f a = a { Q.maxSuccess = i }
- return f
- ]
+testTree :: TestTree
+testTree = testGroup "Penny"
+ [ L.testTree, C.testTree ]
main :: IO ()
-main = do
- opts <- MA.simpleHelp help options
- MA.Intersperse
- ( const . Left . MA.ErrorMsg
- $ "this command does not accept positional arguments")
- let args = foldl (flip (.)) id opts Q.stdArgs
- runner = Q.quickCheckWithResult args
- acts = map ($ runner) allTests
- bools <- sequence acts
- if and bools
- then Exit.exitSuccess
- else Exit.exitFailure
-
-allTests :: [(Q.Property -> IO Q.Result) -> IO Bool]
-allTests = [ L.runTests ] ++ C.tests
+main = defaultMain testTree
diff --git a/versions.m4 b/versions.m4
index a2fc3b8..83150b2 100644
--- a/versions.m4
+++ b/versions.m4
@@ -1,10 +1,10 @@
divert(-1)
# Penny version
-define(`pv_penny', `0.32.0.8')
+define(`pv_penny', `0.32.0.10')
# Haskell Platform
-define(`pv_base', `4.5.0.0') define(`pv_base_max', `4.7')
+define(`pv_base', `4.5.0.0') define(`pv_base_max', `4.8')
define(`pv_bytestring', `0.9.2.1') define(`pv_bytestring_max', `0.11')
define(`pv_containers', `0.4.2.1') define(`pv_containers_max', `0.6')
define(`pv_old_locale', `1.0.0.4') define(`pv_old_locale_max', `1.1')
@@ -29,9 +29,10 @@ define(`pv_contravariant', `0.2.0.1') define(`pv_contravariant_max',
define(`pv_action_permutations', `0.0.0.0') define(`pv_action_permutations_max', `0.0.0.2')
define(`pv_cereal', `0.3.5.2') define(`pv_cereal_max', `0.5')
define(`pv_either', `3.4.1') define(`pv_either_max', `4.2')
-define(`pv_pretty_show', `1.5') define(`pv_pretty_show_max', `1.7')
define(`pv_random', `1.0.0.0') define(`pv_random_max', `1.1')
define(`pv_random_shuffle', `0.0.4')
define(`pv_semigroups', `0.9.2') define(`pv_semigroups_max', `0.14')
+define(`pv_tasty', `0.8') define(`pv_tasty_max', `0.9')
+define(`pv_tasty_quickcheck', `0.8') define(`pv_tasty_quickcheck_max', `0.9')
divert(1)dnl