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 unit tests #9

Merged
merged 10 commits into from
Dec 4, 2023
Prev Previous commit
Next Next commit
docs: fix some comments
  • Loading branch information
fiveoutofnine committed Dec 3, 2023
commit 51adb670486315b6fdb2ee68a734568c9be58819
10 changes: 5 additions & 5 deletions test/CurtaGolf.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ contract CurtaGolfTest is BaseTest {
curtaGolf.submit(1, EFFICIENT_SOLUTION, solver1, 0);
}

/// @notice Test that revealing a solution to a nonexistent course reverts.
/// @notice Test that submitting a solution to a nonexistent course reverts.
function test_submit_NonexistentCourse_Reverts() public {
bytes32 key = keccak256(abi.encode(solver1, EFFICIENT_SOLUTION, 0));

Expand All @@ -114,7 +114,7 @@ contract CurtaGolfTest is BaseTest {
curtaGolf.submit(2, EFFICIENT_SOLUTION, solver1, 0);
}

/// @notice Test that revealing a solution with invalid opcodes reverts.
/// @notice Test that submitting a solution with invalid opcodes reverts.
function test_submit_PollutedSolution_Reverts() public {
// Ban all opcodes.
vm.prank(owner);
Expand All @@ -132,7 +132,7 @@ contract CurtaGolfTest is BaseTest {
curtaGolf.submit(1, EFFICIENT_SOLUTION, solver1, 0);
}

/// @notice Test that revealing an incorrect solution reverts.
/// @notice Test that submitting an incorrect solution reverts.
function test_submit_IncorrectSolution_Reverts() public {
// Commit the key.
bytes32 key = keccak256(abi.encode(solver1, INCORRECT_SOLUTION, 0));
Expand All @@ -146,7 +146,7 @@ contract CurtaGolfTest is BaseTest {
curtaGolf.submit(1, INCORRECT_SOLUTION, solver1, 0);
}

/// @notice Test the emitted events and storage updates upon revealing
/// @notice Test the emitted events and storage updates upon submitting
/// solutions in the following order:
/// 1. `solver1` submits an inefficient solution but becomes the king.
/// 2. `solver2` submits an efficient solution and becomes the new king.
Expand Down Expand Up @@ -288,7 +288,7 @@ contract CurtaGolfTest is BaseTest {
// `submitDirectly`
// -------------------------------------------------------------------------

/// @notice Test the emitted events and storage updates upon revealing
/// @notice Test the emitted events and storage updates upon submitting
/// solutions in the following order:
/// 1. `solver1` submits an inefficient solution but becomes the king.
/// 2. `solver2` submits an efficient solution and becomes the new king.
Expand Down