Skip to content

Commit df514c9

Browse files
authored
Changed filenames (#388)
Changed filenames in test_stdlib_bitsets_64.f90 and test_stdlib_bitsets_large.f90 so that they were no longer the same. Also removed spurious blanks in error stops.
1 parent 1cbb200 commit df514c9

File tree

2 files changed

+45
-74
lines changed

2 files changed

+45
-74
lines changed

src/tests/bitsets/test_stdlib_bitset_64.f90

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,12 @@ subroutine test_io()
147147
'write_bitset'
148148

149149
call set2 % from_string( bitstring_33 )
150-
open( newunit=unit, file='test64_1.txt', status='replace', &
151-
form='formatted', action='write' )
150+
open( newunit=unit, status='scratch', form='formatted', &
151+
action='readwrite' )
152152
call set2 % write_bitset(unit)
153153
call set1 % write_bitset(unit)
154154
call set0 % write_bitset(unit)
155-
close( unit )
156-
open( newunit=unit, file='test64_1.txt', status='old', &
157-
form='formatted', action='read' )
155+
rewind( unit )
158156
call set3 % read_bitset(unit)
159157
call set5 % read_bitset(unit)
160158
call set4 % read_bitset(unit)
@@ -167,66 +165,59 @@ subroutine test_io()
167165
'plain write_bitset_unit and read_bitset_unit succeeded.'
168166
end if
169167

170-
close( unit )
168+
rewind( unit )
171169

172-
open( newunit=unit, file='test64_2.txt', status='replace', &
173-
form='formatted', action='write' )
174170
call set2 % write_bitset(unit, advance='no')
175171
call set1 % write_bitset(unit, advance='no')
176172
call set0 % write_bitset(unit)
177-
close( unit )
178-
open( newunit=unit, file='test64_2.txt', status='old', &
179-
form='formatted', action='read' )
173+
rewind( unit )
180174
call set3 % read_bitset(unit, advance='no')
181175
call set4 % read_bitset(unit, advance='no')
182176
call set5 % read_bitset(unit)
183177

184178
if ( set5 /= set0 .or. set4 /= set1 .or. set3 /= set2 ) then
185179
error stop procedure // ' transfer to and from units using ' // &
186-
' bitset literals with advance == "no" failed.'
180+
'bitset literals with advance == "no" failed.'
187181
else
188182
write(*,*) 'Transfer to and from units using ' // &
189183
'write_bitset_unit and read_bitset_unit with ' // &
190184
'advance=="no" succeeded.'
191185
end if
186+
close(unit)
192187

193-
open( newunit=unit, file='test.bin', status='replace', &
194-
form='unformatted', action='write' )
188+
open( newunit=unit, form='unformatted', status='scratch', &
189+
action='readwrite' )
195190
call set2 % output(unit)
196191
call set1 % output(unit)
197192
call set0 % output(unit)
198-
close( unit )
199-
open( newunit=unit, file='test.bin', status='old', &
200-
form='unformatted', action='read' )
193+
rewind( unit )
201194
call set5 % input(unit)
202195
call set4 % input(unit)
203196
call set3 % input(unit)
204197
close( unit )
205198

206199
if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then
207200
error stop procedure // ' transfer to and from units using ' // &
208-
' output and input failed.'
201+
'output and input failed.'
209202
else
210203
write(*,*) 'Transfer to and from units using ' // &
211204
'output and input succeeded.'
212205
end if
213206

214-
open( newunit=unit, file='test.bin', status='replace', &
215-
form='unformatted', access='stream', action='write' )
207+
open( newunit=unit, form='unformatted', access='stream', &
208+
status='scratch', action='readwrite' )
216209
call set2 % output(unit)
217210
call set1 % output(unit)
218211
call set0 % output(unit)
219-
close( unit )
220-
open( newunit=unit, file='test.bin', status='old', &
221-
form='unformatted', access='stream', action='read' )
212+
rewind( unit )
222213
call set5 % input(unit)
223214
call set4 % input(unit)
224215
call set3 % input(unit)
225216
close( unit )
226217

227218
if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then
228219
error stop procedure // ' transfer to and from units using ' // &
229-
' stream output and input failed.'
220+
'stream output and input failed.'
230221
else
231222
write(*,*) 'Transfer to and from units using ' // &
232223
'stream output and input succeeded.'

src/tests/bitsets/test_stdlib_bitset_large.f90

Lines changed: 30 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -254,79 +254,65 @@ subroutine test_io()
254254
'write_bitset'
255255

256256
call set2 % from_string( bitstring_33 )
257-
open( newunit=unit, file='test1.txt', status='replace', &
258-
form='formatted', action='write' )
257+
open( newunit=unit, status='scratch', form='formatted', &
258+
action='readwrite' )
259259
call set2 % write_bitset(unit)
260260
call set1 % write_bitset(unit)
261261
call set0 % write_bitset(unit)
262-
close( unit )
263-
open( newunit=unit, file='test1.txt', status='old', &
264-
form='formatted', action='read' )
262+
rewind( unit )
265263
call set3 % read_bitset(unit)
266264
call set5 % read_bitset(unit)
267265
call set4 % read_bitset(unit)
268266
if ( set4 /= set0 .or. set5 /= set1 .or. set3 /= set2 ) then
269267
error stop procedure // ' transfer to and from units using ' // &
270-
' bitset literals failed.'
268+
'bitset literals failed.'
271269
else
272270
write(*,*) 'Transfer to and from units using ' // &
273271
'plain write_bitset_unit and read_bitset_unit succeeded.'
274272
end if
275273

276-
close( unit )
274+
rewind( unit )
277275

278276
call set12 % from_string( bitstring_33 // bitstring_33 )
279-
open( newunit=unit, file='test2.txt', status='replace', &
280-
form='formatted', action='write' )
281277
call set12 % write_bitset(unit)
282278
call set11 % write_bitset(unit)
283279
call set10 % write_bitset(unit)
284-
close( unit )
285-
open( newunit=unit, file='test2.txt', status='old', &
286-
form='formatted', action='read' )
280+
rewind( unit )
287281
call set13 % read_bitset(unit)
288282
call set15 % read_bitset(unit)
289283
call set14 % read_bitset(unit)
290284
if ( set14 /= set10 .or. set15 /= set11 .or. set3 /= set12 ) then
291285
error stop procedure // ' transfer to and from units using ' // &
292-
' bitset literals for bits > 64 failed.'
286+
'bitset literals for bits > 64 failed.'
293287
else
294288
write(*,*) 'Transfer bits > 64 to and from units using ' // &
295289
'plain write_bitset_unit and read_bitset_unit succeeded.'
296290
end if
297291

298-
close( unit )
292+
rewind( unit )
299293

300-
open( newunit=unit, file='test3.txt', status='replace', &
301-
form='formatted', action='write' )
302294
call set2 % write_bitset(unit, advance='no')
303295
call set1 % write_bitset(unit, advance='no')
304296
call set0 % write_bitset(unit)
305-
close( unit )
306-
open( newunit=unit, file='test3.txt', status='old', &
307-
form='formatted', action='read' )
297+
rewind( unit )
308298
call set3 % read_bitset(unit, advance='no')
309299
call set4 % read_bitset(unit, advance='no')
310300
call set5 % read_bitset(unit)
311301
if ( set5 /= set0 .or. set4 /= set1 .or. set3 /= set2 ) then
312302
error stop procedure // ' transfer to and from units using ' // &
313-
' bitset literals with advance == "no" failed.'
303+
'bitset literals with advance == "no" failed.'
314304
else
315305
write(*,*) 'Transfer to and from units using ' // &
316306
'write_bitset_unit and read_bitset_unit with ' // &
317307
'advance=="no" succeeded.'
318308
end if
319309

320-
close( unit )
310+
rewind( unit )
321311

322-
open( newunit=unit, file='test4.txt', status='replace', &
323-
form='formatted', action='write' )
324312
call set12 % write_bitset(unit, advance='no')
325313
call set11 % write_bitset(unit, advance='no')
326314
call set10 % write_bitset(unit)
327-
close( unit )
328-
open( newunit=unit, file='test4.txt', status='old', &
329-
form='formatted', action='read' )
315+
rewind( unit )
330316
call set13 % read_bitset(unit, advance='no')
331317
call set14 % read_bitset(unit, advance='no')
332318
call set15 % read_bitset(unit)
@@ -339,82 +325,76 @@ subroutine test_io()
339325
'advance=="no" succeeded.'
340326
end if
341327

342-
open( newunit=unit, file='test.bin', status='replace', &
343-
form='unformatted', action='write' )
328+
close(unit)
329+
330+
open( newunit=unit, form='unformatted', status='scratch', &
331+
action='readwrite' )
344332
call set2 % output(unit)
345333
call set1 % output(unit)
346334
call set0 % output(unit)
347-
close( unit )
348-
open( newunit=unit, file='test.bin', status='old', &
349-
form='unformatted', action='read' )
335+
rewind( unit )
350336
call set5 % input(unit)
351337
call set4 % input(unit)
352338
call set3 % input(unit)
353339
if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then
354340
error stop procedure // ' transfer to and from units using ' // &
355-
' output and input failed.'
341+
'output and input failed.'
356342
else
357343
write(*,*) 'Transfer to and from units using ' // &
358344
'output and input succeeded.'
359345
end if
360346

361347
close( unit )
362348

363-
open( newunit=unit, file='test.bin', status='replace', &
364-
form='unformatted', access='stream', action='write' )
349+
open( newunit=unit, form='unformatted', access='stream', &
350+
status='scratch', action='readwrite' )
365351
call set2 % output(unit)
366352
call set1 % output(unit)
367353
call set0 % output(unit)
368-
close( unit )
369-
open( newunit=unit, file='test.bin', status='old', &
370-
form='unformatted', access='stream', action='read' )
354+
rewind( unit )
371355
call set5 % input(unit)
372356
call set4 % input(unit)
373357
call set3 % input(unit)
374358
if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then
375359
error stop procedure // ' transfer to and from units using ' // &
376-
' stream output and input failed.'
360+
'stream output and input failed.'
377361
else
378362
write(*,*) 'Transfer to and from units using ' // &
379363
'stream output and input succeeded.'
380364
end if
381365

382366
close( unit )
383367

384-
open( newunit=unit, file='test.bin', status='replace', &
385-
form='unformatted', action='write' )
368+
open( newunit=unit, form='unformatted', status='scratch', &
369+
action='readwrite' )
386370
call set12 % output(unit)
387371
call set11 % output(unit)
388372
call set10 % output(unit)
389-
close( unit )
390-
open( newunit=unit, file='test.bin', status='old', &
391-
form='unformatted', action='read' )
373+
rewind( unit )
392374
call set15 % input(unit)
393375
call set14 % input(unit)
394376
call set13 % input(unit)
395377
if ( set13 /= set10 .or. set14 /= set11 .or. set15 /= set12 ) then
396378
error stop procedure // ' transfer to and from units using ' // &
397-
' output and input failed for bits . 64.'
379+
'output and input failed for bits . 64.'
398380
else
399381
write(*,*) 'Transfer to and from units using ' // &
400382
'output and input succeeded for bits > 64.'
401383
end if
402384
close(unit)
403385

404-
open( newunit=unit, file='test.bin', status='replace', &
405-
form='unformatted', access='stream', action='write' )
386+
open( newunit=unit, form='unformatted', access='stream', &
387+
status='scratch', action='readwrite' )
406388
call set12 % output(unit)
407389
call set11 % output(unit)
408390
call set10 % output(unit)
409-
close( unit )
410-
open( newunit=unit, file='test.bin', status='old', &
411-
form='unformatted', access='stream', action='read' )
391+
rewind( unit )
412392
call set15 % input(unit)
413393
call set14 % input(unit)
414394
call set13 % input(unit)
415395
if ( set13 /= set10 .or. set14 /= set11 .or. set15 /= set12 ) then
416396
error stop procedure // ' transfer to and from units using ' // &
417-
' stream output and input failed for bits . 64.'
397+
'stream output and input failed for bits . 64.'
418398
else
419399
write(*,*) 'Transfer to and from units using ' // &
420400
'stream output and input succeeded for bits > 64.'

0 commit comments

Comments
 (0)