feat(#4950): moved sqrt from real.eo to a separate object with tests#4959
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Performance AnalysisAll benchmarks are within the acceptable range. No critical degradation detected (threshold is 100%). Please refer to the detailed report for more information. Click to see the detailed report
✅ Performance gain: |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
eo-runtime/src/main/eo/ms/sqrt.eo (1)
44-77: Extract epsilon into a single constant for tolerance checks.
0.00000000001is duplicated in three tests. Centralizing it improves maintainability and avoids drift.Proposed refactor
[num] > sqrt ? + [] > epsilon + 0.00000000001 + # Tests that square root of zero equals zero. [] +> tests-sqrt-check-zero-input lt. +> @ abs real minus. 0 sqrt 0 - 0.00000000001 + epsilon @@ [] +> tests-sqrt-check-float-input lt. +> @ abs real minus. 2 sqrt 4 - 0.00000000001 + epsilon @@ [] +> tests-sqrt-check-int-input lt. +> @ abs real minus. 9 sqrt 81 - 0.00000000001 + epsilon🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@eo-runtime/src/main/eo/ms/sqrt.eo` around lines 44 - 77, Create a single named constant for the tolerance (epsilon) and use it in all three tests instead of the repeated literal; specifically add a top-level constant (e.g., epsilon) and replace the numeric literal 0.00000000001 in tests-sqrt-check-zero-input, tests-sqrt-check-float-input, and tests-sqrt-check-int-input with that constant so the tolerance is centralized and easy to adjust.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@eo-runtime/src/main/eo/ms/sqrt.eo`:
- Around line 59-70: Update the test names and comments so they accurately
describe the inputs being tested: change the comment and test identifier
tests-sqrt-check-float-input to something like
tests-sqrt-check-exact-square-float (or tests-sqrt-check-exact-square) if it
verifies sqrt 4 == 2, and either rename tests-sqrt-check-int-input to
tests-sqrt-check-noninteger-input if you intend it to test a non-integer case
(e.g., sqrt 2 with a tolerance) or rename it to
tests-sqrt-check-exact-square-int if it also checks an exact-square integer;
update the surrounding comment text to match the chosen intent so test reports
are not misleading and the identifiers (tests-sqrt-check-float-input,
tests-sqrt-check-int-input) clearly reflect the actual assertions.
---
Nitpick comments:
In `@eo-runtime/src/main/eo/ms/sqrt.eo`:
- Around line 44-77: Create a single named constant for the tolerance (epsilon)
and use it in all three tests instead of the repeated literal; specifically add
a top-level constant (e.g., epsilon) and replace the numeric literal
0.00000000001 in tests-sqrt-check-zero-input, tests-sqrt-check-float-input, and
tests-sqrt-check-int-input with that constant so the tolerance is centralized
and easy to adjust.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 998a45d1-7266-4627-8acf-acbcdc1cc8f8
📒 Files selected for processing (3)
eo-runtime/src/main/eo/ms/real.eoeo-runtime/src/main/eo/ms/sqrt.eoeo-runtime/src/main/java/org/eolang/EOms/EOsqrt.java
💤 Files with no reviewable changes (1)
- eo-runtime/src/main/eo/ms/real.eo
🚧 Files skipped from review as they are similar to previous changes (1)
- eo-runtime/src/main/java/org/eolang/EOms/EOsqrt.java
|
@yegor256 check this please |
|
@eshabakhov Thanks for the contribution! You've earned +12 points for this: +16 as a basis, +0.05 points per hit-of-code (168 hits = +8.4 points, capped at +16), and -4 for exceeding 100 hits-of-code. Please keep them coming! Your running score is +68; don't forget to check your Zerocracy account too. |
Summary
This PR solves #4950
Changes
sqrtand tests fromreal.eosqrtinsqrt.eowith testsSummary by CodeRabbit
Refactor
Tests