cryptol-2.2.6: Cryptol: The Language of Cryptography

Copyright | (c) 2013-2015 Galois, Inc.
License | BSD3
Maintainer | cryptol@galois.com
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Cryptol.Testing.Exhaust

Description

Synopsis

- testableType :: Type -> Maybe (Integer, [[Value]])
- runOneTest :: Value -> [Value] -> IO TestResult
- typeSize :: Type -> Maybe Integer
- typeValues :: Type -> [Value]

# Documentation

testableType :: Type -> Maybe (Integer, [[Value]]) Source

Given a (function) type, compute all possible inputs for it. We also return the total number of test (i.e., the length of the outer list.

runOneTest :: Value -> [Value] -> IO TestResult Source

Apply a testable value to some arguments. Please note that this function assumes that the values come from a call to `testableType` (i.e., things are type-correct)

typeSize :: Type -> Maybe Integer Source

Given a fully-evaluated type, try to compute the number of values in it. Returns `Nothing` for infinite types, user-defined types, polymorhic types, and, currently, function spaces. Of course, we can easily compute the sizes of function spaces, but we can't easily enumerate their inhabitants.

typeValues :: Type -> [Value] Source

Returns all the values in a type. Returns an empty list of values, for types where `typeSize` returned `Nothing`.