@@ -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")
@@ -387,10 +388,27 @@ contains
387388 "diff(x, n=2) in test_diff_real_${k1}$ failed")
388389 if (allocated(error)) return
389390
391+ call check(error, all_close(diff(x, prepend=[${t1}$ :: 1]), [${t1}$ :: -1, 5, 10, 15, 20, 25]), &
392+ "diff(x, prepend=[${t1}$ :: 1]) in test_diff_real_${k1}$ failed")
393+ if (allocated(error)) return
394+ call check(error, all_close(diff(x, append=[${t1}$ :: 1]), [${t1}$ :: 5, 10, 15, 20, 25, -74]), &
395+ "diff(x, append=[${t1}$ :: 1]) in test_diff_real_${k1}$ failed")
396+ if (allocated(error)) return
397+
390398 call check(error, all_close(diff(A, n=1, dim=2), reshape([${t1}$ :: 2, 2], [1, 2])), &
391399 "diff(x, n=1, dim=2) in test_diff_real_${k1}$ failed")
392400 if (allocated(error)) return
393401
402+ call check(error, all_close(diff(A, n=1, dim=2, prepend=reshape([${t1}$ :: 1], [1, 1]), &
403+ append=reshape([${t1}$ :: 2], [1, 1])), reshape([${t1}$ :: 0, 2, 2, -3], [1, 4])), &
404+ "diff(x, n=1, dim=2, prepend=reshape([${t1}$ :: 1], [1, 1]), &
405+ &append=reshape([${t1}$ :: 2], [1, 1])) in test_diff_real_${k1}$ failed")
406+ if (allocated(error)) return
407+
408+ call check(error, size(diff(B, 2)), 0, "size(diff(B, 2)) in test_diff_real_${k1}$ failed")
409+ if (allocated(error)) return
410+ call check(error, size(diff(B, 3)), 0, "size(diff(B, 3)) in test_diff_real_${k1}$ failed")
411+
394412 end subroutine test_diff_real_${k1}$
395413 #:endfor
396414
@@ -399,11 +417,15 @@ contains
399417 type(error_type), allocatable, intent(out) :: error
400418 ${t1}$ :: x(6) = [${t1}$ :: 0, 5, 15, 30, 50, 75]
401419 ${t1}$ :: A(1, 3) = reshape([${t1}$ :: 1, 3, 5], [1, 3])
420+ ${t1}$ :: B(2) = [${t1}$ :: 1, 2]
402421
403422 call check(error, all(diff(x) == [${t1}$ :: 5, 10, 15, 20, 25]), &
404423 "diff(x) in test_diff_int_${k1}$ failed")
405424 if (allocated(error)) return
406425
426+ call check(error, all(diff(x, n=0) == x), &
427+ "diff(x, n=0) in test_diff_int_${k1}$ failed")
428+ if (allocated(error)) return
407429 call check(error, all(diff(x, n=2) == [${t1}$ :: 5, 5, 5, 5]), &
408430 "diff(x, n=2) in test_diff_int_${k1}$ failed")
409431 if (allocated(error)) return
@@ -412,6 +434,10 @@ contains
412434 "diff(A, n=1, dim=2) in test_diff_int_${k1}$ failed")
413435 if (allocated(error)) return
414436
437+ call check(error, size(diff(B, 2)), 0, "size(diff(B, 2)) in test_diff_real_${k1}$ failed")
438+ if (allocated(error)) return
439+ call check(error, size(diff(B, 3)), 0, "size(diff(B, 3)) in test_diff_real_${k1}$ failed")
440+
415441 end subroutine test_diff_int_${k1}$
416442 #:endfor
417443
0 commit comments