Skip to content

Commit 2cd869b

Browse files
authored
Merge pull request #1 from risedle/add-improvement
Add solc 0.8.6 and boolean support
2 parents 0a5da56 + 2ba9333 commit 2cd869b

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ test:
66
-dapp --use solc:0.5.17 build
77
-dapp --use solc:0.6.12 build
88
-dapp --use solc:0.7.5 build
9+
-dapp --use solc:0.8.6 build
910

1011
demo:
11-
DAPP_SRC=demo dapp --use solc:0.7.5 build
12+
DAPP_SRC=demo dapp --use solc:0.8.6 build
1213
-hevm dapp-test --verbose 3
1314

1415
.PHONY: test demo

src/test.sol

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ contract DSTest {
3434
event log_named_uint (string key, uint val);
3535
event log_named_bytes (string key, bytes val);
3636
event log_named_string (string key, string val);
37+
event log_named_bool (string key, bool val);
3738

3839
bool public IS_TEST = true;
3940
bool public failed;
@@ -69,6 +70,20 @@ contract DSTest {
6970
}
7071
}
7172

73+
function assertFalse(bool condition) internal {
74+
if (condition) {
75+
emit log("Error: Assertion Failed");
76+
fail();
77+
}
78+
}
79+
80+
function assertFalse(bool condition, string memory err) internal {
81+
if (condition) {
82+
emit log_named_string("Error", err);
83+
assertTrue(condition);
84+
}
85+
}
86+
7287
function assertEq(address a, address b) internal {
7388
if (a != b) {
7489
emit log("Error: a == b not satisfied [address]");
@@ -161,6 +176,20 @@ contract DSTest {
161176
assertEqDecimal(a, b, decimals);
162177
}
163178
}
179+
function assertEq(bool a, bool b) internal {
180+
if (a != b) {
181+
emit log("Error: a == b not satisfied [bool]");
182+
emit log_named_bool(" Expected", b);
183+
emit log_named_bool(" Actual", a);
184+
fail();
185+
}
186+
}
187+
function assertEq(bool a, bool b, string memory err) internal {
188+
if (a != b) {
189+
emit log_named_string("Error", err);
190+
assertEq(a, b);
191+
}
192+
}
164193

165194
function assertGt(uint a, uint b) internal {
166195
if (a <= b) {

0 commit comments

Comments
 (0)