Skip to content

Commit

Permalink
test update
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Oct 31, 2023
1 parent 854d0b6 commit 6877dbb
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 20 deletions.
13 changes: 13 additions & 0 deletions model/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
#
# Ed Hartnett, 10/14/23

# 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 name)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/data/${name}"
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
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)

# Build and run the test.
add_executable(test_io test_io.F90)
target_link_libraries(test_io PRIVATE ww3_lib)
add_test(NAME test_io COMMAND test_io)
Expand Down
Binary file added model/tests/data/out_pnt.points
Binary file not shown.
8 changes: 8 additions & 0 deletions model/tests/data/ww3_outp.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$
20100101 000000 3600 1
$
1
-1
$
4
2 30 20100101 000000 'UTC'
74 changes: 54 additions & 20 deletions model/tests/test_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,65 @@
! Ed Hartnett 10/14/23
program test_io
use w3iopomd
USE W3ODATMD, ONLY: NDST, NDSE, IPASS => IPASS2, NOPTS, IPTINT, &
IL, IW, II, PTLOC, PTIFAC, DPO, WAO, WDO, &
ASO, CAO, CDO, SPCO, PTNME, O2INIT, FNMPRE, &
GRDID, ICEO, ICEHO, ICEFO
USE W3GDATMD, ONLY: NGRIDS, NAUXGR
! USE W3ODATMD, ONLY: NDST, NDSE, IPASS => IPASS2, NOPTS, IPTINT, &
! IL, IW, II, PTLOC, PTIFAC, DPO, WAO, WDO, &
! ASO, CAO, CDO, SPCO, PTNME, O2INIT, FNMPRE, &
! GRDID, ICEO, ICEHO, ICEFO
! USE W3GDATMD, ONLY: NGRIDS, NAUXGR
USE W3GDATMD
use w3wdatmd
use w3odatmd
implicit none

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

integer :: ndsop, iotst, imod
print *, 'Testing WW3 IO...'

ndsop = 10
iotst = 11
ipass => i
! Open file for error output.
ndse => j
ndse = 20
open(unit = ndse, file = "test_io_error")
ndst => k
ndst = 21
ngrids = 9
imod = 1
ndstst = 22
open(unit = ndstst, file = "test_io_test")
call w3iopo('WRITE', ndsop, iotst, imod)
call w3nmod(1, 6, 6)
call w3setg(1, 6, 6)
call w3ndat(6, 6)
call w3setw(1, 6, 6)
#ifdef w3_nl1
call w3naux(6, 6)
call w3seta(1, 6, 6)
#endif
call w3nout(6, 6)
call w3seto(1, 6, 6)

ndsi = 10
ndsm = 20
ndsop = 20
ndsbul = 0
#ifdef w3_nco
ndscbul = 0
#endif
ndstrc = 6
ntrace = 10

write (ndso,900)
900 FORMAT (/15X,' *** WAVEWATCH III Point output post.*** '/ &
15X,'==============================================='/)

open(ndsi, file = 'ww3_outp.inp', status='old', iostat = ierr)
if (ierr .ne. 0) stop 10

! ndsop = 10
! iotst = 11
! ipass => i
! ! Open file for error output.
! ndse => j
! ndse = 20
! open(unit = ndse, file = "test_io_error")
! ndst => k
! ndst = 21
! ngrids = 9
! imod = 1
! ndstst = 22
! open(unit = ndstst, file = "test_io_test")
! call w3iopo('WRITE', ndsop, iotst, imod)
call w3iopo('READ', ndsop, iotst, imod)
if (iotst .ne. 0) stop 10
close(20)

Expand Down

0 comments on commit 6877dbb

Please sign in to comment.