Skip to content

Commit a24ef33

Browse files
committed
test variable scope
1 parent 34cd6a7 commit a24ef33

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

src/tests/test_mod.f90

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,11 @@ program test_maptran
1616
x0 = 660.6752518e3_wp, y0 = -4700.9486832e3_wp, z0 = 4245.7376622e3_wp, &
1717
xl = 6.609301927610815e+5, yl = -4.701424222957011e6, zl = 4.246579604632881e+06, & !< aer2ecef
1818
east = 186.277521_wp, north = 286.84222_wp, up = 939.69262_wp, & !< aer2enu
19-
lat1 = 42.0026_wp, lon1 = -81.9978_wp, alt1 = 1.1397e3_wp, & !< aer2geodetic
20-
azi = 180.1_wp, eli = 80._wp, &
2119
ha = 45.482789587392013_wp
2220

23-
integer,parameter :: N = 3
24-
real(wp), dimension(N), parameter :: alat = [42,52,62], &
25-
deg0 = [15,30,45], &
26-
aaz = [33,43,53]
27-
2821
type(datetime), parameter :: t0 = datetime(2014,4,6,8,0,0) !< UTC
29-
real(wp), parameter :: jd0 = 2456753.833333_wp
30-
31-
32-
real(wp) :: azrd,elrd,rae,dae,jd, ea, eb, atol_dist, atol_deg
33-
34-
35-
real(wp), dimension(N) :: &
36-
ax1, ay1, aaaz1, ax2, ay2,az2, aaaz2, ax3,ay3,aaaz3, &
37-
ae1, an1, au1, ae2,an2,au2, &
38-
alat2,alon2,aalt2, alat3,alon3,aalt3, alat4,alon4,aalt4, &
39-
aaz2, ael2, arng2, aaz3,ael3,arng3, aaz4,ael4,arng4
40-
4122

23+
real(wp) :: ea, eb, atol_dist, atol_deg
4224

4325
select case (wp)
4426
case (real32)
@@ -60,10 +42,7 @@ program test_maptran
6042
ea = spheroid%SemimajorAxis
6143
eb = spheroid%SemiminorAxis
6244

63-
call assert_allclose(degrees(radians(deg0)), deg0, err_msg='deg<->rad')
64-
print *, "OK: degrees < = > radians"
65-
66-
!! ## scalar degrees
45+
!! scalar degrees
6746

6847
call test_enu2aer(east,north, up, az,el,rng)
6948
print *, "OK: enu2aer"
@@ -80,7 +59,7 @@ program test_maptran
8059
call test_ecef2geodetic(x0,y0,z0)
8160
print *, "OK: ecef2geodetic"
8261

83-
call test_enu_ecef(east, north, up, lat, lon, alt)
62+
call test_enu_ecef(east, north, up, lat, lon, alt, xl, yl, zl)
8463
print *, "OK enu2ecef, ecef2enu"
8564

8665
call test_ecef2aer(xl, yl, zl, lat, lon, alt)
@@ -101,7 +80,7 @@ program test_maptran
10180
print *, "OK: test_array"
10281

10382
!! ## Vallado Tests
104-
call test_vallado()
83+
call test_vallado(t0)
10584
print *, "OK: vallado"
10685

10786
!! ## Meeus tests
@@ -115,7 +94,14 @@ program test_maptran
11594
contains
11695

11796

118-
subroutine test_vallado()
97+
subroutine test_vallado(t0)
98+
99+
type(datetime), intent(in) :: t0
100+
101+
real(wp), parameter :: azi = 180.1_wp, eli = 80, jd0 = 2456753.833333_wp
102+
103+
real(wp) :: azrd,elrd,rae,dae,jd
104+
119105
jd = toJulian(t0)
120106

121107
!! http://aa.usno.navy.mil/jdconverter?ID=AA&year=2014&month=4&day=6&era=1&hr=8&min=0&sec=0.0
@@ -156,6 +142,20 @@ end subroutine test_geodetic_enu
156142

157143
subroutine test_array()
158144

145+
integer,parameter :: N = 3
146+
147+
real(wp), dimension(N), parameter :: alat = [42,52,62], &
148+
deg0 = [15,30,45], &
149+
aaz = [33,43,53]
150+
real(wp), dimension(N) :: &
151+
ax1, ay1, aaaz1, ax2, ay2,az2, aaaz2, ax3,ay3,aaaz3, &
152+
ae1, an1, au1, ae2,an2,au2, &
153+
alat2,alon2,aalt2, alat3,alon3,aalt3, alat4,alon4,aalt4, &
154+
aaz2, ael2, arng2, aaz3,ael3,arng3, aaz4,ael4,arng4
155+
156+
call assert_allclose(degrees(radians(deg0)), deg0, err_msg='deg<->rad')
157+
print *, "OK: degrees < = > radians"
158+
159159
call geodetic2ecef(alat,lon,alt,ax1,ay1,aaaz1)
160160
call aer2enu(aaz, el, rng, ae1, an1, au1)
161161
call aer2ecef(aaz, el, rng, lat,lon,alt, ax2, ay2, aaaz2)
@@ -175,6 +175,8 @@ subroutine test_geodetic_aer(lat, lon, alt)
175175
real(wp), intent(in) :: lat, lon, alt
176176
real(wp) :: lt, ln, at, a, e, r
177177

178+
real(wp), parameter :: lat1 = 42.0026_wp, lon1 = -81.9978_wp, alt1 = 1.1397e3_wp
179+
178180
call aer2geodetic(0._wp, -90._wp, 1._wp, lat, lon, alt, lt,ln,at)
179181
call assert_allclose([lt,ln], [lat, lon])
180182
call assert_allclose(at, alt-1, atol=atol_dist)
@@ -242,8 +244,8 @@ subroutine test_ecef2aer(xl, yl, zl, lat, lon, alt)
242244
end subroutine test_ecef2aer
243245

244246

245-
subroutine test_enu_ecef(east, north, up, lat, lon, alt)
246-
real(wp), intent(in) :: east, north, up, lat, lon, alt
247+
subroutine test_enu_ecef(east, north, up, lat, lon, alt, xl, yl, zl)
248+
real(wp), intent(in) :: east, north, up, lat, lon, alt, xl, yl, zl
247249
real(wp) :: x, y, z, e, n, u
248250

249251
call enu2ecef(east, north, up, lat,lon,alt, x, y, z)

0 commit comments

Comments
 (0)