Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possibly support arguments in tests #18

Closed
snd opened this issue Mar 12, 2018 · 1 comment
Closed

possibly support arguments in tests #18

snd opened this issue Mar 12, 2018 · 1 comment

Comments

@snd
Copy link
Contributor

snd commented Mar 12, 2018

just some thoughts.

i tried

    function echidna_balanceAlwaysLowerEqualTotalSupply(address tokenHolder) public view returns (bool) {
        return balanceOf(tokenHolder) <= totalSupply;
    }

and it aborted with Test "echidna_balanceAlwaysLowerEqualTotalSupply" has arguments, aborting

i understand why.

it could be interesting to support this. it would open up a whole new set of properties that
can be tested with echidna. maybe this is possible by using echidna as a library. i've yet to look into that.

i imagine it could fuzz (argument) addresses first, that occur somewhere in storage of the contract or that it has used before.

@japesinator
Copy link
Contributor

It's definitely possible using echidna as a library, you'd just wanna write something like checkETest but with some argument logic. You could either hardcode your addresses and check them exhaustively and keep the type, or make something of type MonadGen m => VM -> m Bool and write something like eCommand but with a more constrained m so you can actually fuzz the addresses. I think the simplest way to do the former is just and <$> forM (addresses :: [AbiValue]) $ \a -> [some test parametrized on an address, returning a bool].

I'm not sure I can think of a general way to have tests with arguments in the CLI that I'm happy with, so I'll close this for now, but if you have a more specific behavior you'd like to see I'm happy to investigate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants