Yet Another eXchange Tool  0.9.0
test_initialized_finalized_f.f90
1 
12 
13 !
14 ! Keywords:
15 ! Maintainer: Jörg Behrens <behrens@dkrz.de>
16 ! Moritz Hanke <hanke@dkrz.de>
17 ! Thomas Jahns <jahns@dkrz.de>
18 ! URL: https://doc.redmine.dkrz.de/yaxt/html/
19 !
20 ! Redistribution and use in source and binary forms, with or without
21 ! modification, are permitted provided that the following conditions are
22 ! met:
23 !
24 ! Redistributions of source code must retain the above copyright notice,
25 ! this list of conditions and the following disclaimer.
26 !
27 ! Redistributions in binary form must reproduce the above copyright
28 ! notice, this list of conditions and the following disclaimer in the
29 ! documentation and/or other materials provided with the distribution.
30 !
31 ! Neither the name of the DKRZ GmbH nor the names of its contributors
32 ! may be used to endorse or promote products derived from this software
33 ! without specific prior written permission.
34 !
35 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
36 ! IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
37 ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
38 ! PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
39 ! OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
40 ! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
41 ! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
42 ! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
43 ! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
44 ! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45 ! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 !
47 PROGRAM test_initialized_finalized_f
48  USE ftest_common, ONLY: init_mpi, finish_mpi, test_abort
49  USE iso_c_binding, ONLY: c_int
50  USE mpi
51  USE test_idxlist_utils, ONLY: test_err_count
52  USE yaxt, ONLY: xt_initialize, xt_finalize, &
54  IMPLICIT NONE
55  CHARACTER(len=*), PARAMETER :: filename = 'test_initialized_finalized_f.f90'
56 
57  CALL init_mpi
58 
59  IF (xt_initialized() .OR. xt_finalized()) &
60  CALL test_abort("ERROR: unexpected library state", filename, __line__)
61 
62  CALL xt_initialize(mpi_comm_world)
63 
64  IF (.NOT. xt_initialized() .OR. xt_finalized()) &
65  CALL test_abort("ERROR: unexpected library state", filename, __line__)
66 
67  CALL xt_finalize
68 
69  IF (.NOT. xt_initialized() .OR. .NOT. xt_finalized()) &
70  CALL test_abort("ERROR: unexpected library state", filename, __line__)
71 
72  IF (test_err_count() /= 0_c_int) &
73  CALL test_abort("non-zero error count!", filename, __line__)
74  CALL finish_mpi
75 
76 END PROGRAM test_initialized_finalized_f
77 !
78 ! Local Variables:
79 ! f90-continuation-indent: 5
80 ! coding: utf-8
81 ! indent-tabs-mode: nil
82 ! show-trailing-whitespace: t
83 ! require-trailing-newline: t
84 ! End:
85 !
Definition: yaxt.f90:49
int xt_finalized(void)
Definition: xt_init.c:113
void xt_initialize(MPI_Comm default_comm)
Definition: xt_init.c:70
int xt_initialized(void)
Definition: xt_init.c:107
void xt_finalize(void)
Definition: xt_init.c:89