@@ -28,9 +28,8 @@ program test_stdlib_bitset_64
28
28
subroutine test_string_operations ()
29
29
character (* ), parameter :: procedure = ' TEST_STRING_OPERATIONS'
30
30
31
- write (* ,* )
32
- write (* ,* ) ' Test string operations: from_string, read_bitset, ' // &
33
- ' to_string, and write_bitset'
31
+ write (* ,' (/a)' ) ' Test string operations: from_string, ' // &
32
+ ' read_bitset, to_string, and write_bitset'
34
33
35
34
call set0 % from_string( bitstring_0 )
36
35
if ( bits(set0) /= 33 ) then
@@ -67,6 +66,9 @@ subroutine test_string_operations()
67
66
call set3 % read_bitset( bitstring_0, status )
68
67
if ( status /= success ) then
69
68
write (* ,* ) ' read_bitset_string failed with bitstring_0 as expected.'
69
+ else
70
+ error stop procedure // ' read_bitset_string did not fail ' // &
71
+ ' with bitstring_0 as expected.'
70
72
end if
71
73
72
74
call set3 % read_bitset( ' s33b' // bitstring_0, status )
@@ -209,6 +211,27 @@ subroutine test_io()
209
211
' output and input succeeded.'
210
212
end if
211
213
214
+ open ( newunit= unit, file= ' test.bin' , status= ' replace' , &
215
+ form= ' unformatted' , access= ' stream' , action= ' write' )
216
+ call set2 % output(unit)
217
+ call set1 % output(unit)
218
+ call set0 % output(unit)
219
+ close ( unit )
220
+ open ( newunit= unit, file= ' test.bin' , status= ' old' , &
221
+ form= ' unformatted' , access= ' stream' , action= ' read' )
222
+ call set5 % input(unit)
223
+ call set4 % input(unit)
224
+ call set3 % input(unit)
225
+ close ( unit )
226
+
227
+ if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then
228
+ error stop procedure // ' transfer to and from units using ' // &
229
+ ' stream output and input failed.'
230
+ else
231
+ write (* ,* ) ' Transfer to and from units using ' // &
232
+ ' stream output and input succeeded.'
233
+ end if
234
+
212
235
end subroutine test_io
213
236
214
237
subroutine test_initialization ()
@@ -404,56 +427,41 @@ subroutine test_bitset_inquiry()
404
427
405
428
call set0 % not ()
406
429
do i= 0 , set0 % bits() - 1
407
- if ( set0 % test(i) ) go to 100
430
+ if ( set0 % test(i) ) then
431
+ error stop procedure // ' against expectations set0 has ' // &
432
+ ' at least 1 bit set.'
433
+ end if
408
434
end do
409
435
410
436
write (* ,* ) ' As expected set0 had no bits set.'
411
437
412
- go to 110
413
-
414
- 100 error stop procedure // ' against expectations set0 has ' // &
415
- ' at least 1 bit set.'
416
-
417
- 110 continue
418
-
419
438
do i= 0 , set1 % bits() - 1
420
- if ( .not. set1 % test(i) ) go to 200
439
+ if ( .not. set1 % test(i) ) then
440
+ error stop procedure // ' against expectations set1 has ' // &
441
+ ' at least 1 bit unset.'
442
+ end if
421
443
end do
422
444
423
445
write (* ,* ) ' As expected set1 had all bits set.'
424
446
425
- go to 210
426
-
427
- 200 error stop procedure // ' against expectations set1 has ' // &
428
- ' at least 1 bit unset.'
429
- 210 continue
430
-
431
447
do i= 0 , set0 % bits() - 1
432
- if ( set0 % value(i) /= 0 ) go to 300
448
+ if ( set0 % value(i) /= 0 ) then
449
+ error stop procedure // ' against expectations set0 has ' // &
450
+ ' at least 1 bit set.'
451
+ end if
433
452
end do
434
453
435
454
write (* ,* ) ' As expected set0 had no bits set.'
436
455
437
- go to 310
438
-
439
- 300 error stop procedure // ' against expectations set0 has ' // &
440
- ' at least 1 bit set.'
441
-
442
- 310 continue
443
-
444
456
do i= 0 , set1 % bits() - 1
445
- if ( set1 % value(i) /= 1 ) go to 400
457
+ if ( set1 % value(i) /= 1 ) then
458
+ error stop procedure // ' against expectations set1 has ' // &
459
+ ' at least 1 bit unset.'
460
+ end if
446
461
end do
447
462
448
463
write (* ,* ) ' As expected set1 had all bits set.'
449
464
450
- go to 410
451
-
452
- 400 error stop procedure // ' against expectations set1 has ' // &
453
- ' at least 1 bit unset.'
454
-
455
- 410 continue
456
-
457
465
if ( set0 % bits() == 33 ) then
458
466
write (* ,* ) ' set0 has 33 bits as expected.'
459
467
else
0 commit comments