Daily Test Coverage Improver - Householder quotation-based tests #48
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.
Summary
Added 18 comprehensive quotation-based tests for the Householder module using F# quotation evaluation technique. This approach ensures that inline functions (
Householder.create,Householder.applyLeft,Householder.applyRight) are properly tracked by coverage tools, addressing the maintainer's suggestion from discussion #5.Test Coverage Results
Changes Made
New Test Module:
HouseholderQuotationTestsAdded a new test module in
tests/FsMath.Tests/LinearAlgebra.fswith:Quotation evaluation helper: Uses
Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotationto invoke inline functions in a way that coverage tools can track18 new tests covering:
Householder.createfunction (8 tests):[3, 0, 0],[4, 3])Householder.applyLeftfunction (5 tests):Householder.applyRightfunction (4 tests):Householdermathematical properties (1 test):Technical Approach
The quotation evaluation technique wraps inline function calls in F# quotations (
<@ ... @>) and evaluates them at runtime. For void-returning functions likeapplyLeftandapplyRight, the quotation is wrapped in a lambda:<@ fun () -> Householder.applyLeft(...) @>. This ensures the inline code is executed and tracked by the coverage tool.Replicating the Test Coverage Measurements
Install Dependencies & Build
Run Tests
dotnet test tests/FsMath.Tests/FsMath.Tests.fsprojExpected: 784 tests passing (782 passed, 2 skipped)
Generate Coverage Reports
Before changes (baseline on main branch):
After changes (on this PR branch):
Compare coverage:
Future Work Recommendations
Based on the coverage analysis, the following areas have low coverage and could benefit from similar quotation-based testing:
The quotation evaluation technique demonstrated here can be applied to these modules to significantly improve coverage tracking.
Notes
AssertHelpers.fsCommands Run
Web Searches Performed
None
Web Pages Fetched
None
🤖 Generated with Claude Code