Add comprehensive tests for seasonal models and coverage analysis#17
Merged
SZabolotnii merged 2 commits intoNov 14, 2025
Conversation
This commit significantly improves test coverage for the seasonal models introduced in version 0.1.2, addressing a critical gap in the CRAN submission readiness. New test file: tests/testthat/test-seasonal-models.R (500+ lines) ================================================================ Comprehensive testing for all seasonal model functionality: SAR (Seasonal AutoRegressive) Models: - Basic SAR(0,P)_s model fitting and validation - Multiplicative SAR(p,P)_s models - Coefficient bounds and convergence testing - Multiple seasonal periods (quarterly, monthly) - Mean/intercept parameter handling - SARPMM2 S4 class structure validation SMA (Seasonal Moving Average) Models: - SMA(Q)_s model fitting with CSS and PMM2 methods - Higher-order models (Q > 1) - Method comparison and convergence parameters - Innovation slot validation - SMAPMM2 S4 class structure testing SARMA (Combined Seasonal ARMA) Models: - Full SARMA(p,P,q,Q)_s specification testing - Pure seasonal and mixed models - Order slot validation and residual properties - SARMAPMM2 S4 class validation SARIMA (Seasonal ARIMA) Models: - Differencing order (d, D) handling - Non-stationary data processing - Full model specification testing - SARIMAPMM2 S4 class structure S4 Methods Testing: - coef(), residuals(), fitted(), summary() methods - Class inheritance from TS2fit - Original series storage and moment statistics Edge Cases & Integration: - Short time series handling - Large seasonal periods - Constant series edge cases - Comparison with stats::arima() Total: 50+ distinct test cases covering all seasonal functionality New coverage analysis script: run_coverage_analysis.R ====================================================== Automated script for comprehensive test coverage analysis: - Package-wide coverage reporting with covr - File-by-file coverage breakdown - HTML report generation (coverage_report.html) - Identification of low-coverage areas (<80%) - Specific focus on seasonal model files - Actionable recommendations based on coverage level - Data export for CI/CD integration (coverage_data.rds) New testing documentation: tests/TESTING_GUIDE.md ================================================== Complete guide for developers and contributors: - Test structure and organization overview - Coverage targets by functionality (>80% overall, >85% seasonal) - Running tests (local, devtools, command-line) - Coverage analysis instructions - Detailed description of test-seasonal-models.R - Test data generation utilities - Best practices for writing new tests - Continuous integration guidance - Troubleshooting common testing issues Updated .Rbuildignore ===================== Added exclusions for development/testing artifacts: - run_coverage_analysis.R (dev script) - coverage_report.html (generated report) - coverage_data.rds (coverage data) - tests/TESTING_GUIDE.md (developer docs) Impact on CRAN Readiness ======================== This commit addresses three critical recommendations from the readiness analysis: 1.⚠️ -> ✅ Added comprehensive tests for sar_pmm2(), sma_pmm2(), sarma_pmm2(), sarima_pmm2() 2.⚠️ -> ✅ Added tests for S4 classes SARPMM2, SMAPMM2, SARMAPMM2, SARIMAPMM2 3.⚠️ -> ✅ Implemented covr-based coverage analysis infrastructure Expected Coverage Improvement: - Before: ~357 lines of tests, estimated 70-75% coverage - After: ~850+ lines of tests, target >80% overall, >85% seasonal These additions significantly strengthen the package's test suite and bring it in line with CRAN quality standards for robust R packages. Testing on real hardware with R installed is required to verify coverage metrics and ensure all tests pass.
…iness-011DRvwF82ZaGu8xt9QKtNhD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit significantly improves test coverage for the seasonal models introduced in version 0.1.2, addressing a critical gap in the CRAN submission readiness.
New test file: tests/testthat/test-seasonal-models.R (500+ lines) ================================================================ Comprehensive testing for all seasonal model functionality:
SAR (Seasonal AutoRegressive) Models:
SMA (Seasonal Moving Average) Models:
SARMA (Combined Seasonal ARMA) Models:
SARIMA (Seasonal ARIMA) Models:
S4 Methods Testing:
Edge Cases & Integration:
Total: 50+ distinct test cases covering all seasonal functionality
New coverage analysis script: run_coverage_analysis.R ====================================================== Automated script for comprehensive test coverage analysis:
New testing documentation: tests/TESTING_GUIDE.md
================================================== Complete guide for developers and contributors:
Updated .Rbuildignore
Added exclusions for development/testing artifacts:
Impact on CRAN Readiness
This commit addresses three critical recommendations from the readiness analysis:
Expected Coverage Improvement:
These additions significantly strengthen the package's test suite and bring it in line with CRAN quality standards for robust R packages.
Testing on real hardware with R installed is required to verify coverage metrics and ensure all tests pass.