summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile8
-rw-r--r--openpgp.cabal1
-rw-r--r--tests/suite.hs5
4 files changed, 10 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 41ece44..1156a3b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
1*.[ao] 1*.[ao]
2*.hi 2*.hi
3*.swp* 3*.swp*
4Data/OpenPGP/Arbitrary.hs
4verify 5verify
5sign 6sign
6keygen 7keygen
diff --git a/Makefile b/Makefile
index 2d9b719..105780e 100644
--- a/Makefile
+++ b/Makefile
@@ -19,9 +19,15 @@ debian: debian/control
19test: tests/suite 19test: tests/suite
20 tests/suite 20 tests/suite
21 21
22tests/suite: tests/suite.hs Data/OpenPGP.hs Data/OpenPGP/Internal.hs 22tests/suite: tests/suite.hs Data/OpenPGP.hs Data/OpenPGP/Internal.hs Data/OpenPGP/Arbitrary.hs
23 ghc --make $(GHCFLAGS) -o $@ $^ 23 ghc --make $(GHCFLAGS) -o $@ $^
24 24
25Data/OpenPGP/Arbitrary.hs: Data/OpenPGP.hs
26 derive -d Arbitrary -m Data.OpenPGP.Arbitrary -iData.OpenPGP -iTest.QuickCheck -iTest.QuickCheck.Instances -iNumeric -iData.Char -iData.Word -o $@ $^
27 -printf ',s/SignaturePacket x1 x2 x3 x4 x5 x6 x7 x8 x9)$$/signaturePacket x1 x2 x3 x4 x5 x6 x7 x8)/g\n/signaturePacket/\n-d\nw\nq\n' | ed $@
28 -printf '/return (IssuerPacket/\n-d\ni\n 4 -> do x1 <- fmap (map toUpper . (`showHex` "")) (arbitrary :: Gen Word64)\n.\nw\nq\n' | ed $@
29 -printf '/return (UnsupportedSignatureSubpacket/\n-d\n.s/x1/105/g\n.s/x2/x1/g\nw\nq\n' | ed $@
30
25report.html: tests/suite.hs Data/OpenPGP.hs Data/OpenPGP/Internal.hs 31report.html: tests/suite.hs Data/OpenPGP.hs Data/OpenPGP/Internal.hs
26 -hlint $(HLINTFLAGS) --report $^ 32 -hlint $(HLINTFLAGS) --report $^
27 33
diff --git a/openpgp.cabal b/openpgp.cabal
index 90cddb4..31ca014 100644
--- a/openpgp.cabal
+++ b/openpgp.cabal
@@ -126,6 +126,7 @@ library
126 126
127 other-modules: 127 other-modules:
128 Data.OpenPGP.Internal 128 Data.OpenPGP.Internal
129 Data.OpenPGP.Arbitrary
129 130
130 build-depends: 131 build-depends:
131 base == 4.*, 132 base == 4.*,
diff --git a/tests/suite.hs b/tests/suite.hs
index 9b5e22e..ede60bb 100644
--- a/tests/suite.hs
+++ b/tests/suite.hs
@@ -2,10 +2,10 @@
2import Test.Framework (defaultMain, testGroup, Test) 2import Test.Framework (defaultMain, testGroup, Test)
3import Test.Framework.Providers.HUnit 3import Test.Framework.Providers.HUnit
4import Test.Framework.Providers.QuickCheck2 4import Test.Framework.Providers.QuickCheck2
5import Test.QuickCheck
6import Test.HUnit hiding (Test) 5import Test.HUnit hiding (Test)
7 6
8import Data.Word 7import Data.Word
8import Data.OpenPGP.Arbitrary ()
9import qualified Data.OpenPGP as OpenPGP 9import qualified Data.OpenPGP as OpenPGP
10import qualified Data.OpenPGP.Internal as OpenPGP 10import qualified Data.OpenPGP.Internal as OpenPGP
11 11
@@ -23,9 +23,6 @@ decode' :: (Binary a) => B.ByteString -> a
23decode' = decode 23decode' = decode
24#endif 24#endif
25 25
26instance Arbitrary OpenPGP.HashAlgorithm where
27 arbitrary = elements [OpenPGP.MD5, OpenPGP.SHA1, OpenPGP.SHA256, OpenPGP.SHA384, OpenPGP.SHA512]
28
29testSerialization :: FilePath -> Assertion 26testSerialization :: FilePath -> Assertion
30testSerialization fp = do 27testSerialization fp = do
31 bs <- B.readFile $ "tests/data/" ++ fp 28 bs <- B.readFile $ "tests/data/" ++ fp