Skip to content

Commit cb70583

Browse files
committed
doc(example): reorg/update the example test suite
This commit 1. Moves/renames example/example-test-suite to demo/, 2. Adds fpm.toml to demo/, sets up an fpm-inspired directory tree, 3. Updates & expands specimen_test_m to leverage Julienne operators, 4. Updates the root-directory README.md accordingly, 5. Deprecates vector_* types as redundant with operator(.all.), and 6. Adds example/README.md redirectoring readers to ../demo except for the string-handling examples.
1 parent 5f99baa commit cb70583

7 files changed

Lines changed: 22 additions & 10 deletions

File tree

File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name = "Example-Test-Suite"
22

33
[dependencies]
4-
julienne = {git = "https://github.com/berkeleylab/julienne", tag = "2.0.0"}
4+
julienne = {git = "https://github.com/berkeleylab/julienne", tag = "2.1.0-rc5"}

example/example-test-suite/include/language-support.F90 renamed to demo/include/language-support.F90

File renamed without changes.

example/example-test-suite/src/specimen_m.F90 renamed to demo/src/specimen_m.F90

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@ module specimen_m
77
type specimen_t
88
contains
99
procedure, nopass :: zero
10+
procedure, nopass :: one
1011
end type
1112

1213
contains
1314

14-
pure function zero() result(incorrect_value)
15-
integer incorrect_value
16-
incorrect_value = 1
15+
pure function zero() result(correct_value)
16+
real correct_value
17+
correct_value = 0
18+
end function
19+
20+
pure function one() result(correct_value)
21+
integer correct_value
22+
correct_value = 1
1723
end function
1824

1925
end module

example/example-test-suite/test/specimen_test_m.F90 renamed to demo/test/specimen_test_m.F90

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ module specimen_test_m
1616
,operator(.approximates.) &
1717
,operator(.within.) &
1818
,operator(.all.) &
19-
,operator(.equalsExpected.)
19+
,operator(.equalsExpected.) &
20+
,operator(.greaterThan.)
2021
#if defined(__GFORTRAN__)
2122
use julienne_m, only : diagnosis_function_i ! work around gfortran's missing Fortran 2008 feature
2223
#endif
@@ -51,7 +52,7 @@ function results() result(test_results)
5152
,test_description_t("aggregating diagnoses of the zero and one functions using operator(.all.)", check_aggregate_diagnosis) &
5253
]
5354
test_descriptions = pack( &
54-
array = test_diagnostics &
55+
array = test_descriptions &
5556
,mask = test_descriptions%contains_text(test_description_substring) .or. index(subject(), test_description_substring)/=0 &
5657
)
5758
test_results = test_descriptions%run()
@@ -73,7 +74,7 @@ function results() result(test_results)
7374
,test_description_t("aggregating diagnoses of the zero and one functions using operator(.all.)", check_aggregate_ptr) &
7475
]
7576
test_descriptions = pack( &
76-
array = test_diagnostics &
77+
array = test_descriptions &
7778
,mask = test_descriptions%contains_text(test_description_substring) .or. index(subject(), test_description_substring)/=0 &
7879
)
7980
test_results = test_descriptions%run()
@@ -94,7 +95,7 @@ function check_zero_using_constructor() result(test_diagnosis)
9495
type(specimen_t) specimen
9596
real, parameter :: expected_value = 0., tolerance = 1E-02
9697
associate(actual_value => specimen%zero())
97-
test_diagnosis = test_diagnosis_t(
98+
test_diagnosis = test_diagnosis_t( &
9899
test_passed = abs(actual_value - expected_value) < tolerance &
99100
,diagnostics_string = "expected " // string_t(expected_value) // "; actual " // string_t(actual_value) &
100101
)
@@ -107,8 +108,8 @@ function check_aggregate_diagnosis() result(test_diagnosis)
107108
type(specimen_t) specimen
108109
real, parameter :: expected_real= 0.
109110
integer, parameter :: expected_integer = 1
110-
associate(actual_real => specimen%zero(), actual_integer = specimen%one())
111-
test_diagnosis = .all. [actual_integer .equalsExpected. expected_integer, actual_real .lessThanOrEqualTo. expected_real]
111+
associate(actual_real => specimen%zero(), actual_integer => specimen%one())
112+
test_diagnosis = .all. [actual_integer .equalsExpected. expected_integer, actual_real .greaterThan. expected_real]
112113
end associate
113114
end function
114115

example/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Examples
2+
========
3+
This directory focuses on examples that demonstrate Julienne's string-handling capabilities.
4+
For a demonstration of how to use Julienne for unit testing, please see the [`demo`](../demo)
5+
subdirectory of this repository.

0 commit comments

Comments
 (0)