add newtypes for QuickCheck to avoid LANG=C issues
All properties changed to use them, except for prop_encode_c_decode_c_roundtrip, which already filtered to ascii for other reasons. A few modules had to be split out, because Setup does not build-depend on QuickCheck.
This commit is contained in:
parent
aad4129669
commit
885974be99
17 changed files with 211 additions and 130 deletions
|
@ -18,6 +18,7 @@ import Data.ByteString.UTF8 (fromString)
|
|||
import qualified Data.ByteString as S
|
||||
|
||||
import Utility.Hash
|
||||
import Utility.QuickCheck
|
||||
|
||||
type Secret = S.ByteString
|
||||
type HMACDigest = String
|
||||
|
@ -38,8 +39,8 @@ verify v secret = v == mkVerifiable (verifiableVal v) secret
|
|||
calcDigest :: String -> Secret -> HMACDigest
|
||||
calcDigest v secret = calcMac HmacSha1 secret (fromString v)
|
||||
|
||||
{- for quickcheck -}
|
||||
prop_verifiable_sane :: String -> String -> Bool
|
||||
prop_verifiable_sane a s = verify (mkVerifiable a secret) secret
|
||||
prop_verifiable_sane :: TestableString -> TestableString -> Bool
|
||||
prop_verifiable_sane v ts =
|
||||
verify (mkVerifiable (fromTestableString v) secret) secret
|
||||
where
|
||||
secret = fromString s
|
||||
secret = fromString (fromTestableString ts)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue