@@ -28,9 +28,8 @@ program test_stdlib_bitset_64
2828 subroutine test_string_operations ()
2929 character (* ), parameter :: procedure = ' TEST_STRING_OPERATIONS'
3030
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'
3433
3534 call set0 % from_string( bitstring_0 )
3635 if ( bits(set0) /= 33 ) then
@@ -67,6 +66,9 @@ subroutine test_string_operations()
6766 call set3 % read_bitset( bitstring_0, status )
6867 if ( status /= success ) then
6968 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.'
7072 end if
7173
7274 call set3 % read_bitset( ' s33b' // bitstring_0, status )
@@ -209,6 +211,27 @@ subroutine test_io()
209211 ' output and input succeeded.'
210212 end if
211213
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+
212235 end subroutine test_io
213236
214237 subroutine test_initialization ()
@@ -404,56 +427,41 @@ subroutine test_bitset_inquiry()
404427
405428 call set0 % not ()
406429 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
408434 end do
409435
410436 write (* ,* ) ' As expected set0 had no bits set.'
411437
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-
419438 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
421443 end do
422444
423445 write (* ,* ) ' As expected set1 had all bits set.'
424446
425- go to 210
426-
427- 200 error stop procedure // ' against expectations set1 has ' // &
428- ' at least 1 bit unset.'
429- 210 continue
430-
431447 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
433452 end do
434453
435454 write (* ,* ) ' As expected set0 had no bits set.'
436455
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-
444456 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
446461 end do
447462
448463 write (* ,* ) ' As expected set1 had all bits set.'
449464
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-
457465 if ( set0 % bits() == 33 ) then
458466 write (* ,* ) ' set0 has 33 bits as expected.'
459467 else
0 commit comments