@@ -18,7 +18,6 @@ module test_constants
1818 STANDARD_ACCELERATION_OF_GRAVITY
1919 implicit none
2020 private
21- real (dp) :: fac
2221 public :: collect_constants
2322
2423contains
@@ -58,299 +57,163 @@ subroutine collect_constants(testsuite)
5857
5958subroutine test_year (error )
6059 type (error_type), allocatable , intent (out ) :: error
61-
62- integer (int32) :: value, expected, diff
63-
64- expected = 2022
65- value = YEAR
66- diff = expected - value
67- call check(error, diff, 0 )
60+ call check(error, 2022 - YEAR, 0 )
6861 if (allocated (error)) return
6962end subroutine
7063
7164subroutine test_ALPHA_PARTICLE_ELECTRON_MASS_RATIO (error )
7265 type (error_type), allocatable , intent (out ) :: error
73- real (dp) :: value, expected, diff
74- fac = 1.0d0
75- expected = 7294.29954171d0 * fac
76- value = ALPHA_PARTICLE_ELECTRON_MASS_RATIO% to_real(fac) * fac
77- diff = expected - value
78- call check(error, diff, 0.0d0 )
66+ call check(error, 7294.29954171_dp - ALPHA_PARTICLE_ELECTRON_MASS_RATIO% to_real(1.0_dp ), 0.0_dp )
7967 if (allocated (error)) return
8068end subroutine
8169
8270subroutine test_ALPHA_PARTICLE_MASS (error )
8371 type (error_type), allocatable , intent (out ) :: error
84- real (dp) :: value, expected, diff
85- fac = 1.0d27
86- expected = 6.6446573450d-27 * fac
87- value = ALPHA_PARTICLE_MASS% to_real(fac) * fac
88- diff = expected - value
89- call check(error, diff, 0.0d0 )
72+ call check(error, 6.6446573450d-27 - ALPHA_PARTICLE_MASS% to_real(1.0_dp ), 0.0_dp )
9073 if (allocated (error)) return
9174end subroutine
9275
9376subroutine test_ATOMIC_MASS_CONSTANT (error )
9477 type (error_type), allocatable , intent (out ) :: error
95- real (dp) :: value, expected, diff
96- fac = 1.0d27
97- expected = 1.66053906892d-27 * fac
98- value = ATOMIC_MASS_CONSTANT% to_real(fac) * fac
99- diff = expected - value
100- call check(error, diff, 0.0d0 )
78+ call check(error, 1.66053906892d-27 - ATOMIC_MASS_CONSTANT% to_real(1.0_dp ), 0.0_dp )
10179 if (allocated (error)) return
10280end subroutine
10381
10482subroutine test_AVOGADRO_CONSTANT (error )
10583 type (error_type), allocatable , intent (out ) :: error
106- real (dp) :: value, expected, diff
107- fac = 1.0d-23
108- expected = 6.02214076d23 * fac
109- value = AVOGADRO_CONSTANT% to_real(fac) * fac
110- diff = expected - value
111- call check(error, diff, 0.0d0 )
84+ call check(error, 6.02214076d23 - AVOGADRO_CONSTANT% to_real(1.0_dp ), 0.0_dp )
11285 if (allocated (error)) return
11386end subroutine
11487
11588subroutine test_BOLTZMANN_CONSTANT (error )
11689 type (error_type), allocatable , intent (out ) :: error
117- real (dp) :: value, expected, diff
118- fac = 1.0d23
119- expected = 1.380649d-23 * fac
120- value = BOLTZMANN_CONSTANT% to_real(fac) * fac
121- diff = expected - value
122- call check(error, diff, 0.0d0 )
90+ call check(error, 1.380649d-23 - BOLTZMANN_CONSTANT% to_real(1.0_dp ), 0.0_dp )
12391 if (allocated (error)) return
12492end subroutine
12593
12694subroutine test_ELECTRON_VOLT (error )
12795 type (error_type), allocatable , intent (out ) :: error
128- real (dp) :: value, expected, diff
129- fac = 1.0d19
130- expected = 1.602176634d-19 * fac
131- value = ELECTRON_VOLT% to_real(fac) * fac
132- diff = expected - value
133- call check(error, diff, 0.0d0 )
96+ call check(error, 1.602176634d-19 - ELECTRON_VOLT% to_real(1.0_dp ), 0.0_dp )
13497 if (allocated (error)) return
13598end subroutine
13699
137100subroutine test_ELEMENTARY_CHARGE (error )
138101 type (error_type), allocatable , intent (out ) :: error
139- real (dp) :: value, expected, diff
140- fac = 1.0d19
141- expected = 1.602176634d-19 * fac
142- value = ELEMENTARY_CHARGE% to_real(fac) * fac
143- diff = expected - value
144- call check(error, diff, 0.0d0 )
102+ call check(error, 1.602176634d-19 - ELEMENTARY_CHARGE% to_real(1.0_dp ), 0.0_dp )
145103 if (allocated (error)) return
146104end subroutine
147105
148106subroutine test_FARADAY_CONSTANT (error )
149107 type (error_type), allocatable , intent (out ) :: error
150- real (dp) :: value, expected, diff
151- fac = 1.0d0
152- expected = 96485.33212d0 * fac
153- value = FARADAY_CONSTANT% to_real(fac) * fac
154- diff = expected - value
155- call check(error, diff, 0.0d0 )
108+ call check(error, 96485.33212d0 - FARADAY_CONSTANT% to_real(1.0_dp ), 0.0_dp )
156109 if (allocated (error)) return
157110end subroutine
158111
159112subroutine test_MOLAR_MASS_CONSTANT (error )
160113 type (error_type), allocatable , intent (out ) :: error
161- real (dp) :: value, expected, diff
162- fac = 1.0d3
163- expected = 1.00000000105d-3 * fac
164- value = MOLAR_MASS_CONSTANT% to_real(fac) * fac
165- diff = expected - value
166- call check(error, diff, 0.0d0 )
114+ call check(error, 1.00000000105d-3 - MOLAR_MASS_CONSTANT% to_real(1.0_dp ), 0.0_dp )
167115 if (allocated (error)) return
168116end subroutine
169117
170118subroutine test_MOLAR_VOLUME_NTP (error )
171119 type (error_type), allocatable , intent (out ) :: error
172- real (dp) :: value, expected, diff
173- fac = 1.0d3
174- expected = 22.41396954d-3 * fac
175- value = MOLAR_VOLUME_OF_IDEAL_GAS_273_15_K_101_325_KPA% to_real(fac) * fac
176- diff = expected - value
177- call check(error, diff, 0.0d0 )
120+ call check(error, 22.41396954d-3 - MOLAR_VOLUME_OF_IDEAL_GAS_273_15_K_101_325_KPA% to_real(1.0_dp ), 0.0_dp )
178121 if (allocated (error)) return
179122end subroutine
180123
181124subroutine test_PLANCK_CONSTANT (error )
182125 type (error_type), allocatable , intent (out ) :: error
183- real (dp) :: value, expected, diff
184- fac = 1.0d34
185- expected = 6.62607015d-34 * fac
186- value = PLANCK_CONSTANT% to_real(fac) * fac
187- diff = expected - value
188- call check(error, diff, 0.0d0 )
126+ call check(error, 6.62607015d-34 - PLANCK_CONSTANT% to_real(1.0_dp ), 0.0_dp )
189127 if (allocated (error)) return
190128end subroutine
191129
192130subroutine test_SPEED_OF_LIGHT (error )
193131 type (error_type), allocatable , intent (out ) :: error
194- real (dp) :: value, expected, diff
195- fac = 1.0d0
196- expected = 299792458.0d0 * fac
197- value = SPEED_OF_LIGHT_IN_VACUUM% to_real(fac) * fac
198- diff = expected - value
199- call check(error, diff, 0.0d0 )
132+ call check(error, 299792458.0d0 - SPEED_OF_LIGHT_IN_VACUUM% to_real(1.0_dp ), 0.0_dp )
200133 if (allocated (error)) return
201134end subroutine
202135
203136subroutine test_STANDARD_ACCELERATION_OF_GRAVITY (error )
204137 type (error_type), allocatable , intent (out ) :: error
205- real (dp) :: value, expected, diff
206- fac = 1.0d0
207- expected = 9.80665d0 * fac
208- value = STANDARD_ACCELERATION_OF_GRAVITY% to_real(fac) * fac
209- diff = expected - value
210- call check(error, diff, 0.0d0 )
138+ call check(error, 9.80665d0 - STANDARD_ACCELERATION_OF_GRAVITY% to_real(1.0_dp ), 0.0_dp )
211139 if (allocated (error)) return
212140end subroutine
213141
214142subroutine test_U_ALPHA_PARTICLE_ELECTRON_MASS_RATIO (error )
215143 type (error_type), allocatable , intent (out ) :: error
216- real (dp) :: value, expected, diff
217- fac = 1.0d7
218- expected = 0.00000017d0 * fac
219- value = ALPHA_PARTICLE_ELECTRON_MASS_RATIO% to_real(fac, uncertainty= .true. ) * fac
220- diff = expected - value
221- call check(error, diff, 0.0d0 )
144+ call check(error, 0.00000017d0 - ALPHA_PARTICLE_ELECTRON_MASS_RATIO% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
222145 if (allocated (error)) return
223146end subroutine
224147
225148subroutine test_U_ALPHA_PARTICLE_MASS (error )
226149 type (error_type), allocatable , intent (out ) :: error
227- real (dp) :: value, expected, diff
228- fac = 1.0d36
229- expected = 0.0000000021d-27 * fac
230- value = ALPHA_PARTICLE_MASS% to_real(fac, uncertainty= .true. ) * fac
231- diff = expected - value
232- call check(error, diff, 0.0d0 )
150+ call check(error, 0.0000000021d-27 - ALPHA_PARTICLE_MASS% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
233151 if (allocated (error)) return
234152end subroutine
235153
236154subroutine test_U_ATOMIC_MASS_CONSTANT (error )
237155 type (error_type), allocatable , intent (out ) :: error
238- real (dp) :: value, expected, diff
239- fac = 1.0d37
240- expected = 0.00000000052d-27 * fac
241- value = ATOMIC_MASS_CONSTANT% to_real(fac, uncertainty= .true. ) * fac
242- diff = expected - value
243- call check(error, diff, 0.0d0 )
156+ call check(error, 0.00000000052d-27 - ATOMIC_MASS_CONSTANT% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
244157 if (allocated (error)) return
245158end subroutine
246159
247160subroutine test_U_AVOGADRO_CONSTANT (error )
248161 type (error_type), allocatable , intent (out ) :: error
249- real (dp) :: value, expected, diff
250- fac = 1.0d0
251- expected = 0.0d0 * fac
252- value = AVOGADRO_CONSTANT% to_real(fac, uncertainty= .true. ) * fac
253- diff = expected - value
254- call check(error, diff, 0.0d0 )
162+ call check(error, AVOGADRO_CONSTANT% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
255163 if (allocated (error)) return
256164end subroutine
257165
258166subroutine test_U_BOLTZMANN_CONSTANT (error )
259167 type (error_type), allocatable , intent (out ) :: error
260- real (dp) :: value, expected, diff
261- fac = 1.0d0
262- expected = 0.0d0 * fac
263- value = BOLTZMANN_CONSTANT% to_real(fac, uncertainty= .true. ) * fac
264- diff = expected - value
265- call check(error, diff, 0.0d0 )
168+ call check(error, BOLTZMANN_CONSTANT% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
266169 if (allocated (error)) return
267170end subroutine
268171
269172subroutine test_U_ELECTRON_VOLT (error )
270173 type (error_type), allocatable , intent (out ) :: error
271- real (dp) :: value, expected, diff
272- fac = 1.0d0
273- expected = 0.0d0 * fac
274- value = ELECTRON_VOLT% to_real(fac, uncertainty= .true. ) * fac
275- diff = expected - value
276- call check(error, diff, 0.0d0 )
174+ call check(error, ELECTRON_VOLT% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
277175 if (allocated (error)) return
278176end subroutine
279177
280178subroutine test_U_ELEMENTARY_CHARGE (error )
281179 type (error_type), allocatable , intent (out ) :: error
282- real (dp) :: value, expected, diff
283- fac = 1.0d0
284- expected = 0.0d0 * fac
285- value = ELEMENTARY_CHARGE% to_real(fac, uncertainty= .true. ) * fac
286- diff = expected - value
287- call check(error, diff, 0.0d0 )
180+ call check(error, ELEMENTARY_CHARGE% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
288181 if (allocated (error)) return
289182end subroutine
290183
291184subroutine test_U_FARADAY_CONSTANT (error )
292185 type (error_type), allocatable , intent (out ) :: error
293- real (dp) :: value, expected, diff
294- fac = 1.0d0
295- expected = 0.0d0 * fac
296- value = FARADAY_CONSTANT% to_real(fac, uncertainty= .true. ) * fac
297- diff = expected - value
298- call check(error, diff, 0.0d0 )
186+ call check(error, FARADAY_CONSTANT% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
299187 if (allocated (error)) return
300188end subroutine
301189
302190subroutine test_U_MOLAR_MASS_CONSTANT (error )
303191 type (error_type), allocatable , intent (out ) :: error
304- real (dp) :: value, expected, diff
305- fac = 1.0d13
306- expected = 0.00000000031d-3 * fac
307- value = MOLAR_MASS_CONSTANT% to_real(fac, uncertainty= .true. ) * fac
308- diff = expected - value
309- call check(error, diff, 0.0d0 )
192+ call check(error, 0.00000000031d-3 - MOLAR_MASS_CONSTANT% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
310193 if (allocated (error)) return
311194end subroutine
312195
313196subroutine test_U_MOLAR_VOLUME_NTP (error )
314197 type (error_type), allocatable , intent (out ) :: error
315- real (dp) :: value, expected, diff
316- fac = 1.0d0
317- expected = 0.0d0 * fac
318- value = MOLAR_VOLUME_OF_IDEAL_GAS_273_15_K_101_325_KPA% to_real(fac, uncertainty= .true. ) * fac
319- diff = expected - value
320- call check(error, diff, 0.0d0 )
198+ call check(error, MOLAR_VOLUME_OF_IDEAL_GAS_273_15_K_101_325_KPA% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
321199 if (allocated (error)) return
322200end subroutine
323201
324202subroutine test_U_PLANCK_CONSTANT (error )
325203 type (error_type), allocatable , intent (out ) :: error
326- real (dp) :: value, expected, diff
327- fac = 1.0d0
328- expected = 0.0d0 * fac
329- value = PLANCK_CONSTANT% to_real(fac, uncertainty= .true. ) * fac
330- diff = expected - value
331- call check(error, diff, 0.0d0 )
204+ call check(error, PLANCK_CONSTANT% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
332205 if (allocated (error)) return
333206end subroutine
334207
335208subroutine test_U_SPEED_OF_LIGHT (error )
336209 type (error_type), allocatable , intent (out ) :: error
337- real (dp) :: value, expected, diff
338- fac = 1.0d0
339- expected = 0.0d0 * fac
340- value = SPEED_OF_LIGHT_IN_VACUUM% to_real(fac, uncertainty= .true. ) * fac
341- diff = expected - value
342- call check(error, diff, 0.0d0 )
210+ call check(error, SPEED_OF_LIGHT_IN_VACUUM% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
343211 if (allocated (error)) return
344212end subroutine
345213
346214subroutine test_U_STANDARD_ACCELERATION_OF_GRAVITY (error )
347215 type (error_type), allocatable , intent (out ) :: error
348- real (dp) :: value, expected, diff
349- fac = 1.0d0
350- expected = 0.0d0 * fac
351- value = STANDARD_ACCELERATION_OF_GRAVITY% to_real(fac, uncertainty= .true. ) * fac
352- diff = expected - value
353- call check(error, diff, 0.0d0 )
216+ call check(error, STANDARD_ACCELERATION_OF_GRAVITY% to_real(1.0_dp , uncertainty= .true. ), 0.0_dp )
354217 if (allocated (error)) return
355218end subroutine
356219
0 commit comments