MOM_unit_tests.F90

1! This file is part of MOM6, the Modular Ocean Model version 6.
2! See the LICENSE file for licensing information.
3! SPDX-License-Identifier: Apache-2.0
4
5!> Invokes unit tests in all modules that have them
7
8! This file is part of MOM6. See LICENSE.md for the license.
9
12use mom_error_handler, only : mom_error, fatal, is_root_pe
21use mom_eos, only : eos_unit_tests
22
23implicit none ; private
24
25public unit_tests
26
27contains
28
29!> Calls unit tests for other modules.
30!! Note that if a unit test returns true, a FATAL error is triggered.
31subroutine unit_tests(verbosity)
32 ! Arguments
33 integer, intent(in) :: verbosity !< The verbosity level
34 ! Local variables
35 logical :: verbose
36
37 verbose = verbosity>=5
38
39 if (is_root_pe()) then ! The following need only be tested on 1 PE
40 if (string_functions_unit_tests(verbose)) call mom_error(fatal, &
41 "MOM_unit_tests: string_functions_unit_tests FAILED")
42 if (symmetric_sum_unit_tests(verbose)) call mom_error(fatal, &
43 "MOM_unit_tests: symmetric_sum_unit_tests FAILED")
44 if (eos_unit_tests(verbose)) call mom_error(fatal, &
45 "MOM_unit_tests: EOS_unit_tests FAILED")
46 if (remapping_unit_tests(verbose)) call mom_error(fatal, &
47 "MOM_unit_tests: remapping_unit_tests FAILED")
48 if (intrinsic_functions_unit_tests(verbose)) call mom_error(fatal, &
49 "MOM_unit_tests: intrinsic_functions_unit_tests FAILED")
50 if (neutral_diffusion_unit_tests(verbose)) call mom_error(fatal, &
51 "MOM_unit_tests: neutralDiffusionUnitTests FAILED")
52 if (random_unit_tests(verbose)) call mom_error(fatal, &
53 "MOM_unit_tests: random_unit_tests FAILED")
54 if (near_boundary_unit_tests(verbose)) call mom_error(fatal, &
55 "MOM_unit_tests: near_boundary_unit_tests FAILED")
56 if (cfc_cap_unit_tests(verbose)) call mom_error(fatal, &
57 "MOM_unit_tests: CFC_cap_unit_tests FAILED")
58 if (mixedlayer_restrat_unit_tests(verbose)) call mom_error(fatal, &
59 "MOM_unit_tests: mixedlayer_restrat_unit_tests FAILED")
60 if (diag_buffer_unit_tests_2d(verbose)) call mom_error(fatal, &
61 "MOM_unit_tests: diag_buffer_unit_tests_2d FAILED")
62 if (diag_buffer_unit_tests_3d(verbose)) call mom_error(fatal, &
63 "MOM_unit_tests: diag_buffer_unit_tests_3d FAILED")
64 endif
65
66end subroutine unit_tests
67
68end module mom_unit_tests