Skip to content

Commit

Permalink
add self swap tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jalvesz committed Sep 8, 2024
1 parent 0fa4450 commit 0daa4d8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/math/test_stdlib_math.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ contains
if (allocated(error)) return
call check(error, all( y == [${t1}$ :: 1, 2, 3] ) )
if (allocated(error)) return

! check self swap
call swap(x,x)

call check(error, all( x == [${t1}$ :: 4, 5, 6] ) )
if (allocated(error)) return
end subroutine test_swap_${k1}$
#:endfor

Expand All @@ -286,6 +292,12 @@ contains
if (allocated(error)) return
call check(error, all( y == cmplx( [1, 2, 3] , [4, 5, 6] ) ) )
if (allocated(error)) return

! check self swap
call swap(x,x)

call check(error, all( x == cmplx( [4, 5, 6] , [1, 2, 3] ) ) )
if (allocated(error)) return
end subroutine test_swap_c${k1}$
#:endfor

Expand All @@ -302,6 +314,12 @@ contains
if (allocated(error)) return
call check(error, all( y == ['abcde','fghij'] ) )
if (allocated(error)) return

! check self swap
call swap(x,x)

call check(error, all( x == ['fghij','abcde'] ) )
if (allocated(error)) return
end subroutine test_swap_str

#:for k1 in CMPLX_KINDS
Expand Down

0 comments on commit 0daa4d8

Please sign in to comment.