Skip to content

Commit bd10da6

Browse files
authored
Merge pull request #54 from BerkeleyLab/chores
Chores and minor new feature
2 parents 6cef106 + 6e926e2 commit bd10da6

42 files changed

Lines changed: 156 additions & 150 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
1+
<p align="center">
2+
<img width="250" height="250" src="https://github.com/user-attachments/assets/1a1c4f1a-f229-4d6d-bcaa-d5d9826ee639">
3+
</p>
4+
15
Julienne
26
========
3-
```
4-
_ _ _
5-
| |_ _| (_) ___ _ __ _ __ ___
6-
_ | | | | | | |/ _ \ '_ \| '_ \ / _ \
7-
| |_| | |_| | | | __/ | | | | | | __/
8-
\___/ \__,_|_|_|\___|_| |_|_| |_|\___|
9-
```
10-
Julienne is a modern Fortran unit-testing framework that includes utilities for manipulating strings
7+
Julienne is a modern Fortran unit-testing framework that includes utilities for manipulating strings
118
via Julienne's `string_t` derived type. The target strings include command-line arguments accessed
129
via Julienne's `command_line_t` type and format strings generated by functions in Julienne's `formats_m` module.
1310

1411
Users construct tests by
1512
1. Extending Julienne's `test_t` abstract derived type,
1613
2. Defining a `subject()` function that returns a description of the entity being tested,
1714
3. Defining a `results()` function that
18-
- Constructs an array of `test_description_t` objects, each of which encapsulates
15+
- Defines a result comprised of an array of `test_result_t` objects.
16+
- Defines a local array of `test_description_t` objects, each of which encapsulates
1917
* A string describing a function that produces one or more `test_diagnosis_t` result objects, each of which encapsulates
2018
* A `logical` indicator of whether the test passed and
2119
* A `character` or `string_t` diagnostics string.
22-
* The corresponding function name and
23-
- Produces an array of `test_result_t` objects.
20+
* The corresponding function name.
2421

2522
Julienne empowers users to customize the diagnostic information that prints when tests fail.
2623
For this purpose, Julienne's `string_t` constructors convert various data types, kinds, and ranks to character data.
2724
Julienne also provides `string_t` operators supporting concatenation and delimited lists such as comma-separated value lists.
2825

2926
Julienne's name derives from the term for vegetables sliced into thin strings: julienned vegetables.
3027
The [Veggies] unit-testing framework inspired the structure of Julienne's tests and output.
31-
Julienne aims to be a more lightweight alternative that is more portable across compilers and compiler versions.
28+
Julienne aims to be a more lightweight alternative that is more portable across compilers.
3229

3330
Getting Started
3431
---------------
3532
Please see the [example-test-suite README.md](./example/example-test-suite/README.md).
3633

37-
Supported Compilers
34+
Supported Compilers
3835
-------------------
3936

4037
Compiler | Version(s) Tested | Known Issues
@@ -104,5 +101,5 @@ See our online [documentation] or build the documentation locally by installing
104101
[Veggies]: https://gitlab.com/everythingfunctional/veggies
105102
[here]: https://github.com/rouson/handy-dandy/blob/7caaa4dc3d6e5331914a3025f0cb1db5ac1a886f/src/fresh-llvm-build.sh
106103
[documentation]: https:///berkeleylab.github.io/julienne/
107-
[FORD]: https://github.com/Fortran-FOSS-Programmers/ford
104+
[FORD]: https://github.com/Fortran-FOSS-Programmers/ford
108105
[handy-dandy]: https://github.com/rouson/handy-dandy/blob/7caaa4dc3d6e5331914a3025f0cb1db5ac1a886f/src/fresh-llvm-build.sh

example/check-command-line-argument.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
! Copyright (c) 2024, The Regents of the University of California and Sourcery Institute
1+
! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
22
! Terms of use are as specified in LICENSE.txt
33
program check_command_line_argument
4-
!! This program serves the dual purposes of
4+
!! This program serves the dual purposes of
55
!! 1. Showing how to use the command_line_t derived type to check whether a
66
!! command-line argument is present and
77
!! 2. Supporting the test suite verification of this same behavior.
88
!!
99
!! Running this program as follows with the command
1010
!!
11-
!! fpm run --example check-command-line-argument -- --some-argument
11+
!! fpm run --example check-command-line-argument -- --some-argument
1212
!!
1313
!! should result in normal termination.
1414
use assert_m, only : assert

example/example-test-suite/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ Likely the fastest way to get started with Julienne is to copy the source code i
1010
3. Similarly replace occurrences of `specimen` in the resulting`test/main.F90` file.
1111
4. Modify the `test_descriptions_t` array constructor in your new `*_test_m.F90` file, adding elements for each test to be performed:
1212
```fortran
13-
test_descriptions = [ &
13+
test_descriptions = [ &
1414
test_description_t("the type-bound function zero() producing a result of 0", check_zero) &
15-
]
15+
]
1616
```
1717
5. Replace the above string (`"the type-bound..."`) with a description of your intended test. The test output will read most naturally if your description contains a gerund: a verb ending in "ing" and used as a noun, such as `producing` above.
18-
6. Replace the `check_zero` function name with the name of a function that will perform your test.
18+
6. Replace the `check_zero` function name with the name of a function that will perform your test.
1919
7. Edit the correspondingly-renamed function to perform the test. The function must take no arguments and define a `test_diagnosis_t` result. An example result might be the following:
2020
```fortran
2121
test_diagnosis = test_diagnosis_t( &
2222
test_passed = actual_value == expected_value &
2323
,diagnostics_string = "expected value " // string_t(expected_value) //", actual value " // string_t(actual_value) &
24-
)
24+
)
2525
```
2626
The above `test_diagnosis_t` constructor function invocation demonstrates the recommended pattern for writing tests with Julienne:
2727

@@ -54,7 +54,7 @@ and the following corresponding test:
5454
```
5555
If the `counting_numbers` result contains all zeros, the test report would include the following text:
5656
```
57-
FAILS on returning the counting numbers up to 3
57+
FAILS on returning the counting numbers up to 3
5858
diagnostics: expected 1,2,3; actual 0,0,0
5959
```
6060
To support a common array notation, Julienne also supports bracketing strings.
@@ -82,7 +82,7 @@ test_t --> specimen_test_t : report() invokes subject() and results()
8282
8383
class specimen_test_t{
8484
subject() character(len=:)
85-
results() test_result_t[0..*]
85+
results() test_result_t[0..*]
8686
}
8787
specimen_test_t --|> test_t : extends and implements
8888
specimen_test_t --> test_description_t : results() constructs local array of
@@ -138,7 +138,7 @@ One might accomplish this with the compiler's predefined preprocessor macro:
138138
#ifndef __GFORTRAN__
139139
,test_description_t('constructing bracketed strings', brackets_strings_ptr) &
140140
#else
141-
,test_description_t('constructing bracketed strings' ) &
141+
,test_description_t('constructing bracketed strings' ) &
142142
#endif
143143
```
144144
which presently appears in Julienne `test/string_test_m.F90` test in order to work around a runtime crash known to be caused by a `gfortran` bug.

example/example-test-suite/main.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! Copyright (c) 2024, The Regents of the University of California and Sourcery Institute
1+
! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
22
! Terms of use are as specified in LICENSE.txt
33

44
#include "language-support.F90"
@@ -29,7 +29,7 @@ subroutine print_usage_and_stop_if_help_requested
2929
print '(a)', 'the tests with test subjects or test descriptions containing the user-specified substring.'
3030
stop
3131
else
32-
print *
32+
print *
3333
print "(a)", "Append '-- --help' or '-- -h' to your `fpm test` command to display usage information."
3434
end if
3535
end subroutine

example/example-test-suite/scalar_and_vector_test_description_m.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! Copyright (c) 2024, The Regents of the University of California and Sourcery Institute
1+
! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
22
! Terms of use are as specified in LICENSE.txt
33

44
#include "language-support.F90"
@@ -29,7 +29,7 @@ module scalar_and_vector_test_description_test_m
2929

3030
pure function subject() result(specimen)
3131
character(len=:), allocatable :: specimen
32-
specimen = "The test_description_t type"
32+
specimen = "The test_description_t type"
3333
end function
3434

3535
function results() result(test_results)
@@ -60,11 +60,11 @@ function results() result(test_results)
6060
string_t( "finding a substring in a test description") &
6161
,string_t("not finding a missing substring in a test description") &
6262
], check_substring_search &
63-
)])
63+
)])
6464
associate(num_vector_tests => size(vector_test_descriptions))
6565
block
6666
integer i
67-
67+
6868
if (substring_in_subject) then
6969
vector_test_results = [(vector_test_descriptions(i)%run(), i=1,num_vector_tests)]
7070
else

example/example-test-suite/specimen_m.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! Copyright (c) 2024, The Regents of the University of California and Sourcery Institute
1+
! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
22
! Terms of use are as specified in LICENSE.txt
33
module specimen_m
44
!! Example test specimen corresponding to the test defined in specimen_test_m.F90

example/example-test-suite/specimen_test_m.F90

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! Copyright (c) 2024, The Regents of the University of California and Sourcery Institute
1+
! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
22
! Terms of use are as specified in LICENSE.txt
33

44
#include "language-support.F90"
@@ -16,7 +16,7 @@ module specimen_test_m
1616
#if ! HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY
1717
use julienne_m, only : diagnosis_function_i ! work around gfortran's missing Fortran 2008 feature
1818
#endif
19-
19+
2020
implicit none
2121

2222
private
@@ -32,32 +32,32 @@ module specimen_test_m
3232

3333
pure function subject() result(specimen_description)
3434
character(len=:), allocatable :: specimen_description
35-
specimen_description = "A specimen_t object"
35+
specimen_description = "A specimen_t object"
3636
end function
3737

3838
function results() result(test_results)
3939
type(test_result_t), allocatable :: test_results(:)
4040
type(test_description_t), allocatable :: test_descriptions(:)
4141

4242
#if HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY
43-
test_descriptions = [ &
43+
test_descriptions = [ &
4444
test_description_t("the type-bound function zero() producing a result of 0", check_zero) &
45-
]
46-
#else
45+
]
46+
#else
4747
! work around gfortran's missing Fortran 2008 feature
4848
procedure(diagnosis_function_i), pointer :: check_zero_ptr
4949
check_zero_ptr => check_zero
5050

51-
test_descriptions = [ &
51+
test_descriptions = [ &
5252
test_description_t("the type-bound function zero() producing a result of 0", check_zero_ptr) &
53-
]
53+
]
5454
#endif
5555
#ifndef __GFORTRAN__
5656
associate(test_subset => pack(test_descriptions, test_descriptions%contains_text(test_description_substring) .or. index(subject(), test_description_substring)/=0))
5757
test_results = test_subset%run()
5858
end associate
59-
#else
60-
59+
#else
60+
6161
test_descriptions = pack(test_descriptions, test_descriptions%contains_text(test_description_substring) .or. index(subject(), test_description_substring)/=0)
6262
test_results = test_descriptions%run()
6363
#endif

example/get-flag-value.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
! Copyright (c) 2024, The Regents of the University of California and Sourcery Institute
1+
! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
22
! Terms of use are as specified in LICENSE.txt
33
program get_flag_value
4-
!! Demonstrate how to find the value of a command-line flag
4+
!! Demonstrate how to find the value of a command-line flag
55
!! Running this program as follows with the command
66
!!
77
!! fpm run --example get-flag-value -- --input-file foo

example/handle-missing-flag.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! Copyright (c) 2024, The Regents of the University of California and Sourcery Institute
1+
! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
22
! Terms of use are as specified in LICENSE.txt
33
program handle_missing_flag
44
!! This program serves the dual purposes of

fpm.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name = "julienne"
2-
version = "1.8.4"
2+
version = "2.0.1"
33
license = "license"
44
author = "Damian Rouson, Brad Richardson, Patrick Raynaud, Katherine Rasmussen"
55
maintainer = "rouson@lbl.gov"
6-
copyright = "Copyright 2024, Sourcery Institute and Berkeley Lab"
6+
copyright = "Copyright 2024-2025, Sourcery Institute and Berkeley Lab"
77

88
[dependencies]
99
assert = {git = "https://github.com/berkeleylab/assert", tag = "2.1.0"}

0 commit comments

Comments
 (0)