mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-01 13:52:12 +03:00
Switch to quickcheck-simple.
This commit is contained in:
parent
4d47f53eb7
commit
05e14b2038
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user