diff options
Diffstat (limited to 'tests/suite.hs')
-rw-r--r-- | tests/suite.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/suite.hs b/tests/suite.hs index 45a2fb2..a843664 100644 --- a/tests/suite.hs +++ b/tests/suite.hs | |||
@@ -3,7 +3,7 @@ import Test.Framework.Providers.HUnit | |||
3 | 3 | ||
4 | import Test.HUnit | 4 | import Test.HUnit |
5 | 5 | ||
6 | import Codec.Encryption.OpenPGP.ASCIIArmor (armor, decode) | 6 | import Codec.Encryption.OpenPGP.ASCIIArmor (encode, decode) |
7 | import Codec.Encryption.OpenPGP.ASCIIArmor.Types | 7 | import Codec.Encryption.OpenPGP.ASCIIArmor.Types |
8 | 8 | ||
9 | import Data.ByteString (ByteString) | 9 | import Data.ByteString (ByteString) |
@@ -25,11 +25,11 @@ testArmorDecode fp targets = do | |||
25 | where | 25 | where |
26 | getPayload (Armor _ _ pl) = pl | 26 | getPayload (Armor _ _ pl) = pl |
27 | 27 | ||
28 | testArmorEncode :: FilePath -> FilePath -> Assertion | 28 | testArmorEncode :: [FilePath] -> FilePath -> Assertion |
29 | testArmorEncode fp target = do | 29 | testArmorEncode fps target = do |
30 | bs <- B.readFile $ "tests/data/" ++ fp | 30 | bss <- mapM (\fp -> B.readFile $ "tests/data/" ++ fp) fps |
31 | tbs <- B.readFile $ "tests/data/" ++ target | 31 | tbs <- B.readFile $ "tests/data/" ++ target |
32 | assertEqual ("literaldata") (armor (Armor ArmorMessage [("Version","OpenPrivacy 0.99")] bs)) tbs | 32 | assertEqual ("literaldata") (encode (map (\bs -> Armor ArmorMessage [("Version","OpenPrivacy 0.99")] bs) bss)) tbs |
33 | 33 | ||
34 | tests = [ | 34 | tests = [ |
35 | testGroup "CRC24" [ | 35 | testGroup "CRC24" [ |
@@ -41,7 +41,8 @@ tests = [ | |||
41 | testCase "Decode sample armor" (testArmorDecode "msg1.asc" ["msg1.gpg"]) | 41 | testCase "Decode sample armor" (testArmorDecode "msg1.asc" ["msg1.gpg"]) |
42 | , testCase "Decode sample armor with cruft" (testArmorDecode "msg1a.asc" ["msg1.gpg"]) | 42 | , testCase "Decode sample armor with cruft" (testArmorDecode "msg1a.asc" ["msg1.gpg"]) |
43 | , testCase "Decode multiple sample armors" (testArmorDecode "msg1b.asc" ["msg1.gpg","msg1.gpg","msg1.gpg"]) | 43 | , testCase "Decode multiple sample armors" (testArmorDecode "msg1b.asc" ["msg1.gpg","msg1.gpg","msg1.gpg"]) |
44 | , testCase "Encode sample armor" (testArmorEncode "msg1.gpg" "msg1.asc") | 44 | , testCase "Encode sample armor" (testArmorEncode ["msg1.gpg"] "msg1.asc") |
45 | , testCase "Encode multiple sample armors" (testArmorEncode ["msg1.gpg","msg1.gpg","msg1.gpg"] "msg1c.asc") | ||
45 | ] | 46 | ] |
46 | ] | 47 | ] |
47 | 48 | ||