Skip to content

Commit

Permalink
add testing for sntb[bdf]e and jstnum
Browse files Browse the repository at this point in the history
  • Loading branch information
jbathegit committed Jan 10, 2024
1 parent 07c7d9c commit 4b64eb4
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/sntbfe.f
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ SUBROUTINE SNTBFE ( LUNT, IFXYN )
C Parse the list of FXY numbers.

CALL PARSTR ( CDSTR(1), ADSC, 10, NIDFXY, ',', .FALSE. )
IF ( NIDFXY .EQ. 0 ) THEN
IF ( ( NIDFXY .EQ. 0 ) .OR. ( ( NIDFXY .EQ. 1 ) .AND.
+ ( ADSC(1) .EQ. ' ' ) ) ) THEN
BORT_STR2 = ' HAS BAD DEPENDENCY LIST (FXY)'
GOTO 900
ENDIF
Expand All @@ -77,13 +78,18 @@ SUBROUTINE SNTBFE ( LUNT, IFXYN )
C Parse the list of values.

CALL PARSTR ( CDSTR(2), CVAL, 25, NIDVAL, ',', .FALSE. )
IF ( NIDVAL .EQ. 0 ) THEN
IF ( ( NIDVAL .EQ. 0 ) .OR. ( ( NIDVAL .EQ. 1 ) .AND.
+ ( CVAL(1) .EQ. ' ' ) ) ) THEN
BORT_STR2 = ' HAS BAD DEPENDENCY LIST (VAL)'
GOTO 900
ENDIF
DO II = 1, NIDVAL
CVAL(II) = ADJUSTL( CVAL(II) )
CALL STRNUM ( CVAL(II), IVAL, IER )
IF ( IER .NE. 0 ) THEN
BORT_STR2 = ' HAS BAD DEPENDENCY (VAL)'
GOTO 900
ENDIF
IDVAL(II) = IVAL
ENDDO

Expand Down
24 changes: 24 additions & 0 deletions test/run_test_bort.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ for kind in "4" "d"; do
(./test_bort_$kind iupvs01 2) && exit 1
(./test_bort_$kind iupvs01 3) && exit 1

# Check jstnum().
(./test_bort_$kind jstnum 1) && exit 1

# Check lstjpb().
(./test_bort_$kind lstjpb 1) && exit 1
(./test_bort_$kind lstjpb 2) && exit 1
Expand Down Expand Up @@ -228,8 +231,29 @@ for kind in "4" "d"; do
(./test_bort_$kind status 1) && exit 1
(./test_bort_$kind status 2) && exit 1

# Check sntbbe().
(./test_bort_$kind sntbbe 1) && exit 1
(./test_bort_$kind sntbbe 2) && exit 1
(./test_bort_$kind sntbbe 3) && exit 1
(./test_bort_$kind sntbbe 4) && exit 1
(./test_bort_$kind sntbbe 5) && exit 1
(./test_bort_$kind sntbbe 6) && exit 1

# Check sntbde().
(./test_bort_$kind sntbde 1) && exit 1
(./test_bort_$kind sntbde 2) && exit 1
(./test_bort_$kind sntbde 3) && exit 1
(./test_bort_$kind sntbde 4) && exit 1
(./test_bort_$kind sntbde 5) && exit 1

# Check sntbfe().
(./test_bort_$kind sntbfe 1) && exit 1
(./test_bort_$kind sntbfe 2) && exit 1
(./test_bort_$kind sntbfe 3) && exit 1
(./test_bort_$kind sntbfe 4) && exit 1
(./test_bort_$kind sntbfe 5) && exit 1
(./test_bort_$kind sntbfe 6) && exit 1
(./test_bort_$kind sntbfe 7) && exit 1

# Check stdmsg().
(./test_bort_$kind stdmsg 1) && exit 1
Expand Down
103 changes: 99 additions & 4 deletions test/test_bort.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ program test_bort
integer iret, jret, iunit, iqcd
! integer i1
integer int_1d(1), int_1d_2(1)
character char_1
character*2 char_short
character*30 char_30
character*8 tags(5)
Expand Down Expand Up @@ -313,6 +314,11 @@ program test_bort
call openbf(11, 'IN', 10)
iret = iupvs01(11, 'LENM')
endif
elseif (sub_name .eq. 'jstnum') then
if (test_case .eq. '1') then
char_val_8 = ' '
call jstnum(char_val_8,char_1,iret)
endif
elseif (sub_name .eq. 'lstjpb') then
if (test_case .eq. '1') then
open(unit = 11, file = 'testfiles/IN_3', form = 'UNFORMATTED', iostat = ios)
Expand Down Expand Up @@ -738,11 +744,103 @@ program test_bort
elseif (sub_name .eq. 'sntbbe') then
if (test_case .eq. '1') then
call sntbbe(0, 'c', 1, 2, int_1d, char_4, char_12, char_4, char_24, char_8, char_4, char_120)
elseif (test_case .eq. '2') then
card = ' 0-00-007 | 0 | '
elseif (test_case .eq. '3') then
card = ' 0-00-007 | | 0 | 16 | CCITT IA5 | CMTVN ; ; '
elseif (test_case .eq. '4') then
card = ' 0-00-007 | 0 | | 16 | CCITT IA5 | CMTVN ; ; '
elseif (test_case .eq. '5') then
card = ' 0-00-007 | 0 | 0 | | CCITT IA5 | CMTVN ; ; '
elseif (test_case .eq. '6') then
card = ' 0-00-007 | 0 | 0 | 16 | | CMTV$ ; ; '
endif
jret = 0
call sntbbe(0, card, 1, jret, int_1d, char_4, char_12, char_4, char_24, char_8, char_4, char_120)
elseif (sub_name .eq. 'sntbde') then
card = ' 3-01-022 | LTLONHHT ; ; '
if (test_case .eq. '1') then
call sntbde(0, 0, 'c', 1, 1, 2, int_1d, char_8, char_4, char_120, int_1d, int_1d, char_120)
elseif (test_case .eq. '2') then
card(21:21) = '$'
elseif (test_case .eq. '3') then
open(unit = 12, file = '/dev/null')
elseif (test_case .eq. '4') then
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
char_85 = ' 0-05-001 '
write (12,'(A)') char_85
close (12)
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
elseif (test_case .eq. '5') then
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
char_85 = ' | 0-05-001 > '
write (12,'(A)') char_85
char_85 = ' | 0-06-300 '
write (12,'(A)') char_85
close (12)
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
endif
jret = 0
call wrdlen
call sntbde(12, 49430, card, 1, 1, jret, int_1d, char_8, char_4, char_120, int_1d, int_1d, char_120)
elseif (sub_name .eq. 'sntbfe') then
if (test_case .eq. '1') then
call sntbde(0, 0, 'c', 1, 1, 2, int_1d, char_8, char_4, char_120, int_1d_2, int_1d, char_120)
open(unit = 12, file = '/dev/null')
elseif (test_case .eq. '2') then
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
card = ' 0-01-031,0-01-033,0-01-035=176 '
write (12,'(A)') card
close (12)
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
elseif (test_case .eq. '3') then
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
card = ' | 0-01-031,0-01-033,0-01-035 176 '
write (12,'(A)') card
close (12)
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
elseif (test_case .eq. '4') then
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
card = ' | =176 '
write (12,'(A)') card
close (12)
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
elseif (test_case .eq. '5') then
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
card = ' | 0-01-331,0-01-033,0-01-035=176 '
write (12,'(A)') card
close (12)
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
elseif (test_case .eq. '6') then
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
card = ' | 0-01-031,0-01-033,0-01-035= '
write (12,'(A)') card
close (12)
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
elseif (test_case .eq. '7') then
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
card = ' | 0-01-031,0-01-033,0-01-035=17T '
write (12,'(A)') card
close (12)
open(unit = 12, file = 'testfiles/test_bort_master', iostat = ios)
if (ios .ne. 0) stop 3
endif
call wrdlen
call sntbfe(12, 288)
elseif (sub_name .eq. 'stdmsg') then
if (test_case .eq. '1') then
call stdmsg('W')
Expand Down Expand Up @@ -845,9 +943,6 @@ program test_bort
write (12,'(A)') card
card = '| YEAR | 0 | 0 | 12 | YEAR |-------------|'
write (12,'(A)') card
close (12)
open(unit = 12, file = 'testfiles/test_bort_DX', iostat = ios)
call openbf(11, 'OUT', 12)
elseif (test_case .eq. '8') then
card = '| YEAR | 004001 | YEAR |'
write (12,'(A)') card
Expand Down

0 comments on commit 4b64eb4

Please sign in to comment.