implemented newPWDatabase

This commit is contained in:
Jonathan Lamothe 2018-12-18 14:41:29 -05:00
parent e28faacc13
commit 970adc221c
3 changed files with 40 additions and 2 deletions

View File

@ -34,7 +34,7 @@ module Password (
-- *** PWPolicy -- *** PWPolicy
pwLength, pwUpper, pwLower, pwDigits, pwSpecial, pwLength, pwUpper, pwLower, pwDigits, pwSpecial,
-- ** Default Instances -- ** Default Instances
newPWData, newPWPolicy, newPWSalt, newPWDatabase, newPWData, newPWPolicy, newPWSalt,
-- * Functions -- * Functions
validatePWPolicy validatePWPolicy
) where ) where
@ -83,6 +83,10 @@ type PWSalt = B.ByteString
makeLenses ''PWPolicy makeLenses ''PWPolicy
makeLenses ''PWData makeLenses ''PWData
-- | default (empty) password database
newPWDatabase :: PWDatabase
newPWDatabase = M.empty
-- | builds a new @'PWData'@ -- | builds a new @'PWData'@
newPWData newPWData
:: RandomGen g :: RandomGen g

View File

@ -27,6 +27,7 @@ import System.Exit (exitFailure)
import Test.HUnit (errors, failures, runTestTT, Test(TestList)) import Test.HUnit (errors, failures, runTestTT, Test(TestList))
import qualified Spec.NewPWData as NewPWData import qualified Spec.NewPWData as NewPWData
import qualified Spec.NewPWDatabase as NewPWDatabase
import qualified Spec.NewPWPolicy as NewPWPolicy import qualified Spec.NewPWPolicy as NewPWPolicy
import qualified Spec.NewPWSalt as NewPWSalt import qualified Spec.NewPWSalt as NewPWSalt
import qualified Spec.ValidatePWPolicy as ValidatePWPolicy import qualified Spec.ValidatePWPolicy as ValidatePWPolicy
@ -37,7 +38,8 @@ main = do
exitFailure exitFailure
tests = TestList tests = TestList
[ NewPWData.tests [ NewPWDatabase.tests
, NewPWData.tests
, NewPWPolicy.tests , NewPWPolicy.tests
, NewPWSalt.tests , NewPWSalt.tests
, ValidatePWPolicy.tests , ValidatePWPolicy.tests

View File

@ -0,0 +1,32 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program. If not, see
<https://www.gnu.org/licenses/>.
-}
module Spec.NewPWDatabase (tests) where
import Test.HUnit (Test (..), (~?=))
import Password
tests = TestLabel "newPWDatabase" $
length newPWDatabase ~?= 0
--jl