Description
The min-revenue-threshold path in report_revenue emits rev_below and skips report/audit updates when amount < threshold, but boundary behavior (amount == threshold, threshold == 0, override of an already-persisted period below threshold) needs explicit coverage. Add a focused test matrix asserting state and emitted events at each boundary.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/lib.rs (report_revenue, set_min_revenue_threshold, get_min_revenue_threshold), src/test.rs
- Verify
override_existing=true still corrects below-threshold persisted periods
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/min-revenue-threshold-tests
- Implement changes
- Assert
amount == threshold is accepted (not below)
- Assert
rev_below emitted and no AuditSummary mutation when below
- Assert override of a persisted period bypasses the threshold
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- threshold 0, threshold equal, threshold-minus-one, override below threshold
- Include test output and security notes
Example commit message
test: cover min revenue threshold boundaries in report_revenue
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
The min-revenue-threshold path in
report_revenueemitsrev_belowand skips report/audit updates whenamount < threshold, but boundary behavior (amount == threshold,threshold == 0, override of an already-persisted period below threshold) needs explicit coverage. Add a focused test matrix asserting state and emitted events at each boundary.Requirements and context
src/lib.rs(report_revenue,set_min_revenue_threshold,get_min_revenue_threshold),src/test.rsoverride_existing=truestill corrects below-threshold persisted periodsSuggested execution
git checkout -b feat/min-revenue-threshold-testsamount == thresholdis accepted (not below)rev_belowemitted and noAuditSummarymutation when belowTest and commit
cargo testExample commit message
test: cover min revenue threshold boundaries in report_revenueGuidelines