@@ -18,7 +18,6 @@ module test_constants
18
18
STANDARD_ACCELERATION_OF_GRAVITY
19
19
implicit none
20
20
private
21
- real (dp) :: fac
22
21
public :: collect_constants
23
22
24
23
contains
@@ -58,299 +57,163 @@ subroutine collect_constants(testsuite)
58
57
59
58
subroutine test_year (error )
60
59
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 )
68
61
if (allocated (error)) return
69
62
end subroutine
70
63
71
64
subroutine test_ALPHA_PARTICLE_ELECTRON_MASS_RATIO (error )
72
65
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 )
79
67
if (allocated (error)) return
80
68
end subroutine
81
69
82
70
subroutine test_ALPHA_PARTICLE_MASS (error )
83
71
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 )
90
73
if (allocated (error)) return
91
74
end subroutine
92
75
93
76
subroutine test_ATOMIC_MASS_CONSTANT (error )
94
77
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 )
101
79
if (allocated (error)) return
102
80
end subroutine
103
81
104
82
subroutine test_AVOGADRO_CONSTANT (error )
105
83
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 )
112
85
if (allocated (error)) return
113
86
end subroutine
114
87
115
88
subroutine test_BOLTZMANN_CONSTANT (error )
116
89
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 )
123
91
if (allocated (error)) return
124
92
end subroutine
125
93
126
94
subroutine test_ELECTRON_VOLT (error )
127
95
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 )
134
97
if (allocated (error)) return
135
98
end subroutine
136
99
137
100
subroutine test_ELEMENTARY_CHARGE (error )
138
101
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 )
145
103
if (allocated (error)) return
146
104
end subroutine
147
105
148
106
subroutine test_FARADAY_CONSTANT (error )
149
107
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 )
156
109
if (allocated (error)) return
157
110
end subroutine
158
111
159
112
subroutine test_MOLAR_MASS_CONSTANT (error )
160
113
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 )
167
115
if (allocated (error)) return
168
116
end subroutine
169
117
170
118
subroutine test_MOLAR_VOLUME_NTP (error )
171
119
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 )
178
121
if (allocated (error)) return
179
122
end subroutine
180
123
181
124
subroutine test_PLANCK_CONSTANT (error )
182
125
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 )
189
127
if (allocated (error)) return
190
128
end subroutine
191
129
192
130
subroutine test_SPEED_OF_LIGHT (error )
193
131
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 )
200
133
if (allocated (error)) return
201
134
end subroutine
202
135
203
136
subroutine test_STANDARD_ACCELERATION_OF_GRAVITY (error )
204
137
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 )
211
139
if (allocated (error)) return
212
140
end subroutine
213
141
214
142
subroutine test_U_ALPHA_PARTICLE_ELECTRON_MASS_RATIO (error )
215
143
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 )
222
145
if (allocated (error)) return
223
146
end subroutine
224
147
225
148
subroutine test_U_ALPHA_PARTICLE_MASS (error )
226
149
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 )
233
151
if (allocated (error)) return
234
152
end subroutine
235
153
236
154
subroutine test_U_ATOMIC_MASS_CONSTANT (error )
237
155
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 )
244
157
if (allocated (error)) return
245
158
end subroutine
246
159
247
160
subroutine test_U_AVOGADRO_CONSTANT (error )
248
161
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 )
255
163
if (allocated (error)) return
256
164
end subroutine
257
165
258
166
subroutine test_U_BOLTZMANN_CONSTANT (error )
259
167
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 )
266
169
if (allocated (error)) return
267
170
end subroutine
268
171
269
172
subroutine test_U_ELECTRON_VOLT (error )
270
173
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 )
277
175
if (allocated (error)) return
278
176
end subroutine
279
177
280
178
subroutine test_U_ELEMENTARY_CHARGE (error )
281
179
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 )
288
181
if (allocated (error)) return
289
182
end subroutine
290
183
291
184
subroutine test_U_FARADAY_CONSTANT (error )
292
185
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 )
299
187
if (allocated (error)) return
300
188
end subroutine
301
189
302
190
subroutine test_U_MOLAR_MASS_CONSTANT (error )
303
191
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 )
310
193
if (allocated (error)) return
311
194
end subroutine
312
195
313
196
subroutine test_U_MOLAR_VOLUME_NTP (error )
314
197
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 )
321
199
if (allocated (error)) return
322
200
end subroutine
323
201
324
202
subroutine test_U_PLANCK_CONSTANT (error )
325
203
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 )
332
205
if (allocated (error)) return
333
206
end subroutine
334
207
335
208
subroutine test_U_SPEED_OF_LIGHT (error )
336
209
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 )
343
211
if (allocated (error)) return
344
212
end subroutine
345
213
346
214
subroutine test_U_STANDARD_ACCELERATION_OF_GRAVITY (error )
347
215
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 )
354
217
if (allocated (error)) return
355
218
end subroutine
356
219
0 commit comments