Skip to content

Commit

Permalink
Add testcase for static array access.
Browse files Browse the repository at this point in the history
  • Loading branch information
vehre committed Oct 8, 2021
1 parent e90b091 commit a92ba10
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ if(opencoarrays_aware_compiler)
add_caf_test(get_with_offset_1d 2 get_with_offset_1d)
add_caf_test(whole_get_array 2 whole_get_array)
add_caf_test(strided_get 2 strided_get)
add_caf_test(get_static_array 2 get_static_array)

# Pure send tests
add_caf_test(send_array 2 send_array)
Expand Down
1 change: 1 addition & 0 deletions src/tests/unit/send-get/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ caf_compile_executable(strided_get strided_get.f90)
caf_compile_executable(get_with_vector_index get_with_vector_index.f90)
## Inquiry functions (these are gets that could be optimized in the future to communicate only the descriptors)
caf_compile_executable(alloc_comp_multidim_shape alloc_comp_multidim_shape.F90)
caf_compile_executable(get_static_array get_static_array.f90)

## Pure send() tests
caf_compile_executable(send_array send_array_test.f90)
Expand Down
23 changes: 23 additions & 0 deletions src/tests/unit/send-get/get_static_array.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
program get_static_array
type :: container
integer, allocatable :: stuff(:)
end type

type(container) :: co_containers(10)[*]

if (this_image() == 1) then
allocate(co_containers(2)%stuff(4))
co_containers(2)%stuff = [1,2,3,4]
end if

sync all

if (this_image() == 2) then
if (any(co_containers(2)[1]%stuff /= [1,2,3,4])) then
error stop "Test failed."
else
print *, "Test passed."
end if
end if
end program

0 comments on commit a92ba10

Please sign in to comment.