YAC 3.13.0
Yet Another Coupler
Loading...
Searching...
No Matches
test_read_icon.F90
Go to the documentation of this file.
1! Copyright (c) 2024 The YAC Authors
2!
3! SPDX-License-Identifier: BSD-3-Clause
4
8
9#include "test_macros.inc"
10
11PROGRAM main
12
13 use, INTRINSIC :: iso_c_binding
14 USE utest
15 USE yac_core
16 USE yac_utils
17
18 CHARACTER(LEN=1024) :: grid_dir
19
20 INTERFACE
21 FUNCTION yac_file_exists_c ( path ) bind ( c, name='yac_file_exists' )
22 use, INTRINSIC :: iso_c_binding, only : c_char, c_int
23 CHARACTER(KIND=c_char), DIMENSION(*) :: path
24 INTEGER(KIND=c_int) :: yac_file_exists_c
25 END FUNCTION yac_file_exists_c
26 END INTERFACE
27
28 ! ===================================================================
29
30 CALL start_test('read_icon')
31
32 CALL test(command_argument_count() == 1)
33
34 IF (command_argument_count() /= 1) THEN
35 print *, "ERROR: missing grid file directory"
36 CALL stop_test
37 CALL exit_tests
38 ELSE
39 CALL get_command_argument(1, grid_dir)
40 END IF
41
42 IF (0_c_int == &
43 yac_file_exists_c( &
44 trim(grid_dir)//"icon_grid_0030_R02B03_G.nc"//c_null_char)) THEN
45
46 stop exit_skip_test
47 END IF
48
49 ! ===================================================================
50 ! yac_read_icon_basic_grid
51 ! ===================================================================
52 block
53 TYPE(c_ptr) :: icon_grid
54
55 icon_grid = &
57 trim(grid_dir)//"icon_grid_0030_R02B03_G.nc"//c_null_char, &
58 "icon_grid")
59
60 CALL test(yac_basic_grid_get_data_size_c(icon_grid, yac_loc_cell) == 5120)
61
62 CALL yac_basic_grid_delete_c(icon_grid)
63 END block
64
65 CALL stop_test
66 CALL exit_tests
67
68END PROGRAM main
Definition utest.F90:5
subroutine, public start_test(name)
Definition utest.F90:20
subroutine, public stop_test()
Definition utest.F90:27
subroutine, public exit_tests()
Definition utest.F90:81
@ yac_loc_cell
Definition yac_core.F90:33