module Tests.PassList (tests) where import Tests.Mode () import Distribution.TestSuite.QuickCheck import Passman.Core.PassList import Test.QuickCheck import Control.Applicative import Passman.Core.Internal.Util (strip) tests :: IO [Test] tests = return [ testProperty "prop_entryToEntry" prop_entryToEntry ] infoCond :: String -> Bool infoCond x = (x == strip x) && all (`notElem` "\t\NUL") x instance Arbitrary PassListEntry where arbitrary = do info <- arbitrary `suchThat` infoCond mi <- arbitrary `suchThat` maybe True (>0) mode <- arbitrary return $ PassListEntry info mi mode prop_entryToEntry :: PassListEntry -> Bool prop_entryToEntry x = x == stringToEntry (entryToString x)