Skip to content

Commit 56320fc

Browse files
authored
doc(demo/README): finish overview
1 parent 4972840 commit 56320fc

1 file changed

Lines changed: 49 additions & 47 deletions

File tree

demo/README.md

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,37 @@ Getting Started
22
===============
33
This `demo` directory contains a demonstration project with
44

5-
* Stub types and functions in the `src` subdirectory and
6-
* Tests for the stubs in the `test` subdirectory.
5+
* Stub types and functions in the `src` subdirectory,
6+
* Tests for the stubs in the `test` subdirectory,
7+
* A Fortran Package Manager (`fpm`) build/test system in `fpm.toml`.
78

89
Please try [running the demonstration tests] and [generating test scaffolding].
910

1011
Writing tests
1112
-------------
12-
Testing centers around Julienne's `test_t` abstract derived type.
13-
Users define non-abstract `test_t` child types to capture groups of tests.
14-
Doing so requires defining the inherited deferred bindings: `subject` and `results`.
15-
The `subject` function defines a `character` string result describing what is being tested.
16-
The `results` function defines a `test_result_t` array result by invoking the inherited `run` procedure on an instance of the child type.
17-
The `run` function accepts a `test_descripton_t` array argument and constructs the `test_result_t` array.
13+
Testing with Julienne centers around the `test_t` abstract derived type.
14+
Users extend `test_t`, definoing non-abstract child types capturing groups of tests.
15+
Doing so requires defining the inherited deferred bindings: the `subject` and `results` functions.
1816

19-
Users construct the `test_description_t` array by invoking a `test_description_t` constructor for each array element and passing each constructor invocation two arguments:
17+
* `subject` has no argumetns and defines a `character` string result describing what is being tested,
18+
* `results` has no arguments defines a `test_result_t` array result by invoking the inherited `run` function on a child instance, and
19+
* `run` uses a `test_descripton_t` array argument to construct a `test_result_t` array result.
2020

21-
* A `character` test description typically beginning with a gerund: a word ending in `-ing` and
21+
Users construct each `test_description_t` array element by invoking a `test_description_t` constructor function, which has two arguments:
22+
23+
* A `character` string describing whata the test does, typically beginning with a gerund: a word ending in `-ing`, and
2224
* The name of a function conforming to Julienne's `diagnosis_function_i` abstract interface.
2325

24-
Users define functions conforming to the `diagnosis_function_i` interface: functions with no arguments and with a `test_diagnosis_t` result.
25-
Constructing a the function result involves either
26+
The `diagnosis_function_i` function implementations have no arguments and construct a `test_diagnosis_t` result by
27+
28+
* Writing an expression in a Julienne idiom with defined operations (.e.g, `.all.(['a','b','c'] .isBefore. 'efg')`) or
29+
* Invoking the `test_diagnosis_t` constructor if no convenient idiom exists.
2630

27-
* Invoking the `test_diagnosis_t` constructor or
28-
* Writing an expression in a Julienne idiom using Julienne's defined operations.
31+
The `test_diagnosis_t` constructor has two arguments:
2932

30-
The `test_diagnosis_t` constructor takes two arguments.
31-
The first is usually a `logical` expression defining the test condition.
32-
The second is a diagnostics string of type `string_t` or `character`.
33+
* `test_passed`: `logical` expression defining the test condition (.e.g, `
34+
* `diagnostics_string`: a `string_t` or `character`. Please see [Forming Diagnostics Strings] and [String-Handling Functions].
35+
3336
Please see the `test` subdirectory for code examples.
3437
Also, please see the following Unified Modeling Language ([UML]) class diagram for a summary of user-facing derived types, including type relationships and object constructors.
3538
Users invoke constructor functions via generic names matching the type of the constructed object result.
@@ -44,52 +47,54 @@ class test_t{
4447
<<abstract>>
4548
subject() character *
4649
results() test_result_t *
47-
run(test_descriptions : test_description_t) : test_result_t
50+
run(test_descriptions : test_description_t) test_result_t
4851
}
4952
5053
class test_description_t{
51-
test_decription_t(description : character, diagnosis_function : procedure(diagnosis_function_i)) : test_description_t
54+
test_decription_t(description : character, diagnosis_function : procedure(diagnosis_function_i)) test_description_t
5255
}
56+
```
57+
58+
```mermaid
59+
classDiagram
5360
5461
class test_diagnosis_t{
55-
test_diagnosis_t(test_passed : logical, diagnostics_string : string_t) : test_diagnosis_t
62+
test_diagnosis_t(test_passed : logical, diagnostics_string : string_t) test_diagnosis_t
5663
}
5764
65+
```
66+
67+
```mermaid
68+
classDiagram
5869
class string_t{
59-
string_t(character) : string_t
70+
string_t(character) string_t
6071
}
6172
```
6273

6374
Running the demonstration tests
6475
-------------------------------
65-
With the Fortran Package Manager (`fpm`) installed and the `demo`
66-
subdirectory as your present working directory in a shell, run
67-
the demonstration test suite using the command corresponding to
68-
your compiler in the table below.
76+
With the Fortran Package Manager (`fpm`) installed, please set the `demo` subdirectory as your present working directory in a shell.
77+
Then run the demonstration test suite using the command below for your compiler.
6978

7079
|Vendor | Version(s) Tested | Example shell command |
7180
|-------|-------------------------|--------------------------------------------------|
7281
|LLVM | 20.1.8 | `fpm test --compiler flang-new --flag "-O3"` |
7382
|GCC | 14.3.0, 15.1.0 | `fpm test --compiler gfortran --profile release` |
74-
|NAG | 7.2 Build 7235 | `fpm test --compiler nagfor --flag -fpp` |
83+
|NAG | 7.2 Build 7235 | `fpm test --compiler nagfor --flag "-O3 -fpp"` |
7584
|Intel | 2025.1.0 Build 20250728 | `fpm test --compiler ifx --flag "-fpp -O3"` |
7685

7786
Generating test scaffolding
7887
---------------------------
79-
The `demo/test` subdirectory contains tests generated by first creating a
80-
`test-suite.json` file with the following contents:
88+
To recreate the `test` directory contents, pass the following `test-suite.json` file to Julienne's `scaffold` program:
8189
```
8290
{
8391
"test suite": {
8492
"test subjects" : ["specimen","widget"]
8593
}
8694
}
8795
```
88-
The current file reader is fragile. It is recommended to maintain the
89-
above file structure, keeping the array on one line.
90-
91-
Entering the following command in a `zsh` shell with the present working
92-
directory set to the root of Julienne's source tree:
96+
Please maintain the above format by introducing by not inserting, deleting, or combining any lines.
97+
Please run following command in a `zsh` shell with the root of Julienne's source tree as your present working directory:
9398
```
9499
fpm run scaffold \
95100
--compiler flang-new \
@@ -107,8 +112,7 @@ demo
107112
   ├── specimen_test_m.f90
108113
   └── widget_test_m.f90
109114
```
110-
The modules inside the `specimen_test_m.f90` and `widget_test_m.f90` files each
111-
contain three tests:
115+
The modules inside the `specimen_test_m.f90` and `widget_test_m.f90` files each contain three tests:
112116
1. One test intentionally fails and demonstrates the construction of a test
113117
diagnosis via an idiom using Julienne's defined operations:
114118
```
@@ -130,7 +134,7 @@ contain three tests:
130134

131135
The driver program imports the `test_t` child types.
132136
The driver then constructs a `test_harness_t` object from an array of `test_fixture_t` objects.
133-
The driver constructs `test_fixture_t` objects from structure constructors provided by the compiler for each test type.
137+
The driver constructs `test_fixture_t` objects from structure constructors provided by the language standard for each test type.
134138

135139
Forming diagnostic strings
136140
--------------------------
@@ -172,7 +176,7 @@ To support a common array notation, Julienne also supports bracketing strings.
172176

173177
Diagnosis Functions
174178
-------------------
175-
The Unified Modeling Language ([UML]) class diagram below depicts the class
179+
The Unified Modeling Language ([UML]) class diagram below depicts some of the class
176180
relationships involved in making the above example work:
177181

178182
```mermaid
@@ -185,24 +189,20 @@ class test_t{
185189
results() test_result_t[0..*] *
186190
report(passes : integer, tests : integer, skips : integer)
187191
}
188-
test_t --> specimen_test_t : report() invokes subject() and results()
192+
test_t --> specimen_test_t : report() invokes subject() and results() on
189193
190194
class specimen_test_t{
191195
subject() character(len=:)
192196
results() test_result_t[0..*]
193197
}
194198
specimen_test_t --|> test_t : extends and implements
195-
specimen_test_t --> test_description_t : results() constructs local array of
196-
specimen_test_t --> test_description_t : results() invokes run() on
199+
specimen_test_t --> test_description_t : results() passes run() an array of
200+
specimen_test_t --> test_t : results() invokes run() on
197201
198202
class test_description_t{
199203
test_description_t(description : string_t, diagnosis_function : diagnosis_function_i)
200204
run() test_result_t
201205
}
202-
203-
class test_diagnosis_t{
204-
test_diagnosis_t(test_passed : logical, diagnostics_string : string_t)
205-
}
206206
```
207207

208208
Skipping Tests
@@ -228,8 +228,8 @@ preprocessor macro:
228228
which presently appears in Julienne `test/string_test_m.f90` test in order to
229229
work around a runtime crash known to be caused by a `gfortran` bug.
230230

231-
String_t Functions
232-
------------------
231+
String-Handling Functions
232+
-------------------------
233233
Because of the central role that `string_t` type-bound procedures play in
234234
defining diagnostics strings, we list most of these procedures in the class
235235
diagram below.
@@ -263,6 +263,8 @@ class string_t{
263263
}
264264
```
265265

266-
[UML]: https://wikipedia.org/Unified_modeling_language)
266+
[UML]: https://wikipedia.org/Unified_modeling_language
267267
[running the demonstration tests]: #running-the-demonstration-tests
268268
[generating test scaffolding]: #generating-test-scaffolding
269+
[Forming Diagnostics Strings]: #forming-diagnostics-strings
270+
[String-Handling Functions]: #string-handling-functions

0 commit comments

Comments
 (0)