From 410f6d72284bd5ccae1b4786bb844e00d005a0c0 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 13 Mar 2023 11:07:02 -0600 Subject: [PATCH 01/11] add testing for bort for bvers() --- test/run_test_bort.sh | 8 +++++++- test/test_bort.F90 | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/test/run_test_bort.sh b/test/run_test_bort.sh index 5cc7c061..92664284 100644 --- a/test/run_test_bort.sh +++ b/test/run_test_bort.sh @@ -5,12 +5,18 @@ # # Ed Hartnett 3/12/23 +# Check bort(). ./test_bort_4 bort 1 [ $? != 1 ] && exit 1 -./test_bort_4 bort 2 +# Check bort2(). +./test_bort_4 bort 1 [ $? != 1 ] && exit 1 +# Check bvers(). +./test_bort_4 bvers 1 +[ $? != 1 ] && exit 1 + # If we made it here, all error codes were correctly returned, and the # test passed! exit 0 diff --git a/test/test_bort.F90 b/test/test_bort.F90 index 0c80195d..0dce2e0d 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -6,6 +6,7 @@ ! Ed Hartnett 3/12/23 program test_bort implicit none + character*2 char_short integer :: num_args, len, status character(len=32) :: sub_name, test_case @@ -28,9 +29,15 @@ program test_bort if (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 endif end program test_bort From 11312f1abe64e8cc124cc9768f2675b35af8f10d Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 13 Mar 2023 11:18:20 -0600 Subject: [PATCH 02/11] add testing for bort for bvers() --- src/adn30.f | 9 ++++----- test/run_test_bort.sh | 10 ++++++++++ test/test_bort.F90 | 10 ++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/adn30.f b/src/adn30.f index c9729edd..30d2f353 100644 --- a/src/adn30.f +++ b/src/adn30.f @@ -1,6 +1,6 @@ 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 @@ -8,14 +8,13 @@ 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) diff --git a/test/run_test_bort.sh b/test/run_test_bort.sh index 92664284..967ce8ab 100644 --- a/test/run_test_bort.sh +++ b/test/run_test_bort.sh @@ -17,6 +17,16 @@ ./test_bort_4 bvers 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 + # If we made it here, all error codes were correctly returned, and the # test passed! exit 0 diff --git a/test/test_bort.F90 b/test/test_bort.F90 index 0dce2e0d..f85733c8 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -38,6 +38,16 @@ program test_bort if (test_case .eq. '1') then call bvers(char_short) 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, 0) + endif endif end program test_bort From 19f7fef1a03c9be066ca54cdd7a8911612d30fe3 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 13 Mar 2023 11:22:51 -0600 Subject: [PATCH 03/11] add testing for bort for bvers() --- test/test_bort.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_bort.F90 b/test/test_bort.F90 index f85733c8..9ba4d48e 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -46,7 +46,7 @@ program test_bort elseif (test_case .eq. '3') then call wtstat(1, 1, -2, 0) elseif (test_case .eq. '4') then - call wtstat(1, 1, 0, 0) + call wtstat(1, 1, 0, -1) endif endif From 3ed9aced6cfa0e878689de31a63e49ca68e8d54e Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 13 Mar 2023 11:35:12 -0600 Subject: [PATCH 04/11] add testing for bort for bvers() --- test/run_test_bort.sh | 4 ++++ test/test_bort.F90 | 3 +++ 2 files changed, 7 insertions(+) diff --git a/test/run_test_bort.sh b/test/run_test_bort.sh index 967ce8ab..fe152830 100644 --- a/test/run_test_bort.sh +++ b/test/run_test_bort.sh @@ -27,6 +27,10 @@ ./test_bort_4 wtstat 4 [ $? != 1 ] && exit 1 +# Check writdx(). +./test_bort_4 writdx 4 +[ $? != 1 ] && exit 1 + # If we made it here, all error codes were correctly returned, and the # test passed! exit 0 diff --git a/test/test_bort.F90 b/test/test_bort.F90 index 9ba4d48e..180424f6 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -48,6 +48,9 @@ program test_bort elseif (test_case .eq. '4') then call wtstat(1, 1, 0, -1) endif + elseif (sub_name .eq. 'writdx') then + if (test_case .eq. '1') then + call writdx(0, 0) endif end program test_bort From d2f85eeed9b10df6aa5a979570280a3e4051ae0e Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 13 Mar 2023 11:37:23 -0600 Subject: [PATCH 05/11] add testing for bort for bvers() --- test/test_bort.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_bort.F90 b/test/test_bort.F90 index 180424f6..9e6d92a1 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -51,6 +51,7 @@ program test_bort elseif (sub_name .eq. 'writdx') then if (test_case .eq. '1') then call writdx(0, 0) + endif endif end program test_bort From 28aff1a321a5944a3dd1d7d89d77b92400312285 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 13 Mar 2023 12:31:43 -0600 Subject: [PATCH 06/11] add testing for bort for bvers() --- test/test_bort.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_bort.F90 b/test/test_bort.F90 index 9e6d92a1..96f3d44f 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -50,7 +50,7 @@ program test_bort endif elseif (sub_name .eq. 'writdx') then if (test_case .eq. '1') then - call writdx(0, 0) + call writdx(0, 0, 0) endif endif From 37485e09fd622167e9c735a584b57fce115add60 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 13 Mar 2023 12:36:33 -0600 Subject: [PATCH 07/11] add testing for bort for bvers() --- test/run_test_bort.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run_test_bort.sh b/test/run_test_bort.sh index fe152830..8fee370d 100644 --- a/test/run_test_bort.sh +++ b/test/run_test_bort.sh @@ -28,7 +28,7 @@ [ $? != 1 ] && exit 1 # Check writdx(). -./test_bort_4 writdx 4 +./test_bort_4 writdx 1 [ $? != 1 ] && exit 1 # If we made it here, all error codes were correctly returned, and the From afe8fcedf3cfd3585908fdbace433f56fb7942a5 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 13 Mar 2023 12:39:38 -0600 Subject: [PATCH 08/11] more testing for borts --- test/run_test_bort.sh | 4 ++++ test/test_bort.F90 | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/test/run_test_bort.sh b/test/run_test_bort.sh index 8fee370d..1b86c9de 100644 --- a/test/run_test_bort.sh +++ b/test/run_test_bort.sh @@ -31,6 +31,10 @@ ./test_bort_4 writdx 1 [ $? != 1 ] && exit 1 +# Check writsa(). +./test_bort_4 writdx 1 +[ $? != 1 ] && exit 1 + # If we made it here, all error codes were correctly returned, and the # test passed! exit 0 diff --git a/test/test_bort.F90 b/test/test_bort.F90 index 96f3d44f..f37202a6 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -52,6 +52,10 @@ program test_bort if (test_case .eq. '1') then call writdx(0, 0, 0) endif + elseif (sub_name .eq. 'writsa') then + if (test_case .eq. '1') then + call writdx(0, 0, 0, 0) + endif endif end program test_bort From 5e76125851f33bd6e1ae798b4f43659f6ce53ae4 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 13 Mar 2023 12:42:28 -0600 Subject: [PATCH 09/11] more testing for borts --- test/run_test_bort.sh | 6 +++++- test/test_bort.F90 | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/run_test_bort.sh b/test/run_test_bort.sh index 1b86c9de..60867d7a 100644 --- a/test/run_test_bort.sh +++ b/test/run_test_bort.sh @@ -31,8 +31,12 @@ ./test_bort_4 writdx 1 [ $? != 1 ] && exit 1 +# Check writlc(). +./test_bort_4 writlc 1 +[ $? != 1 ] && exit 1 + # Check writsa(). -./test_bort_4 writdx 1 +./test_bort_4 writsa 1 [ $? != 1 ] && exit 1 # If we made it here, all error codes were correctly returned, and the diff --git a/test/test_bort.F90 b/test/test_bort.F90 index f37202a6..8cd40b7f 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -52,9 +52,13 @@ program test_bort 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, 0, 0, 0) + endif elseif (sub_name .eq. 'writsa') then if (test_case .eq. '1') then - call writdx(0, 0, 0, 0) + call writsa(0, 0, 0, 0) endif endif From 185c9b7375249ff5dae9903cf9bcc5835258a168 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 14 Mar 2023 07:32:25 -0600 Subject: [PATCH 10/11] added a bunch of tests for borts that occur on bad subroutine parameters --- src/capit.f | 6 +++--- src/cmpmsg.f | 12 ++++++------ src/nemtab.f | 2 +- test/run_test_bort.sh | 16 +++++++++++++++- test/test_bort.F90 | 37 ++++++++++++++++++++++++++++--------- 5 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/capit.f b/src/capit.f index a34c6b96..6e2ebbbb 100644 --- a/src/capit.f +++ b/src/capit.f @@ -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) diff --git a/src/cmpmsg.f b/src/cmpmsg.f index 3392ec8b..90a7c084 100644 --- a/src/cmpmsg.f +++ b/src/cmpmsg.f @@ -1,5 +1,5 @@ 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 @@ -7,11 +7,6 @@ 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 @@ -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) diff --git a/src/nemtab.f b/src/nemtab.f index 9aedd878..6a8a941c 100644 --- a/src/nemtab.f +++ b/src/nemtab.f @@ -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 diff --git a/test/run_test_bort.sh b/test/run_test_bort.sh index 60867d7a..2254547f 100644 --- a/test/run_test_bort.sh +++ b/test/run_test_bort.sh @@ -5,18 +5,28 @@ # # 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 # Check bort2(). -./test_bort_4 bort 1 +./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 @@ -39,6 +49,10 @@ ./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 diff --git a/test/test_bort.F90 b/test/test_bort.F90 index 8cd40b7f..36a5ec38 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -7,9 +7,11 @@ 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 @@ -26,7 +28,13 @@ 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!') endif @@ -38,15 +46,9 @@ program test_bort if (test_case .eq. '1') then call bvers(char_short) endif - elseif (sub_name .eq. 'wtstat') then + elseif (sub_name .eq. 'cmpmsg') 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) + call cmpmsg('W') endif elseif (sub_name .eq. 'writdx') then if (test_case .eq. '1') then @@ -60,6 +62,23 @@ program test_bort 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, 0, 0, 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 From 3492a337580e0d49419d259230aee6582d932ab5 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 14 Mar 2023 15:06:12 -0600 Subject: [PATCH 11/11] changes in response to review comments --- test/test_bort.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_bort.F90 b/test/test_bort.F90 index 36a5ec38..e655912e 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -11,7 +11,7 @@ program test_bort integer :: num_args, len, status character(len=32) :: sub_name, test_case - CHARACTER ADN30 + character adn30 num_args = command_argument_count() if (num_args /= 2) then @@ -56,7 +56,7 @@ program test_bort endif elseif (sub_name .eq. 'writlc') then if (test_case .eq. '1') then - call writlc(0, 0, 0, 0) + call writlc(0, char_30, char_30) endif elseif (sub_name .eq. 'writsa') then if (test_case .eq. '1') then @@ -64,7 +64,7 @@ program test_bort endif elseif (sub_name .eq. 'writsb') then if (test_case .eq. '1') then - call writsb(0, 0, 0, 0) + call writsb(0) endif elseif (sub_name .eq. 'wtstat') then if (test_case .eq. '1') then