-
Notifications
You must be signed in to change notification settings - Fork 0
Add L1-L4 tests for interpolation and diff_integ modules #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Interpolation (49 tests): - L1: 9/9 PASS - DBINT4, DBVALU, DPCHIM, DPCHFE, DPLINT, DPOLVL - L2: 14/17 PASS - B-spline issues identified, PCHIP and polynomial OK - L3: 4/4 PASS - IBM 360 golden values via Hercules/TK4- - L4: 19/19 PASS - Runge phenomenon, subnormals, cancellation Diff_Integ (43 tests): - L1: 12/12 PASS - DGAUS8, DQAGS, DQAGI, DQNG - L2: 17/17 PASS - Gauss-Kronrod exactness, classical integrals - L3: 2/2 PASS - Trapezoidal rule (QUADPACK post-1983, N/A) - L4: 12/12 PASS - Extreme values, oscillatory, reproducibility Total test count: 464/471 (3 B-spline mathematical issues documented)
📝 WalkthroughWalkthroughThis pull request adds comprehensive test suites for interpolation and differentiation/integration routines across all four test levels (Level 1 regression, Level 2 mathematical verification, Level 3 historical baseline, and Level 4 hostile environments). Documentation files are updated to reflect new test coverage, statuses, and detailed test results. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
🤖 Fix all issues with AI agents
In `@TEST_RESULTS.md`:
- Line 3: Convert the emphasized line "*Comprehensive test execution log — 18
January 2026*" into a proper Markdown heading to satisfy MD036; replace the
asterisks with a heading marker (e.g., prefix with "#" or "##") so the line
becomes a heading like "## Comprehensive test execution log — 18 January 2026",
ensuring it renders as a heading rather than emphasis.
In `@test/level1_regression/test_l1_diff_integ.f90`:
- Line 96: The long FORMAT print statements using the literal format
"(A,ES15.8,A,ES15.8)" (e.g., the line containing print '(A,ES15.8,A,ES15.8)', '
[FAIL] integral(sin(x), 0, pi) = ', result, ' expected ', exact and the similar
one at line 108) exceed 100 characters; break the string into multiple
concatenated literals or use Fortran line continuation so no source line exceeds
100 chars—e.g., split the message into two prints or use & continuation to split
the arguments across lines while keeping the same format specifier and variables
(result, exact) to preserve output.
In `@test/level2_mathematical/README.md`:
- Line 68: The heading "#### Interpolation Test Results (2025-01-18)" contains
the wrong year; update that header string to "#### Interpolation Test Results
(2026-01-18)" so the README date matches the PR context and intended 2026-01-18
date.
In `@test/level2_mathematical/test_l2_diff_integ.f90`:
- Line 196: The long FORTRAN print statements using the format
'(A,ES22.15,A,ES22.15)' (e.g. printing " [FAIL] int(x^5*exp(-x), 0, inf) = "
with result and exact) exceed the 100‑char lint rule; split these into shorter
lines by concatenating string literals or using multiple print calls while
preserving the same format descriptors and output order — update the offending
print using '(A,ES22.15,A,ES22.15)' and the similar fail messages elsewhere (the
other occurrences using the same format/message pattern) so every source line is
under 100 characters.
- Around line 12-16: The header incorrectly claims tests for DQK41/51/61 while
the file only exercises DQK15, DQK21 and DQK31; either add test cases that call
and validate DQK41, DQK51 and DQK61 (mirroring the existing DQK15/21/31 test
patterns) or change the header comment to list only DQK15/21/31 so it accurately
reflects coverage; update the header block in test_l2_diff_integ.f90 (the
comment listing "DQK15/21/31/41/51/61") accordingly and ensure any new tests
follow the same style and assertions as the existing DQK* tests if you choose to
add them.
In `@test/level4_hostile/test_l4_diff_integ.f90`:
- Around line 340-377: The reproducibility test (subroutine
test_reproducibility) currently compares result1/result2/result3 but never
checks the DQAGS error code (ier); add the same ier checks used elsewhere: after
each call to DQAGS(f_exp_neg_x2, ...) inspect ier and if ier /= 0 print a
failure message including the ier value, increment failed, and exit the
subroutine (or return) so a failing integration doesn't allow a false-positive
reproducibility pass. Ensure you reference the existing variables (ier, failed,
result1/result2/result3) and the DQAGS calls when adding these checks.
In `@test/level4_hostile/test_l4_interpolation.f90`:
- Around line 466-523: The test does not check DPCHIM and DPCHFE return codes;
after each call to DPCHIM(...) and DPCHFE(...) inspect ierr and if ierr < 0
print an error message, increment failed, and return immediately to fail fast;
reference the existing variables ierr, failed, passed, and the routines DPCHIM
and DPCHFE so you add the checks right after those calls (e.g., if (ierr < 0)
then print '... error ...', failed = failed + 1; return; end if).
🧹 Nitpick comments (12)
test/level1_regression/test_l1_diff_integ.f90 (2)
17-17: Considerimplicit none (type, external)for stricter checks.Fortitude C003 suggests adding the
externalspecifier for implicit typing of externals.💡 Suggested change
- implicit none + implicit none (type, external)Also applies to: 364-364
363-363: Preferonlyon the moduleuseto limit namespace exposure.This keeps the program scope tight.
💡 Suggested change
- use test_diff_integ_level1 + use test_diff_integ_level1, only: run_all_teststest/level1_regression/test_l1_interpolation.f90 (2)
19-19: Considerimplicit none (type, external)for stricter checks.Fortitude C003 suggests explicitly disabling implicit externals.
💡 Suggested change
- implicit none + implicit none (type, external)Also applies to: 437-437
121-122: Nameend subroutinestatements to satisfy Fortitude S061.This is a style/consistency lint rule. Consider naming each
end subroutine.💡 Example change
- end subroutine + end subroutine test_dbint4_runsAlso applies to: 156-157, 189-190, 241-242, 281-282, 314-315, 364-365, 397-398, 428-429
test/level2_mathematical/test_l2_diff_integ.f90 (2)
21-21: Considerimplicit none (type, external)for stricter checks.Fortitude C003 recommends disabling implicit externals explicitly.
💡 Suggested change
- implicit none + implicit none (type, external)Also applies to: 516-516
515-515: Preferonlyon the moduleuseto limit namespace exposure.This keeps the program scope tight.
💡 Suggested change
- use test_diff_integ_level2 + use test_diff_integ_level2, only: run_all_teststest/level2_mathematical/test_l2_interpolation.f90 (2)
1-26: Well-structured module header with clear documentation.The module is well-documented with references to authoritative sources (de Boor, Fritsch & Carlson, Burden & Faires). The tolerance
tol_dp = 1.0e-10_dpis appropriate for double precision comparisons.Minor note:
sp => real32is imported at line 18 but never used in this file.🔧 Remove unused import
- use, intrinsic :: iso_fortran_env, only: dp => real64, sp => real32 + use, intrinsic :: iso_fortran_env, only: dp => real64
621-628: Consider adding explicit imports for clarity.The main program is functional. For better clarity and to satisfy the static analysis hint, consider using an explicit
onlyclause.🔧 Add explicit import
program run_level2_interpolation - use test_interpolation_level2 + use test_interpolation_level2, only: run_all_tests implicit none integer :: passed, failed call run_all_tests(passed, failed) if (failed > 0) stop 1 end program run_level2_interpolationtest/level3_historical/test_l3_interpolation.f90 (2)
27-37: Unused parameters defined.
sp => real32(line 28) andtol_hex(line 36) are defined but never used in this file. Consider removing them for cleaner code.🔧 Remove unused definitions
module test_interpolation_level3 - use, intrinsic :: iso_fortran_env, only: dp => real64, sp => real32 + use, intrinsic :: iso_fortran_env, only: dp => real64 implicit none private public :: run_all_tests - ! Tolerances account for IBM Hex vs IEEE 754 differences real(dp), parameter :: tol_dp = 1.0e-12_dp - real(dp), parameter :: tol_hex = 1.0e-10_dp ! Looser for hex comparisons
233-246: Consider adding explicit imports.Similar to the Level 2 test, consider using an explicit
onlyclause for clarity.🔧 Add explicit import
program run_level3_interpolation - use test_interpolation_level3 + use test_interpolation_level3, only: run_all_tests implicit nonetest/level3_historical/test_l3_diff_integ.f90 (2)
73-131: Unused variableexact.The variable
exactis declared at line 78 and assigned values at lines 103 and 120, but it is never used. This appears to be dead code, possibly left over from earlier development where exact values were compared.🔧 Remove unused variable
subroutine test_polynomial_integrals_ibm360(passed, failed) integer, intent(out) :: passed, failed integer :: i integer, parameter :: n = 100 real(dp) :: h, x, sum_trap - real(dp) :: exact, result + real(dp) :: resultAnd remove the assignments:
result = sum_trap * h - exact = 1.0_dp / 3.0_dp if (abs(result - int_x2_trap) < 1.0e-10_dp) thenresult = sum_trap * h - exact = 0.25_dp if (abs(result - int_x3_trap) < 1.0e-10_dp) then
165-178: Consider adding explicit imports.Consistent with the other test files, consider using an explicit
onlyclause.🔧 Add explicit import
program run_level3_diff_integ - use test_diff_integ_level3 + use test_diff_integ_level3, only: run_all_tests implicit none
| # SLATEC-Modern Test Results | ||
|
|
||
| *Comprehensive test execution log — 1 January 2026* | ||
| *Comprehensive test execution log — 18 January 2026* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a heading instead of emphasis to satisfy markdownlint.
MD036 flags emphasis as a heading. Consider converting this line to a proper heading.
💡 Suggested change
-*Comprehensive test execution log — 18 January 2026*
+### Comprehensive test execution log — 18 January 2026📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| *Comprehensive test execution log — 18 January 2026* | |
| ### Comprehensive test execution log — 18 January 2026 |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
3-3: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🤖 Prompt for AI Agents
In `@TEST_RESULTS.md` at line 3, Convert the emphasized line "*Comprehensive test
execution log — 18 January 2026*" into a proper Markdown heading to satisfy
MD036; replace the asterisks with a heading marker (e.g., prefix with "#" or
"##") so the line becomes a heading like "## Comprehensive test execution log —
18 January 2026", ensuring it renders as a heading rather than emphasis.
| print '(A,ES15.8)', ' [PASS] integral(sin(x), 0, pi) = ', result | ||
| passed = passed + 1 | ||
| else | ||
| print '(A,ES15.8,A,ES15.8)', ' [FAIL] integral(sin(x), 0, pi) = ', result, ' expected ', exact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap long print lines to satisfy the 100‑char lint rule.
These lines exceed the limit flagged by Fortitude S001.
💡 Example wrap
- print '(A,ES15.8,A,ES15.8)', ' [FAIL] integral(sin(x), 0, pi) = ', result, ' expected ', exact
+ print '(A,ES15.8,A,ES15.8)', &
+ ' [FAIL] integral(sin(x), 0, pi) = ', result, ' expected ', exactAlso applies to: 108-108
🧰 Tools
🪛 Fortitude (0.7.5)
[error] 96-96: line length of 101, exceeds maximum 100
(S001)
🤖 Prompt for AI Agents
In `@test/level1_regression/test_l1_diff_integ.f90` at line 96, The long FORMAT
print statements using the literal format "(A,ES15.8,A,ES15.8)" (e.g., the line
containing print '(A,ES15.8,A,ES15.8)', ' [FAIL] integral(sin(x), 0, pi) = ',
result, ' expected ', exact and the similar one at line 108) exceed 100
characters; break the string into multiple concatenated literals or use Fortran
line continuation so no source line exceeds 100 chars—e.g., split the message
into two prints or use & continuation to split the arguments across lines while
keeping the same format specifier and variables (result, exact) to preserve
output.
| | Polynomial uniqueness theorem | Burden & Faires Thm 3.2 | ✓ PASS | | ||
| | Polynomial exactness for degree ≤ n-1 | Burden & Faires Cor 3.3 | ✓ PASS | | ||
|
|
||
| #### Interpolation Test Results (2025-01-18) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Date inconsistency.
The date "2025-01-18" appears incorrect. Based on the PR context (created 2026-01-19), this should likely be "2026-01-18".
📝 Fix date
-#### Interpolation Test Results (2025-01-18)
+#### Interpolation Test Results (2026-01-18)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #### Interpolation Test Results (2025-01-18) | |
| #### Interpolation Test Results (2026-01-18) |
🤖 Prompt for AI Agents
In `@test/level2_mathematical/README.md` at line 68, The heading "####
Interpolation Test Results (2025-01-18)" contains the wrong year; update that
header string to "#### Interpolation Test Results (2026-01-18)" so the README
date matches the PR context and intended 2026-01-18 date.
| !> Routines tested: | ||
| !> - DGAUS8: Verifies Gauss-Legendre quadrature exactness | ||
| !> - DQAGS: Verifies handling of endpoint singularities | ||
| !> - DQAGI: Verifies infinite interval integration | ||
| !> - DQK15/21/31/41/51/61: Verifies Gauss-Kronrod rule exactness |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, let's read the test file to see the header and understand the structure
head -100 test/level2_mathematical/test_l2_diff_integ.f90Repository: Zaneham/SLATEC
Length of output: 3605
🏁 Script executed:
# Search for actual calls to each QK routine in the test file
rg "call DQK(15|21|31|41|51|61)" test/level2_mathematical/test_l2_diff_integ.f90 -A 1Repository: Zaneham/SLATEC
Length of output: 363
🏁 Script executed:
# Comprehensive search for all DQK routine calls in the file
rg "call DQK(41|51|61)" test/level2_mathematical/test_l2_diff_integ.f90Repository: Zaneham/SLATEC
Length of output: 40
🏁 Script executed:
# Let's check the entire file to confirm which routines are actually tested
wc -l test/level2_mathematical/test_l2_diff_integ.f90Repository: Zaneham/SLATEC
Length of output: 109
🏁 Script executed:
# Search for DQK41, DQK51, DQK61 separately to confirm they're not used
grep -n "DQK41\|DQK51\|DQK61" test/level2_mathematical/test_l2_diff_integ.f90Repository: Zaneham/SLATEC
Length of output: 153
🏁 Script executed:
# Let's verify the test_gauss_kronrod_exactness subroutine more thoroughly
sed -n '58,120p' test/level2_mathematical/test_l2_diff_integ.f90Repository: Zaneham/SLATEC
Length of output: 2570
🏁 Script executed:
# Search more in the test_gauss_kronrod_exactness subroutine
sed -n '120,180p' test/level2_mathematical/test_l2_diff_integ.f90Repository: Zaneham/SLATEC
Length of output: 2379
Header lists DQK15/21/31/41/51/61, but tests only exercise DQK15/21/31.
Either add coverage for DQK41/51/61 or update the header to match actual test scope and avoid overstating coverage.
Suggested doc alignment
-!> - DQK15/21/31/41/51/61: Verifies Gauss-Kronrod rule exactness
+!> - DQK15/21/31: Verifies Gauss-Kronrod rule exactness📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| !> Routines tested: | |
| !> - DGAUS8: Verifies Gauss-Legendre quadrature exactness | |
| !> - DQAGS: Verifies handling of endpoint singularities | |
| !> - DQAGI: Verifies infinite interval integration | |
| !> - DQK15/21/31/41/51/61: Verifies Gauss-Kronrod rule exactness | |
| !> Routines tested: | |
| !> - DGAUS8: Verifies Gauss-Legendre quadrature exactness | |
| !> - DQAGS: Verifies handling of endpoint singularities | |
| !> - DQAGI: Verifies infinite interval integration | |
| !> - DQK15/21/31: Verifies Gauss-Kronrod rule exactness |
🤖 Prompt for AI Agents
In `@test/level2_mathematical/test_l2_diff_integ.f90` around lines 12 - 16, The
header incorrectly claims tests for DQK41/51/61 while the file only exercises
DQK15, DQK21 and DQK31; either add test cases that call and validate DQK41,
DQK51 and DQK61 (mirroring the existing DQK15/21/31 test patterns) or change the
header comment to list only DQK15/21/31 so it accurately reflects coverage;
update the header block in test_l2_diff_integ.f90 (the comment listing
"DQK15/21/31/41/51/61") accordingly and ensure any new tests follow the same
style and assertions as the existing DQK* tests if you choose to add them.
| print '(A,ES22.15)', ' [PASS] int(x^5*exp(-x), 0, inf) = ', result | ||
| passed = passed + 1 | ||
| else | ||
| print '(A,ES22.15,A,ES22.15)', ' [FAIL] int(x^5*exp(-x), 0, inf) = ', result, ' expected ', exact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap long print lines to satisfy the 100‑char lint rule.
These lines exceed the Fortitude S001 limit.
💡 Example wrap
- print '(A,ES22.15,A,ES22.15)', ' [FAIL] int(x^5*exp(-x), 0, inf) = ', result, ' expected ', exact
+ print '(A,ES22.15,A,ES22.15)', &
+ ' [FAIL] int(x^5*exp(-x), 0, inf) = ', result, ' expected ', exactAlso applies to: 336-336, 384-384, 396-396
🧰 Tools
🪛 Fortitude (0.7.5)
[error] 196-196: line length of 104, exceeds maximum 100
(S001)
🤖 Prompt for AI Agents
In `@test/level2_mathematical/test_l2_diff_integ.f90` at line 196, The long
FORTRAN print statements using the format '(A,ES22.15,A,ES22.15)' (e.g. printing
" [FAIL] int(x^5*exp(-x), 0, inf) = " with result and exact) exceed the
100‑char lint rule; split these into shorter lines by concatenating string
literals or using multiple print calls while preserving the same format
descriptors and output order — update the offending print using
'(A,ES22.15,A,ES22.15)' and the similar fail messages elsewhere (the other
occurrences using the same format/message pattern) so every source line is under
100 characters.
| subroutine test_reproducibility(passed, failed) | ||
| integer, intent(out) :: passed, failed | ||
| integer, parameter :: limit = 500, lenw = 4*limit | ||
| real(dp) :: result1, result2, result3, abserr | ||
| integer :: neval, ier, last | ||
| integer :: iwork(limit) | ||
| real(dp) :: work(lenw) | ||
|
|
||
| passed = 0 | ||
| failed = 0 | ||
|
|
||
| print '(A)', 'Reproducibility' | ||
| print '(A)', '---------------' | ||
|
|
||
| ! Test: Same integral computed three times should give identical results | ||
| call DQAGS(f_exp_neg_x2, 0.0_dp, 1.0_dp, 0.0_dp, 1.0e-12_dp, & | ||
| result1, abserr, neval, ier, limit, lenw, last, iwork, work) | ||
|
|
||
| call DQAGS(f_exp_neg_x2, 0.0_dp, 1.0_dp, 0.0_dp, 1.0e-12_dp, & | ||
| result2, abserr, neval, ier, limit, lenw, last, iwork, work) | ||
|
|
||
| call DQAGS(f_exp_neg_x2, 0.0_dp, 1.0_dp, 0.0_dp, 1.0e-12_dp, & | ||
| result3, abserr, neval, ier, limit, lenw, last, iwork, work) | ||
|
|
||
| if (result1 == result2 .and. result2 == result3) then | ||
| print '(A)', ' [PASS] Three identical calls give identical results' | ||
| passed = passed + 1 | ||
| else | ||
| print '(A)', ' [FAIL] Results differ between identical calls!' | ||
| print '(A,ES22.15)', ' Run 1: ', result1 | ||
| print '(A,ES22.15)', ' Run 2: ', result2 | ||
| print '(A,ES22.15)', ' Run 3: ', result3 | ||
| failed = failed + 1 | ||
| end if | ||
|
|
||
| print '(A)', '' | ||
|
|
||
| end subroutine test_reproducibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
head -n 400 test/level4_hostile/test_l4_diff_integ.f90 | tail -n 70Repository: Zaneham/SLATEC
Length of output: 2421
🏁 Script executed:
# Also check nearby context to understand the full subroutine structure
sed -n '330,390p' test/level4_hostile/test_l4_diff_integ.f90Repository: Zaneham/SLATEC
Length of output: 2155
🏁 Script executed:
# Check if there are error-handling patterns for ier elsewhere in the test file
rg -n "ier\s*[/!=<>]" test/level4_hostile/test_l4_diff_integ.f90Repository: Zaneham/SLATEC
Length of output: 968
🏁 Script executed:
# Also search for any documentation or comments about DQAGS error codes
rg -i "ier.*error\|error.*ier" . -t f --max-count=10Repository: Zaneham/SLATEC
Length of output: 83
Add error-status checks for DQAGS calls in reproducibility test.
The test only compares numerical results across three runs but does not validate the DQAGS error code (ier). If all three calls fail identically, the test will incorrectly pass. Every other test in this file checks ier == 0 after DQAGS invocation. Add the same error-handling pattern here to fail fast when DQAGS reports an error.
Suggested adjustment
call DQAGS(f_exp_neg_x2, 0.0_dp, 1.0_dp, 0.0_dp, 1.0e-12_dp, &
result1, abserr, neval, ier, limit, lenw, last, iwork, work)
+ if (ier /= 0) then
+ print '(A,I3)', ' [FAIL] DQAGS failed (run 1), ier=', ier
+ failed = failed + 1
+ return
+ end if
call DQAGS(f_exp_neg_x2, 0.0_dp, 1.0_dp, 0.0_dp, 1.0e-12_dp, &
result2, abserr, neval, ier, limit, lenw, last, iwork, work)
+ if (ier /= 0) then
+ print '(A,I3)', ' [FAIL] DQAGS failed (run 2), ier=', ier
+ failed = failed + 1
+ return
+ end if
call DQAGS(f_exp_neg_x2, 0.0_dp, 1.0_dp, 0.0_dp, 1.0e-12_dp, &
result3, abserr, neval, ier, limit, lenw, last, iwork, work)
+ if (ier /= 0) then
+ print '(A,I3)', ' [FAIL] DQAGS failed (run 3), ier=', ier
+ failed = failed + 1
+ return
+ end if🤖 Prompt for AI Agents
In `@test/level4_hostile/test_l4_diff_integ.f90` around lines 340 - 377, The
reproducibility test (subroutine test_reproducibility) currently compares
result1/result2/result3 but never checks the DQAGS error code (ier); add the
same ier checks used elsewhere: after each call to DQAGS(f_exp_neg_x2, ...)
inspect ier and if ier /= 0 print a failure message including the ier value,
increment failed, and exit the subroutine (or return) so a failing integration
doesn't allow a false-positive reproducibility pass. Ensure you reference the
existing variables (ier, failed, result1/result2/result3) and the DQAGS calls
when adding these checks.
| subroutine test_reproducibility(passed, failed) | ||
| use interpolation, only: DPCHIM, DPCHFE | ||
| integer, intent(out) :: passed, failed | ||
| integer, parameter :: n = 7 | ||
| integer, parameter :: incfd = 1 | ||
| integer, parameter :: nruns = 3 | ||
| integer :: i, run, ierr, ne | ||
| real(dp) :: x(n), f(incfd,n), d(incfd,n) | ||
| real(dp) :: xe(5), fe(5), fe_prev(5) | ||
| logical :: skip, is_reproducible | ||
|
|
||
| passed = 0 | ||
| failed = 0 | ||
|
|
||
| print '(A)', 'REPRODUCIBILITY' | ||
| print '(A)', '---------------' | ||
| print '(A)', 'Tests that identical inputs give identical outputs' | ||
| print '(A)', '' | ||
|
|
||
| ! Setup test data | ||
| do i = 1, n | ||
| x(i) = real(i-1, dp) * 0.5_dp | ||
| f(1,i) = exp(-x(i)) | ||
| end do | ||
|
|
||
| xe = [0.25_dp, 0.75_dp, 1.25_dp, 1.75_dp, 2.25_dp] | ||
| ne = 5 | ||
|
|
||
| is_reproducible = .true. | ||
|
|
||
| do run = 1, nruns | ||
| call DPCHIM(n, x, f, d, incfd, ierr) | ||
| skip = .false. | ||
| call DPCHFE(n, x, f, d, incfd, skip, ne, xe, fe, ierr) | ||
|
|
||
| if (run > 1) then | ||
| do i = 1, ne | ||
| if (fe(i) /= fe_prev(i)) then | ||
| is_reproducible = .false. | ||
| exit | ||
| end if | ||
| end do | ||
| end if | ||
|
|
||
| fe_prev = fe | ||
| end do | ||
|
|
||
| if (is_reproducible) then | ||
| print '(A,I2,A)', ' [PASS] PCHIP reproducible over ', nruns, ' runs' | ||
| passed = passed + 1 | ||
| else | ||
| print '(A)', ' [FAIL] PCHIP not reproducible (parallel reduction variance?)' | ||
| failed = failed + 1 | ||
| end if | ||
|
|
||
| print '(A)', '' | ||
|
|
||
| end subroutine test_reproducibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, let's check the test file to confirm the current state
cat -n test/level4_hostile/test_l4_interpolation.f90 | sed -n '466,523p'Repository: Zaneham/SLATEC
Length of output: 1948
🏁 Script executed:
# Search for DPCHIM and DPCHFE function definitions and documentation
find . -name "*.f90" -o -name "*.f" | head -20Repository: Zaneham/SLATEC
Length of output: 873
🏁 Script executed:
# Search for DPCHIM and DPCHFE in the codebase to understand their signatures
rg "subroutine DPCHIM|subroutine DPCHFE" -A 5Repository: Zaneham/SLATEC
Length of output: 40
🏁 Script executed:
# Look for other tests that use DPCHIM or DPCHFE and see how they handle errors
rg "DPCHIM|DPCHFE" test/ -B 2 -A 5Repository: Zaneham/SLATEC
Length of output: 24447
🏁 Script executed:
# Check the interpolation module to understand error codes
rg "DPCHIM|DPCHFE" src/modern/interpolation/ -B 2 -A 3 | head -100Repository: Zaneham/SLATEC
Length of output: 7041
🏁 Script executed:
# Look at the closely_spaced_data test to see error handling pattern
sed -n '370,430p' test/level4_hostile/test_l4_interpolation.f90Repository: Zaneham/SLATEC
Length of output: 1983
🏁 Script executed:
# Check test_l2_mathematical pattern more closely
sed -n '85,130p' test/level2_mathematical/test_l2_interpolation.f90Repository: Zaneham/SLATEC
Length of output: 1410
🏁 Script executed:
# Look at DPCHIM implementation to understand error codes
sed -n '1,150p' src/modern/interpolation/pchip/dpchim.inc | tail -50Repository: Zaneham/SLATEC
Length of output: 2518
🏁 Script executed:
# Check the full DPCHIM implementation for error code handling
cat src/modern/interpolation/pchip/dpchim.inc | grep -A 50 "ERROR STOP" | head -60Repository: Zaneham/SLATEC
Length of output: 1721
🏁 Script executed:
# Examine the test_reproducibility context - what's before and after it
sed -n '450,530p' test/level4_hostile/test_l4_interpolation.f90Repository: Zaneham/SLATEC
Length of output: 2460
🏁 Script executed:
# Look at DPCHIM return behavior more closely
grep -A 200 "Ierr = 0" src/modern/interpolation/pchip/dpchim.inc | head -30Repository: Zaneham/SLATEC
Length of output: 902
🏁 Script executed:
# Check if DPCHFE also sets error codes similarly
grep -B 5 -A 10 "Ierr" src/modern/interpolation/pchip/dpchfe.inc | head -50Repository: Zaneham/SLATEC
Length of output: 1357
🏁 Script executed:
# Verify error handling in a comparable level4 test
sed -n '200,260p' test/level4_hostile/test_l4_interpolation.f90Repository: Zaneham/SLATEC
Length of output: 2003
Add error checking for DPCHIM and DPCHFE to fail fast on errors.
The reproducibility test calls both routines but doesn't check if they succeed. If either returns ierr < 0, the test can still "pass" because it only compares if outputs are identical—not whether the computations succeeded. Add error checks and return early on failure to ensure errors are caught immediately.
Suggested fix
do run = 1, nruns
call DPCHIM(n, x, f, d, incfd, ierr)
+ if (ierr < 0) then
+ print '(A,I4)', ' [FAIL] DPCHIM failed, ierr=', ierr
+ failed = failed + 1
+ return
+ end if
skip = .false.
call DPCHFE(n, x, f, d, incfd, skip, ne, xe, fe, ierr)
+ if (ierr < 0) then
+ print '(A,I4)', ' [FAIL] DPCHFE failed, ierr=', ierr
+ failed = failed + 1
+ return
+ end if📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| subroutine test_reproducibility(passed, failed) | |
| use interpolation, only: DPCHIM, DPCHFE | |
| integer, intent(out) :: passed, failed | |
| integer, parameter :: n = 7 | |
| integer, parameter :: incfd = 1 | |
| integer, parameter :: nruns = 3 | |
| integer :: i, run, ierr, ne | |
| real(dp) :: x(n), f(incfd,n), d(incfd,n) | |
| real(dp) :: xe(5), fe(5), fe_prev(5) | |
| logical :: skip, is_reproducible | |
| passed = 0 | |
| failed = 0 | |
| print '(A)', 'REPRODUCIBILITY' | |
| print '(A)', '---------------' | |
| print '(A)', 'Tests that identical inputs give identical outputs' | |
| print '(A)', '' | |
| ! Setup test data | |
| do i = 1, n | |
| x(i) = real(i-1, dp) * 0.5_dp | |
| f(1,i) = exp(-x(i)) | |
| end do | |
| xe = [0.25_dp, 0.75_dp, 1.25_dp, 1.75_dp, 2.25_dp] | |
| ne = 5 | |
| is_reproducible = .true. | |
| do run = 1, nruns | |
| call DPCHIM(n, x, f, d, incfd, ierr) | |
| skip = .false. | |
| call DPCHFE(n, x, f, d, incfd, skip, ne, xe, fe, ierr) | |
| if (run > 1) then | |
| do i = 1, ne | |
| if (fe(i) /= fe_prev(i)) then | |
| is_reproducible = .false. | |
| exit | |
| end if | |
| end do | |
| end if | |
| fe_prev = fe | |
| end do | |
| if (is_reproducible) then | |
| print '(A,I2,A)', ' [PASS] PCHIP reproducible over ', nruns, ' runs' | |
| passed = passed + 1 | |
| else | |
| print '(A)', ' [FAIL] PCHIP not reproducible (parallel reduction variance?)' | |
| failed = failed + 1 | |
| end if | |
| print '(A)', '' | |
| end subroutine test_reproducibility | |
| subroutine test_reproducibility(passed, failed) | |
| use interpolation, only: DPCHIM, DPCHFE | |
| integer, intent(out) :: passed, failed | |
| integer, parameter :: n = 7 | |
| integer, parameter :: incfd = 1 | |
| integer, parameter :: nruns = 3 | |
| integer :: i, run, ierr, ne | |
| real(dp) :: x(n), f(incfd,n), d(incfd,n) | |
| real(dp) :: xe(5), fe(5), fe_prev(5) | |
| logical :: skip, is_reproducible | |
| passed = 0 | |
| failed = 0 | |
| print '(A)', 'REPRODUCIBILITY' | |
| print '(A)', '---------------' | |
| print '(A)', 'Tests that identical inputs give identical outputs' | |
| print '(A)', '' | |
| ! Setup test data | |
| do i = 1, n | |
| x(i) = real(i-1, dp) * 0.5_dp | |
| f(1,i) = exp(-x(i)) | |
| end do | |
| xe = [0.25_dp, 0.75_dp, 1.25_dp, 1.75_dp, 2.25_dp] | |
| ne = 5 | |
| is_reproducible = .true. | |
| do run = 1, nruns | |
| call DPCHIM(n, x, f, d, incfd, ierr) | |
| if (ierr < 0) then | |
| print '(A,I4)', ' [FAIL] DPCHIM failed, ierr=', ierr | |
| failed = failed + 1 | |
| return | |
| end if | |
| skip = .false. | |
| call DPCHFE(n, x, f, d, incfd, skip, ne, xe, fe, ierr) | |
| if (ierr < 0) then | |
| print '(A,I4)', ' [FAIL] DPCHFE failed, ierr=', ierr | |
| failed = failed + 1 | |
| return | |
| end if | |
| if (run > 1) then | |
| do i = 1, ne | |
| if (fe(i) /= fe_prev(i)) then | |
| is_reproducible = .false. | |
| exit | |
| end if | |
| end do | |
| end if | |
| fe_prev = fe | |
| end do | |
| if (is_reproducible) then | |
| print '(A,I2,A)', ' [PASS] PCHIP reproducible over ', nruns, ' runs' | |
| passed = passed + 1 | |
| else | |
| print '(A)', ' [FAIL] PCHIP not reproducible (parallel reduction variance?)' | |
| failed = failed + 1 | |
| end if | |
| print '(A)', '' | |
| end subroutine test_reproducibility |
🤖 Prompt for AI Agents
In `@test/level4_hostile/test_l4_interpolation.f90` around lines 466 - 523, The
test does not check DPCHIM and DPCHFE return codes; after each call to
DPCHIM(...) and DPCHFE(...) inspect ierr and if ierr < 0 print an error message,
increment failed, and return immediately to fail fast; reference the existing
variables ierr, failed, passed, and the routines DPCHIM and DPCHFE so you add
the checks right after those calls (e.g., if (ierr < 0) then print '... error
...', failed = failed + 1; return; end if).
Interpolation (49 tests):
Diff_Integ (43 tests):
Total test count: 464/471 (3 B-spline mathematical issues documented)
Summary by CodeRabbit
Tests
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.