Improve test coverage for src/utils.jl #952
Merged
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
This PR addresses issue #868 by adding comprehensive unit tests for all functions in
src/utils.jl
, significantly improving test coverage from the current 30.77%.Changes
test/utils.jl
- Comprehensive test suite for utils functionstest/runtests.jl
- Added utils tests to the main test suiteTest Coverage Added
The new test suite covers all functions in
src/utils.jl
:Core Functions
get_maxiters()
- Tests iterator size handling (with error handling for existing implementation issue)maybe_with_logger()
- Tests logger wrapper functionality with and without loggersdefault_logger()
- Tests logger creation with different log levels@withprogress
- Tests progress logging macro behaviordecompose_trace()
- Tests trace decomposition (passthrough function)Validation Functions
_check_and_convert_maxiters()
- Tests validation and conversion with positive values, error cases (≤0), and type conversion_check_and_convert_maxtime()
- Tests validation and conversion with positive values, error cases (≤0), and type conversionReturn Code Functions
deduce_retcode(::String)
- Tests all regex patterns for mapping stop reason strings to ReturnCode valuesdeduce_retcode(::Symbol)
- Tests symbolic return code mapping for all supported symbolsTest Results
Benefits
Closes #868
🤖 Generated with Claude Code