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

Extraction of the demo programs from the specs #662

Merged
merged 45 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0db0de1
fix issues in examples in specs
jvdp1 Jun 20, 2022
7536c0c
create demo programs from specs
jvdp1 Jun 21, 2022
3d4d8a7
rename examples to example
jvdp1 Jun 21, 2022
03df63e
fix issues in most demo programs
jvdp1 Jun 21, 2022
6e75462
fix issue hashmap_wrappers
jvdp1 Jun 21, 2022
af11e23
Generation of all demo programs + modif specs
jvdp1 Jun 21, 2022
f93dc4a
add examples in fpm
jvdp1 Jun 21, 2022
7bebf15
formatting
jvdp1 Jun 21, 2022
8e2dfc9
fix demo_copy_otehr
jvdp1 Jun 22, 2022
b003080
Update test/example/array/demo_falseloc.f90
jvdp1 Jun 22, 2022
ec8d47c
progress
jvdp1 Jun 22, 2022
e8d840c
Update test/example/logger/demo_log_text_error.f90
jvdp1 Jun 27, 2022
0a2f030
Update test/example/strings/demo_padl.f90
jvdp1 Jun 27, 2022
c3ca0c8
Update test/example/strings/demo_replace_all.f90
jvdp1 Jun 27, 2022
aec3691
Update test/example/strings/demo_padr.f90
jvdp1 Jun 27, 2022
b390dc8
Update test/example/strings/demo_padr.f90
jvdp1 Jun 27, 2022
faa1bc3
Update test/example/strings/demo_padr.f90
jvdp1 Jun 27, 2022
dc42cf5
Update test/example/logger/demo_log_text_error.f90
jvdp1 Jun 27, 2022
7fd1ac9
remove `int()` out of a `logical` expression
14NGiestas Jun 27, 2022
729b403
fix demo to pass all tests
jvdp1 Jun 27, 2022
e9cd24f
add example files in io
jvdp1 Jun 27, 2022
5954f51
fix issue with Intel compiler
jvdp1 Jun 28, 2022
6d7f889
use 2 spaces for indentation
jvdp1 Jun 28, 2022
bf00288
replace the prefix demo_ by example_
jvdp1 Jun 28, 2022
5d0024b
Update example_padr.f90
14NGiestas Jul 4, 2022
6a6900c
Revert last change using unformatted, but this time use the DT descri…
14NGiestas Jul 4, 2022
e208c2b
Merge remote-tracking branch 'upstream/master' into extract_demo
jvdp1 Jul 7, 2022
31d02cb
fix issues with examples in strings
jvdp1 Jul 7, 2022
e98384d
Merge remote-tracking branch 'origin/extract_demo' into extract_demo
jvdp1 Jul 7, 2022
948cf4d
Merge remote-tracking branch 'upstream/master' into extract_demo
jvdp1 Jul 7, 2022
9d17482
mv tests/examples to src/examples
jvdp1 Jul 14, 2022
e2f362d
fix ci/fpm-deployment.sh
jvdp1 Jul 14, 2022
b607ef3
Update README.md
jvdp1 Jul 22, 2022
83902b6
Merge remote-tracking branch 'upstream/master' into extract_demo
jvdp1 Jul 22, 2022
6988336
fix log_text_error
jvdp1 Jul 22, 2022
d644482
add log_text_error in CMakeLists.txt
jvdp1 Jul 22, 2022
29a091e
add a dummy file for logger examples
jvdp1 Jul 22, 2022
5fc1caa
add instructions to run the examples with fpm
jvdp1 Jul 25, 2022
9794b86
Merge remote-tracking branch 'upstream/master' into extract_demo
jvdp1 Jul 31, 2022
a647c5d
mv src/examples to example
jvdp1 Jul 31, 2022
dda3b45
update CMakeLists.txt
jvdp1 Jul 31, 2022
79b53a2
update fpm-deployment
jvdp1 Jul 31, 2022
6b2b5d2
update specs
jvdp1 Jul 31, 2022
ead3440
Mv src/examples to example
jvdp1 Jul 31, 2022
d0aeb90
update README.md
jvdp1 Jul 31, 2022
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ add_subdirectory(src)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(test)
add_subdirectory(example)
endif()

install(EXPORT ${PROJECT_NAME}-targets
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,17 @@ To build the standard library run
cmake --build build
```

To test your build, run the test suite after the build has finished with
To test your build, run the test suite and all example programs after the build has finished with

```sh
cmake --build build --target test
```

To test only the test suite, run
```sh
ctest --test-dir build/test
```

Please report failing tests on our [issue tracker](https://github.com/fortran-lang/stdlib/issues/new/choose) including details of the compiler used, the operating system and platform architecture.

To install the project to the declared prefix run
Expand All @@ -179,6 +184,15 @@ git checkout stdlib-fpm
fpm build --profile release
```

You can run the examples with `fpm` as:

```sh
fpm run --example prog
```

with `prog` being the name of the example program (e.g., `example_sort`).


To use `stdlib` within your `fpm` project, add the following lines to your `fpm.toml` file:
```toml
[dependencies]
Expand Down
3 changes: 2 additions & 1 deletion ci/fpm-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ minor=$(cut -d. -f2 VERSION)
patch=$(cut -d. -f3 VERSION)
fyflags="${fyflags} -DPROJECT_VERSION_MAJOR=${major} -DPROJECT_VERSION_MINOR=${minor} -DPROJECT_VERSION_PATCH=${patch}"

mkdir -p "$destdir/src" "$destdir/test"
mkdir -p "$destdir/src" "$destdir/test" "$destdir/example"

# Preprocess stdlib sources
find src -maxdepth 1 -iname "*.fypp" \
Expand All @@ -49,6 +49,7 @@ find src -maxdepth 1 -iname "*.fypp" \
find src -maxdepth 1 -iname "*.f90" -exec cp {} "$destdir/src/" \;
find test -name "test_*.f90" -exec cp {} "$destdir/test/" \;
find test -name "*.dat" -exec cp {} "$destdir/" \;
find example -name "example_*.f90" -exec cp {} "$destdir/example/" \;

# Include additional files
cp "${include[@]}" "$destdir/"
Expand Down
18 changes: 2 additions & 16 deletions doc/specs/stdlib_array.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,7 @@ Returns an array of default integer size, with a maximum length of `size(array)`
#### Examples

```fortran
program demo_trueloc
use stdlib_array, only : trueloc
implicit none
real, allocatable :: array(:)
allocate(array(500))
call random_number(array)
array(trueloc(array > 0.5)) = 0.0
end program demo_trueloc
{!example/array/example_trueloc.f90!}
```


Expand Down Expand Up @@ -90,12 +83,5 @@ Returns an array of default integer size, with a maximum length of `size(array)`
#### Examples

```fortran
program demo_falseloc
use stdlib_array, only : falseloc
implicit none
real, allocatable :: array(:)
allocate(array(-200:200))
call random_number(array)
array(falseloc(array < 0.5), lbound(array)) = 0.0
end program demo_falseloc
{!example/array/example_falseloc.f90!}
```
34 changes: 5 additions & 29 deletions doc/specs/stdlib_ascii.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ The result is an intrinsic character type of the same length as `string`.
#### Example

```fortran
program demo_to_lower
use stdlib_ascii, only : to_lower
implicit none
print'(a)', to_lower("HELLo!") ! returns "hello!"
end program demo_to_lower
{!example/ascii/example_ascii_to_lower.f90!}
```

### `to_upper`
Expand Down Expand Up @@ -87,11 +83,7 @@ The result is an intrinsic character type of the same length as `string`.
#### Example

```fortran
program demo_to_upper
use stdlib_ascii, only : to_upper
implicit none
print'(a)', to_upper("hello!") ! returns "HELLO!"
end program demo_to_upper
{!example/ascii/example_ascii_to_upper.f90!}
```

### `to_title`
Expand Down Expand Up @@ -128,13 +120,7 @@ The result is an intrinsic character type of the same length as `string`.
#### Example

```fortran
program demo_to_title
use stdlib_ascii, only : to_title
implicit none
print*, to_title("hello there!") ! returns "Hello There!"
print*, to_title("'enquoted'") ! returns "'Enquoted'"
print*, to_title("1st") ! returns "1st"
end program demo_to_title
{!example/ascii/example_ascii_to_title.f90!}
```

### `to_sentence`
Expand Down Expand Up @@ -169,13 +155,7 @@ The result is an intrinsic character type of the same length as `string`.
#### Example

```fortran
program demo_to_sentence
use stdlib_ascii, only : to_sentence
implicit none
print*, to_sentence("hello!") ! returns "Hello!"
print*, to_sentence("'enquoted'") ! returns "'Enquoted'"
print*, to_sentence("1st") ! returns "1st"
end program demo_to_sentence
{!example/ascii/example_ascii_to_sentence.f90!}
```

### `reverse`
Expand Down Expand Up @@ -207,9 +187,5 @@ The result is an intrinsic character type of the same length as `string`.
#### Example

```fortran
program demo_reverse
use stdlib_ascii, only : reverse
implicit none
print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH"
end program demo_reverse
{!example/ascii/example_ascii_reverse.f90!}
```
Loading