mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-12-11 07:00:49 +03:00
Make random value generation work on a slightly larger class of types.
Simplify types when calculating random generators to avoid spurrious failures.
This commit is contained in:
parent
2cface6f31
commit
e0dc226787
@ -14,6 +14,8 @@ module Cryptol.Testing.Random where
|
|||||||
import Cryptol.Eval.Value (BV(..),Value,GenValue(..))
|
import Cryptol.Eval.Value (BV(..),Value,GenValue(..))
|
||||||
import qualified Cryptol.Testing.Concrete as Conc
|
import qualified Cryptol.Testing.Concrete as Conc
|
||||||
import Cryptol.TypeCheck.AST (Type(..),TCon(..),TC(..),tNoUser)
|
import Cryptol.TypeCheck.AST (Type(..),TCon(..),TC(..),tNoUser)
|
||||||
|
import Cryptol.TypeCheck.Solve(simpType)
|
||||||
|
|
||||||
import Cryptol.Utils.Ident (Ident)
|
import Cryptol.Utils.Ident (Ident)
|
||||||
|
|
||||||
import Control.Monad (forM)
|
import Control.Monad (forM)
|
||||||
@ -62,7 +64,7 @@ randomValue :: RandomGen g => Type -> Maybe (Gen g)
|
|||||||
randomValue ty =
|
randomValue ty =
|
||||||
case ty of
|
case ty of
|
||||||
TCon tc ts ->
|
TCon tc ts ->
|
||||||
case (tc, map tNoUser ts) of
|
case (tc, map (simpType . tNoUser) ts) of
|
||||||
(TC TCBit, []) -> Just randomBit
|
(TC TCBit, []) -> Just randomBit
|
||||||
|
|
||||||
(TC TCSeq, [TCon (TC TCInf) [], el]) ->
|
(TC TCSeq, [TCon (TC TCInf) [], el]) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user