Switch to quickcheck-simple.

This commit is contained in:
Kei Hibino 2015-06-16 08:35:32 +09:00
parent 4d47f53eb7
commit 05e14b2038
2 changed files with 19 additions and 16 deletions

View File

@ -30,13 +30,12 @@ library
test-suite monoids
build-depends: base <5
, Cabal
, cabal-test-compat
, quickcheck-simple
, QuickCheck >=2
, sql-words
type: detailed-0.9
test-module: MonoidLaw
type: exitcode-stdio-1.0
main-is: MonoidLaw.hs
hs-source-dirs: test
ghc-options: -Wall

View File

@ -1,15 +1,16 @@
{-# OPTIONS -fno-warn-orphans #-}
module MonoidLaw (tests) where
import Language.SQL.Keyword (Keyword, DString)
import Data.Monoid (Monoid, mempty, (<>))
import Data.String (fromString)
import Distribution.TestSuite.Compat (TestList, testList, prop)
import Test.QuickCheck (Arbitrary (..))
import Test.QuickCheck (Arbitrary (..), Testable)
import Test.QuickCheck.Simple (Test, qcTest, defaultMain)
prop :: Testable prop => String -> prop -> Test
prop = qcTest
leftId :: (Eq a, Monoid a) => a -> Bool
leftId a = mempty <> a == a
@ -43,11 +44,14 @@ kwAssoc = assoc
instance Arbitrary Keyword where
arbitrary = fmap fromString arbitrary
tests :: TestList
tests = testList [ prop "DString left Id" dsLeftId
, prop "DString right Id" dsRightId
, prop "DString associativity" dsAssoc
, prop "Keyword left Id" kwLeftId
, prop "Keyword right Id" kwRightId
, prop "Keyword associativity" kwAssoc
]
tests :: [Test]
tests = [ prop "DString left Id" dsLeftId
, prop "DString right Id" dsRightId
, prop "DString associativity" dsAssoc
, prop "Keyword left Id" kwLeftId
, prop "Keyword right Id" kwRightId
, prop "Keyword associativity" kwAssoc
]
main :: IO ()
main = defaultMain tests