Skip to content

Commit

Permalink
chore: change assert error strings
Browse files Browse the repository at this point in the history
  • Loading branch information
cucupac committed Nov 1, 2023
1 parent 3e3bfe2 commit 012e025
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
18 changes: 6 additions & 12 deletions test/create3/Create3Factory.admin.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract Create3FactoryAdminTest is TestSetup {
vm.assume(amount > 0 && amount < 1e22);
vm.deal(address(proxy), amount);

assertEq(address(proxy).balance, amount, "Equivalence Violation: address(proxy) native balance and amount.");
assertEq(address(proxy).balance, amount, "Equivalence Violation: native balance != amount");

uint256 preLocalBalance = CONTRACT_DEPLOYER.balance;

Expand All @@ -28,7 +28,7 @@ contract Create3FactoryAdminTest is TestSetup {
assertEq(
CONTRACT_DEPLOYER.balance,
preLocalBalance + amount,
"Equivalence Violation: CONTRACT_DEPLOYER native balance and preLocalBalance + amount."
"Equivalence Violation: native balance != preLocalBalance + amount."
);
}

Expand Down Expand Up @@ -63,7 +63,7 @@ contract Create3FactoryForkTest is Test {
}

function test_ActiveFork() public {
assertEq(vm.activeFork(), mainnetFork, "Equivalence Violation: vm.activeFork() and mainnetFork.");
assertEq(vm.activeFork(), mainnetFork, "Equivalence Violation: vm.activeFork() != mainnetFork");
}

function test_ExtractERC20(uint256 amount) public {
Expand All @@ -75,25 +75,19 @@ contract Create3FactoryForkTest is Test {

// Pre-action assertions
assertEq(
IERC20(TEST_ERC20_TOKEN).balanceOf(address(proxy)),
amount,
"Equivalence Violation: address(proxy) TEST_ERC20_TOKEN balance and amount."
IERC20(TEST_ERC20_TOKEN).balanceOf(address(proxy)), amount, "Equivalence Violation: ERC20 balance != amount"
);

// Act
vm.prank(CONTRACT_DEPLOYER);
ICreate3FactoryAdmin(address(proxy)).extractERC20(TEST_ERC20_TOKEN);

// Post-action assertions
assertEq(
IERC20(TEST_ERC20_TOKEN).balanceOf(address(proxy)),
0,
"Equivalence Violation: address(proxy) TEST_ERC20_TOKEN balance and 0."
);
assertEq(IERC20(TEST_ERC20_TOKEN).balanceOf(address(proxy)), 0, "Equivalence Violation: ERC20 balance != 0");
assertEq(
IERC20(TEST_ERC20_TOKEN).balanceOf(CONTRACT_DEPLOYER),
amount,
"Equivalence Violation: CONTRACT_DEPLOYER TEST_ERC20_TOKEN balance and amount."
"Equivalence Violation: ERC20 balance != amount"
);
}

Expand Down
20 changes: 10 additions & 10 deletions test/create3/Create3Factory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract Create3FactoryTest is DeploymentHelper, TestSetup {
vm.stopPrank();

// Assertions
assertEq(actualChild, expectedChild, "Equivalence violation: actualChild and expectedChild.");
assertEq(actualChild, expectedChild, "Equivalence violation: actualChild != expectedChild");
}

function testFuzz_Deploy(uint256 pkNum, address sender) public {
Expand Down Expand Up @@ -76,7 +76,7 @@ contract Create3FactoryTest is DeploymentHelper, TestSetup {
vm.stopPrank();

// Assertions
assertEq(actualChild, expectedChild, "Equivalence violation: actualChild and expectedChild.");
assertEq(actualChild, expectedChild, "Equivalence violation: actualChild != expectedChild");
}

function testFuzz_DeployTwice(uint256 pkNum) public {
Expand Down Expand Up @@ -125,8 +125,8 @@ contract Create3FactoryTest is DeploymentHelper, TestSetup {
address setTwoChildA = setTwoDeployementHistory[1];

// Assertions
assertEq(setOneChildA, setTwoChildA, "Equivalence violation: setOneChildA and setTwoChildA.");
assertEq(setOneChildB, setTwoChildB, "Equivalence violation: setOneChildB and setTwoChildB.");
assertEq(setOneChildA, setTwoChildA, "Equivalence violation: setOneChildA != setTwoChildA");
assertEq(setOneChildB, setTwoChildB, "Equivalence violation: setOneChildB != setTwoChildB");
}

function testFuzz_DeployNonceUpdate(uint256 pkNum) public {
Expand All @@ -139,7 +139,7 @@ contract Create3FactoryTest is DeploymentHelper, TestSetup {
uint256 postDeployNonce = ICreate3Factory(address(proxy)).userNonces(wallet.addr, hashedStrippedBytecodeChildA);

// Assertions
assertEq(postDeployNonce, preDeployNonce + 1, "Equivalence violation: postDeployNonce and preDeployNonce + 1.");
assertEq(postDeployNonce, preDeployNonce + 1, "Equivalence violation: postDeployNonce != preDeployNonce + 1");
}

function testFuzz_DeployHistoryUpdate(uint256 pkNum) public {
Expand All @@ -159,8 +159,8 @@ contract Create3FactoryTest is DeploymentHelper, TestSetup {
deploymentHistory = ICreate3Factory(address(proxy)).getDeploymentHistory(wallet.addr);

// Assertions 1
assertEq(deploymentHistory.length, 1, "Equivalence violation: deploymentHistory.length and 1.");
assertTrue(deploymentHistory.includes(child1), "Truth Violation: deploymentHistory.includes(child1).");
assertEq(deploymentHistory.length, 1, "Equivalence violation: deploymentHistory.length != 1");
assertTrue(deploymentHistory.includes(child1), "Truth Violation: deploymentHistory.includes(child1)");

// Expectation 2
address child2 = ICreate3Factory(address(proxy)).getAddress(wallet.addr, strippedBytecodeChildA);
Expand All @@ -170,8 +170,8 @@ contract Create3FactoryTest is DeploymentHelper, TestSetup {
deploymentHistory = ICreate3Factory(address(proxy)).getDeploymentHistory(wallet.addr);

// Assertions 2
assertEq(deploymentHistory.length, 2, "Equivalence violation: deploymentHistory.length and 2.");
assertTrue(deploymentHistory.includes(child2), "Truth Violation: deploymentHistory.includes(child2).");
assertEq(deploymentHistory.length, 2, "Equivalence violation: deploymentHistory.length != 2");
assertTrue(deploymentHistory.includes(child2), "Truth Violation: deploymentHistory.includes(child2)");
}

function testFuzz_CannotDeployReplay(uint256 pkNum) public {
Expand Down Expand Up @@ -226,7 +226,7 @@ contract Create3FactoryTest is DeploymentHelper, TestSetup {
bytes32 expectedHash = keccak256(_childStrippedBytecode);

// Assertions
assertEq(actualHash, expectedHash, "Equivalence Violation: actualHash and expectedHash.");
assertEq(actualHash, expectedHash, "Equivalence Violation: actualHash != expectedHash");
}

function testFuzz_Receive(uint256 transferAmount) public {
Expand Down

0 comments on commit 012e025

Please sign in to comment.