Draft
Reduce redundancies and fix dead test coverage in functionality_tests.jl#278
Conversation
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor script structure and reduce coding redundancies
Reduce redundancies and fix dead test coverage in functionality_tests.jl
Mar 3, 2026
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.
functionality_tests.jlhad significant structural redundancy and three silently-disabled@testassertions due to a typo. This PR extracts helpers to eliminate repeated boilerplate and re-enables the dead test code.Structural improvements
make_params(m, old_params)— replaces two near-identical 7-element array constructions forparams/params2make_conditions_and_shocks(m, algorithm; condition_values, level_differences, shock_values)— replaces three ~80-line duplicate blocks that builtconditions,conditions_lvl, andshocksfor conditional forecast tests; parameterized with descriptive keyword args so callers express intent clearlyNet change: −135 lines (93 added, 228 removed).
Test coverage gaps fixed
Three Zygote covariance gradient
@testassertions were never executing due toalgorithm == :first_order_(trailing underscore — alwaysfalse). Fixed toalgorithm == :first_order, re-enabling:@test isapprox(deriv5_zyg[1], deriv5_fin[1], rtol = 1e-4)— Zygote vs finite-diff on initial covariance Jacobian@test isapprox(deriv5_zyg[1], DERIV5_zyg[1], rtol = 1e-4)— Zygote consistency across solver algorithm variantsOriginal prompt
Created from VS Code.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.