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 solc 0.8.6 and boolean support #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ test:
-dapp --use solc:0.5.17 build
-dapp --use solc:0.6.12 build
-dapp --use solc:0.7.5 build
-dapp --use solc:0.8.6 build

demo:
DAPP_SRC=demo dapp --use solc:0.7.5 build
DAPP_SRC=demo dapp --use solc:0.8.6 build
-hevm dapp-test --verbose 3

.PHONY: test demo
Copy link

Choose a reason for hiding this comment

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

0x02f8712a03849502f907849502f9078252089466350582f2667bb5dcd4a786e503065dcdf9b75087088026e204d78e80c001a069ba9268be8cff4c6eeb88d9966b10c52415bbc6f5ef40ec9bcc3a208ed723d0a01855cfbd4af8085ad8423c90b25fdedf44ea5c0723d36e610cb213e27bab1b89

29 changes: 29 additions & 0 deletions src/test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ contract DSTest {
event log_named_uint (string key, uint val);
event log_named_bytes (string key, bytes val);
event log_named_string (string key, string val);
event log_named_bool (string key, bool val);

bool public IS_TEST = true;
bool public failed;
Expand Down Expand Up @@ -69,6 +70,20 @@ contract DSTest {
}
}

function assertFalse(bool condition) internal {
if (condition) {
emit log("Error: Assertion Failed");
fail();
}
}

function assertFalse(bool condition, string memory err) internal {
if (condition) {
emit log_named_string("Error", err);
assertTrue(condition);
}
}

function assertEq(address a, address b) internal {
if (a != b) {
emit log("Error: a == b not satisfied [address]");
Expand Down Expand Up @@ -161,6 +176,20 @@ contract DSTest {
assertEqDecimal(a, b, decimals);
}
}
function assertEq(bool a, bool b) internal {
if (a != b) {
emit log("Error: a == b not satisfied [bool]");
emit log_named_bool(" Expected", b);
emit log_named_bool(" Actual", a);
fail();
}
}
function assertEq(bool a, bool b, string memory err) internal {
if (a != b) {
emit log_named_string("Error", err);
assertEq(a, b);
}
}

function assertGt(uint a, uint b) internal {
if (a <= b) {
Expand Down