source: palm/trunk/UTIL/inifor/tests/test-reverse-even.f90 @ 4836

Last change on this file since 4836 was 4499, checked in by eckhard, 5 years ago

bugfix for explicit loop in 'reverse' subroutine, updated test suite

File size: 2.2 KB
Line 
1!> @file tests/test-prototype.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 2017-2020 Leibniz Universitaet Hannover
18! Copyright 2017-2020 Deutscher Wetterdienst Offenbach
19!------------------------------------------------------------------------------!
20!
21! Current revisions:
22! -----------------
23!
24!
25! Former revisions:
26! -----------------
27! $Id: test-prototype.f90 4481 2020-03-31 18:55:54Z maronga $
28! Added usage hints
29!
30! 3182 2018-07-27 13:36:03Z suehring
31! Initial revision
32!
33!
34!
35! Authors:
36! --------
37! @author Eckhard Kadasch
38!
39! Description:
40! ------------
41!> This prototype test does nothing, but serves as a template for programming
42!> new INIFOR tests.
43!------------------------------------------------------------------------------!
44 PROGRAM test_reverse_even
45
46    USE inifor_defs,                                                           &
47        ONLY :  wp
48
49    USE inifor_util,                                                           &
50        ONLY :  reverse
51
52    USE test_utils
53   
54    IMPLICIT NONE
55
56    CHARACTER(LEN=*), PARAMETER ::  title = "array reversion even no of elements"
57    LOGICAL                     ::  res
58
59    REAL(wp), DIMENSION(1,1,4) :: array, reversed_array
60
61    CALL begin_test(title, res)
62
63    ! Arange
64    array(1,1,:) = (/1.0_wp, 2.0_wp, 3.0_wp, 4.0_wp/)
65    reversed_array(1,1,:) = (/4.0_wp, 3.0_wp, 2.0_wp, 1.0_wp/)
66
67    ! Act
68    CALL reverse(array)
69
70    ! Assert
71    res = res .AND. assert_equal(array(1,1,:), reversed_array(1,1,:), 'reversed array')
72
73    CALL end_test(title, res)
74   
75 END PROGRAM test_reverse_even
Note: See TracBrowser for help on using the repository browser.