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

Add assert approx and assert false #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MerlinEgalite
Copy link

@MerlinEgalite MerlinEgalite commented Feb 10, 2022

This PR has been opened to add 2 functionalities:

  • assertApproxEq: allows to do testing with an approximation given as input (to avoid small rounding errors).
  • assertFalse: The opposite of assertFalse for convenience.

It seems there is a duplicate PR for assertFalse here so we can just merge it and only add the commit for the assertApproxEq from this PR or simply just merge this PR 🙂

Thanks for you feedbacks!

@MerlinEgalite MerlinEgalite changed the title Add assert false Add assert approx and assert false Feb 10, 2022
Copy link

@MathisGD MathisGD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@charlesndalton
Copy link

🥇

Comment on lines +72 to +77
function assertFalse(bool condition) internal {
if (condition) {
emit log("Error: Assertion Failed");
fail();
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this simply call assertTrue like this?

function assertFalse(bool condition) internal {
    assertTrue(!condition);
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can also do this !

@PaulRBerg PaulRBerg mentioned this pull request Aug 13, 2022
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants