Skip to content
Open
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
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,16 @@ Interfaces should be the entrypoint for all contracts. When exploring the a cont

## Testing

The following testing practices should be followed when writing unit tests for new code. All functions, lines and branches should be tested to result in 100% testing coverage. Fuzz parameters and conditions whenever possible. Extremes should be tested in dedicated edge case and corner case tests. Invariants should be tested in dedicated invariant tests.
The following testing practices should be followed when writing unit tests for new code:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Test naming conventions

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

come back and expand the testing conventions

- All functions, lines and branches should be tested to result in 100% testing coverage.
- Fuzz parameters and conditions whenever possible.
- Extremes should be tested in dedicated edge case and corner case tests.
- Invariants should be tested in dedicated invariant tests.

Tests should follow clear naming principles to easily understand the purpose of the test:
- The test itself (or the contract of the test) should include the name of the function it is testing.
- When a test checks for a revert, the test name should start with `test_revert_` or `testRevert`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what about when you want to test that it reverts with a specific error?

- Dedicated fuzz tests should start with `test_fuzz_` or `testFuzz`.

Differential testing should be used to compare assembly implementations with implementations in Solidity or testing alternative implementations against existing Solidity or non-Solidity code using ffi.

Expand Down
Loading