Skip to content
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
5 changes: 5 additions & 0 deletions demo/demo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ contract DemoTest is DSTest {
emit log("\n");
assertTrue(false, err);

emit log("## assertFalse(bool)\n");
assertFalse(true);
emit log("\n");
assertFalse(true, err);

emit log("\n## assertEq(address,address)\n");
assertEq(address(this), msg.sender);
emit log("\n");
Expand Down
13 changes: 13 additions & 0 deletions src/test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ 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);
assertFalse(condition);
}
}

function assertEq(address a, address b) internal {
if (a != b) {
emit log("Error: a == b not satisfied [address]");
Expand Down