-
Notifications
You must be signed in to change notification settings - Fork 5
/
Main.hs
33 lines (30 loc) · 1.43 KB
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified PasswordBasedVectors as Pwd
import Test.Tasty
import Test.Tasty.HUnit
import Test.Tasty.QuickCheck
import Tests
----------------------------------------------------------------------
withQuickCheckDepth :: TestName -> Int -> [TestTree] -> TestTree
withQuickCheckDepth tn depth tests =
localOption (QuickCheckTests depth) (testGroup tn tests)
----------------------------------------------------------------------
main :: IO ()
main = do
defaultMainWithIngredients defaultIngredients $
testGroup "RNCryptor tests" $ [
testCase "Swift-encrypted input can be decrypted" testForeignEncryption
, testGroup "Password-Based Test Vectors" [
testCase "All fields empty or zero" Pwd.allEmptyOrZero
, testCase "One byte" Pwd.oneByte
, testCase "Exactly one block" Pwd.exactlyOneBlock
, testCase "More than one block" Pwd.moreThanOneBlock
, testCase "Multibyte password" Pwd.multibytePassword
, testCase "Longer text and password" Pwd.longerTextAndPassword
]
, withQuickCheckDepth "RNCryptor properties" 100 [
testProperty "encrypt/decrypt roundtrip" testEncryptDecryptRoundtrip
, testProperty "encrypt/decrypt streaming roundtrip" testStreamingEncryptDecryptRoundtrip
]
]