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

Improved test coverage for array exercises - FilterOddNumbers and Mean #36

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pali101
Copy link
Contributor

@pali101 pali101 commented Oct 19, 2024

This PR introduces improvement to test cases for FilterOddNumbers and Mean contracts:

1. FilterOddNumbers Contract:

  • Added edge cases to handle:
    • Empty arrays
    • Arrays with all even numbers
    • Arrays with all odd numbers
    • Arrays with a single even number
    • Arrays with a single odd number
  • Added array length checks to ensure the result array matches the expected size.
  • Included tests for large arrays to check correctness.

2. Mean Contract:

  • Re-structured tests as one function, one type of test and added comprehensive tests for the mean function.
  • Covered edge cases, including:
    • Empty array (handled with Panic error check for division by zero)
    • Single-element arrays (mean should be the element itself)
    • Large numbers to ensure proper handling of large sums
  • Implemented vm.expectRevert for the Panic error (0x12 for division by zero).

…dd), array length checks, and large array tests for FilterOddNumbers contract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant