forked from gentoo-haskell/gentoo-haskell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev-haskell/saltine: loosen profunctors dep
...and also fix tests. It seems the release tarball was missing a test module, the patch added came directly from the project git history. [An issue][1] has been opened to loosen the profunctors dep. [1]: tel/saltine#57 Signed-off-by: Wolfgang E. Sanyer <[email protected]>
- Loading branch information
1 parent
1d25239
commit 7f3a5d8
Showing
2 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
dev-haskell/saltine/files/saltine-0.1.1.0-missing-test-module.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
diff --git a/tests/HashProperties.hs b/tests/HashProperties.hs | ||
new file mode 100644 | ||
index 0000000..3f37fb4 | ||
--- /dev/null | ||
+++ b/tests/HashProperties.hs | ||
@@ -0,0 +1,37 @@ | ||
+{-# LANGUAGE OverloadedStrings #-} | ||
+ | ||
+module HashProperties ( | ||
+ testHash | ||
+ ) where | ||
+ | ||
+import Util | ||
+import Crypto.Saltine.Core.Hash | ||
+ | ||
+import qualified Data.ByteString as S | ||
+import Test.Framework.Providers.QuickCheck2 | ||
+import Test.Framework | ||
+import Test.QuickCheck | ||
+ | ||
+testHash :: Test | ||
+testHash = buildTest $ do | ||
+ shKey <- newShorthashKey | ||
+ shKey2 <- newShorthashKey | ||
+ | ||
+ return $ testGroup "...Internal.Hash" [ | ||
+ | ||
+ testProperty "No two hashes are alike" | ||
+ $ \(Message bs1, Message bs2) -> bs1 /= bs2 ==> hash bs1 /= hash bs2, | ||
+ | ||
+ testProperty "Hash of empty ByteString is correct" | ||
+ $ \(Message bs) -> (bs == S.empty) ==> hash bs == (read hashEmptyBS :: S.ByteString), | ||
+ | ||
+ testProperty "No two shorthashes are alike" | ||
+ $ \(Message bs1, Message bs2) -> bs1 /= bs2 ==> shorthash shKey bs1 /= shorthash shKey bs2, | ||
+ | ||
+ testProperty "Different keys produce different shorthashes" | ||
+ $ \(Message bs) -> shorthash shKey bs /= shorthash shKey2 bs | ||
+ | ||
+ ] | ||
+ | ||
+ where | ||
+ hashEmptyBS = "\"\207\131\225\&5~\239\184\189\241T(P\214m\128\a\214 \228\ENQ\vW\NAK\220\131\244\169!\211l\233\206G\208\209<]\133\242\176\255\131\CAN\210\135~\236/c\185\&1\189GAz\129\165\&82z\249'\218>\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters