mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-28 06:26:18 +03:00
sql-words/test: add commutativity property about (<++>).
This commit is contained in:
parent
626701279c
commit
aa44a82481
@ -1,6 +1,7 @@
|
|||||||
{-# OPTIONS -fno-warn-orphans #-}
|
{-# OPTIONS -fno-warn-orphans #-}
|
||||||
|
|
||||||
import Language.SQL.Keyword (Keyword, DString)
|
import Language.SQL.Keyword
|
||||||
|
(Keyword (Sequence), DString, (<++>))
|
||||||
|
|
||||||
import Data.Monoid (Monoid, mempty, (<>))
|
import Data.Monoid (Monoid, mempty, (<>))
|
||||||
import Data.String (fromString)
|
import Data.String (fromString)
|
||||||
@ -44,6 +45,12 @@ kwAssoc = assoc
|
|||||||
instance Arbitrary Keyword where
|
instance Arbitrary Keyword where
|
||||||
arbitrary = fmap fromString arbitrary
|
arbitrary = fmap fromString arbitrary
|
||||||
|
|
||||||
|
concatCommutative :: DString -> DString -> Bool
|
||||||
|
concatCommutative x y =
|
||||||
|
Sequence x <++> Sequence y
|
||||||
|
==
|
||||||
|
Sequence (x <> y)
|
||||||
|
|
||||||
tests :: [Test]
|
tests :: [Test]
|
||||||
tests = [ prop "DString left Id" dsLeftId
|
tests = [ prop "DString left Id" dsLeftId
|
||||||
, prop "DString right Id" dsRightId
|
, prop "DString right Id" dsRightId
|
||||||
@ -51,6 +58,7 @@ tests = [ prop "DString left Id" dsLeftId
|
|||||||
, prop "Keyword left Id" kwLeftId
|
, prop "Keyword left Id" kwLeftId
|
||||||
, prop "Keyword right Id" kwRightId
|
, prop "Keyword right Id" kwRightId
|
||||||
, prop "Keyword associativity" kwAssoc
|
, prop "Keyword associativity" kwAssoc
|
||||||
|
, prop "concat commutative" concatCommutative
|
||||||
]
|
]
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
|
Loading…
Reference in New Issue
Block a user