better tests for newSalt
This commit is contained in:
parent
ceb9d77bfd
commit
72d8609674
|
@ -24,12 +24,21 @@ module Spec.NewSalt (tests) where
|
||||||
|
|
||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
import System.Random (mkStdGen)
|
import System.Random (mkStdGen)
|
||||||
import Test.HUnit (Test(..), (~?=))
|
import Test.HUnit (Test(..), assertBool, (~?=))
|
||||||
|
|
||||||
import Password
|
import Password
|
||||||
|
|
||||||
tests = TestLabel "newSalt" $ B.length salt ~?= 256 where
|
tests = TestLabel "newSalt" $ TestList
|
||||||
(salt, _) = newSalt g
|
[ testLength salt
|
||||||
g = mkStdGen 1
|
, testDiff salt salt'
|
||||||
|
] where
|
||||||
|
(salt, g') = newSalt g
|
||||||
|
(salt', _) = newSalt g'
|
||||||
|
g = mkStdGen 1
|
||||||
|
|
||||||
|
testLength x = TestLabel "salt length" $ B.length x ~?= 256
|
||||||
|
|
||||||
|
testDiff x y = TestLabel "different generators" $ TestCase $
|
||||||
|
assertBool "salts match" $ x /= y
|
||||||
|
|
||||||
--jl
|
--jl
|
||||||
|
|
Loading…
Reference in New Issue
Block a user