Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing more borts. #379

Merged
merged 14 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/adn30.f
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
C> @file
C> @brief Convert an FXY value from its bit-wise (integer)
C> representation to its five or six character representation
C> representation to its five or six character representation.
C>
C> @author J. Woollen @date 1994-01-06

C> This function converts an FXY value from its bit-wise
C> (integer) representation to its 5 or 6 character
C> representation.
C>
C> This function is the logical inverse of function idn30().
C>
C> @param[in] IDN -- integer: Bit-wise representation of FXY value
C> @param[in] L30 -- integer: Length of string to be returned; can be
C> either 5 or 6 characters
C> either 5 or 6 characters
C> @returns adn30 -- character*(*): FXY value
C>
C> @remarks
C> - This function is the logical inverse of function idn30().
C>
C> @author J. Woollen @date 1994-01-06

FUNCTION ADN30(IDN,L30)
Expand Down
6 changes: 3 additions & 3 deletions src/capit.f
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
C> @file
C> @brief Capitalize a character string
C> @brief Capitalize a character string.
C>
C> @author J. Woollen @date 2002-05-14

C> This subroutine capitalizes all of the alphabetic characters in
C> a string. The string is modified in place.
C> a string. The string is modified in place.
C>
C> @param[in,out] STR -- character*(*): String
C> @param[in,out] STR - character*(*): String
C>
C> @author J. Woollen @date 2002-05-14
SUBROUTINE CAPIT(STR)
Expand Down
12 changes: 6 additions & 6 deletions src/cmpmsg.f
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
C> @file
C> @brief Specify the use of compression when writing BUFR messages
C> @brief Specify the use of compression when writing BUFR messages.
C>
C> @author J. Ator @date 2005-03-09

C> This subroutine is used to specify whether BUFR messages output
C> by future calls to [message-writing subroutines](@ref hierarchy) and
C> [subset-writing subroutines](@ref hierarchy) are to be compressed.
C>
C> @param[in] CF -- character*1: Flag indicating whether future BUFR
C> output messages are to be compressed
C> - 'N' = No (the default)
C> - 'Y' = Yes
C>
C> This subroutine can be called at any time after the first call
C> to subroutine openbf(), and the specified value for CF will remain
C> in effect for all future calls to
Expand All @@ -32,6 +27,11 @@
C> compression may provide little to no benefit, and which is why
C> it is not activated by default.
C>
C> @param[in] CF -- character*1: Flag indicating whether future BUFR
C> output messages are to be compressed
C> - 'N' = No (the default)
C> - 'Y' = Yes
C>
C> @author J. Ator @date 2005-03-09
SUBROUTINE CMPMSG(CF)

Expand Down
2 changes: 1 addition & 1 deletion src/nemtab.f
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
C> @file
C> @brief Get information about a descriptor, based on the mnemonic
C> @brief Get information about a descriptor, based on the mnemonic.
C>
C> @author J. Woollen @date 1994-01-06

Expand Down
44 changes: 43 additions & 1 deletion test/run_test_bort.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,54 @@
#
# Ed Hartnett 3/12/23

# Check adn30().
./test_bort_4 adn30 1
[ $? != 1 ] && exit 1
./test_bort_4 adn30 2
[ $? != 1 ] && exit 1

# Check bort().
./test_bort_4 bort 1
[ $? != 1 ] && exit 1

./test_bort_4 bort 2
# Check bort2().
./test_bort_4 bort2 1
[ $? != 1 ] && exit 1

# Check bvers().
./test_bort_4 bvers 1
[ $? != 1 ] && exit 1

# Check cmpmsg().
./test_bort_4 cmpmsg 1
[ $? != 1 ] && exit 1

# Check wtstat().
./test_bort_4 wtstat 1
[ $? != 1 ] && exit 1
./test_bort_4 wtstat 2
[ $? != 1 ] && exit 1
./test_bort_4 wtstat 3
[ $? != 1 ] && exit 1
./test_bort_4 wtstat 4
[ $? != 1 ] && exit 1

# Check writdx().
./test_bort_4 writdx 1
[ $? != 1 ] && exit 1

# Check writlc().
./test_bort_4 writlc 1
[ $? != 1 ] && exit 1

# Check writsa().
./test_bort_4 writsa 1
[ $? != 1 ] && exit 1

# Check writsb().
./test_bort_4 writsb 1
[ $? != 1 ] && exit 1

# If we made it here, all error codes were correctly returned, and the
# test passed!
exit 0
52 changes: 50 additions & 2 deletions test/test_bort.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
! Ed Hartnett 3/12/23
program test_bort
implicit none
character*2 char_short
character*30 char_30

integer :: num_args, len, status
character(len=32) :: sub_name, test_case
character adn30

num_args = command_argument_count()
if (num_args /= 2) then
Expand All @@ -25,12 +28,57 @@ program test_bort
print *, 'Testing ', sub_name, ' case ', test_case

! Run the test for the subroutine and test case.
if (sub_name .eq. 'bort') then
if (sub_name .eq. 'adn30') then
if (test_case .eq. '1') then
char_short = adn30(0, 5)
elseif (test_case .eq. '2') then
char_30 = adn30(0, 9)
endif
elseif (sub_name .eq. 'bort') then
if (test_case .eq. '1') then
call bort('goodbye!')
else if (test_case .eq. '2') then
endif
elseif (sub_name .eq. 'bort2') then
if (test_case .eq. '1') then
call bort2('goodbye!', 'goodbye again!')
endif
elseif (sub_name .eq. 'bvers') then
if (test_case .eq. '1') then
call bvers(char_short)
endif
elseif (sub_name .eq. 'cmpmsg') then
if (test_case .eq. '1') then
call cmpmsg('W')
endif
elseif (sub_name .eq. 'writdx') then
if (test_case .eq. '1') then
call writdx(0, 0, 0)
endif
elseif (sub_name .eq. 'writlc') then
if (test_case .eq. '1') then
call writlc(0, char_30, char_30)
endif
elseif (sub_name .eq. 'writsa') then
if (test_case .eq. '1') then
call writsa(0, 0, 0, 0)
endif
elseif (sub_name .eq. 'writsb') then
if (test_case .eq. '1') then
call writsb(0)
endif
elseif (sub_name .eq. 'wtstat') then
if (test_case .eq. '1') then
call wtstat(0, 0, 0, 0)
elseif (test_case .eq. '2') then
call wtstat(1, 0, 0, 0)
elseif (test_case .eq. '3') then
call wtstat(1, 1, -2, 0)
elseif (test_case .eq. '4') then
call wtstat(1, 1, 0, -1)
endif
else
print *, "Unknown test function"
stop 2
endif

end program test_bort