[Tests] factorise assertEq
This commit is contained in:
parent
ec57ecc0a0
commit
5d2e2ce999
@ -444,10 +444,6 @@ testBlockCipher kats cipher = testGroup (cipherName cipher)
|
||||
++ testModes cipher
|
||||
)
|
||||
|
||||
assertEq :: ByteString -> ByteString -> Bool
|
||||
assertEq b1 b2 | b1 /= b2 = error ("b1: " ++ show b1 ++ " b2: " ++ show b2)
|
||||
| otherwise = True
|
||||
|
||||
cipherMakeKey :: Cipher cipher => cipher -> ByteString -> Key cipher
|
||||
cipherMakeKey _ bs = Key bs
|
||||
|
||||
|
||||
@ -160,10 +160,6 @@ macIncrementalTests =
|
||||
prop_inc1 _ (MacIncrementalList secret msgs result) =
|
||||
result `assertEq` HMAC.finalize (foldl' HMAC.update (HMAC.initialize secret) msgs)
|
||||
|
||||
assertEq a b
|
||||
| a == b = True
|
||||
| otherwise = False -- error ("expected: " ++ show a ++ " got: " ++ show b)
|
||||
|
||||
tests = testGroup "HMAC"
|
||||
[ testGroup "KATs" macTests
|
||||
, testGroup "properties" macIncrementalTests
|
||||
|
||||
@ -52,3 +52,10 @@ splitB l b =
|
||||
else
|
||||
[ b ]
|
||||
|
||||
assertBytesEq :: ByteString -> ByteString -> Bool
|
||||
assertBytesEq b1 b2 | b1 /= b2 = error ("expected: " ++ show b1 ++ " got: " ++ show b2)
|
||||
| otherwise = True
|
||||
|
||||
assertEq :: (Show a, Eq a) => a -> a -> Bool
|
||||
assertEq b1 b2 | b1 /= b2 = error ("expected: " ++ show b1 ++ " got: " ++ show b2)
|
||||
| otherwise = True
|
||||
|
||||
Loading…
Reference in New Issue
Block a user