[test] add marshalling tests for numbers
This commit is contained in:
parent
4edb580cda
commit
3eda859c8d
@ -2,9 +2,11 @@ module Number (tests) where
|
|||||||
|
|
||||||
import Imports
|
import Imports
|
||||||
|
|
||||||
|
import Data.ByteArray (Bytes)
|
||||||
import Crypto.Number.Basic
|
import Crypto.Number.Basic
|
||||||
import Crypto.Number.Generate
|
import Crypto.Number.Generate
|
||||||
import Crypto.Number.Prime
|
import Crypto.Number.Prime
|
||||||
|
import Crypto.Number.Serialize
|
||||||
import Data.Bits
|
import Data.Bits
|
||||||
|
|
||||||
tests = testGroup "number"
|
tests = testGroup "number"
|
||||||
@ -35,4 +37,6 @@ tests = testGroup "number"
|
|||||||
-- to the next is quite high, as the number generated has two highest bit set.
|
-- to the next is quite high, as the number generated has two highest bit set.
|
||||||
--
|
--
|
||||||
in bits == numBits prime || (if baseBits < 64 then (bits + 1) == numBits prime else False)
|
in bits == numBits prime || (if baseBits < 64 then (bits + 1) == numBits prime else False)
|
||||||
|
, testProperty "marshalling" $ \qaInt ->
|
||||||
|
getQAInteger qaInt == os2ip (i2osp (getQAInteger qaInt) :: Bytes)
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user