Skip to content
Snippets Groups Projects
Commit 05ff86f0 authored by Moritz Hanke's avatar Moritz Hanke
Browse files

improves test coverage for icon reader

parent e0142f59
No related branches found
No related tags found
No related merge requests found
......@@ -957,6 +957,7 @@ AS_VAR_IF([enable_utils], [yes],
tests/utils/test_read_cube_csv.sh
tests/utils/test_read_fesom.sh
tests/utils/test_read_icon.sh
tests/utils/test_read_icon_c.sh
tests/utils/test_read_icon_parallel.sh
tests/utils/test_read_mpiom.sh
tests/utils/test_read_scrip.sh
......
......@@ -2,6 +2,6 @@
!
! SPDX-License-Identifier: BSD-3-Clause
#define EXIT_SKIP_TEST 77
#define test(arg) test_r((arg), __FILE__, __LINE__)
#define test_v(arg) test_v_r((arg), __FILE__, __LINE__)
......@@ -25,6 +25,7 @@ test_SCRIPTS_ = \
test_read_cube_csv.sh \
test_read_fesom.sh \
test_read_icon.sh \
test_read_icon_c.sh \
test_read_icon_parallel.sh \
test_read_mpiom.sh \
test_read_scrip.sh \
......@@ -43,7 +44,7 @@ if HAVE_NETCDF
check_PROGRAMS += \
test_generate_cubed_sphere.x \
test_read_fesom.x \
test_read_icon.x \
test_read_icon_c.x \
test_read_mpiom.x \
test_read_scrip_c.x \
test_read_woa_data.x
......@@ -51,6 +52,7 @@ endif
if ENABLE_FORTRAN_BINDINGS
check_PROGRAMS += \
test_read_icon.x \
test_read_scrip.x
endif ENABLE_FORTRAN_BINDINGS
......@@ -152,6 +154,10 @@ test_duplicate_stencils_parallel_x_LDADD = $(FCLDADD)
test_duplicate_stencils_parallel_x_SOURCES = test_duplicate_stencils_parallel.F90 test_read_scrip_common.c test_read_scrip_common.h
test_duplicate_stencils_parallel.$(OBJEXT): $(utest_FCDEPS)
test_read_icon_x_LDADD = $(FCLDADD)
test_read_icon_x_SOURCES = test_read_icon.F90
test_read_icon.$(OBJEXT): $(utest_FCDEPS)
test_read_scrip_parallel_c_x_SOURCES = test_read_scrip_parallel_c.c test_read_scrip_common.c test_read_scrip_common.h
test_read_scrip_c_x_SOURCES = test_read_scrip_c.c test_read_scrip_common.c test_read_scrip_common.h
......
! Copyright (c) 2024 The YAC Authors
!
! SPDX-License-Identifier: BSD-3-Clause
#include "test_macros.inc"
PROGRAM main
USE, INTRINSIC :: iso_c_binding
USE utest
USE yac_core
USE yac_utils
CHARACTER(LEN=1024) :: grid_dir
INTERFACE
FUNCTION yac_file_exists_c ( path ) BIND ( c, name='yac_file_exists' )
USE, INTRINSIC :: iso_c_binding, only : c_char, c_int
CHARACTER(KIND=c_char), DIMENSION(*) :: path
INTEGER(KIND=c_int) :: yac_file_exists_c
END FUNCTION yac_file_exists_c
END INTERFACE
! ===================================================================
CALL start_test('read_icon')
CALL test(command_argument_count() == 1)
IF (command_argument_count() /= 1) THEN
PRINT *, "ERROR: missing grid file directory"
CALL stop_test
CALL exit_tests
ELSE
CALL get_command_argument(1, grid_dir)
END IF
IF (0_c_int == &
yac_file_exists_c( &
TRIM(grid_dir)//"icon_grid_0030_R02B03_G.nc"//c_null_char)) THEN
STOP EXIT_SKIP_TEST
END IF
! ===================================================================
! yac_read_icon_basic_grid
! ===================================================================
BLOCK
TYPE(c_ptr) :: icon_grid
icon_grid = &
yac_read_icon_basic_grid_c( &
TRIM(grid_dir)//"icon_grid_0030_R02B03_G.nc"//c_null_char, &
"icon_grid")
CALL test(yac_basic_grid_get_data_size_c(icon_grid, YAC_LOC_CELL) == 5120)
CALL yac_basic_grid_delete_c(icon_grid)
END BLOCK
CALL stop_test
CALL exit_tests
END PROGRAM main
......@@ -5,6 +5,7 @@
# SPDX-License-Identifier: CC0-1.0
@HAVE_NETCDF_FALSE@exit 77
@ENABLE_FORTRAN_BINDINGS_FALSE@exit 77
GRID_DIR=@top_builddir@/grids/
......
File moved
#!@SHELL@
# Copyright (c) 2024 The YAC Authors
#
# SPDX-License-Identifier: CC0-1.0
@HAVE_NETCDF_FALSE@exit 77
GRID_DIR=@top_builddir@/grids/
./test_read_icon_c.x $GRID_DIR
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment