Skip to content

Commit

Permalink
test development
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Nov 1, 2023
1 parent 6877dbb commit 2e2ca18
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions model/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,19 @@ function(copy_test_data name)
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
endfunction()

# Some very small test files may be committed to the repo. This
# function copies such a data file to the build directory.
function(copy_test_data_2 dir srcname destname)
file(COPY "${CMAKE_SOURCE_DIR}/${dir}/${srcname}"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/${srcname}" "${CMAKE_CURRENT_BINARY_DIR}/${destname}")
endfunction()

# Copy test data files that are in the repo to the build directory.
copy_test_data(ww3_outp.inp)
copy_test_data(out_pnt.points)
copy_test_data_2(regtests/mww3_test_05/work_ST4_PR2_UQ_MPI mod_def.points mod_def.ww3)

# Build and run the test.
add_executable(test_io test_io.F90)
Expand Down
18 changes: 18 additions & 0 deletions model/tests/test_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ program test_io
USE W3GDATMD
use w3wdatmd
use w3odatmd
use w3iogrmd
USE W3ADATMD
implicit none

integer, target :: i, j, k, l
integer :: ndsop, iotst, imod, ndstst, ierr, ndsbul, ndsi, ndsm
integer :: ndstrc, ntrace
real :: m2km

print *, 'Testing WW3 IO...'

Expand Down Expand Up @@ -47,6 +50,21 @@ program test_io
open(ndsi, file = 'ww3_outp.inp', status='old', iostat = ierr)
if (ierr .ne. 0) stop 10

! 2. Read model definition file.
CALL W3IOGR('READ', NDSM)
WRITE (NDSO,920) GNAME
920 FORMAT (' Grid name : ',A/)

IF (FLAGLL) THEN
M2KM = 1.
ELSE
M2KM = 1.E-3
END IF

! DIMXP = ((NK+1)/2) * ((NTH-1)/2)
! ALLOCATE(XPART(DIMP,0:DIMXP))
! XPART = UNDEF

! ndsop = 10
! iotst = 11
! ipass => i
Expand Down

0 comments on commit 2e2ca18

Please sign in to comment.