test(dpp): add numerical assertions to evaluate_interval distribution tests#3102
Conversation
Add explicit assert_eq!(result.total_amount, <expected>) checks before tautological string comparisons in epoch_tests module. This ensures the numerical correctness of total_amount is independently verified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add explicit assert_eq!(result.total_amount, <expected>) checks before tautological string comparisons in block_tests module. This ensures the numerical correctness of total_amount is independently verified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add explicit assert_eq!(result.total_amount, <expected>) checks before tautological string comparisons in time_interval_tests module. This ensures the numerical correctness of total_amount is independently verified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughThis pull request adds validation assertions to existing test cases for interval evaluation, checking computed Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
I've ran tests; and confirmed this works. Merging |
Problem
The 72 tests in
evaluate_interval.rsverify distribution function outputs by comparing explanation strings. But the expected string is built from the result itself:If the function computes 999 when it should be 1,000, the test builds an expected string with 999, compares to the actual string with 999, and passes. The numerical correctness assertion is tautological — it can never fail.
Fix
Added 30 explicit
assert_eq!(result.total_amount, <expected_value>)assertions before the existing string comparisons:Assertions added by distribution type:
Reward-ratio tests already had proper numerical assertions — no changes needed.
Verification
All 72 tests pass:
cargo test -p dpp --lib --features token-reward-explanations -- evaluate_intervalFound during SDK test quality audit (tracker thepastaclaw/tracker#13).
Summary by CodeRabbit