[tests] reduce the size of the number generated as this basically block the test suite now
This commit is contained in:
parent
5dab0190ac
commit
6e5ad0c640
@ -20,28 +20,29 @@ serializationVectors =
|
||||
]
|
||||
|
||||
tests = testGroup "number"
|
||||
[ testProperty "num-bits" $ \(Positive i) ->
|
||||
[ testProperty "num-bits" $ \(Int0_2901 i) ->
|
||||
and [ (numBits (2^i-1) == i)
|
||||
, (numBits (2^i) == i+1)
|
||||
, (numBits (2^i + (2^i-1)) == i+1)
|
||||
]
|
||||
, testProperty "num-bits2" $ \(Positive i) ->
|
||||
not (i `testBit` numBits i) && (i `testBit` (numBits i - 1))
|
||||
, testProperty "generate-param" $ \testDRG (Positive bits) ->
|
||||
, testProperty "generate-param" $ \testDRG (Int0_2901 bits) ->
|
||||
let r = withTestDRG testDRG $ generateParams bits (Just SetHighest) False
|
||||
in r >= 0 && numBits r == bits && testBit r (bits-1)
|
||||
, testProperty "generate-param2" $ \testDRG (Positive m1bits) ->
|
||||
, testProperty "generate-param2" $ \testDRG (Int0_2901 m1bits) ->
|
||||
let bits = m1bits + 1 -- make sure minimum is 2
|
||||
r = withTestDRG testDRG $ generateParams bits (Just SetTwoHighest) False
|
||||
in r >= 0 && numBits r == bits && testBit r (bits-1) && testBit r (bits-2)
|
||||
, testProperty "generate-param-odd" $ \testDRG (Positive bits) ->
|
||||
, testProperty "generate-param-odd" $ \testDRG (Int0_2901 bits) ->
|
||||
let r = withTestDRG testDRG $ generateParams bits Nothing True
|
||||
in r >= 0 && odd r
|
||||
, testProperty "generate-range" $ \testDRG (Positive range) ->
|
||||
let r = withTestDRG testDRG $ generateMax range
|
||||
in 0 <= r && r < range
|
||||
, testProperty "generate-prime" $ \testDRG (Positive baseBits) ->
|
||||
let bits = 48 + baseBits -- no point generating lower than 48 bits ..
|
||||
, testProperty "generate-prime" $ \testDRG (Int0_2901 baseBits') ->
|
||||
let baseBits = baseBits' `mod` 800
|
||||
bits = 48 + baseBits -- no point generating lower than 48 bits ..
|
||||
prime = withTestDRG testDRG $ generatePrime bits
|
||||
-- with small base bits numbers, the probability that we "cross" this bit size ness
|
||||
-- to the next is quite high, as the number generated has two highest bit set.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user