Skip to content

Commit 068d3c6

Browse files
committed
Update diff tests.
1 parent b6f0ab1 commit 068d3c6

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Features available from the latest git source
2222
- new procedures `arg`, `argd` and `argpi`
2323
[#498](https://github.com/fortran-lang/stdlib/pull/498)
2424
- new procedure `diff`
25+
[#605](https://github.com/fortran-lang/stdlib/pull/605)
2526

2627
Changes to existing modules
2728

src/tests/math/test_stdlib_math.fypp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ contains
378378
type(error_type), allocatable, intent(out) :: error
379379
${t1}$ :: x(6) = [${t1}$ :: 0, 5, 15, 30, 50, 75]
380380
${t1}$ :: A(1, 3) = reshape([${t1}$ :: 1, 3, 5], [1, 3])
381+
${t1}$ :: B(2) = [${t1}$ :: 1, 2]
381382

382383
call check(error, all_close(diff(x), [${t1}$ :: 5, 10, 15, 20, 25]), &
383384
"diff(x) in test_diff_real_${k1}$ failed")
@@ -391,6 +392,10 @@ contains
391392
"diff(x, n=1, dim=2) in test_diff_real_${k1}$ failed")
392393
if (allocated(error)) return
393394

395+
call check(error, size(diff(B, 2)), 0, "size(diff(B, 2)) in test_diff_real_${k1}$ failed")
396+
if (allocated(error)) return
397+
call check(error, size(diff(B, 3)), 0, "size(diff(B, 3)) in test_diff_real_${k1}$ failed")
398+
394399
end subroutine test_diff_real_${k1}$
395400
#:endfor
396401

@@ -399,6 +404,7 @@ contains
399404
type(error_type), allocatable, intent(out) :: error
400405
${t1}$ :: x(6) = [${t1}$ :: 0, 5, 15, 30, 50, 75]
401406
${t1}$ :: A(1, 3) = reshape([${t1}$ :: 1, 3, 5], [1, 3])
407+
${t1}$ :: B(2) = [${t1}$ :: 1, 2]
402408

403409
call check(error, all(diff(x) == [${t1}$ :: 5, 10, 15, 20, 25]), &
404410
"diff(x) in test_diff_int_${k1}$ failed")
@@ -412,6 +418,10 @@ contains
412418
"diff(A, n=1, dim=2) in test_diff_int_${k1}$ failed")
413419
if (allocated(error)) return
414420

421+
call check(error, size(diff(B, 2)), 0, "size(diff(B, 2)) in test_diff_real_${k1}$ failed")
422+
if (allocated(error)) return
423+
call check(error, size(diff(B, 3)), 0, "size(diff(B, 3)) in test_diff_real_${k1}$ failed")
424+
415425
end subroutine test_diff_int_${k1}$
416426
#:endfor
417427

0 commit comments

Comments
 (0)