]> git.immae.eu Git - github/fretlink/hmacaroons.git/blobdiff - test/Crypto/Macaroon/Instances.hs
ghc<7.10.1 compat
[github/fretlink/hmacaroons.git] / test / Crypto / Macaroon / Instances.hs
index c82bbd3b5d1822199fbb68f52be8125e36ead49e..019c094c26bcbd8ee09d3c1a9c5a74a0218c8d0f 100644 (file)
@@ -11,9 +11,10 @@ This test suite is based on the pymacaroons test suite:
 -}
 module Crypto.Macaroon.Instances where
 
-import Control.Monad
+import           Control.Applicative
+import           Control.Monad
 import           Data.Byteable
-import qualified Data.ByteString as BS
+import qualified Data.ByteString       as BS
 import qualified Data.ByteString.Char8 as B8
 import           Data.Hex
 import           Data.List
@@ -23,19 +24,6 @@ import           Test.Tasty.QuickCheck
 
 import           Crypto.Macaroon
 
-
--- | Adjust the size parameter, by transforming it with the given
--- function.
--- Copied over from QuickCheck 2.8
-scale :: (Int -> Int) -> Gen a -> Gen a
-scale f g = sized (\n -> resize (f n) g)
-
-
--- | Generates a random subsequence of the given list.
--- Copied over from QuickCheck 2.8
-sublistOf :: [a] -> Gen [a]
-sublistOf = filterM (\_ -> choose (False, True))
-
 newtype Url = Url { unUrl :: BS.ByteString } deriving (Show)
 
 instance Arbitrary Url where
@@ -45,10 +33,10 @@ instance Arbitrary Url where
         domain <- elements [".com",".net"]
         return . Url . B8.pack $ (protocol ++ name ++ domain)
 
-newtype Secret = Secret { unSecret :: BS.ByteString } deriving (Show)
+newtype BSSecret = BSSecret { unSecret :: BS.ByteString } deriving (Show)
 
-instance Arbitrary Secret where
-    arbitrary = Secret . B8.pack <$> scale (*3) arbitrary
+instance Arbitrary BSSecret where
+    arbitrary = BSSecret . B8.pack <$> scale (*3) arbitrary
 
 newtype Identifier = Identifier { unIdent :: BS.ByteString } deriving (Show)