Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data UnitTestOptions = UnitTestOptions {
- oracle :: Query -> IO (EVM ())
- verbose :: Maybe Int
- maxIter :: Maybe Integer
- askSmtIters :: Maybe Integer
- maxDepth :: Maybe Int
- smtTimeout :: Maybe Integer
- smtState :: Maybe State
- solver :: Maybe Text
- match :: Text
- fuzzRuns :: Int
- replay :: Maybe (Text, ByteString)
- vmModifier :: VM -> VM
- dapp :: DappInfo
- testParams :: TestVMParams
- ffiAllowed :: Bool
- data TestVMParams = TestVMParams {
- testAddress :: Addr
- testCaller :: Addr
- testOrigin :: Addr
- testGasCreate :: W256
- testGasCall :: W256
- testBaseFee :: W256
- testPriorityFee :: W256
- testBalanceCreate :: W256
- testCoinbase :: Addr
- testNumber :: W256
- testTimestamp :: W256
- testGaslimit :: W256
- testGasprice :: W256
- testMaxCodeSize :: W256
- testDifficulty :: W256
- testChainId :: W256
- defaultGasForCreating :: W256
- defaultGasForInvoking :: W256
- defaultBalanceForTestContract :: W256
- defaultMaxCodeSize :: W256
- type ABIMethod = Text
- initializeUnitTest :: UnitTestOptions -> SolcContract -> Stepper ()
- runUnitTest :: UnitTestOptions -> ABIMethod -> AbiValue -> Stepper Bool
- execTestStepper :: UnitTestOptions -> ABIMethod -> AbiValue -> Stepper Bool
- exploreStep :: UnitTestOptions -> ByteString -> Stepper Bool
- checkFailures :: UnitTestOptions -> ABIMethod -> Bool -> Stepper Bool
- fuzzTest :: UnitTestOptions -> Text -> [AbiType] -> VM -> Property
- tick :: Text -> IO ()
- data OpLocation = OpLocation {
- srcContract :: Contract
- srcOpIx :: Int
- srcMapForOpLocation :: DappInfo -> OpLocation -> Maybe SrcMap
- type CoverageState = (VM, MultiSet OpLocation)
- currentOpLocation :: VM -> OpLocation
- execWithCoverage :: StateT CoverageState IO VMResult
- runWithCoverage :: StateT CoverageState IO VM
- interpretWithCoverage :: UnitTestOptions -> Stepper a -> StateT CoverageState IO a
- coverageReport :: DappInfo -> MultiSet SrcMap -> Map Text (Vector (Int, ByteString))
- coverageForUnitTestContract :: UnitTestOptions -> Map Text SolcContract -> SourceCache -> (Text, [(Test, [AbiType])]) -> IO (MultiSet SrcMap)
- runUnitTestContract :: UnitTestOptions -> Map Text SolcContract -> (Text, [(Test, [AbiType])]) -> Query [(Bool, VM)]
- runTest :: UnitTestOptions -> VM -> (Test, [AbiType]) -> Query (Text, Either Text Text, VM)
- type ExploreTx = (Addr, Addr, ByteString, W256)
- decodeCalls :: ByteString -> [ExploreTx]
- explorationStepper :: UnitTestOptions -> ABIMethod -> [ExploreTx] -> [Addr] -> RLP -> Int -> Stepper (Bool, RLP)
- getTargetContracts :: UnitTestOptions -> Stepper [Addr]
- exploreRun :: UnitTestOptions -> VM -> ABIMethod -> [ExploreTx] -> IO (Text, Either Text Text, VM)
- execTest :: UnitTestOptions -> VM -> ABIMethod -> AbiValue -> IO (Bool, VM)
- runOne :: UnitTestOptions -> VM -> ABIMethod -> AbiValue -> IO (Text, Either Text Text, VM)
- fuzzRun :: UnitTestOptions -> VM -> Text -> [AbiType] -> IO (Text, Either Text Text, VM)
- symRun :: UnitTestOptions -> VM -> Text -> [AbiType] -> Query (Text, Either Text Text, VM)
- symFailure :: UnitTestOptions -> Text -> [(VM, Text)] -> Text
- prettyCalldata :: (?context :: DappContext) => (Buffer, SymWord) -> Text -> [AbiType] -> Query Text
- execSymTest :: UnitTestOptions -> ABIMethod -> (Buffer, SymWord) -> Stepper (Bool, VM)
- checkSymFailures :: UnitTestOptions -> Stepper VM
- indentLines :: Int -> Text -> Text
- passOutput :: VM -> UnitTestOptions -> Text -> Text
- failOutput :: VM -> UnitTestOptions -> Text -> Text
- formatTestLogs :: (?context :: DappContext) => Map W256 Event -> Seq Log -> Text
- formatTestLog :: (?context :: DappContext) => Map W256 Event -> Log -> Maybe Text
- word32Bytes :: Word32 -> ByteString
- abiCall :: TestVMParams -> Either (Text, AbiValue) ByteString -> EVM ()
- makeTxCall :: TestVMParams -> (Buffer, SymWord) -> EVM ()
- initialUnitTestVm :: UnitTestOptions -> SolcContract -> VM
- symbolify :: VM -> VM
- getParametersFromEnvironmentVariables :: Maybe Text -> IO TestVMParams
Documentation
data UnitTestOptions Source #
UnitTestOptions | |
|
data TestVMParams Source #
TestVMParams | |
|
initializeUnitTest :: UnitTestOptions -> SolcContract -> Stepper () Source #
Assuming a constructor is loaded, this stepper will run the constructor to create the test contract, give it an initial balance, and run `setUp()'.
runUnitTest :: UnitTestOptions -> ABIMethod -> AbiValue -> Stepper Bool Source #
Assuming a test contract is loaded and initialized, this stepper will run the specified test method and return whether it succeeded.
execTestStepper :: UnitTestOptions -> ABIMethod -> AbiValue -> Stepper Bool Source #
exploreStep :: UnitTestOptions -> ByteString -> Stepper Bool Source #
checkFailures :: UnitTestOptions -> ABIMethod -> Bool -> Stepper Bool Source #
fuzzTest :: UnitTestOptions -> Text -> [AbiType] -> VM -> Property Source #
Randomly generates the calldata arguments and runs the test
data OpLocation Source #
This is like an unresolved source mapping.
OpLocation | |
|
Instances
Eq OpLocation Source # | |
Defined in EVM.UnitTest (==) :: OpLocation -> OpLocation -> Bool # (/=) :: OpLocation -> OpLocation -> Bool # | |
Ord OpLocation Source # | |
Defined in EVM.UnitTest compare :: OpLocation -> OpLocation -> Ordering # (<) :: OpLocation -> OpLocation -> Bool # (<=) :: OpLocation -> OpLocation -> Bool # (>) :: OpLocation -> OpLocation -> Bool # (>=) :: OpLocation -> OpLocation -> Bool # max :: OpLocation -> OpLocation -> OpLocation # min :: OpLocation -> OpLocation -> OpLocation # | |
Show OpLocation Source # | |
Defined in EVM.UnitTest showsPrec :: Int -> OpLocation -> ShowS # show :: OpLocation -> String # showList :: [OpLocation] -> ShowS # |
srcMapForOpLocation :: DappInfo -> OpLocation -> Maybe SrcMap Source #
type CoverageState = (VM, MultiSet OpLocation) Source #
currentOpLocation :: VM -> OpLocation Source #
interpretWithCoverage :: UnitTestOptions -> Stepper a -> StateT CoverageState IO a Source #
coverageForUnitTestContract :: UnitTestOptions -> Map Text SolcContract -> SourceCache -> (Text, [(Test, [AbiType])]) -> IO (MultiSet SrcMap) Source #
runUnitTestContract :: UnitTestOptions -> Map Text SolcContract -> (Text, [(Test, [AbiType])]) -> Query [(Bool, VM)] Source #
runTest :: UnitTestOptions -> VM -> (Test, [AbiType]) -> Query (Text, Either Text Text, VM) Source #
decodeCalls :: ByteString -> [ExploreTx] Source #
explorationStepper :: UnitTestOptions -> ABIMethod -> [ExploreTx] -> [Addr] -> RLP -> Int -> Stepper (Bool, RLP) Source #
getTargetContracts :: UnitTestOptions -> Stepper [Addr] Source #
exploreRun :: UnitTestOptions -> VM -> ABIMethod -> [ExploreTx] -> IO (Text, Either Text Text, VM) Source #
runOne :: UnitTestOptions -> VM -> ABIMethod -> AbiValue -> IO (Text, Either Text Text, VM) Source #
Define the thread spawner for normal test cases
fuzzRun :: UnitTestOptions -> VM -> Text -> [AbiType] -> IO (Text, Either Text Text, VM) Source #
Define the thread spawner for property based tests
symRun :: UnitTestOptions -> VM -> Text -> [AbiType] -> Query (Text, Either Text Text, VM) Source #
Define the thread spawner for symbolic tests TODO: return a list of VM's
symFailure :: UnitTestOptions -> Text -> [(VM, Text)] -> Text Source #
prettyCalldata :: (?context :: DappContext) => (Buffer, SymWord) -> Text -> [AbiType] -> Query Text Source #
execSymTest :: UnitTestOptions -> ABIMethod -> (Buffer, SymWord) -> Stepper (Bool, VM) Source #
passOutput :: VM -> UnitTestOptions -> Text -> Text Source #
failOutput :: VM -> UnitTestOptions -> Text -> Text Source #
formatTestLogs :: (?context :: DappContext) => Map W256 Event -> Seq Log -> Text Source #
formatTestLog :: (?context :: DappContext) => Map W256 Event -> Log -> Maybe Text Source #
word32Bytes :: Word32 -> ByteString Source #
abiCall :: TestVMParams -> Either (Text, AbiValue) ByteString -> EVM () Source #
makeTxCall :: TestVMParams -> (Buffer, SymWord) -> EVM () Source #
initialUnitTestVm :: UnitTestOptions -> SolcContract -> VM Source #