implemented tests for pwGenerate

This commit is contained in:
Jonathan Lamothe
2018-12-19 16:45:16 -05:00
parent e08b10a586
commit 7d2dd98320
3 changed files with 152 additions and 3 deletions

View File

@@ -36,7 +36,12 @@ module Password (
-- ** Default Instances
newPWDatabase, newPWData, newPWPolicy, newPWSalt,
-- ** Validations
validatePWDatabase, validatePWData, validatePWPolicy
validatePWDatabase, validatePWData, validatePWPolicy,
-- * Functions
-- ** Password Generator
pwGenerate,
-- ** Password Checkers
pwCountUpper, pwCountLower, pwCountDigits, pwCountSpecial
) where
import Control.Lens (makeLenses, (^.))
@@ -148,4 +153,47 @@ validatePWPolicy x = and
needed = x^.pwUpper + x^.pwLower + x^.pwDigits + special
special = fromMaybe 0 $ x^.pwSpecial
-- | generates a password
pwGenerate
:: String
-- ^ the master password
-> PWData
-- ^ the password parameters
-> Maybe String
-- ^ the resulting password, if possible; @"Nothing"@ if the data is
-- invalid
pwGenerate = undefined
-- | counts lower case characters in a password
pwCountLower
:: String
-- ^ the password
-> Int
-- ^ the count
pwCountLower = undefined
-- | counts digits in a password
pwCountDigits
:: String
-- ^ the password
-> Int
-- ^ the count
pwCountDigits = undefined
-- | counts special characters in a password
pwCountSpecial
:: String
-- ^ the password
-> Int
-- ^ the count
pwCountSpecial = undefined
-- | counts upper case characters in a password
pwCountUpper
:: String
-- ^ the password
-> Int
-- ^ the count
pwCountUpper = undefined
--jl