An open API service indexing awesome lists of open source software.

https://github.com/Recon-Fuzz/call-test-undo

CallTestAndUndo - a simple abstract contract to help you write invariant tests that do not influence the story
https://github.com/Recon-Fuzz/call-test-undo

Last synced: 4 months ago
JSON representation

CallTestAndUndo - a simple abstract contract to help you write invariant tests that do not influence the story

Awesome Lists containing this project

README

        

# CallTestAndUndo

A simple contract that allows you to perform stateful invariant tests without changing global state

## Use Cases

When you're doing tests and don't want to track their side effects into the global state

You can use this abstract contract to perform the test and then revert all state changes

This way you can keep the "Story" simple while testing complex behavior

## Usage

Make your contract inherit `CallTestAndUndo`

Edit the function you want to test to require it being called by `this`

Use `_doTestAndReturnResult` to call the function (use `encodeCall`)

## Demo

See `testDemoCal` for a quick demo