Skip to content

Conversation

@matchv
Copy link
Collaborator

@matchv matchv commented Oct 5, 2025

add
ray_div_up
ray_div_down
ray_div_up
ray_div_down

into way_ray_math.move

add 17 test cases.

matchv added 21 commits October 5, 2025 19:30
- Add basic upward rounding division test for ray_div_up function
- Test with small numbers (100, 3) and larger numbers (1000 RAY, 300 RAY)
- Verify upward rounding behavior with expected values
- Update imports to include ray_div_up function
- Add edge cases test for ray_div_up function
- Test zero numerator handling (should return 0)
- Test exact division scenarios (600 RAY / 200 RAY)
- Test very small remainder cases (1000 RAY + 1 / 1000 RAY)
- Verify upward rounding behavior in edge cases
- Add division by zero test for ray_div_up function
- Test that ray_div_up(1000, 0) properly aborts with EDIVISION_BY_ZERO error
- Verify error handling behavior for invalid input parameters
- Use expected_failure annotation to test error conditions
- Add overflow test for ray_div_up function
- Test that ray_div_up properly aborts with EOVERFLOW error when input is too large
- Verify overflow handling behavior for extreme input parameters
- Use expected_failure annotation to test overflow conditions
- Add basic downward rounding division test for ray_div_down function
- Test with small numbers (100, 3) and larger numbers (1000 RAY, 300 RAY)
- Verify downward rounding behavior with expected values
- Update imports to include ray_div_down function
- Add edge cases test for ray_div_down function
- Test zero numerator handling (should return 0)
- Test exact division scenarios (600 RAY / 200 RAY)
- Test very small remainder cases (1000 RAY + 1 / 1000 RAY)
- Verify downward rounding behavior in edge cases
- Add division by zero test for ray_div_down function
- Test that ray_div_down(1000, 0) properly aborts with EDIVISION_BY_ZERO error
- Verify error handling behavior for invalid input parameters
- Use expected_failure annotation to test error conditions
- Add directional comparison test for ray_div functions
- Test that ray_div_up >= ray_div >= ray_div_down for same inputs
- Verify proper ordering of rounding results (700 RAY / 300 RAY)
- Ensure directional rounding maintains mathematical consistency
- Add basic upward rounding multiplication test for ray_mul_up function
- Test with small numbers (100, 3) and larger numbers (500 RAY, 200 RAY)
- Verify upward rounding behavior with expected values
- Update imports to include ray_mul_up function
- Add edge cases test for ray_mul_up function
- Test zero operand handling (should return 0)
- Test exact multiplication scenarios (500 RAY * 200 RAY)
- Verify upward rounding behavior in edge cases
- Add overflow test for ray_mul_up function
- Test that ray_mul_up properly aborts with EOVERFLOW error when input is too large
- Verify overflow handling behavior for extreme input parameters
- Use expected_failure annotation to test overflow conditions
- Add basic downward rounding multiplication test for ray_mul_down function
- Test with small numbers (100, 3) and larger numbers (500 RAY, 200 RAY)
- Verify downward rounding behavior with expected values
- Update imports to include ray_mul_down function
- Add edge cases test for ray_mul_down function
- Test zero operand handling (should return 0)
- Test exact multiplication scenarios (500 RAY * 200 RAY)
- Verify downward rounding behavior in edge cases
- Add directional comparison test for ray_mul functions
- Test that ray_mul_up >= ray_mul >= ray_mul_down for same inputs
- Verify proper ordering of rounding results (700 RAY * 300 RAY)
- Ensure directional rounding maintains mathematical consistency
- Add exact division consistency test for ray_div functions
- Test that ray_div_up and ray_div_down give same result for exact division
- Verify mathematical consistency when no rounding is needed (600 RAY / 200 RAY)
- Ensure directional rounding functions behave correctly for exact cases
- Add comprehensive directional rounding consistency test
- Test both division and multiplication with remainder scenarios
- Verify ray_div_up > ray_div_down for non-exact division (700 RAY / 300 RAY)
- Verify ray_mul_up == ray_mul_down for exact multiplication (700 RAY * 300 RAY)
- Ensure directional rounding functions maintain expected mathematical behavior
- Add protocol safety test for directional rounding functions
- Test small debt calculation scenario (should not round to zero)
- Test collateral calculation scenario (should not overestimate)
- Test interest calculation precision with exact rate multiplication
- Verify directional rounding provides protocol safety benefits in real-world scenarios
@codecov
Copy link

codecov bot commented Oct 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.70%. Comparing base (21619ff) to head (e441357).
⚠️ Report is 46 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #65      +/-   ##
==========================================
+ Coverage   97.69%   97.70%   +0.01%     
==========================================
  Files          38       38              
  Lines         781      785       +4     
==========================================
+ Hits          763      767       +4     
  Misses         18       18              
Flag Coverage Δ
move 97.70% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@mpsc0x mpsc0x left a comment

Choose a reason for hiding this comment

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

LGTM

@matchv matchv closed this pull request by merging all changes into main in f163015 Oct 21, 2025
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.

4 participants