From 0db0de163c115a2d61e62b9ad3026a2a9a59a728 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Mon, 20 Jun 2022 22:58:42 +0200 Subject: [PATCH 01/38] fix issues in examples in specs --- doc/specs/stdlib_error.md | 6 +- doc/specs/stdlib_hash_procedures.md | 18 ++-- doc/specs/stdlib_quadrature.md | 8 +- doc/specs/stdlib_string_type.md | 148 ++++++++++++++-------------- doc/specs/stdlib_strings.md | 16 +-- 5 files changed, 98 insertions(+), 98 deletions(-) diff --git a/doc/specs/stdlib_error.md b/doc/specs/stdlib_error.md index 697e3f618..945a03251 100644 --- a/doc/specs/stdlib_error.md +++ b/doc/specs/stdlib_error.md @@ -77,16 +77,16 @@ program demo_check3 integer :: a = 1 ! If a /= 5, prints 'a == 5 failed.', but doesn't stop the program. call check(a == 5, msg='a == 5 failed.', warn=.true.) -end program demo_check2 +end program demo_check3 ``` ```fortran -program demo_check3 +program demo_check4 use stdlib_error, only: check implicit none integer :: a = 1 ! If a /= 5, stops the program with exit code 77 and prints 'a == 5 failed.' call check(a == 5, msg='a == 5 failed.', code=77) -end program demo_check3 +end program demo_check4 ``` ### `error_stop` - aborts the program diff --git a/doc/specs/stdlib_hash_procedures.md b/doc/specs/stdlib_hash_procedures.md index d01e04b8c..84cb71415 100755 --- a/doc/specs/stdlib_hash_procedures.md +++ b/doc/specs/stdlib_hash_procedures.md @@ -1016,7 +1016,7 @@ program demo_universal_mult_hash hash = universal_mult_hash(source, seed, 6) array1(hash) = source print *, seed, hash, array1 -end program demo_odd_random_integer +end program demo_universal_mult_hash ``` #### `water_hash`- calculates a hash code from a key and a seed @@ -1175,7 +1175,7 @@ E. Knuth. It multiplies the `key` by the odd valued approximation to ##### Example ```fortran -program demo_fibonacci_hash +program demo_fibonacci_hash_64 use stdlib_hash_64bit, only: fibonacci_hash use iso_fortran_env, only: int64 implicit none @@ -1187,7 +1187,7 @@ program demo_fibonacci_hash hash = fibonacci_hash(source, 6) array1(hash) = source print *, hash -end program demo_fibonacci_hash +end program demo_fibonacci_hash_64 ``` #### `FNV_1`- calculates a hash code from a key @@ -1241,7 +1241,7 @@ function for character strings. ##### Example ```fortran -program demo_fnv_1_hash +program demo_fnv_1_hash_64 use stdlib_hash_64bit, only: fnv_1_hash use iso_fortran_env, only: int64 implicit none @@ -1250,7 +1250,7 @@ program demo_fnv_1_hash array1 = [ 5, 4, 3, 1, 10, 4, 9] hash = fnv_1_hash(array1) print *, hash -end program demo_fnv_1_hash +end program demo_fnv_1_hash_64 ``` @@ -1304,7 +1304,7 @@ function for character strings. ##### Example ```fortran -program demo_fnv_1a_hash +program demo_fnv_1a_hash_64 use stdlib_hash_64bit, only: fnv_1a_hash use iso_fortran_env, only: int64 implicit none @@ -1313,7 +1313,7 @@ program demo_fnv_1a_hash array1 = [ 5, 4, 3, 1, 10, 4, 9] hash = fnv_1a_hash(array1) print *, hash -end program demo_fnv_1a_hash +end program demo_fnv_1a_hash_64 ``` @@ -1596,7 +1596,7 @@ It multiplies the `key` by `seed`, and returns the ```fortran -program demo_universal_mult_hash +program demo_universal_mult_hash_64 use stdlib_hash_32bit, only: odd_random_integer, & universal_mult_hash use iso_fortran_env, only: int64 @@ -1611,7 +1611,7 @@ program demo_universal_mult_hash hash = universal_mult_hash(source, seed, 6) array1(hash) = source print *, seed, hash, array1 -end program demo_universal_mult_hash +end program demo_universal_mult_hash_64 ``` diff --git a/doc/specs/stdlib_quadrature.md b/doc/specs/stdlib_quadrature.md index bd67f8af0..363cff8f2 100644 --- a/doc/specs/stdlib_quadrature.md +++ b/doc/specs/stdlib_quadrature.md @@ -222,7 +222,7 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -program integrate +program demo_gauss_legendre use iso_fortran_env, dp => real64 implicit none @@ -230,7 +230,7 @@ program integrate real(dp), dimension(N) :: x,w call gauss_legendre(x,w) print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) -end program +end program demo_gauss_legendre ``` ## `gauss_legendre_lobatto` - Gauss-Legendre-Lobatto quadrature nodes and weights @@ -268,7 +268,7 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -program integrate +program demo_gauss_legendre_lobatto use iso_fortran_env, dp => real64 implicit none @@ -276,5 +276,5 @@ program integrate real(dp), dimension(N) :: x,w call gauss_legendre_lobatto(x,w) print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) -end program +end program demo_gauss_legendre_lobatto ``` diff --git a/doc/specs/stdlib_string_type.md b/doc/specs/stdlib_string_type.md index 3349280d5..5873c1f8b 100644 --- a/doc/specs/stdlib_string_type.md +++ b/doc/specs/stdlib_string_type.md @@ -67,13 +67,13 @@ The result is an instance of `string_type` with zero length. #### Example ```fortran -program demo +program demo_constructor_empty use stdlib_string_type implicit none type(string_type) :: string string = string_type() ! len(string) == 0 -end program demo +end program demo_constructor_empty ``` @@ -111,7 +111,7 @@ The result is an instance of `string_type`. #### Example ```fortran -program demo +program demo_constructor_scalar use stdlib_string_type implicit none type(string_type) :: string @@ -119,7 +119,7 @@ program demo ! len(string) == 8 string = string_type(" S p a c e d ") ! len(string) == 13 -end program demo +end program demo_constructor_scalar ``` @@ -153,7 +153,7 @@ The result is an instance of `string_type`. #### Example ```fortran -program demo +program demo_constructor_integer use stdlib_string_type implicit none type(string_type) :: string @@ -161,7 +161,7 @@ program demo ! len(string) == 2 string = string_type(-289) ! len(string) == 4 -end program demo +end program demo_constructor_integer ``` @@ -195,7 +195,7 @@ The result is an instance of `string_type`. #### Example ```fortran -program demo +program demo_constructor_logical use stdlib_string_type implicit none type(string_type) :: string @@ -203,7 +203,7 @@ program demo ! len(string) == 1 string = string_type(.false.) ! len(string) == 1 -end program demo +end program demo_constructor_logical ``` @@ -232,14 +232,14 @@ Elemental subroutine, `assignment(=)`. #### Example ```fortran -program demo +program demo_constructor_character use stdlib_string_type implicit none type(string_type) :: string ! len(string) == 0 string = "Sequence" ! len(string) == 8 -end program demo +end program demo_constructor_character ``` @@ -273,7 +273,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo +program demo_len use stdlib_string_type implicit none type(string_type) :: string @@ -286,7 +286,7 @@ program demo string = "Whitespace " length = len(string) ! length == 38 -end program demo +end program demo_len ``` @@ -321,7 +321,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo +program demo_len_trim use stdlib_string_type implicit none type(string_type) :: string @@ -334,7 +334,7 @@ program demo string = "Whitespace " length = len_trim(string) ! length == 10 -end program demo +end program demo_len_trim ``` @@ -369,7 +369,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo +program demo_trim use stdlib_string_type implicit none type(string_type) :: string @@ -377,7 +377,7 @@ program demo string = "Whitespace " string = trim(string) ! len(string) == 10 -end program demo +end program demo_trim ``` @@ -412,7 +412,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo +program demo_adjustl use stdlib_string_type implicit none type(string_type) :: string @@ -420,7 +420,7 @@ program demo string = " Whitespace" string = adjustl(string) ! char(string) == "Whitespace " -end program demo +end program demo_adjustl ``` @@ -455,7 +455,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo +program demo_adjustr use stdlib_string_type implicit none type(string_type) :: string @@ -463,7 +463,7 @@ program demo string = "Whitespace " string = adjustr(string) ! char(string) == " Whitespace" -end program demo +end program demo_adjustr ``` @@ -499,7 +499,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo +program demo_repeat use stdlib_string_type implicit none type(string_type) :: string @@ -507,7 +507,7 @@ program demo string = "What? " string = repeat(string, 3) ! string == "What? What? What? " -end program demo +end program demo_repeat ``` @@ -541,7 +541,7 @@ The result is a scalar character value. #### Example ```fortran -program demo +program demo_char use stdlib_string_type implicit none type(string_type) :: string @@ -550,7 +550,7 @@ program demo string = "Character sequence" dlc = char(string) ! dlc == "Character sequence" -end program demo +end program demo_char ``` @@ -585,7 +585,7 @@ The result is a scalar character value. #### Example ```fortran -program demo +program demo_char_position use stdlib_string_type implicit none type(string_type) :: string @@ -597,7 +597,7 @@ program demo ! dlc == "a" chars = char(string, [3, 5, 8, 12, 14, 15, 18]) ! chars == ["a", "a", "e", "e", "u", "e", "e"] -end program demo +end program demo_char_position ``` @@ -633,7 +633,7 @@ The result is a scalar character value. #### Example ```fortran -program demo +program demo_char_range use stdlib_string_type implicit none type(string_type) :: string @@ -642,7 +642,7 @@ program demo string = "Fortran" dlc = char(string, 1, 4) ! dlc == "Fort" -end program demo +end program demo_char_range ``` @@ -679,7 +679,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo +program demo_ichar use stdlib_string_type implicit none type(string_type) :: string @@ -687,7 +687,7 @@ program demo string = "Fortran" code = ichar(string) -end program demo +end program demo_ichar ``` @@ -724,7 +724,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo +program demo_iachar use stdlib_string_type implicit none type(string_type) :: string @@ -732,7 +732,7 @@ program demo string = "Fortran" code = iachar(string) -end program demo +end program demo_iachar ``` @@ -772,7 +772,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo +program demo_index use stdlib_string_type implicit none type(string_type) :: string @@ -787,7 +787,7 @@ program demo pos = index(string, "This") ! pos == 0 -end program demo +end program demo_index ``` @@ -827,7 +827,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo +program demo_scan use stdlib_string_type implicit none type(string_type) :: string @@ -842,7 +842,7 @@ program demo pos = scan(string, "c++") ! pos == 0 -end program demo +end program demo_scan ``` @@ -882,7 +882,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo +program demo_verify use stdlib_string_type implicit none type(string_type) :: string @@ -903,7 +903,7 @@ program demo pos = verify(string, string) ! pos == 0 -end program demo +end program demo_verify ``` @@ -942,7 +942,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_lgt use stdlib_string_type implicit none type(string_type) :: string @@ -957,7 +957,7 @@ program demo res = lgt(string, "cde") ! res .eqv. .false. -end program demo +end program demo_lgt ``` @@ -996,7 +996,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_llt use stdlib_string_type implicit none type(string_type) :: string @@ -1011,7 +1011,7 @@ program demo res = llt(string, "cde") ! res .eqv. .true. -end program demo +end program demo_llt ``` @@ -1051,7 +1051,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_lge use stdlib_string_type implicit none type(string_type) :: string @@ -1066,7 +1066,7 @@ program demo res = lge(string, "cde") ! res .eqv. .false. -end program demo +end program demo_lge ``` @@ -1106,7 +1106,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_lle use stdlib_string_type implicit none type(string_type) :: string @@ -1121,7 +1121,7 @@ program demo res = lle(string, "cde") ! res .eqv. .true. -end program demo +end program demo_lle ``` @@ -1156,7 +1156,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo +program demo_to_lower use stdlib_string_type implicit none type(string_type) :: string, lowercase_string @@ -1167,7 +1167,7 @@ program demo lowercase_string = to_lower(string) ! string <-- "Lowercase This String" ! lowercase_string <-- "lowercase this string" -end program demo +end program demo_to_lower ``` @@ -1202,7 +1202,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo +program demo_to_upper use stdlib_string_type implicit none type(string_type) :: string, uppercase_string @@ -1213,7 +1213,7 @@ program demo uppercase_string = to_upper(string) ! string <-- "Uppercase This String" ! uppercase_string <-- "UPPERCASE THIS STRING" -end program demo +end program demo_to_upper ``` @@ -1346,7 +1346,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo +program demo_reverse use stdlib_string_type implicit none type(string_type) :: string, reverse_string @@ -1357,7 +1357,7 @@ program demo reverse_string = reverse(string) ! string <-- "Reverse This String" ! reverse_string <-- "gnirtS sihT esreveR" -end program demo +end program demo_reverse ``` @@ -1399,7 +1399,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_gt use stdlib_string_type implicit none type(string_type) :: string @@ -1414,7 +1414,7 @@ program demo res = string > "cde" ! res .eqv. .false. -end program demo +end program demo_gt ``` @@ -1456,7 +1456,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_lt use stdlib_string_type implicit none type(string_type) :: string @@ -1471,7 +1471,7 @@ program demo res = string < "cde" ! res .eqv. .true. -end program demo +end program demo_lt ``` @@ -1513,7 +1513,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_ge use stdlib_string_type implicit none type(string_type) :: string @@ -1528,7 +1528,7 @@ program demo res = string >= "cde" ! res .eqv. .false. -end program demo +end program demo_ge ``` @@ -1570,7 +1570,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_le use stdlib_string_type implicit none type(string_type) :: string @@ -1585,7 +1585,7 @@ program demo res = string <= "cde" ! res .eqv. .true. -end program demo +end program demo_le ``` @@ -1627,7 +1627,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_eq use stdlib_string_type implicit none type(string_type) :: string @@ -1642,7 +1642,7 @@ program demo res = string == "cde" ! res .eqv. .false. -end program demo +end program demo_eq ``` @@ -1684,7 +1684,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo +program demo_ne use stdlib_string_type implicit none type(string_type) :: string @@ -1699,7 +1699,7 @@ program demo res = string /= "cde" ! res .eqv. .true. -end program demo +end program demo_ne ``` @@ -1738,7 +1738,7 @@ The result is an instance of `string_type`. #### Example ```fortran -program demo +program demo_cont use stdlib_string_type implicit none type(string_type) :: string @@ -1746,7 +1746,7 @@ program demo string = "Hello, " string = string // "World!" ! len(string) == 13 -end program demo +end program demo_cont ``` @@ -1783,7 +1783,7 @@ Unformatted user defined derived type output. #### Example ```fortran -program demo +program demo_uwrite use stdlib_string_type implicit none type(string_type) :: string @@ -1797,7 +1797,7 @@ program demo read(io) string close(io) -end program demo +end program demo_uwrite ``` @@ -1840,7 +1840,7 @@ Formatted user defined derived type output. #### Example ```fortran -program demo +program demo_fwrite use stdlib_string_type implicit none type(string_type) :: string @@ -1855,7 +1855,7 @@ program demo read(io, *) string close(io) -end program demo +end program demo_fwrite ``` @@ -1894,7 +1894,7 @@ Unformatted derived type input. #### Example ```fortran -program demo +program demo_uread use stdlib_string_type implicit none type(string_type) :: string @@ -1908,7 +1908,7 @@ program demo read(io) string close(io) -end program demo +end program demo_uread ``` @@ -1955,7 +1955,7 @@ Formatted derived type input. #### Example ```fortran -program demo +program demo_fread use stdlib_string_type implicit none type(string_type) :: string @@ -1970,7 +1970,7 @@ program demo read(io, *) string close(io) -end program demo +end program demo_fread ``` diff --git a/doc/specs/stdlib_strings.md b/doc/specs/stdlib_strings.md index 714869118..772486c29 100644 --- a/doc/specs/stdlib_strings.md +++ b/doc/specs/stdlib_strings.md @@ -45,7 +45,7 @@ The result is of the same type as `string`. #### Example ```fortran -program demo +program demo_strip use stdlib_ascii, only : TAB, VT, NUL, LF, CR, FF use stdlib_strings, only : strip implicit none @@ -54,7 +54,7 @@ program demo print'(a)', strip(" "//TAB//LF//VT//FF//CR) ! "" print'(a)', strip(" ! ")//"!" ! "!!" print'(a)', strip("Hello") ! "Hello" -end program demo +end program demo_strip ``` @@ -93,7 +93,7 @@ The result is of the same type as `string`. #### Example ```fortran -program demo +program demo_chomp use stdlib_ascii, only : TAB, VT, NUL, LF, CR, FF use stdlib_strings, only : chomp implicit none @@ -106,7 +106,7 @@ program demo print'(a)', chomp("hello", set=["l", "o"]) ! "he" print'(a)', chomp("hello", "lo") ! "hel" print'(a)', chomp("hello", substring="lo") ! "hel" -end program demo +end program demo_chomp ``` @@ -143,12 +143,12 @@ The result is of scalar logical type. #### Example ```fortran -program demo +program demo_starts_with use stdlib_strings, only : starts_with implicit none print'(a)', starts_with("pattern", "pat") ! T print'(a)', starts_with("pattern", "ern") ! F -end program demo +end program demo_starts_with ``` @@ -185,12 +185,12 @@ The result is of scalar logical type. #### Example ```fortran -program demo +program demo_ends_with use stdlib_strings, only : ends_with implicit none print'(a)', ends_with("pattern", "ern") ! T print'(a)', ends_with("pattern", "pat") ! F -end program demo +end program demo_ends_with ``` From 7536c0c41bf821f0c11be072b40c5205d935f7bb Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 21 Jun 2022 08:18:17 +0200 Subject: [PATCH 02/38] create demo programs from specs --- doc/specs/stdlib_array.md | 18 +- doc/specs/stdlib_ascii.md | 34 +- doc/specs/stdlib_bitsets.md | 534 +---------------- doc/specs/stdlib_error.md | 44 +- doc/specs/stdlib_hash_procedures.md | 168 +----- doc/specs/stdlib_hashmaps.md | 408 +------------ doc/specs/stdlib_io.md | 78 +-- doc/specs/stdlib_linalg.md | 170 +----- doc/specs/stdlib_logger.md | 89 +-- doc/specs/stdlib_math.md | 213 +------ doc/specs/stdlib_optval.md | 15 +- doc/specs/stdlib_quadrature.md | 65 +- doc/specs/stdlib_random.md | 26 +- doc/specs/stdlib_selection.md | 136 +---- doc/specs/stdlib_sorting.md | 51 +- doc/specs/stdlib_specialfunctions_gamma.md | 138 +---- doc/specs/stdlib_stats.md | 67 +-- .../stdlib_stats_distribution_exponential.md | 116 +--- doc/specs/stdlib_stats_distribution_normal.md | 137 +---- .../stdlib_stats_distribution_uniform.md | 212 +------ doc/specs/stdlib_string_type.md | 563 ++---------------- doc/specs/stdlib_stringlist_type.md | 213 +------ doc/specs/stdlib_strings.md | 170 +----- doc/specs/stdlib_version.md | 8 +- test/examples/array/demo_falseloc.f90 | 8 + test/examples/array/demo_trueloc.f90 | 8 + test/examples/ascii/demo_reverse.f90 | 5 + test/examples/ascii/demo_to_lower.f90 | 5 + test/examples/ascii/demo_to_sentence.f90 | 7 + test/examples/ascii/demo_to_title.f90 | 7 + test/examples/ascii/demo_to_upper.f90 | 5 + test/examples/bitsets/demo_all.f90 | 14 + test/examples/bitsets/demo_and.f90 | 17 + test/examples/bitsets/demo_and_not.f90 | 18 + test/examples/bitsets/demo_any.f90 | 15 + test/examples/bitsets/demo_assignment.f90 | 24 + test/examples/bitsets/demo_bit_count.f90 | 15 + test/examples/bitsets/demo_bits.f90 | 11 + test/examples/bitsets/demo_clear.f90 | 11 + test/examples/bitsets/demo_equality.f90 | 16 + test/examples/bitsets/demo_extract.f90 | 10 + test/examples/bitsets/demo_flip.f90 | 10 + test/examples/bitsets/demo_from_string.f90 | 17 + test/examples/bitsets/demo_ge.f90 | 17 + test/examples/bitsets/demo_gt.f90 | 16 + test/examples/bitsets/demo_inequality.f90 | 16 + test/examples/bitsets/demo_init.f90 | 8 + test/examples/bitsets/demo_input.f90 | 30 + test/examples/bitsets/demo_le.f90 | 17 + test/examples/bitsets/demo_lt.f90 | 16 + test/examples/bitsets/demo_none.f90 | 15 + test/examples/bitsets/demo_not.f90 | 13 + test/examples/bitsets/demo_or.f90 | 18 + test/examples/bitsets/demo_output.f90 | 30 + test/examples/bitsets/demo_read_bitset.f90 | 33 + test/examples/bitsets/demo_set.f90 | 10 + test/examples/bitsets/demo_test.f90 | 11 + test/examples/bitsets/demo_to_string.f90 | 14 + test/examples/bitsets/demo_value.f90 | 11 + test/examples/bitsets/demo_write_bitset.f90 | 33 + test/examples/bitsets/demo_xor.f90 | 18 + test/examples/error/demo_check1.f90 | 7 + test/examples/error/demo_check2.f90 | 7 + test/examples/error/demo_check3.f90 | 7 + test/examples/error/demo_check4.f90 | 7 + test/examples/error/demo_error_stop1.f90 | 5 + test/examples/error/demo_error_stop2.f90 | 5 + .../hash_procedures/demo_fibonacci_hash.f90 | 13 + .../demo_fibonacci_hash_64.f90 | 13 + .../hash_procedures/demo_fnv_1_hash.f90 | 8 + .../hash_procedures/demo_fnv_1_hash_64.f90 | 10 + .../hash_procedures/demo_fnv_1a_hash.f90 | 8 + .../hash_procedures/demo_fnv_1a_hash_64.f90 | 10 + .../hash_procedures/demo_nmhash32.f90 | 11 + .../hash_procedures/demo_nmhash32x.f90 | 11 + .../hash_procedures/demo_pengy_hash.f90 | 13 + .../hash_procedures/demo_spooky_hash.f90 | 13 + .../demo_universal_mult_hash.f90 | 18 + .../demo_universal_mult_hash_64.f90 | 16 + .../hash_procedures/demo_water_hash.f90 | 11 + test/examples/hashmaps/demo_calls.f90 | 10 + test/examples/hashmaps/demo_copy_key.f90 | 12 + test/examples/hashmaps/demo_copy_other.f90 | 23 + test/examples/hashmaps/demo_entries.f90 | 10 + test/examples/hashmaps/demo_equal_keys.f90 | 14 + test/examples/hashmaps/demo_fnv_1_hasher.f90 | 13 + test/examples/hashmaps/demo_fnv_1a_hasher.f90 | 13 + test/examples/hashmaps/demo_free_key.f90 | 12 + test/examples/hashmaps/demo_free_other.f90 | 18 + test/examples/hashmaps/demo_get.f90 | 16 + .../examples/hashmaps/demo_get_other_data.f90 | 33 + test/examples/hashmaps/demo_hasher_fun.f90 | 15 + test/examples/hashmaps/demo_init.f90 | 7 + test/examples/hashmaps/demo_key_test.f90 | 13 + test/examples/hashmaps/demo_loading.f90 | 10 + test/examples/hashmaps/demo_map_entry.f90 | 16 + test/examples/hashmaps/demo_num_slots.f90 | 10 + test/examples/hashmaps/demo_probes.f90 | 10 + test/examples/hashmaps/demo_rehash.f90 | 15 + test/examples/hashmaps/demo_remove.f90 | 17 + .../hashmaps/demo_seeded_nmhash32_hasher.f90 | 13 + .../hashmaps/demo_seeded_nmhash32x_hasher.f90 | 13 + .../hashmaps/demo_seeded_water_hasher.f90 | 13 + test/examples/hashmaps/demo_set.f90 | 16 + .../examples/hashmaps/demo_set_other_data.f90 | 19 + test/examples/hashmaps/demo_slots_bits.f90 | 10 + test/examples/hashmaps/demo_total_depth.f90 | 10 + test/examples/io/demo_fmt_constants.f90 | 26 + test/examples/io/demo_getline.f90 | 13 + test/examples/io/demo_loadnpy.f90 | 6 + test/examples/io/demo_loadtxt.f90 | 6 + test/examples/io/demo_open.f90 | 8 + test/examples/io/demo_savenpy.f90 | 6 + test/examples/io/demo_savetxt.f90 | 6 + test/examples/linalg/demo_diag1.f90 | 7 + test/examples/linalg/demo_diag2.f90 | 9 + test/examples/linalg/demo_diag3.f90 | 11 + test/examples/linalg/demo_diag4.f90 | 10 + test/examples/linalg/demo_diag5.f90 | 11 + test/examples/linalg/demo_eye1.f90 | 14 + test/examples/linalg/demo_eye2.f90 | 5 + test/examples/linalg/demo_is_diagonal.f90 | 10 + test/examples/linalg/demo_is_hermitian.f90 | 10 + test/examples/linalg/demo_is_hessenberg.f90 | 10 + .../linalg/demo_is_skew_symmetric.f90 | 10 + test/examples/linalg/demo_is_square.f90 | 10 + test/examples/linalg/demo_is_symmetric.f90 | 10 + test/examples/linalg/demo_is_triangular.f90 | 10 + test/examples/linalg/demo_outer_product.f90 | 9 + test/examples/linalg/demo_trace.f90 | 7 + test/examples/logger/demo_add_log_unit.f90 | 22 + test/examples/logger/demo_configure.f90 | 6 + test/examples/logger/demo_global_logger.f90 | 12 + test/examples/logger/demo_log_io_error.f90 | 20 + test/examples/logger/demo_log_text_error.f90 | 24 + test/examples/math/demo_clip_integer.f90 | 16 + test/examples/math/demo_clip_real.f90 | 16 + test/examples/math/demo_diff.f90 | 22 + test/examples/math/demo_gcd.f90 | 9 + test/examples/math/demo_linspace_complex.f90 | 12 + test/examples/math/demo_linspace_int16.f90 | 12 + test/examples/math/demo_logspace_complex.f90 | 12 + test/examples/math/demo_logspace_int.f90 | 13 + .../math/demo_logspace_rstart_cbase.f90 | 15 + test/examples/math/demo_math_all_close.f90 | 15 + test/examples/math/demo_math_arange.f90 | 19 + test/examples/math/demo_math_arg.f90 | 7 + test/examples/math/demo_math_argd.f90 | 7 + test/examples/math/demo_math_argpi.f90 | 7 + test/examples/math/demo_math_is_close.f90 | 14 + test/examples/optval/demo_optval.f90 | 14 + .../quadrature/demo_gauss_legendre.f90 | 9 + .../demo_gauss_legendre_lobatto.f90 | 9 + test/examples/quadrature/demo_simps.f90 | 10 + .../quadrature/demo_simps_weights.f90 | 10 + test/examples/quadrature/demo_trapz.f90 | 10 + .../quadrature/demo_trapz_weights.f90 | 11 + test/examples/random/demo_dist_rand.f90 | 16 + test/examples/random/demo_random_seed.f90 | 8 + test/examples/selection/demo_arg_select.f90 | 29 + test/examples/selection/demo_select.f90 | 27 + test/examples/selection/selection_vs_sort.f90 | 77 +++ test/examples/sorting/demo_ord_sort.f90 | 10 + test/examples/sorting/demo_sort.f90 | 9 + .../specialfunctions_gamma/demo_gamma.f90 | 37 ++ .../specialfunctions_gamma/demo_gamma_p.f90 | 8 + .../specialfunctions_gamma/demo_gamma_q.f90 | 8 + .../specialfunctions_gamma/demo_ligamma.f90 | 16 + .../demo_log_factorial.f90 | 15 + .../specialfunctions_gamma/demo_log_gamma.f90 | 35 ++ .../specialfunctions_gamma/demo_uigamma.f90 | 12 + test/examples/stats/demo_corr.f90 | 8 + test/examples/stats/demo_cov.f90 | 9 + test/examples/stats/demo_mean.f90 | 10 + test/examples/stats/demo_median.f90 | 10 + test/examples/stats/demo_moment.f90 | 12 + test/examples/stats/demo_var.f90 | 12 + .../demo_exponential_cdf.f90 | 41 ++ .../demo_exponential_pdf.f90 | 39 ++ .../demo_exponential_rvs.f90 | 33 + .../demo_norm_cdf.f90 | 45 ++ .../demo_normal_pdf.f90 | 44 ++ .../demo_normal_rvs.f90 | 45 ++ .../demo_shuffle.f90 | 30 + .../demo_uniform_cdf.f90 | 49 ++ .../demo_uniform_pdf.f90 | 50 ++ .../demo_uniform_rvs.f90 | 79 +++ test/examples/string_type/demo_adjustl.f90 | 9 + test/examples/string_type/demo_adjustr.f90 | 9 + test/examples/string_type/demo_char.f90 | 10 + .../string_type/demo_char_position.f90 | 13 + test/examples/string_type/demo_char_range.f90 | 10 + .../demo_constructor_character.f90 | 8 + .../string_type/demo_constructor_empty.f90 | 7 + .../string_type/demo_constructor_integer.f90 | 9 + .../string_type/demo_constructor_logical.f90 | 9 + .../string_type/demo_constructor_scalar.f90 | 9 + test/examples/string_type/demo_cont.f90 | 9 + test/examples/string_type/demo_eq.f90 | 16 + test/examples/string_type/demo_fread.f90 | 16 + test/examples/string_type/demo_fwrite.f90 | 16 + test/examples/string_type/demo_ge.f90 | 16 + test/examples/string_type/demo_gt.f90 | 16 + test/examples/string_type/demo_iachar.f90 | 9 + test/examples/string_type/demo_ichar.f90 | 9 + test/examples/string_type/demo_index.f90 | 16 + test/examples/string_type/demo_le.f90 | 16 + test/examples/string_type/demo_len.f90 | 14 + test/examples/string_type/demo_len_trim.f90 | 14 + test/examples/string_type/demo_lge.f90 | 16 + test/examples/string_type/demo_lgt.f90 | 16 + test/examples/string_type/demo_lle.f90 | 16 + test/examples/string_type/demo_llt.f90 | 16 + test/examples/string_type/demo_lt.f90 | 16 + test/examples/string_type/demo_move.f90 | 21 + test/examples/string_type/demo_ne.f90 | 16 + test/examples/string_type/demo_repeat.f90 | 9 + test/examples/string_type/demo_reverse.f90 | 12 + test/examples/string_type/demo_scan.f90 | 16 + test/examples/string_type/demo_to_lower.f90 | 12 + .../examples/string_type/demo_to_sentence.f90 | 12 + test/examples/string_type/demo_to_title.f90 | 12 + test/examples/string_type/demo_to_upper.f90 | 12 + test/examples/string_type/demo_trim.f90 | 9 + test/examples/string_type/demo_uread.f90 | 15 + test/examples/string_type/demo_uwrite.f90 | 15 + test/examples/string_type/demo_verify.f90 | 22 + test/examples/stringlist_type/demo_clear.f90 | 19 + .../demo_concatenate_operator.f90 | 27 + .../stringlist_type/demo_constructor.f90 | 17 + .../demo_equality_operator.f90 | 29 + .../stringlist_type/demo_fidx_bidx.f90 | 13 + test/examples/stringlist_type/demo_get.f90 | 28 + .../demo_inequality_operator.f90 | 29 + .../stringlist_type/demo_insert_at.f90 | 23 + test/examples/stringlist_type/demo_len.f90 | 19 + test/examples/strings/demo_chomp.f90 | 14 + test/examples/strings/demo_count.f90 | 13 + test/examples/strings/demo_ends_with.f90 | 6 + test/examples/strings/demo_find.f90 | 13 + test/examples/strings/demo_padl.f90 | 15 + test/examples/strings/demo_padr.f90 | 15 + test/examples/strings/demo_replace_all.f90 | 16 + test/examples/strings/demo_slice.f90 | 20 + test/examples/strings/demo_starts_with.f90 | 6 + test/examples/strings/demo_strip.f90 | 10 + test/examples/strings/demo_to_string.f90 | 31 + test/examples/version/demo_version.f90 | 7 + 248 files changed, 3656 insertions(+), 3433 deletions(-) mode change 100755 => 100644 doc/specs/stdlib_hash_procedures.md create mode 100644 test/examples/array/demo_falseloc.f90 create mode 100644 test/examples/array/demo_trueloc.f90 create mode 100644 test/examples/ascii/demo_reverse.f90 create mode 100644 test/examples/ascii/demo_to_lower.f90 create mode 100644 test/examples/ascii/demo_to_sentence.f90 create mode 100644 test/examples/ascii/demo_to_title.f90 create mode 100644 test/examples/ascii/demo_to_upper.f90 create mode 100644 test/examples/bitsets/demo_all.f90 create mode 100644 test/examples/bitsets/demo_and.f90 create mode 100644 test/examples/bitsets/demo_and_not.f90 create mode 100644 test/examples/bitsets/demo_any.f90 create mode 100644 test/examples/bitsets/demo_assignment.f90 create mode 100644 test/examples/bitsets/demo_bit_count.f90 create mode 100644 test/examples/bitsets/demo_bits.f90 create mode 100644 test/examples/bitsets/demo_clear.f90 create mode 100644 test/examples/bitsets/demo_equality.f90 create mode 100644 test/examples/bitsets/demo_extract.f90 create mode 100644 test/examples/bitsets/demo_flip.f90 create mode 100644 test/examples/bitsets/demo_from_string.f90 create mode 100644 test/examples/bitsets/demo_ge.f90 create mode 100644 test/examples/bitsets/demo_gt.f90 create mode 100644 test/examples/bitsets/demo_inequality.f90 create mode 100644 test/examples/bitsets/demo_init.f90 create mode 100644 test/examples/bitsets/demo_input.f90 create mode 100644 test/examples/bitsets/demo_le.f90 create mode 100644 test/examples/bitsets/demo_lt.f90 create mode 100644 test/examples/bitsets/demo_none.f90 create mode 100644 test/examples/bitsets/demo_not.f90 create mode 100644 test/examples/bitsets/demo_or.f90 create mode 100644 test/examples/bitsets/demo_output.f90 create mode 100644 test/examples/bitsets/demo_read_bitset.f90 create mode 100644 test/examples/bitsets/demo_set.f90 create mode 100644 test/examples/bitsets/demo_test.f90 create mode 100644 test/examples/bitsets/demo_to_string.f90 create mode 100644 test/examples/bitsets/demo_value.f90 create mode 100644 test/examples/bitsets/demo_write_bitset.f90 create mode 100644 test/examples/bitsets/demo_xor.f90 create mode 100644 test/examples/error/demo_check1.f90 create mode 100644 test/examples/error/demo_check2.f90 create mode 100644 test/examples/error/demo_check3.f90 create mode 100644 test/examples/error/demo_check4.f90 create mode 100644 test/examples/error/demo_error_stop1.f90 create mode 100644 test/examples/error/demo_error_stop2.f90 create mode 100644 test/examples/hash_procedures/demo_fibonacci_hash.f90 create mode 100644 test/examples/hash_procedures/demo_fibonacci_hash_64.f90 create mode 100644 test/examples/hash_procedures/demo_fnv_1_hash.f90 create mode 100644 test/examples/hash_procedures/demo_fnv_1_hash_64.f90 create mode 100644 test/examples/hash_procedures/demo_fnv_1a_hash.f90 create mode 100644 test/examples/hash_procedures/demo_fnv_1a_hash_64.f90 create mode 100644 test/examples/hash_procedures/demo_nmhash32.f90 create mode 100644 test/examples/hash_procedures/demo_nmhash32x.f90 create mode 100644 test/examples/hash_procedures/demo_pengy_hash.f90 create mode 100644 test/examples/hash_procedures/demo_spooky_hash.f90 create mode 100644 test/examples/hash_procedures/demo_universal_mult_hash.f90 create mode 100644 test/examples/hash_procedures/demo_universal_mult_hash_64.f90 create mode 100644 test/examples/hash_procedures/demo_water_hash.f90 create mode 100644 test/examples/hashmaps/demo_calls.f90 create mode 100644 test/examples/hashmaps/demo_copy_key.f90 create mode 100644 test/examples/hashmaps/demo_copy_other.f90 create mode 100644 test/examples/hashmaps/demo_entries.f90 create mode 100644 test/examples/hashmaps/demo_equal_keys.f90 create mode 100644 test/examples/hashmaps/demo_fnv_1_hasher.f90 create mode 100644 test/examples/hashmaps/demo_fnv_1a_hasher.f90 create mode 100644 test/examples/hashmaps/demo_free_key.f90 create mode 100644 test/examples/hashmaps/demo_free_other.f90 create mode 100644 test/examples/hashmaps/demo_get.f90 create mode 100644 test/examples/hashmaps/demo_get_other_data.f90 create mode 100644 test/examples/hashmaps/demo_hasher_fun.f90 create mode 100644 test/examples/hashmaps/demo_init.f90 create mode 100644 test/examples/hashmaps/demo_key_test.f90 create mode 100644 test/examples/hashmaps/demo_loading.f90 create mode 100644 test/examples/hashmaps/demo_map_entry.f90 create mode 100644 test/examples/hashmaps/demo_num_slots.f90 create mode 100644 test/examples/hashmaps/demo_probes.f90 create mode 100644 test/examples/hashmaps/demo_rehash.f90 create mode 100644 test/examples/hashmaps/demo_remove.f90 create mode 100644 test/examples/hashmaps/demo_seeded_nmhash32_hasher.f90 create mode 100644 test/examples/hashmaps/demo_seeded_nmhash32x_hasher.f90 create mode 100644 test/examples/hashmaps/demo_seeded_water_hasher.f90 create mode 100644 test/examples/hashmaps/demo_set.f90 create mode 100644 test/examples/hashmaps/demo_set_other_data.f90 create mode 100644 test/examples/hashmaps/demo_slots_bits.f90 create mode 100644 test/examples/hashmaps/demo_total_depth.f90 create mode 100644 test/examples/io/demo_fmt_constants.f90 create mode 100644 test/examples/io/demo_getline.f90 create mode 100644 test/examples/io/demo_loadnpy.f90 create mode 100644 test/examples/io/demo_loadtxt.f90 create mode 100644 test/examples/io/demo_open.f90 create mode 100644 test/examples/io/demo_savenpy.f90 create mode 100644 test/examples/io/demo_savetxt.f90 create mode 100644 test/examples/linalg/demo_diag1.f90 create mode 100644 test/examples/linalg/demo_diag2.f90 create mode 100644 test/examples/linalg/demo_diag3.f90 create mode 100644 test/examples/linalg/demo_diag4.f90 create mode 100644 test/examples/linalg/demo_diag5.f90 create mode 100644 test/examples/linalg/demo_eye1.f90 create mode 100644 test/examples/linalg/demo_eye2.f90 create mode 100644 test/examples/linalg/demo_is_diagonal.f90 create mode 100644 test/examples/linalg/demo_is_hermitian.f90 create mode 100644 test/examples/linalg/demo_is_hessenberg.f90 create mode 100644 test/examples/linalg/demo_is_skew_symmetric.f90 create mode 100644 test/examples/linalg/demo_is_square.f90 create mode 100644 test/examples/linalg/demo_is_symmetric.f90 create mode 100644 test/examples/linalg/demo_is_triangular.f90 create mode 100644 test/examples/linalg/demo_outer_product.f90 create mode 100644 test/examples/linalg/demo_trace.f90 create mode 100644 test/examples/logger/demo_add_log_unit.f90 create mode 100644 test/examples/logger/demo_configure.f90 create mode 100644 test/examples/logger/demo_global_logger.f90 create mode 100644 test/examples/logger/demo_log_io_error.f90 create mode 100644 test/examples/logger/demo_log_text_error.f90 create mode 100644 test/examples/math/demo_clip_integer.f90 create mode 100644 test/examples/math/demo_clip_real.f90 create mode 100644 test/examples/math/demo_diff.f90 create mode 100644 test/examples/math/demo_gcd.f90 create mode 100644 test/examples/math/demo_linspace_complex.f90 create mode 100644 test/examples/math/demo_linspace_int16.f90 create mode 100644 test/examples/math/demo_logspace_complex.f90 create mode 100644 test/examples/math/demo_logspace_int.f90 create mode 100644 test/examples/math/demo_logspace_rstart_cbase.f90 create mode 100644 test/examples/math/demo_math_all_close.f90 create mode 100644 test/examples/math/demo_math_arange.f90 create mode 100644 test/examples/math/demo_math_arg.f90 create mode 100644 test/examples/math/demo_math_argd.f90 create mode 100644 test/examples/math/demo_math_argpi.f90 create mode 100644 test/examples/math/demo_math_is_close.f90 create mode 100644 test/examples/optval/demo_optval.f90 create mode 100644 test/examples/quadrature/demo_gauss_legendre.f90 create mode 100644 test/examples/quadrature/demo_gauss_legendre_lobatto.f90 create mode 100644 test/examples/quadrature/demo_simps.f90 create mode 100644 test/examples/quadrature/demo_simps_weights.f90 create mode 100644 test/examples/quadrature/demo_trapz.f90 create mode 100644 test/examples/quadrature/demo_trapz_weights.f90 create mode 100644 test/examples/random/demo_dist_rand.f90 create mode 100644 test/examples/random/demo_random_seed.f90 create mode 100644 test/examples/selection/demo_arg_select.f90 create mode 100644 test/examples/selection/demo_select.f90 create mode 100644 test/examples/selection/selection_vs_sort.f90 create mode 100644 test/examples/sorting/demo_ord_sort.f90 create mode 100644 test/examples/sorting/demo_sort.f90 create mode 100644 test/examples/specialfunctions_gamma/demo_gamma.f90 create mode 100644 test/examples/specialfunctions_gamma/demo_gamma_p.f90 create mode 100644 test/examples/specialfunctions_gamma/demo_gamma_q.f90 create mode 100644 test/examples/specialfunctions_gamma/demo_ligamma.f90 create mode 100644 test/examples/specialfunctions_gamma/demo_log_factorial.f90 create mode 100644 test/examples/specialfunctions_gamma/demo_log_gamma.f90 create mode 100644 test/examples/specialfunctions_gamma/demo_uigamma.f90 create mode 100644 test/examples/stats/demo_corr.f90 create mode 100644 test/examples/stats/demo_cov.f90 create mode 100644 test/examples/stats/demo_mean.f90 create mode 100644 test/examples/stats/demo_median.f90 create mode 100644 test/examples/stats/demo_moment.f90 create mode 100644 test/examples/stats/demo_var.f90 create mode 100644 test/examples/stats_distribution_exponential/demo_exponential_cdf.f90 create mode 100644 test/examples/stats_distribution_exponential/demo_exponential_pdf.f90 create mode 100644 test/examples/stats_distribution_exponential/demo_exponential_rvs.f90 create mode 100644 test/examples/stats_distribution_normal/demo_norm_cdf.f90 create mode 100644 test/examples/stats_distribution_normal/demo_normal_pdf.f90 create mode 100644 test/examples/stats_distribution_normal/demo_normal_rvs.f90 create mode 100644 test/examples/stats_distribution_uniform/demo_shuffle.f90 create mode 100644 test/examples/stats_distribution_uniform/demo_uniform_cdf.f90 create mode 100644 test/examples/stats_distribution_uniform/demo_uniform_pdf.f90 create mode 100644 test/examples/stats_distribution_uniform/demo_uniform_rvs.f90 create mode 100644 test/examples/string_type/demo_adjustl.f90 create mode 100644 test/examples/string_type/demo_adjustr.f90 create mode 100644 test/examples/string_type/demo_char.f90 create mode 100644 test/examples/string_type/demo_char_position.f90 create mode 100644 test/examples/string_type/demo_char_range.f90 create mode 100644 test/examples/string_type/demo_constructor_character.f90 create mode 100644 test/examples/string_type/demo_constructor_empty.f90 create mode 100644 test/examples/string_type/demo_constructor_integer.f90 create mode 100644 test/examples/string_type/demo_constructor_logical.f90 create mode 100644 test/examples/string_type/demo_constructor_scalar.f90 create mode 100644 test/examples/string_type/demo_cont.f90 create mode 100644 test/examples/string_type/demo_eq.f90 create mode 100644 test/examples/string_type/demo_fread.f90 create mode 100644 test/examples/string_type/demo_fwrite.f90 create mode 100644 test/examples/string_type/demo_ge.f90 create mode 100644 test/examples/string_type/demo_gt.f90 create mode 100644 test/examples/string_type/demo_iachar.f90 create mode 100644 test/examples/string_type/demo_ichar.f90 create mode 100644 test/examples/string_type/demo_index.f90 create mode 100644 test/examples/string_type/demo_le.f90 create mode 100644 test/examples/string_type/demo_len.f90 create mode 100644 test/examples/string_type/demo_len_trim.f90 create mode 100644 test/examples/string_type/demo_lge.f90 create mode 100644 test/examples/string_type/demo_lgt.f90 create mode 100644 test/examples/string_type/demo_lle.f90 create mode 100644 test/examples/string_type/demo_llt.f90 create mode 100644 test/examples/string_type/demo_lt.f90 create mode 100644 test/examples/string_type/demo_move.f90 create mode 100644 test/examples/string_type/demo_ne.f90 create mode 100644 test/examples/string_type/demo_repeat.f90 create mode 100644 test/examples/string_type/demo_reverse.f90 create mode 100644 test/examples/string_type/demo_scan.f90 create mode 100644 test/examples/string_type/demo_to_lower.f90 create mode 100644 test/examples/string_type/demo_to_sentence.f90 create mode 100644 test/examples/string_type/demo_to_title.f90 create mode 100644 test/examples/string_type/demo_to_upper.f90 create mode 100644 test/examples/string_type/demo_trim.f90 create mode 100644 test/examples/string_type/demo_uread.f90 create mode 100644 test/examples/string_type/demo_uwrite.f90 create mode 100644 test/examples/string_type/demo_verify.f90 create mode 100644 test/examples/stringlist_type/demo_clear.f90 create mode 100644 test/examples/stringlist_type/demo_concatenate_operator.f90 create mode 100644 test/examples/stringlist_type/demo_constructor.f90 create mode 100644 test/examples/stringlist_type/demo_equality_operator.f90 create mode 100644 test/examples/stringlist_type/demo_fidx_bidx.f90 create mode 100644 test/examples/stringlist_type/demo_get.f90 create mode 100644 test/examples/stringlist_type/demo_inequality_operator.f90 create mode 100644 test/examples/stringlist_type/demo_insert_at.f90 create mode 100644 test/examples/stringlist_type/demo_len.f90 create mode 100644 test/examples/strings/demo_chomp.f90 create mode 100644 test/examples/strings/demo_count.f90 create mode 100644 test/examples/strings/demo_ends_with.f90 create mode 100644 test/examples/strings/demo_find.f90 create mode 100644 test/examples/strings/demo_padl.f90 create mode 100644 test/examples/strings/demo_padr.f90 create mode 100644 test/examples/strings/demo_replace_all.f90 create mode 100644 test/examples/strings/demo_slice.f90 create mode 100644 test/examples/strings/demo_starts_with.f90 create mode 100644 test/examples/strings/demo_strip.f90 create mode 100644 test/examples/strings/demo_to_string.f90 create mode 100644 test/examples/version/demo_version.f90 diff --git a/doc/specs/stdlib_array.md b/doc/specs/stdlib_array.md index 8acaa20b3..cffe1ff73 100644 --- a/doc/specs/stdlib_array.md +++ b/doc/specs/stdlib_array.md @@ -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 +{!test/examples/array/demo_trueloc.f90!} ``` @@ -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 +{!test/examples/array/demo_falseloc.f90!} ``` diff --git a/doc/specs/stdlib_ascii.md b/doc/specs/stdlib_ascii.md index b861f6067..e57ef97bb 100644 --- a/doc/specs/stdlib_ascii.md +++ b/doc/specs/stdlib_ascii.md @@ -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 +{!test/examples/ascii/demo_to_lower.f90!} ``` ### `to_upper` @@ -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 +{!test/examples/ascii/demo_to_upper.f90!} ``` ### `to_title` @@ -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 +{!test/examples/ascii/demo_to_title.f90!} ``` ### `to_sentence` @@ -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 +{!test/examples/ascii/demo_to_sentence.f90!} ``` ### `reverse` @@ -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 +{!test/examples/ascii/demo_reverse.f90!} ``` diff --git a/doc/specs/stdlib_bitsets.md b/doc/specs/stdlib_bitsets.md index 0ac1977b2..25b0c71c0 100644 --- a/doc/specs/stdlib_bitsets.md +++ b/doc/specs/stdlib_bitsets.md @@ -205,30 +205,7 @@ is mapped to a set bit, and `.false.` is mapped to an unset bit. #### Example ```fortran - program demo_assignment - use stdlib_bitsets - logical(int8) :: logical1(64) = .true. - logical(int32), allocatable :: logical2(:) - type(bitset_64) :: set0, set1 - set0 = logical1 - if ( set0 % bits() /= 64 ) then - error stop procedure // & - ' initialization with logical(int8) failed to set' // & - ' the right size.' - else if ( .not. set0 % all() ) then - error stop procedure // ' initialization with' // & - ' logical(int8) failed to set the right values.' - else - write(*,*) 'Initialization with logical(int8) succeeded.' - end if - set1 = set0 - if ( set1 == set0 ) & - write(*,*) 'Initialization by assignment succeeded' - logical2 = set1 - if ( all( logical2 ) ) then - write(*,*) 'Initialization of logical(int32) succeeded.' - end if - end program demo_assignment +{!test/examples/bitsets/demo_assignment.f90!} ``` ### Table of the non-member comparison operations @@ -282,20 +259,7 @@ otherwise it is `.false.`. #### Example ```fortran - program demo_all - use stdlib_bitsets - character(*), parameter :: & - bits_all = '111111111111111111111111111111111' - type(bitset_64) :: set0 - call set0 % from_string( bits_all ) - if ( .not. set0 % all() ) then - error stop "FROM_STRING failed to interpret" // & - "BITS_ALL's value properly." - else - write(*,*) "FROM_STRING transferred BITS_ALL properly" // & - " into set0." - end if - end program demo_all +{!test/examples/bitsets/demo_all.f90!} ``` ### `and` - bitwise `and` of the bits of two bitsets @@ -332,23 +296,7 @@ number of bits as `set1`. #### Example ```fortran - program demo_and - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0 % init(166) - call set1 % init(166) - call and( set0, set1 ) ! none none - if ( none(set0) ) write(*,*) 'First test of AND worked.' - call set0 % not() - call and( set0, set1 ) ! all none - if ( none(set0) ) write(*,*) 'Second test of AND worked.' - call set1 % not() - call and( set0, set1 ) ! none all - if ( none(set0) ) write(*,*) 'Third test of AND worked.' - call set0 % not() - call and( set0, set1 ) ! all all - if ( all(set0) ) write(*,*) 'Fourth test of AND worked.' - end program demo_and +{!test/examples/bitsets/demo_and.f90!} ``` ### `and_not` - Bitwise `and` of one bitset with the negation of another @@ -386,24 +334,7 @@ number of bits as `set1`, otherwise the result is undefined. #### Example ```fortran - program demo_and_not - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0 % init(166) - call set1 % init(166) - call and_not( set0, set1 ) ! none none - if ( none(set0) ) write(*,*) 'First test of AND_NOT worked.' - call set0 % not() - call and_not( set0, set1 ) ! all none - if ( all(set0) ) write(*,*) 'Second test of AND_NOT worked.' - call set0 % not() - call set1 % not() - call and_not( set0, set1 ) ! none all - if ( none(set0) ) write(*,*) 'Third test of AND_NOT worked.' - call set0 % not() - call and_not( set0, set1 ) ! all all - if ( none(set0) ) write(*,*) 'Fourth test of AND_NOT worked.' - end program demo_and_not +{!test/examples/bitsets/demo_and_not.f90!} ``` ### `any` - determine whether any bits are set @@ -437,21 +368,7 @@ is `.false.`. #### Example ```fortran - program demo_any - use stdlib_bitsets - character(*), parameter :: & - bits_0 = '0000000000000000000' - type(bitset_64) :: set0 - call set0 % from_string( bits_0 ) - if ( .not. set0 % any() ) then - write(*,*) "FROM_STRING interpreted " // & - "BITS_0's value properly." - end if - call set0 % set(5) - if ( set0 % any() ) then - write(*,*) "ANY interpreted SET0's value properly." - end if - end program demo_any +{!test/examples/bitsets/demo_any.f90!} ``` ### `bit_count` - return the number of bits that are set @@ -485,21 +402,7 @@ equal to the number of bits that are set in `self`. #### Example ```fortran - program demo_bit_count - use stdlib_bitsets - character(*), parameter :: & - bits_0 = '0000000000000000000' - type(bitset_64) :: set0 - call set0 % from_string( bits_0 ) - if ( set0 % bit_count() == 0 ) then - write(*,*) "FROM_STRING interpreted " // & - "BITS_0's value properly." - end if - call set0 % set(5) - if ( set0 % bit_count() == 1 ) then - write(*,*) "BIT_COUNT interpreted SET0's value properly." - end if - end program demo_bit_count +{!test/examples/bitsets/demo_bit_count.f90!} ``` #### `bits` - returns the number of bits @@ -533,17 +436,7 @@ the number of defined bits in `self`. #### Example ```fortran - program demo_bits - use stdlib_bitsets - character(*), parameter :: & - bits_0 = '0000000000000000000' - type(bitset_64) :: set0 - call set0 % from_string( bits_0 ) - if ( set0 % bits() == 19 ) then - write(*,*) "FROM_STRING interpreted " // & - "BITS_0's size properly." - end if - end program demo_bits +{!test/examples/bitsets/demo_bits.f90!} ``` ### `clear` - clears a sequence of one or more bits @@ -594,17 +487,7 @@ an `intent(in)` argument. #### Example ```fortran - program demo_clear - use stdlib_bitsets - type(bitset_large) :: set0 - call set0 % init(166) - call set0 % not() - if ( set0 % all() ) write(*,*) 'SET0 is properly initialized.' - call set0 % clear(165) - if ( .not. set0 % test(165) ) write(*,*) 'Bit 165 is cleared.' - call set0 % clear(0,164) - if ( set0 % none() ) write(*,*) 'All bits are cleared.' - end program demo_clear +{!test/examples/bitsets/demo_clear.f90!} ``` ### `extract` - create a new bitset from a range in an old bitset @@ -655,16 +538,7 @@ an `intent(out)` argument. If present it shall have one of the values: #### Example ```fortran - program demo_extract - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0 % init(166) - call set0 % set(100,150) - call extract( set1, set0, 100, 150) - if ( set1 % bits() == 51 ) & - write(*,*) 'SET1 has the proper size.' - if ( set1 % all() ) write(*,*) 'SET1 has the proper values.' - end program demo_extract +{!test/examples/bitsets/demo_extract.f90!} ``` ### `flip` - flip the values of a sequence of one or more bits @@ -716,16 +590,7 @@ an `intent(in)` argument. #### Example ```fortran - program demo_flip - use stdlib_bitsets - type(bitset_large) :: set0 - call set0 % init(166) - if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' - call set0 % flip(165) - if ( set0 % test(165) ) write(*,*) 'Bit 165 is flipped.' - call set0 % flip(0,164) - if ( set0 % all() ) write(*,*) 'All bits are flipped.' - end program demo_flip +{!test/examples/bitsets/demo_flip.f90!} ``` ### `from_string` - initializes a bitset from a binary literal @@ -775,23 +640,7 @@ codes: #### Example ```fortran - program demo_from_string - use stdlib_bitsets - character(*), parameter :: & - bits_all = '111111111111111111111111111111111' - type(bitset_64) :: set0 - call set0 % from_string( bits_all ) - if ( bits(set0) /= 33 ) then - error stop "FROM_STRING failed to interpret " // & - 'BITS_ALL's size properly." - else if ( .not. set0 % all() ) then - error stop "FROM_STRING failed to interpret" // & - "BITS_ALL's value properly." - else - write(*,*) "FROM_STRING transferred BITS_ALL properly" // & - " into set0." - end if - end program demo_from_string +{!test/examples/bitsets/demo_from_string.f90!} ``` ### `init` - `bitset_type` initialization routines @@ -840,14 +689,7 @@ stop code. It can have any of the following error codes: #### Example ```fortran - program demo_init - use stdlib_bitsets - type(bitset_large) :: set0 - call set0 % init(166) - if ( set0 % bits() == 166 ) & - write(*,*) 'SET0 has the proper size.' - if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' - end program demo_init +{!test/examples/bitsets/demo_init.f90!} ``` ### `input` - reads a bitset from an unformatted file @@ -900,36 +742,7 @@ values for this `status` are: #### Example ```fortran - program demo_input - character(*), parameter :: & - bits_0 = '000000000000000000000000000000000', & - bits_1 = '000000000000000000000000000000001', & - bits_33 = '100000000000000000000000000000000' - integer :: unit - type(bitset_64) :: set0, set1, set2, set3, set4, set5 - call set0 % from_string( bits_0 ) - call set1 % from_string( bits_1 ) - call set2 % from_string( bits_33 ) - open( newunit=unit, file='test.bin', status='replace', & - form='unformatted', action='write' ) - call set2 % output(unit) - call set1 % output(unit) - call set0 % output(unit) - close( unit ) - open( newunit=unit, file='test.bin', status='old', & - form='unformatted', action='read' ) - call set5 % input(unit) - call set4 % input(unit) - call set3 % input(unit) - close( unit ) - if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then - error stop 'Transfer to and from units using ' // & - ' output and input failed.' - else - write(*,*) 'Transfer to and from units using ' // & - 'output and input succeeded.' - end if - end program demo_input +{!test/examples/bitsets/demo_input.f90!} ``` ### `none` - determines whether no bits are set @@ -964,21 +777,7 @@ The result is `.true.` if no bits in `self` are set, otherwise it is #### Example ```fortran - program demo_none - use stdlib_bitsets - character(*), parameter :: & - bits_0 = '0000000000000000000' - type(bitset_large) :: set0 - call set0 % from_string( bits_0 ) - if ( set0 % none() ) then - write(*,*) "FROM_STRING interpreted " // & - "BITS_0's value properly." - end if - call set0 % set(5) - if ( .not. set0 % none() ) then - write(*,*) "NONE interpreted SET0's value properly." - end if - end program demo_none +{!test/examples/bitsets/demo_none.f90!} ``` ### `not` - Performs the logical complement on a bitset @@ -1008,19 +807,7 @@ complement of their values on input. #### Example ```fortran - program demo_not - use stdlib_bitsets - type(bitset_large) :: set0 - call set0 % init( 155 ) - if ( set0 % none() ) then - write(*,*) "FROM_STRING interpreted " // & - "BITS_0's value properly." - end if - call set0 % not() - if ( set0 % all() ) then - write(*,*) "ALL interpreted SET0's value properly." - end if - end program demo_not +{!test/examples/bitsets/demo_not.f90!} ``` ### `or` - Bitwise OR of the bits of two bitsets @@ -1057,24 +844,7 @@ otherwise the results are undefined. #### Example ```fortran - program demo_or - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0 % init(166) - call set1 % init(166) - call or( set0, set1 ) ! none none - if ( none(set0) ) write(*,*) 'First test of OR worked.' - call set0 % not() - call or( set0, set1 ) ! all none - if ( all(set0) ) write(*,*) 'Second test of OR worked.' - call set0 % not() - call set1 % not() - call or( set0, set1 ) ! none all - if ( all(set0) ) write(*,*) 'Third test of OR worked.' - call set0 % not() - call or( set0, set1 ) ! all all - if ( all(set0) ) write(*,*) 'Fourth test of OR worked.' - end program demo_or +{!test/examples/bitsets/demo_or.f90!} ``` ### `output` - Writes a binary representation of a bitset to a file @@ -1117,36 +887,7 @@ code. The two code values have the meaning: #### Example ```fortran - program demo_output - character(*), parameter :: & - bits_0 = '000000000000000000000000000000000', & - bits_1 = '000000000000000000000000000000001', & - bits_33 = '100000000000000000000000000000000' - integer :: unit - type(bitset_64) :: set0, set1, set2, set3, set4, set5 - call set0 % from_string( bits_0 ) - call set1 % from_string( bits_1 ) - call set2 % from_string( bits_33 ) - open( newunit=unit, file='test.bin', status='replace', & - form='unformatted', action='write' ) - call set2 % output(unit) - call set1 % output(unit) - call set0 % output(unit) - close( unit ) - open( newunit=unit, file='test.bin', status='old', & - form='unformatted', action='read' ) - call set5 % input(unit) - call set4 % input(unit) - call set3 % input(unit) - close( unit ) - if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then - error stop 'Transfer to and from units using ' // & - ' output and input failed.' - else - write(*,*) 'Transfer to and from units using ' // & - 'output and input succeeded.' - end if - end program demo_output +{!test/examples/bitsets/demo_output.f90!} ``` ### `read_bitset` - initializes `self` with the value of a *bitset_literal* @@ -1227,39 +968,7 @@ as its error code. The possible error codes are: #### Example ```fortran - program demo_read_bitset - character(*), parameter :: & - bits_0 = 'S33B000000000000000000000000000000000', & - bits_1 = 'S33B000000000000000000000000000000001', & - bits_33 = 'S33B100000000000000000000000000000000' - character(:), allocatable :: test_0, test_1, test_2 - integer :: unit - type(bitset_64) :: set0, set1, set2, set3, set4, set5 - call set0 % read_bitset( bits_0, status ) - call set1 % read_bitset( bits_1, status ) - call set2 % read_bitset( bits_2, status ) - call set0 % write_bitset( test_0, status ) - call set1 % write_bitset( test_1, status ) - call set2 % write_bitset( test_2, status ) - if ( bits_0 == test_0 .and. bits_1 == test_1 .and. & - bits_2 == test_2 ) then - write(*,*) 'READ_BITSET to WRITE_BITSET strings worked.' - end if - open( newunit=unit, file='test.txt', status='replace', & - form='formatted', action='write' ) - call set2 % write_bitset(unit, advance='no') - call set1 % write_bitset(unit, advance='no') - call set0 % write_bitset(unit) - close( unit ) - open( newunit=unit, file='test.txt', status='old', & - form='formatted', action='read' ) - call set3 % read_bitset(unit, advance='no') - call set4 % read_bitset(unit, advance='no') - call set5 % read_bitset(unit) - if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then - write(*,*) WRITE_BITSET to READ_BITSET through unit worked.' - end if - end program demo_read_bitset +{!test/examples/bitsets/demo_read_bitset.f90!} ``` ### `set` - sets a sequence of one or more bits to 1 @@ -1313,16 +1022,7 @@ Elemental subroutine #### Example ```fortran - program demo_set - use stdlib_bitsets - type(bitset_large) :: set0 - call set0 % init(166) - if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' - call set0 % set(165) - if ( set0 % test(165) ) write(*,*) 'Bit 165 is set.' - call set0 % set(0,164) - if ( set0 % all() ) write(*,*) 'All bits are set.' - end program demo_set +{!test/examples/bitsets/demo_set.f90!} ``` ### `test` - determine whether a bit is set @@ -1362,17 +1062,7 @@ otherwise it is `.false.`. If `pos` is outside the range #### Example ```fortran - program demo_test - use stdlib_bitsets - type(bitset_large) :: set0 - call set0 % init(166) - call set0 % not() - if ( set0 % all() ) write(*,*) 'SET0 is properly initialized.' - call set0 % clear(165) - if ( .not. set0 % test(165) ) write(*,*) 'Bit 165 is cleared.' - call set0 % set(165) - if ( set0 % test(165) ) write(*,*) 'Bit 165 is set.' - end program demo_test +{!test/examples/bitsets/demo_test.f90!} ``` ### `to_string` - represent a bitset as a binary literal @@ -1416,20 +1106,7 @@ the stop code. The values have the following meanings: #### Example ```fortran - program demo_to_string - use stdlib_bitsets - character(*), parameter :: & - bits_all = '111111111111111111111111111111111' - type(bitset_64) :: set0 - character(:), allocatable :: new_string - call set0 % init(33) - call set0 % not() - call set0 % to_string( new_string ) - if ( new_string == bits_all ) then - write(*,*) "TO_STRING transferred BITS0 properly" // & - " into NEW_STRING." - end if - end program demo_to_string +{!test/examples/bitsets/demo_to_string.f90!} ``` ### `value` - determine the value of a bit @@ -1468,17 +1145,7 @@ is zero. #### Example ```fortran - program demo_value - use stdlib_bitsets - type(bitset_large) :: set0 - call set0 % init(166) - call set0 % not() - if ( set0 % all() ) write(*,*) 'SET0 is properly initialized.' - call set0 % clear(165) - if ( set0 % value(165) == 0 ) write(*,*) 'Bit 165 is cleared.' - call set0 % set(165) - if ( set0 % value(165) == 1 ) write(*,*) 'Bit 165 is set.' - end program demo_value +{!test/examples/bitsets/demo_value.f90!} ``` ### `write_bitset` - writes a *bitset-literal* @@ -1545,39 +1212,7 @@ the following error code values: #### Example ```fortran - program demo_write_bitset - character(*), parameter :: & - bits_0 = 'S33B000000000000000000000000000000000', & - bits_1 = 'S33B000000000000000000000000000000001', & - bits_33 = 'S33B100000000000000000000000000000000' - character(:), allocatable :: test_0, test_1, test_2 - integer :: unit - type(bitset_64) :: set0, set1, set2, set3, set4, set5 - call set0 % read_bitset( bits_0, status ) - call set1 % read_bitset( bits_1, status ) - call set2 % read_bitset( bits_2, status ) - call set0 % write_bitset( test_0, status ) - call set1 % write_bitset( test_1, status ) - call set2 % write_bitset( test_2, status ) - if ( bits_0 == test_0 .and. bits_1 == test_1 .and. & - bits_2 == test_2 ) then - write(*,*) 'READ_BITSET to WRITE_BITSET strings worked.' - end if - open( newunit=unit, file='test.txt', status='replace', & - form='formatted', action='write' ) - call set2 % write_bitset(unit, advance='no') - call set1 % write_bitset(unit, advance='no') - call set0 % write_bitset(unit) - close( unit ) - open( newunit=unit, file='test.txt', status='old', & - form='formatted', action='read' ) - call set3 % read_bitset(unit, advance='no') - call set4 % read_bitset(unit, advance='no') - call set5 % read_bitset(unit) - if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then - write(*,*) WRITE_BITSET to READ_BITSET through unit worked.' - end if - end program demo_write_bitset +{!test/examples/bitsets/demo_write_bitset.f90!} ``` ### `xor` - bitwise exclusive `or` @@ -1614,24 +1249,7 @@ samee number of bits, otherwise the result is undefined. #### Example ```fortran - program demo_xor - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0 % init(166) - call set1 % init(166) - call xor( set0, set1 ) ! none none - if ( none(set0) ) write(*,*) 'First test of XOR worked.' - call set0 % not() - call xor( set0, set1 ) ! all none - if ( all(set0) ) write(*,*) 'Second test of XOR worked.' - call set0 % not() - call set1 % not() - call xor( set0, set1 ) ! none all - if ( all(set0) ) write(*,*) 'Third test of XOR worked.' - call set0 % not() - call xor( set0, set1 ) ! all all - if ( none(set0) ) write(*,*) 'Fourth test of XOR worked.' - end program demo_xor +{!test/examples/bitsets/demo_xor.f90!} ``` ## Specification of the `stdlib_bitsets` operators @@ -1677,22 +1295,7 @@ to the same value, otherwise the result is `.false.`. #### Example ```fortran - program demo_equality - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0 % init( 33 ) - call set1 % init( 33 ) - call set2 % init( 33 ) - call set1 % set( 0 ) - call set2 % set( 32 ) - if ( set0 == set0 .and. set1 == set1 .and. set2 == set2 .and. & - .not. set0 == set1 .and. .not. set0 == set2 .and. .not. & - set1 == set2 ) then - write(*,*) 'Passed 64 bit equality tests.' - else - error stop 'Failed 64 bit equality tests.' - end if - end program demo_equality +{!test/examples/bitsets/demo_equality.f90!} ``` ### `/=` - compare two bitsets to determine whether any bits differ in value @@ -1736,22 +1339,7 @@ the result is `.false.`. #### Example ```fortran - program demo_inequality - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0 % init( 33 ) - call set1 % init( 33 ) - call set2 % init( 33 ) - call set1 % set( 0 ) - call set2 % set( 32 ) - if ( set0 /= set1 .and. set0 /= set2 .and. set1 /= set2 .and. & - .not. set0 /= set0 .and. .not. set1 /= set1 .and. .not. & - set2 /= set2 ) then - write(*,*) 'Passed 64 bit inequality tests.' - else - error stop 'Failed 64 bit inequality tests.' - end if - end program demo_inequality +{!test/examples/bitsets/demo_inequality.f90!} ``` ### `>=` - compare two bitsets to determine whether the first is greater than or equal to the second @@ -1798,23 +1386,7 @@ or the highest order different bit is set to 1 in `set1` and to 0 in #### Example ```fortran - program demo_ge - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0 % init( 33 ) - call set1 % init( 33 ) - call set2 % init( 33 ) - call set1 % set( 0 ) - call set2 % set( 32 ) - if ( set1 >= set0 .and. set2 >= set1 .and. set2 >= set0 .and. & - set0 >= set0 .and. set1 >= set1 .and. set2 >= set2 .and. & - .not. set0 >= set1 .and. .not. set0 >= set2 .and. .not. & - set1 >= set2 ) then - write(*,*) 'Passed 64 bit greater than or equals tests.' - else - error stop 'Failed 64 bit greater than or equals tests.' - end if - end program demo_ge +{!test/examples/bitsets/demo_ge.f90!} ``` ### `>` - compare two bitsets to determine whether the first is greater than the other @@ -1861,22 +1433,7 @@ highest order different bit is set to 1 in `set1` and to 0 in `set2`, #### Example ```fortran - program demo_gt - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0 % init( 33 ) - call set1 % init( 33 ) - call set2 % init( 33 ) - call set1 % set( 0 ) - call set2 % set( 32 ) - if ( set1 > set0 .and. set2 > set1 .and. set2 > set0 .and. & - .not. set0 > set0 .and. .not. set0 > set1 .and. .not. & - set1 > set2 ) then - write(*,*) 'Passed 64 bit greater than tests.' - else - error stop 'Failed 64 bit greater than tests.' - end if - end program demo_gt +{!test/examples/bitsets/demo_gt.f90!} ``` ### `<=` - compare two bitsets to determine whether the first is less than or equal to the other @@ -1923,23 +1480,7 @@ or the highest order different bit is set to 0 in `set1` and to 1 in #### Example ```fortran - program demo_le - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0 % init( 33 ) - call set1 % init( 33 ) - call set2 % init( 33 ) - call set1 % set( 0 ) - call set2 % set( 32 ) - if ( set0 <= set1 .and. set1 <= set2 .and. set0 <= set2 .and. & - set0 <= set0 .and. set1 <= set1 .and. set2 <= set2 .and. & - .not. set1 <= set0 .and. .not. set2 <= set0 .and. .not. & - set2 <= set1 ) then - write(*,*) 'Passed 64 bit less than or equal tests.' - else - error stop 'Failed 64 bit less than or equal tests.' - end if - end program demo_le +{!test/examples/bitsets/demo_le.f90!} ``` ### `<` - compare two bitsets to determine whether the first is less than the other @@ -1986,20 +1527,5 @@ highest order different bit is set to 0 in `set1` and to 1 in `set2`, #### Example ```fortran - program demo_lt - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0 % init( 33 ) - call set1 % init( 33 ) - call set2 % init( 33 ) - call set1 % set( 0 ) - call set2 % set( 32 ) - if ( set0 < set1 .and. set1 < set2 .and. set0 < set2 .and. & - .not. set0 < set0 .and. .not. set2 < set0 .and. .not. & - set2 < set1 ) then - write(*,*) 'Passed 64 bit less than tests.' - else - error stop 'Failed 64 bit less than tests.' - end if - end program demo_lt +{!test/examples/bitsets/demo_lt.f90!} ``` diff --git a/doc/specs/stdlib_error.md b/doc/specs/stdlib_error.md index 945a03251..3900a19a7 100644 --- a/doc/specs/stdlib_error.md +++ b/doc/specs/stdlib_error.md @@ -53,40 +53,16 @@ If `condition` is `.false.`, and: #### Examples ```fortran -program demo_check1 - use stdlib_error, only: check - implicit none - integer :: a = 1 - ! If a /= 5, stops the program with exit code 1 and prints 'Check failed.' - call check(a == 5) -end program demo_check1 +{!test/examples/error/demo_check1.f90!} ``` ```fortran -program demo_check2 - use stdlib_error, only: check - implicit none - integer :: a = 1 - ! If a /= 5, stops the program with exit code 1 and prints 'a == 5 failed.' - call check(a == 5, msg='a == 5 failed.') -end program demo_check2 +{!test/examples/error/demo_check2.f90!} ``` ```fortran -program demo_check3 - use stdlib_error, only: check - implicit none - integer :: a = 1 - ! If a /= 5, prints 'a == 5 failed.', but doesn't stop the program. - call check(a == 5, msg='a == 5 failed.', warn=.true.) -end program demo_check3 +{!test/examples/error/demo_check3.f90!} ``` ```fortran -program demo_check4 - use stdlib_error, only: check - implicit none - integer :: a = 1 - ! If a /= 5, stops the program with exit code 77 and prints 'a == 5 failed.' - call check(a == 5, msg='a == 5 failed.', code=77) -end program demo_check4 +{!test/examples/error/demo_check4.f90!} ``` ### `error_stop` - aborts the program @@ -118,19 +94,11 @@ Aborts the program with printing the message `msg` to `stderr` and a nonzero exi Without error code: ```fortran -program demo_error_stop1 - use stdlib_error, only: error_stop - implicit none - call error_stop("Invalid argument") -end program demo_error_stop1 +{!test/examples/error/demo_error_stop1.f90!} ``` With error code: ```fortran -program demo_error_stop2 - use stdlib_error, only: error_stop - implicit none - call error_stop("Invalid argument", code = 123) -end program demo_error_stop2 +{!test/examples/error/demo_error_stop2.f90!} ``` diff --git a/doc/specs/stdlib_hash_procedures.md b/doc/specs/stdlib_hash_procedures.md old mode 100755 new mode 100644 index 84cb71415..d40f6601b --- a/doc/specs/stdlib_hash_procedures.md +++ b/doc/specs/stdlib_hash_procedures.md @@ -543,19 +543,7 @@ E. Knuth. It multiplies the `key` by the odd valued approximation to ##### Example ```fortran -program demo_fibonacci_hash - use stdlib_hash_32bit, only: fibonacci_hash - use iso_fortran_env, only: int32 - implicit none - integer, allocatable :: array1(:) - integer(int32) :: hash, source - allocate( array1(0:2**6-1) ) - array1(:) = 0 - source = 42_int32 - hash = fibonacci_hash(source, 6) - array1(hash) = source - print *, hash -end program demo_fibonacci_hash +{!test/examples/hash_procedures/demo_fibonacci_hash.f90!} ``` #### `fnv_1_hash`- calculates a hash code from a key @@ -609,14 +597,7 @@ function for character strings. ##### Example ```fortran -program demo_fnv_1_hash - use stdlib_hash_32bit, only: fnv_1_hash - use iso_fortran_env, only: int32 - implicit none - integer(int32) :: hash - hash = fnv_1_hash([ 5, 4, 3, 1, 10, 4, 9]) - print *, hash -end program demo_fnv_1_hash +{!test/examples/hash_procedures/demo_fnv_1_hash.f90!} ``` @@ -670,14 +651,7 @@ function for character strings. ##### Example ```fortran -program demo_fnv_1a_hash - use stdlib_hash_32bit, only: fnv_1a_hash - use iso_fortran_env, only: int32 - implicit none - integer(int32) :: hash - hash = fnv_1a_hash( [ 5, 4, 3, 1, 10, 4, 9] ) - print *, hash -end program demo_fnv_1a_hash +{!test/examples/hash_procedures/demo_fnv_1a_hash.f90!} ``` @@ -844,17 +818,7 @@ function for character strings. ##### Example ```fortran -program demo_nmhash32 - use stdlib_hash_32bit, only: nmhash32, & - new_nmhash32_seed - use iso_fortran_env, only: int32 - implicit none - integer(int32) :: hash - integer(int32) :: seed = 42_int32 - call new_nmhash32_seed(seed) - hash = nmhash32([ 5, 4, 3, 1, 10, 4, 9], seed) - print *, seed, hash -end program demo_nmhash32 +{!test/examples/hash_procedures/demo_nmhash32.f90!} ``` @@ -906,17 +870,7 @@ function for character strings. ##### Example ```fortran -program demo_nmhash32x - use stdlib_hash_32bit, only: nmhash32x, & - new_nmhash32x_seed - use iso_fortran_env, only: int32 - implicit none - integer(int32) :: hash - integer(int32) :: seed = 42_int32 - call new_nmhash32x_seed(seed) - hash = nmhash32x([ 5, 4, 3, 1, 10, 4, 9], seed) - print *, seed, hash -end program demo_nmhash32x +{!test/examples/hash_procedures/demo_nmhash32x.f90!} ``` #### `odd_random_integer` - returns an odd integer @@ -999,24 +953,7 @@ It multiplies the `key` by `seed`, and returns the ##### Example ```fortran -program demo_universal_mult_hash - use stdlib_hash_32bit, only: odd_random_integer, & - universal_mult_hash - use iso_fortran_env, only: int32 - implicit none - integer, allocatable :: array1(:) - integer(int32) :: hash, i, seed, source - seed = 0 - allocate( array1(0:2**6-1) ) - do i = 0, 2**6-1 - array1(i) = i - end do - call odd_random_integer( seed ) - source = 42_int32 - hash = universal_mult_hash(source, seed, 6) - array1(hash) = source - print *, seed, hash, array1 -end program demo_universal_mult_hash +{!test/examples/hash_procedures/demo_universal_mult_hash.f90!} ``` #### `water_hash`- calculates a hash code from a key and a seed @@ -1074,17 +1011,7 @@ function for character strings. ##### Example ```fortran -program demo_water_hash - use stdlib_hash_32bit, only: water_hash, & - new_water_hash_seed - use iso_fortran_env, only: int32, int64 - implicit none - integer(int32) :: hash - integer(int64) :: seed = 42_int64 - call new_water_hash_seed( seed ) - hash = water_hash([ 5, 4, 3, 1, 10, 4, 9], seed) - print *, hash, seed -end program demo_water_hash +{!test/examples/hash_procedures/demo_water_hash.f90!} ``` ## The `stdlib_hash_64bit` module @@ -1175,19 +1102,7 @@ E. Knuth. It multiplies the `key` by the odd valued approximation to ##### Example ```fortran -program demo_fibonacci_hash_64 - use stdlib_hash_64bit, only: fibonacci_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: array1(:) - integer(int64) :: hash, source - allocate( array1(0:2**6-1) ) - array1(:) = 0 - source = int(Z'1FFFFFFFF', int64) - hash = fibonacci_hash(source, 6) - array1(hash) = source - print *, hash -end program demo_fibonacci_hash_64 +{!test/examples/hash_procedures/demo_fibonacci_hash_64.f90!} ``` #### `FNV_1`- calculates a hash code from a key @@ -1241,16 +1156,7 @@ function for character strings. ##### Example ```fortran -program demo_fnv_1_hash_64 - use stdlib_hash_64bit, only: fnv_1_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: array1(:) - integer(int64) :: hash - array1 = [ 5, 4, 3, 1, 10, 4, 9] - hash = fnv_1_hash(array1) - print *, hash -end program demo_fnv_1_hash_64 +{!test/examples/hash_procedures/demo_fnv_1_hash_64.f90!} ``` @@ -1304,16 +1210,7 @@ function for character strings. ##### Example ```fortran -program demo_fnv_1a_hash_64 - use stdlib_hash_64bit, only: fnv_1a_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: array1(:) - integer(int64) :: hash - array1 = [ 5, 4, 3, 1, 10, 4, 9] - hash = fnv_1a_hash(array1) - print *, hash -end program demo_fnv_1a_hash_64 +{!test/examples/hash_procedures/demo_fnv_1a_hash_64.f90!} ``` @@ -1473,19 +1370,7 @@ function for character strings. ##### Example ```fortran -program demo_pengy_hash - use stdlib_hash_64bit, only: new_pengy_hash_seed, pengy_hash - use iso_fortran_env, only: int32, int64 - implicit none - integer, allocatable :: key(:) - integer(int64) :: hash - integer(int32) :: seed - key = [ 0, 1, 2, 3 ] - seed = 0_int32 - call new_pengy_hash_seed( seed ) - hash = pengy_hash( key, seed ) - print *, seed, hash -end program demo_pengy_hash +{!test/examples/hash_procedures/demo_pengy_hash.f90!} ``` @@ -1535,19 +1420,7 @@ and has no known bad seeds. ##### Example ```fortran -program demo_spooky_hash - use stdlib_hash_64bit, only: new_spooky_hash_seed, & - spooky_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: key(:) - integer(int64) :: hash(2), seed(2) - key = [ 0, 1, 2, 3 ] - seed = [ 119_int64, 2_int64**41-1 ] - call new_spooky_hash_seed( seed ) - hash = spooky_hash( key, seed ) - print *, seed, hash -end program demo_spooky_hash +{!test/examples/hash_procedures/demo_spooky_hash.f90!} ``` #### `universal_mult_hash` - maps an integer to a smaller number of bits @@ -1596,22 +1469,7 @@ It multiplies the `key` by `seed`, and returns the ```fortran -program demo_universal_mult_hash_64 - use stdlib_hash_32bit, only: odd_random_integer, & - universal_mult_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: array1(:) - integer(int64) :: hash, i, seed, source - seed = 0 - allocate( array1(0:2**6-1) ) - array1 = 0 - call odd_random_integer( seed ) - source = 42_int64 - hash = universal_mult_hash(source, seed, 6) - array1(hash) = source - print *, seed, hash, array1 -end program demo_universal_mult_hash_64 +{!test/examples/hash_procedures/demo_universal_mult_hash_64.f90!} ``` diff --git a/doc/specs/stdlib_hashmaps.md b/doc/specs/stdlib_hashmaps.md index abe6b92c8..ee9ad0291 100644 --- a/doc/specs/stdlib_hashmaps.md +++ b/doc/specs/stdlib_hashmaps.md @@ -227,18 +227,7 @@ is an `intent(out)` argument. ##### Example ```fortran - program demo_copy_key - use stdlib_hashmap_wrappers, only: & - copy_key, operator(==), key_type - use iso_fortran_env, only: int8 - implicit none - integer(int8) :: i, value(15) - type(key_type) :: old_key, new_key - value = [(i, i = 1, 15)] - call set( key_out, value ) - call copy_key( key_out, new_key ) - print *, "old_key == new_key = ", old_key == new_key - end program demo_copy_key +{!test/examples/hashmaps/demo_copy_key.f90!} ``` #### `copy_other` - Returns a copy of the other data @@ -270,29 +259,7 @@ is an `intent(out)` argument. ##### Example ```fortran - program demo_copy_other - use stdlib_hashmap_wrappers, only: & - copy_other, get, other_type, set - use iso_fortran_env, only: int8 - implicit none - type(other_type) :: other_in, other_out - integer(int_8) :: i - class(*), allocatable :: dummy - type dummy_type - integer(int8) :: value(15) - end type - type(dummy_type) :: dummy_val - do i=1, 15 - dummy_val % value1(i) = i - end do - allocate(other_in % value, source=dummy_val) - call copy_other( other_in, other_out ) - select type(other_out) - type(dummy_type) - print *, "other_in == other_out = ", & - all( dummy_val % value == other_out % value ) - end select - end program demo_copy_other +{!test/examples/hashmaps/demo_copy_other.f90!} ``` @@ -358,19 +325,7 @@ expected to be minor compared to its faster hashing rate. ##### Example ```fortran - program demo_fnv_1_hasher - use stdlib_hashmap_wrappers, only: & - fnv_1_hasher, key_type, set - use iso_fortran_env, only: int32 - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] - call set( key, array1 ) - hash = fnv_1_hasher(key) - print *, hash - end program demo_fnv_1_hasher +{!test/examples/hashmaps/demo_fnv_1_hasher.f90!} ``` @@ -422,19 +377,7 @@ expected to be minor compared to its faster hashing rate. ##### Example ```fortran - program demo_fnv_1a_hasher - use stdlib_hashmap_wrappers, only: & - fnv_1a_hasher, key_type, set - use iso_fortran_env, only: int32 - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] - call set( key, array1 ) - hash = fnv_1a_hasher(key) - print *, hash - end program demo_fnv_1a_hasher +{!test/examples/hashmaps/demo_fnv_1a_hasher.f90!} ``` #### `free_key` - frees the memory associated with a key @@ -464,18 +407,7 @@ is an `intent(out)` argument. ##### Example ```fortran - program demo_free_key - use stdlib_hashmap_wrappers, only: & - copy_key, free_key, key_type, set - use iso_fortran_env, only: int8 - implicit none - integer(int8) :: i, value(15) - type(key_type) :: old_key, new_key - value = [(i, i=1, 15)] - call set( old_key, value ) - call copy_key( old_key, new_key ) - call free_key( old_key ) - end program demo_free_key +{!test/examples/hashmaps/demo_free_key.f90!} ``` #### `free_other` - frees the memory associated with other data @@ -505,24 +437,7 @@ is an `intent(out)` argument. ##### Example ```fortran - program demo_free_other - use stdlib_hashmap_wrappers, only: & - copy_other, free_other, other_type, set - use iso_fortran_env, only: int8 - implicit none - type dummy_type - integer(int8) :: value(15) - end type dummy_type - typer(dummy_type) :: dummy_val - type(other_type), allocatable :: other_in, other_out - integer(int_8) :: i - do i=1, 15 - dummy_val % value(i) = i - end do - allocate(other_in, source=dummy_val) - call copy_other( other_in, other_out ) - call free_other( other_out ) - end program demo_free_other +{!test/examples/hashmaps/demo_free_other.f90!} ``` @@ -566,22 +481,7 @@ an allocatable of `class(*)`. It is an `intent(out)` argument. ##### Example ```fortran - program demo_get - use stdlib_hashmap_wrappers, only: & - get, key_type, set - use iso_fortran_env, only: int8 - implicit none - integer(int8), allocatable :: value(:), result(:) - type(key_type) :: key - integer(int_8) :: i - allocate( value(1:15) ) - do i=1, 15 - value(i) = i - end do - call set( key, value ) - call get( key, result ) - print *, 'RESULT == VALUE = ', all( value == result ) - end program demo_get +{!test/examples/hashmaps/demo_get.f90!} ``` @@ -625,21 +525,7 @@ pointers intended for use as a hash function for the hash maps. ##### Example ```fortran - program demo_hasher_fun - use stdlib_hashmap_wrappers, only: & - fnv_1a_hasher, hasher_fun, set - use iso_fortran_env, only: int8, int32 - implicit none - type(hasher_fun), pointer :: hasher_pointer - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - hasher_pointer => fnv_1a_hasher - array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] - call set( key, array1 ) - hash = hasher_pointer(key) - print *, hash - end program demo_hasher_fun +{!test/examples/hashmaps/demo_hasher_fun.f90!} ``` #### `operator(==)` - Compares two keys for equality @@ -679,20 +565,7 @@ The result is `.true.` if the keys are equal, otherwise `.falss.`. ##### Example ```fortran - program demo_equal_keys - use stdlib_hashmap_wrappers, only: & - copy_key, operator(==), key_type, set - use iso_fortran_env, only: int8 - implicit none - integer(int8) :: i, value(15) - type(key_type) :: old_key, new_key - do i=1, 15 - value(i) = i - end do - call set( old_key, value ) - call copy_key( old_key, new_key ) - print *, "old_key == new_key = ", old_key == new_key - end program demo_equal_keys +{!test/examples/hashmaps/demo_equal_keys.f90!} ``` #### `seeded_nmhash32_hasher`- calculates a hash code from a key @@ -742,19 +615,7 @@ This code passes the SMHasher tests. ##### Example ```fortran - program demo_seeded_nmhash32_hasher - use stdlib_hashmap_wrappers, only: & - seeded_nmhash32_hasher, key_type, set - use iso_fortran_env, only: int32 - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] - call set( key, array1 ) - hash = seeded_nmhash32_hasher (key) - print *, hash - end program demo_seeded_nmhash32_hasher +{!test/examples/hashmaps/demo_seeded_nmhash32_hasher.f90!} ``` #### `seeded_nmhash32x_hasher`- calculates a hash code from a key @@ -803,19 +664,7 @@ This code passes the SMHasher tests. ##### Example ```fortran - program demo_seeded_nmhash32x_hasher - use stdlib_hashmap_wrappers, only: & - seeded_nmhash32x_hasher, key_type, set - use iso_fortran_env, only: int32 - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] - call set( key, array1 ) - hash = seeded_nmhash32x_hasher (key) - print *, hash - end program demo_seeded_nmhash32x_hasher +{!test/examples/hashmaps/demo_seeded_nmhash32x_hasher.f90!} ``` #### `seeded_water_hasher`- calculates a hash code from a key @@ -865,19 +714,7 @@ This code passes the SMHasher tests. ##### Example ```fortran - program demo_seeded_water_hasher - use stdlib_hashmap_wrappers, only: & - seeded_water_hasher, key_type, set - use iso_fortran_env, only: int32 - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] - call set( key, array1 ) - hash = seeded_water_hasher (key) - print *, hash - end program demo_seeded_water_hasher +{!test/examples/hashmaps/demo_seeded_water_hasher.f90!} ``` @@ -926,22 +763,7 @@ value to an `int8` vector. ##### Example ```fortran - program demo_set - use stdlib_hashmap_wrappers, only: & - get, key_type, set - use iso_fortran_env, only: int8 - implicit none - integer(int8), allocatable :: value(:), result(:) - type(key_type) :: key - integer(int_8) :: i - allocate( value(1:15) ) - do i=1, 15 - value(i) = i - end do - call set( key, value ) - call get( key, result ) - print *, 'RESULT == VALUE = ', all( value == result ) - end program demo_set +{!test/examples/hashmaps/demo_set.f90!} ``` @@ -1387,16 +1209,7 @@ The result will be the number of procedure calls on the hash map. ##### Example ```fortran - program demo_calls - use stdlib_hashmaps, only: chaining_hashmap_type, int_calls - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - type(int_calls) :: initial_calls - call map % init( fnv_1_hasher ) - initial_calls = map % calls() - print *, "INITIAL_CALLS = ", initial_calls - end program demo_calls +{!test/examples/hashmaps/demo_calls.f90!} ``` @@ -1434,16 +1247,7 @@ The result will be the number of entries in the hash map. ##### Example ```fortran - program demo_entries - use stdlib_hashmaps, only: open_hashmap_type, int_index - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(open_hashmap_type) :: map - type(int_index) :: initial_entries - call map % init( fnv_1_hasher ) - initial_entries = map % entries () - print *, "INITIAL_ENTRIES = ", initial_entries - end program demo_entries +{!test/examples/hashmaps/demo_entries.f90!} ``` @@ -1491,39 +1295,7 @@ undefined. ```fortran - program demo_get_other_data - use, intrinsic:: iso_fortran_env, only: & - int8 - use stdlib_hashmaps, only: chaining_hashmap_type, int_index - use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type - logical :: conflict, exists - type(key_type) :: key - type(other_type) :: other - type(chaining_hashmap_type) :: map - type dummy_type - integer(int8) :: value(4) - end type dummy_type - type(dummy_type) :: dummy - class(*), allocatable :: data - dummy % value = [ 4_int8, 3_int8, 2_int8, 1_int8 ] - allocate( data, source=dummy ) - call map % init( fnv_1_hasher ) - call set( key, [ 0_int8, 1_int8, 2_int8, 3_int8, 4_int8 ] ) - call set( other, data ) - call map % map_entry( key, other, conflict ) - if ( .not. conflict ) then - call map % get_other_data( key, other ) - else - stop 'Key is already present in the map.' - end if - call get( other, data ) - select type( data ) - type (dummy_type) - print *, 'Other data % value = ', data % value - type default - print *, 'Invalid data type in other' - end select - end program demo_get_other_data +{!test/examples/hashmaps/demo_get_other_data.f90!} ``` @@ -1586,13 +1358,7 @@ has the value `alloc_fault`. ##### Example ```fortran - program demo_init - use stdlib_hashmaps, only: chaining_map_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher - type(fnv_1a_type) :: fnv_1 - type(chaining_map_type) :: map - call map % init( fnv_1a, slots_bits=10 ) - end program demo_init +{!test/examples/hashmaps/demo_init.f90!} ``` @@ -1634,19 +1400,7 @@ is being examined. ##### Example ```fortran - program demo_key_test - use stdlib_kinds, only: int8 - use stdlib_hashmaps, only: chaining_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type - implicit none - type(chaining_hashmap_type) :: map - type(key_type) :: key - logocal :: present - call map % init( fnv_1_hasher ) - call set(key, [0_int8, 1_int8] ) - call map % key_test ( key, present ) - print *, "Initial key of 10 present for empty map = ", present - end program demo_key_test +{!test/examples/hashmaps/demo_key_test.f90!} ``` @@ -1686,16 +1440,7 @@ number of slots in the hash map. ##### Example ```fortran - program demo_loading - use stdlib_hashmaps, only: open_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(open_hashmap_type) :: map - real :: ratio - call map % init( fnv_1_hasher ) - ratio = map % loading () - print *, "Initial loading = ", ratio - end program demo_loading +{!test/examples/hashmaps/demo_loading.f90!} ``` #### `map_entry` - inserts an entry into the hash map @@ -1745,22 +1490,7 @@ is ignored. ##### Example ```fortran - program demo_map_entry - use, intrinsic:: iso_fortran_env, only: int8 - use stdlib_hashmaps, only: chaining_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type - type(chaining_hashmap_type) :: map - type(key_type) :: key - logical :: conflict - type(other_type) :: other - class(*), allocatable :: dummy - allocate( dummy, source=4 ) - call map % init( fnv_1_hasher, slots_bits=10 ) - call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) - call set( other, dummy ) - call map % map_entry( key, other, conflict ) - print *, 'CONFLICT = ', conflict - end program demo_map_entry +{!test/examples/hashmaps/demo_map_entry.f90!} ``` #### `map_probes` - returns the number of hash map probes @@ -1799,16 +1529,7 @@ rehashing. ##### Example ```fortran - program demo_probes - use stdlib_hashmaps, only: chaining_hashmap_type, int_index - use stdlib_hashmap_wrappers: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - real :: nprobes - call map % init( fnv_1_hasher ) - nprobes = map % probes() - print *, "Initial probes = ", nprobes - end program demo_probes +{!test/examples/hashmaps/demo_probes.f90!} ``` #### `num_slots` - returns the number of hash map slots. @@ -1846,16 +1567,7 @@ The result is the number of slots in `map`. ##### Example ```fortran - program demo_num_slots - use stdlib_hashmaps, only: chaining_hashmap_type, int_index - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - integer(int_index) :: initial_slots - call map % init( fnv_1_hasher ) - initial_slots = map % num_slots () - print *, "Initial slots = ", initial_slots - end program num_slots +{!test/examples/hashmaps/demo_num_slots.f90!} ``` @@ -1890,21 +1602,7 @@ It is the hash method to be used by `map`. ##### Example ```fortran - program demo_rehash - use stdlib_hashmaps, only: open_hashmap_type - use stdlib_hasmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher,& - key_type, other_type - type(openn_hashmap_type) :: map - type(key_type) :: key - type(other_type) :: other - class(*), allocatable :: dummy - allocate( dummy, source='a dummy value' ) - call map % init( fnv_1_hasher, slots_bits=10 ) - call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) - call set( other, dummy ) - call map % map_entry( key, other ) - call map % rehash( fnv_1a_hasher ) - end program demo_rehash +{!test/examples/hashmaps/demo_rehash.f90!} ``` #### `remove` - removes an entry from the hash map @@ -1945,23 +1643,7 @@ absent, the procedure returns with no entry with the given key. ##### Example ```fortran - program demo_remove - use stdlib_hashmaps, only: open_hashmap_type, int_index - use stdlib_hashmap_wrappers, only: fnv_1_hasher, & - fnv_1a_hasher, key_type, other_type - type(open_hashmap_type) :: map - type(key_type) :: key - type(other_type) :: other - logical :: existed - class(*), allocatable :: dummy - allocate( dummy, source=4.0 ) - call map % init( fnv_1_hasher, slots_bits=10 ) - call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) - call set( other, dummy ) - call map % map_entry( key, other ) - call map % remove( key, existed ) - print *, "Removed key existed = ", existed - end program demo_remove +{!test/examples/hashmaps/demo_remove.f90!} ``` #### `set_other_data` - replaces the other data for an entry @@ -2008,25 +1690,7 @@ not exist and nothing was done. ##### Example ```fortran - program demo_set_other_data - use stdlib_hashmaps, only: open_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher, & - fnv_1a_hasher, key_type, other_type, set - type(open_hashmap_type) :: map - type(key_type) :: key - type(other_type) :: other - class(*), allocatable :: dummy - call map % init( fnv_1_hasher, slots_bits=10 ) - allocate( dummy, source='A value` ) - call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) - call set( other, dummy ) - call map % map_entry( key, other ) - deallocate( dummy ) - allocate( dummy, source='Another value` ) - call set( other, dummy ) - call map % set_other_data( key, other, exists ) - print *, 'The entry to have its other data replaced exists = ', exists - end program demo_set_other_data +{!test/examples/hashmaps/demo_set_other_data.f90!} ``` #### `slots_bits` - returns the number of bits used to address the hash map slots @@ -2064,16 +1728,7 @@ The result is the number of bits used in addressing the slots in `map`. ##### Example ```fortran - program demo_slots_bits - use stdlib_hashmaps, only: chaining_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - integer :: bits - call map % init( fnv_1_hasher ) - bits = map % slots_bits () - print *, "Initial slot bits = ", bits - end program demo_slots_bits +{!test/examples/hashmaps/demo_slots_bits.f90!} ``` @@ -2114,14 +1769,5 @@ from their slot index the map. ##### Example ```fortran - program demo_total_depth - use stdlib_hashmaps, only: chaining_hashmap_type, int_depth - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - integer(int_depth) :: initial_depth - call map % init( fnv_1_hasher ) - initial_depth = map % total_depth () - print *, "Initial total depth = ", initial_depth - end program demo_total_depth +{!test/examples/hashmaps/demo_total_depth.f90!} ``` diff --git a/doc/specs/stdlib_io.md b/doc/specs/stdlib_io.md index 971a8ee29..5cc618009 100644 --- a/doc/specs/stdlib_io.md +++ b/doc/specs/stdlib_io.md @@ -36,12 +36,7 @@ Returns an allocated rank-2 `array` with the content of `filename`. ### Example ```fortran -program demo_loadtxt - use stdlib_io, only: loadtxt - implicit none - real, allocatable :: x(:,:) - call loadtxt('example.dat', x) -end program demo_loadtxt +{!test/examples/io/demo_loadtxt.f90!} ``` @@ -91,14 +86,7 @@ The result is a scalar of type `integer`. ### Example ```fortran -program demo_open - use stdlib_io, only: open - implicit none - integer :: u - u = open('example.dat', 'wt') - write(u,'(a)')'This is an example for open' - close(u) -end program demo_open +{!test/examples/io/demo_open.f90!} ``` @@ -128,12 +116,7 @@ Provides a text file called `filename` that contains the rank-2 `array`. ### Example ```fortran -program demo_savetxt - use stdlib_io, only: savetxt - implicit none - real :: x(3,2) = 1 - call savetxt('example.dat', x) -end program demo_savetxt +{!test/examples/io/demo_savetxt.f90!} ``` @@ -174,12 +157,7 @@ Returns an allocated `array` with the content of `filename` in case of success. ### Example ```fortran -program demo_loadnpy - use stdlib_io_npy, only: load_npy - implicit none - real, allocatable :: x(:,:) - call loadtxt('example.npy', x) -end program demo_loadnpy +{!test/examples/io/demo_loadnpy.f90!} ``` @@ -220,12 +198,7 @@ Provides a npy file called `filename` that contains the rank-2 `array`. ### Example ```fortran -program demo_savenpy - use stdlib_io_npy, only: save_npy - implicit none - real :: x(3,2) = 1 - call save_npy('example.npy', x) -end program demo_savenpy +{!test/examples/io/demo_savenpy.f90!} ``` ## `getline` @@ -263,19 +236,7 @@ Read a whole line from a formatted unit into a string variable ### Example ```fortran -program demo_getline - use, intrinsic :: iso_fortran_env, only : input_unit, output_unit - use stdlib_io, only: getline - implicit none - character(len=:), allocatable :: line - integer :: stat - - call getline(input_unit, line, stat) - do while(stat == 0) - write(output_unit, '(a)') line - call getline(input_unit, line, stat) - end do -end program demo_getline +{!test/examples/io/demo_getline.f90!} ``` ## Formatting constants @@ -292,30 +253,5 @@ Provides formats for all kinds as defined in the `stdlib_kinds` module. ### Example ```fortran -program demo_fmt_constants - use, stdlib_kinds, only : int32, int64, sp, dp - use stdlib_io, only : FMT_INT, FMT_REAL_SP, FMT_REAL_DP, FMT_COMPLEX_SP, FMT_COMPLEX_DP - implicit none - - integer(kind=int32) :: i32 - integer(kind=int64) :: i64 - real(kind=sp) :: r32 - real(kind=dp) :: r64 - complex(kind=sp) :: c32 - complex(kind=dp) :: c64 - - i32 = 100_int32 - i64 = 100_int64 - r32 = 100.0_sp - r64 = 100.0_dp - c32 = cmplx(100.0_sp, kind=sp) - c64 = cmplx(100.0_dp, kind=dp) - - print "(2("//FMT_INT//",1x))", i32, i64 ! outputs: 100 100 - print FMT_REAL_SP, r32 ! outputs: 1.00000000E+02 - print FMT_REAL_DP, r64 ! outputs: 1.0000000000000000E+002 - print FMT_COMPLEX_SP, c32 ! outputs: 1.00000000E+02 0.00000000E+00 - print FMT_COMPLEX_DP, c64 ! outputs: 1.0000000000000000E+002 0.0000000000000000E+000 - -end program demo_fmt_constants +{!test/examples/io/demo_fmt_constants.f90!} ``` diff --git a/doc/specs/stdlib_linalg.md b/doc/specs/stdlib_linalg.md index 749aeed10..1db29b651 100644 --- a/doc/specs/stdlib_linalg.md +++ b/doc/specs/stdlib_linalg.md @@ -33,66 +33,23 @@ Returns a diagonal array or a vector with the extracted diagonal elements. ### Example ```fortran -program demo_diag1 - use stdlib_linalg, only: diag - implicit none - real, allocatable :: A(:,:) - integer :: i - A = diag([(1,i=1,10)]) ! creates a 10 by 10 identity matrix -end program demo_diag1 +{!test/examples/linalg/demo_diag1.f90!} ``` ```fortran -program demo_diag2 - use stdlib_linalg, only: diag - implicit none - real :: v(:) - real, allocatable :: A(:,:) - integer :: i - v = [1,2,3,4,5] - A = diag(v) ! creates a 5 by 5 matrix with elements of v on the diagonal -end program demo_diag2 +{!test/examples/linalg/demo_diag2.f90!} ``` ```fortran -program demo_diag3 - use stdlib_linalg, only: diag - implicit none - integer, parameter :: n = 10 - real :: c(n), ul(n-1) - real :: A(n,n) - integer :: i - c = 2 - ul = -1 - A = diag(ul,-1) + diag(c) + diag(ul,1) ! Gil Strang's favorite matrix -end program demo_diag3 +{!test/examples/linalg/demo_diag3.f90!} ``` ```fortran -program demo_diag4 - use stdlib_linalg, only: diag - implicit none - integer, parameter :: n = 12 - real :: A(n,n) - real :: v(n) - integer :: i - call random_number(A) - v = diag(A) ! v contains diagonal elements of A -end program demo_diag4 +{!test/examples/linalg/demo_diag4.f90!} ``` ```fortran -program demo_diag5 - use stdlib_linalg, only: diag - implicit none - integer, parameter :: n = 3 - real :: A(n,n) - real, allocatable :: v(:) - integer :: i - A = reshape([1,2,3,4,5,6,7,8,9],[n,n]) - v = diag(A,-1) ! v is [2,6] - v = diag(A,1) ! v is [4,8] -end program demo_diag5 +{!test/examples/linalg/demo_diag5.f90!} ``` ## `eye` - Construct the identity matrix @@ -130,7 +87,6 @@ The use of `int8` was suggested to save storage. Since the result of `eye` is of `integer(int8)` type, one should be careful about using it in arithmetic expressions. For example: ```fortran -real :: A(:,:) !> Be careful A = eye(2,2)/2 !! A == 0.0 !> Recommend @@ -140,28 +96,11 @@ A = eye(2,2)/2.0 !! A == diag([0.5, 0.5]) ### Example ```fortran -program demo_eye1 - use stdlib_linalg, only: eye - implicit none - integer :: i(2,2) - real :: a(3,3) - real :: b(2,3) !! Matrix is non-square. - complex :: c(2,2) - I = eye(2) !! [1,0; 0,1] - A = eye(3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] - A = eye(3,3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] - B = eye(2,3) !! [1.0,0.0,0.0; 0.0,1.0,0.0] - C = eye(2,2) !! [(1.0,0.0),(0.0,0.0); (0.0,0.0),(1.0,0.0)] - C = (1.0,1.0)*eye(2,2) !! [(1.0,1.0),(0.0,0.0); (0.0,0.0),(1.0,1.0)] -end program demo_eye1 +{!test/examples/linalg/demo_eye1.f90!} ``` ```fortran -program demo_eye2 - use stdlib_linalg, only: eye, diag - implicit none - print *, all(eye(4) == diag([1,1,1,1])) ! prints .true. -end program demo_eye2 +{!test/examples/linalg/demo_eye2.f90!} ``` ## `trace` - Trace of a matrix @@ -188,13 +127,7 @@ Returns the trace of the matrix, i.e. the sum of diagonal elements. ### Example ```fortran -program demo_trace - use stdlib_linalg, only: trace - implicit none - real :: A(3,3) - A = reshape([1,2,3,4,5,6,7,8,9],[3,3]) - print *, trace(A) ! 1 + 5 + 9 -end program demo_trace +{!test/examples/linalg/demo_trace.f90!} ``` ## `outer_product` - Computes the outer product of two vectors @@ -224,15 +157,7 @@ Returns a rank-2 array equal to `u v^T` (where `u, v` are considered column vect ### Example ```fortran -program demo_outer_product - use stdlib_linalg, only: outer_product - implicit none - real, allocatable :: A(:,:), u(:), v(:) - u = [1., 2., 3. ] - v = [3., 4.] - A = outer_product(u,v) - !A = reshape([3., 6., 9., 4., 8., 12.], [3,2]) -end program demo_outer_product +{!test/examples/linalg/demo_outer_product.f90!} ``` ## `is_square` - Checks if a matrix is square @@ -260,16 +185,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is square, and ` ### Example ```fortran -program demo_is_square - use stdlib_linalg, only: is_square - implicit none - real :: A(2,2), B(3,2) - logical :: res - A = reshape([1., 2., 3., 4.], shape(A)) - B = reshape([1., 2., 3., 4., 5., 6.], shape(B)) - res = is_square(A) ! returns .true. - res = is_square(B) ! returns .false. -end program demo_is_square +{!test/examples/linalg/demo_is_square.f90!} ``` ## `is_diagonal` - Checks if a matrix is diagonal @@ -298,16 +214,7 @@ Note that nonsquare matrices may be diagonal, so long as `a_ij = 0` when `i /= j ### Example ```fortran -program demo_is_diagonal - use stdlib_linalg, only: is_diagonal - implicit none - real :: A(2,2), B(2,2) - logical :: res - A = reshape([1., 0., 0., 4.], shape(A)) - B = reshape([1., 0., 3., 4.], shape(B)) - res = is_diagonal(A) ! returns .true. - res = is_diagonal(B) ! returns .false. -end program demo_is_diagonal +{!test/examples/linalg/demo_is_diagonal.f90!} ``` ## `is_symmetric` - Checks if a matrix is symmetric @@ -335,16 +242,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is symmetric, an ### Example ```fortran -program demo_is_symmetric - use stdlib_linalg, only: is_symmetric - implicit none - real :: A(2,2), B(2,2) - logical :: res - A = reshape([1., 3., 3., 4.], shape(A)) - B = reshape([1., 0., 3., 4.], shape(B)) - res = is_symmetric(A) ! returns .true. - res = is_symmetric(B) ! returns .false. -end program demo_is_symmetric +{!test/examples/linalg/demo_is_symmetric.f90!} ``` ## `is_skew_symmetric` - Checks if a matrix is skew-symmetric @@ -372,16 +270,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is skew-symmetri ### Example ```fortran -program demo_is_skew_symmetric - use stdlib_linalg, only: is_skew_symmetric - implicit none - real :: A(2,2), B(2,2) - logical :: res - A = reshape([0., -3., 3., 0.], shape(A)) - B = reshape([0., 3., 3., 0.], shape(B)) - res = is_skew_symmetric(A) ! returns .true. - res = is_skew_symmetric(B) ! returns .false. -end program demo_is_skew_symmetric +{!test/examples/linalg/demo_is_skew_symmetric.f90!} ``` ## `is_hermitian` - Checks if a matrix is Hermitian @@ -409,16 +298,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is Hermitian, an ### Example ```fortran -program demo_is_hermitian - use stdlib_linalg, only: is_hermitian - implicit none - complex :: A(2,2), B(2,2) - logical :: res - A = reshape([cmplx(1.,0.), cmplx(3.,-1.), cmplx(3.,1.), cmplx(4.,0.)], shape(A)) - B = reshape([cmplx(1.,0.), cmplx(3.,1.), cmplx(3.,1.), cmplx(4.,0.)], shape(B)) - res = is_hermitian(A) ! returns .true. - res = is_hermitian(B) ! returns .false. -end program demo_is_hermitian +{!test/examples/linalg/demo_is_hermitian.f90!} ``` ## `is_triangular` - Checks if a matrix is triangular @@ -450,16 +330,7 @@ Specifically, upper triangular matrices satisfy `a_ij = 0` when `j < i`, and low ### Example ```fortran -program demo_is_triangular - use stdlib_linalg, only: is_triangular - implicit none - real :: A(3,3), B(3,3) - logical :: res - A = reshape([1., 0., 0., 4., 5., 0., 7., 8., 9.], shape(A)) - B = reshape([1., 0., 3., 4., 5., 0., 7., 8., 9.], shape(B)) - res = is_triangular(A,'u') ! returns .true. - res = is_triangular(B,'u') ! returns .false. -end program demo_is_triangular +{!test/examples/linalg/demo_is_triangular.f90!} ``` ## `is_hessenberg` - Checks if a matrix is hessenberg @@ -491,14 +362,5 @@ Specifically, upper Hessenberg matrices satisfy `a_ij = 0` when `j < i-1`, and l ### Example ```fortran -program demo_is_hessenberg - use stdlib_linalg, only: is_hessenberg - implicit none - real :: A(3,3), B(3,3) - logical :: res - A = reshape([1., 2., 0., 4., 5., 6., 7., 8., 9.], shape(A)) - B = reshape([1., 2., 3., 4., 5., 6., 7., 8., 9.], shape(B)) - res = is_hessenberg(A,'u') ! returns .true. - res = is_hessenberg(B,'u') ! returns .false. -end program demo_is_hessenberg +{!test/examples/linalg/demo_is_hessenberg.f90!} ``` diff --git a/doc/specs/stdlib_logger.md b/doc/specs/stdlib_logger.md index 60a823406..695fc98ed 100644 --- a/doc/specs/stdlib_logger.md +++ b/doc/specs/stdlib_logger.md @@ -195,18 +195,7 @@ an `intent(in)` argument. It shall be the name of the file to be opened. #### Example ```fortran -program demo_global_logger - use stdlib_logger, global => global_logger - - integer :: unit, stat - - call global % add_log_file( 'error_log.txt', unit, & - position='asis', stat=stat ) - if ( stat /= success ) then - error stop 'Unable to open "error_log.txt".' - end if - -end program demo_global_logger +{!test/examples/logger/demo_global_logger.f90!} ``` ### `add_log_unit` - add a unit to the array `self % log_units` @@ -262,28 +251,7 @@ to `unit`. #### Example ```fortran -program demo_add_log_unit - use stdlib_logger, only: global_logger, read_only_error - - character(256) :: iomsg - integer :: iostat, unit, stat - - open( newunit=unit, 'error_log.txt', & - form='formatted', status='replace', & - position='rewind', err=999, & - action='read', iostat=iostat, iomsg=iomsg ) - - call global_logger % add_log_unit( unit, stat ) - select case ( stat ) - - case ( read_only_error ) - error stop 'Unable to write to "error_log.txt".' - - end select - - 999 error stop 'Unable to open "error_log.txt". - -end program demo_add_log_unit +{!test/examples/logger/demo_add_log_unit.f90!} ``` ### `configuration` - report a logger's configuration @@ -410,12 +378,7 @@ Pure subroutine #### Example ```fortran -program demo_configure - use stdlib_logger, only: global => global_logger - - call global % configure( indent=.false., max_width=72 ) - -end program demo_configure +{!test/examples/logger/demo_configure.f90!} ``` ### `log_debug` - Writes the string `message` to `self % log_units` @@ -705,26 +668,7 @@ Subroutine #### Example ```fortran -program demo_log_io_error - use stdlib_logger, global=>global_logger - - character(*), parameter :: filename = 'dummy.txt' - integer :: iostat, lun - character(128) :: iomsg - character(*), parameter :: message = & - 'Failure in opening "dummy.txt".' - - open( newunit=lun, file = filename, form='formatted', & - status='old', iostat=iostat, iomsg=iomsg ) - if ( iostat /= 0 ) then - call global % log_io_error( message, & - procedure = 'EXAMPLE', & - iostat=iostat, & - iomsg = iomsg ) - error stop 'Error on opening a file' - end if - -end program demo_log_io_error +{!test/examples/logger/demo_log_io_error.f90!} ``` ### `log_message` - write the string `message` to `self % log_units` @@ -873,30 +817,7 @@ Subroutine #### Example ```fortran -program demo_log_text_error - use stdlib_logger - - character(*), parameter :: filename = 'dummy.txt' - integer :: col_no, line_no, lun - character(128) :: line - character(*), parameter :: message = 'Bad text found.' - - open( newunit=lun, file = filename, statu='old', & - form='formatted' ) - line_no = 0 - do - read( lun, fmt='(a)', end=900 ) line - line_no = line_no + 1 - call check_line( line, status, col_no ) - if ( status /= 0 ) - call global_logger % log_text_error( line, & - col_no, message, filename, line_no ) - error stop 'Error in reading ' // filename - end if - end do - 900 continue - -end program demo_log_text_error +{!test/examples/logger/demo_log_text_error.f90!} ``` ### `log_units_assigned` - returns the number of active I/O units diff --git a/doc/specs/stdlib_math.md b/doc/specs/stdlib_math.md index 9091b836d..8429d7d45 100644 --- a/doc/specs/stdlib_math.md +++ b/doc/specs/stdlib_math.md @@ -51,44 +51,14 @@ The output is a scalar of `type` and `kind` same as to that of the arguments. Here inputs are of type `integer` and kind `int32` ```fortran -program demo_clip_integer - use stdlib_math, only: clip - use stdlib_kinds, only: int32 - implicit none - integer(int32) :: x - integer(int32) :: xmin - integer(int32) :: xmax - integer(int32) :: clipped_value - - xmin = -5_int32 - xmax = 5_int32 - x = 12_int32 - - clipped_value = clip(x, xmin, xmax) - ! clipped_value <- 5 -end program demo_clip_integer +{!test/examples/math/demo_clip_integer.f90!} ``` ##### Example 2: Here inputs are of type `real` and kind `sp` ```fortran -program demo_clip_real - use stdlib_math, only: clip - use stdlib_kinds, only: sp - implicit none - real(sp) :: x - real(sp) :: xmin - real(sp) :: xmax - real(sp) :: clipped_value - - xmin = -5.769_sp - xmax = 3.025_sp - x = 3.025_sp - - clipped_value = clip(x, xmin, xmax) - ! clipped_value <- 3.02500010 -end program demo_clip_real +{!test/examples/math/demo_clip_real.f90!} ``` ### `gcd` function @@ -125,15 +95,7 @@ Returns an integer of the same `kind` as that of the arguments. ##### Example 1: ```fortran -program demo_gcd - use stdlib_math, only: gcd - implicit none - integer :: a, b, c - - a = 48 - b = 18 - c = gcd(a, b) ! returns 6 -end program demo_gcd +{!test/examples/math/demo_gcd.f90!} ``` ### `linspace` - Create a linearly spaced rank one array @@ -176,36 +138,14 @@ If `start`/`end` are `integer` types, the `result` will default to a `real(dp)` Here inputs are of type `complex` and kind `dp` ```fortran -program demo_linspace_complex - use stdlib_math, only: linspace - use stdlib_kinds, only: dp - implicit none - - complex(dp) :: start = complex(10.0_dp, 5.0_dp) - complex(dp) :: end = complex(-10.0_dp, 15.0_dp) - - complex(dp) :: z(11) - - z = linspace(start, end, 11) -end program demo_linspace_complex +{!test/examples/math/demo_linspace_complex.f90!} ``` ##### Example 2: Here inputs are of type `integer` and kind `int16`, with the result defaulting to `real(dp)`. ```fortran -program demo_linspace_int16 - use stdlib_math, only: linspace - use stdlib_kinds, only: int16, dp - implicit none - - integer(int16) :: start = 10_int16 - integer(int16) :: end = 23_int16 - - real(dp) :: r(15) - - r = linspace(start, end, 15) -end program demo_linspace_int16 +{!test/examples/math/demo_linspace_int16.f90!} ``` ### `logspace` - Create a logarithmically spaced rank one array @@ -267,58 +207,21 @@ For function calls where the `base` is specified, the `type` and `kind` of the r Here inputs are of type `complex` and kind `dp`. `n` and `base` is not specified and thus default to 50 and 10, respectively. ```fortran -program demo_logspace_complex - use stdlib_math, only: logspace - use stdlib_kinds, only: dp - implicit none - - complex(dp) :: start = (10.0_dp, 5.0_dp) - complex(dp) :: end = (-10.0_dp, 15.0_dp) - - complex(dp) :: z(11) ! Complex values raised to complex powers results in complex values - - z = logspace(start, end, 11) -end program demo_logspace_complex +{!test/examples/math/demo_logspace_complex.f90!} ``` ##### Example 2: Here inputs are of type `integer` and default kind. `base` is not specified and thus defaults to 10. ```fortran -program demo_logspace_int - use stdlib_math, only: logspace - use stdlib_kinds, only: dp - implicit none - - integer :: start = 10 - integer :: end = 23 - integer :: n = 15 - - real(dp) :: r(n) ! Integer values raised to real powers results in real values - - r = logspace(start, end, n) -end program demo_logspace_int +{!test/examples/math/demo_logspace_int.f90!} ``` ##### Example 3: Here `start`/`end` are of type `real` and double precision. `base` is type `complex` and also double precision. ```fortran -program demo_logspace_rstart_cbase - use stdlib_math, only: logspace - use stdlib_kinds, only: dp - implicit none - - real(dp) :: start = 0.0_dp - real(dp) :: end = 3.0_dp - integer :: n = 4 - complex(dp) :: base = (0.0_dp, 1.0_dp) - - complex(dp) :: z(n) ! complex values raised to real powers result in complex values - - z = logspace(start, end, n, base) - -end program demo_logspace_rstart_cbase +{!test/examples/math/demo_logspace_rstart_cbase.f90!} ``` ### `arange` function @@ -368,25 +271,7 @@ For `real` type arguments, the length of the result vector is `floor((end - star #### Example ```fortran -program demo_math_arange - use stdlib_math, only: arange - - print *, arange(3) ! [1,2,3] - print *, arange(-1) ! [1,0,-1] - print *, arange(0,2) ! [0,1,2] - print *, arange(1,-1) ! [1,0,-1] - print *, arange(0, 2, 2) ! [0,2] - - print *, arange(3.0) ! [1.0,2.0,3.0] - print *, arange(0.0,5.0) ! [0.0,1.0,2.0,3.0,4.0,5.0] - print *, arange(0.0,6.0,2.5) ! [0.0,2.5,5.0] - - print *, (1.0,1.0)*arange(3) ! [(1.0,1.0),(2.0,2.0),[3.0,3.0]] - - print *, arange(0.0,2.0,-2.0) ! [0.0,2.0]. Not recommended: `step` argument is negative! - print *, arange(0.0,2.0,0.0) ! [0.0,1.0,2.0]. Not recommended: `step` argument is zero! - -end program demo_math_arange +{!test/examples/math/demo_math_arange.f90!} ``` ### `arg` function @@ -422,13 +307,7 @@ Notes: Although the angle of the complex number `0` is undefined, `arg((0,0))` r #### Example ```fortran -program demo_math_arg - use stdlib_math, only: arg - print *, arg((0.0, 0.0)) ! 0.0 - print *, arg((3.0, 4.0)) ! 0.927 - print *, arg(2.0*exp((0.0, 0.5))) ! 0.5 - print *, arg([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [π/2, 0.0, -π/2, π] -end program demo_math_arg +{!test/examples/math/demo_math_arg.f90!} ``` ### `argd` function @@ -464,13 +343,7 @@ Notes: Although the angle of the complex number `0` is undefined, `argd((0,0))` #### Example ```fortran -program demo_math_argd - use stdlib_math, only: argd - print *, argd((0.0, 0.0)) ! 0.0° - print *, argd((3.0, 4.0)) ! 53.1° - print *, argd(2.0*exp((0.0, 0.5))) ! 28.64° - print *, argd([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [90°, 0°, -90°, 180°] -end program demo_math_argd +{!test/examples/math/demo_math_argd.f90!} ``` ### `argpi` function @@ -506,13 +379,7 @@ Notes: Although the angle of the complex number `0` is undefined, `argpi((0,0))` #### Example ```fortran -program demo_math_argpi - use stdlib_math, only: argpi - print *, argpi((0.0, 0.0)) ! 0.0 - print *, argpi((3.0, 4.0)) ! 0.295 - print *, argpi(2.0*exp((0.0, 0.5))) ! 0.159 - print *, argpi([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [0.5, 0.0, -0.5, 1.0] -end program demo_math_argpi +{!test/examples/math/demo_math_argpi.f90!} ``` ### `is_close` function @@ -572,20 +439,7 @@ Returns a `logical` scalar/array. #### Example ```fortran -program demo_math_is_close - - use stdlib_math, only: is_close - real :: x(2) = [1, 2], y, NAN - - y = -3 - NAN = sqrt(y) - - print *, is_close(x,[real :: 1, 2.1]) ! [T, F] - print *, is_close(2.0, 2.1, abs_tol=0.1) ! T - print *, NAN, is_close(2.0, NAN), is_close(2.0, NAN, equal_nan=.true.) ! NAN, F, F - print *, is_close(NAN, NAN), is_close(NAN, NAN, equal_nan=.true.) ! F, T - -end program demo_math_is_close +{!test/examples/math/demo_math_is_close.f90!} ``` ### `all_close` function @@ -636,21 +490,7 @@ Returns a `logical` scalar. #### Example ```fortran -program demo_math_all_close - - use stdlib_math, only: all_close - real :: x(2) = [1, 2], y, NAN - complex :: z(4, 4) - - y = -3 - NAN = sqrt(y) - z = (1.0, 1.0) - - print *, all_close(z+cmplx(1.0e-11, 1.0e-11), z) ! T - print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.) - ! NAN, F, T - -end program demo_math_all_close +{!test/examples/math/demo_math_all_close.f90!} ``` ### `diff` function @@ -712,26 +552,5 @@ When both `prepend` and `append` are not present, the result `y` has one fewer e #### Example ```fortran -program demo_diff - - use stdlib_math, only: diff - implicit none - - integer :: i(7) = [1, 1, 2, 3, 5, 8, 13] - real :: x(6) = [0, 5, 15, 30, 50, 75] - integer :: A(3, 3) = reshape([1, 7, 17, 3, 11, 19, 5, 13, 23], [3, 3]) - integer :: Y(3, 2) - - print *, diff(i) ! [0, 1, 1, 2, 3, 5] - print *, diff(x, 2) ! [5.0, 5.0, 5.0, 5.0] - - Y = diff(A, n=1, dim=2) - print *, Y(1, :) ! [2, 2] - print *, Y(2, :) ! [4, 2] - print *, Y(3, :) ! [2, 4] - - print *, diff(i, prepend=[0]) ! [1, 0, 1, 1, 2, 3, 5] - print *, diff(i, append=[21]) ! [0, 1, 1, 2, 3, 5, 8] - -end program demo_diff -``` \ No newline at end of file +{!test/examples/math/demo_diff.f90!} +``` diff --git a/doc/specs/stdlib_optval.md b/doc/specs/stdlib_optval.md index 25a54b3e5..627f285c7 100644 --- a/doc/specs/stdlib_optval.md +++ b/doc/specs/stdlib_optval.md @@ -35,18 +35,5 @@ If `x` is present, the result is `x`, otherwise the result is `default`. ### Example ```fortran -program demo_optval - use stdlib_optval, only: optval - implicit none - print *, root(64.0) -! 8.0 - print *, root(64.0, 3) -! 4.0 -contains - real function root(x, n) - real, intent(in) :: x - integer, intent(in), optional :: n - root = x**(1.0/optval(n, 2)) - end function root -end program demo_optval +{!test/examples/optval/demo_optval.f90!} ``` diff --git a/doc/specs/stdlib_quadrature.md b/doc/specs/stdlib_quadrature.md index 363cff8f2..fa4247bdb 100644 --- a/doc/specs/stdlib_quadrature.md +++ b/doc/specs/stdlib_quadrature.md @@ -39,16 +39,7 @@ If the size of `y` is zero or one, the result is zero. ### Example ```fortran -program demo_trapz - use stdlib_quadrature, only: trapz - implicit none - real :: x(5) = [0., 1., 2., 3., 4.] - real :: y(5) = x**2 - print *, trapz(y, x) -! 22.0 - print *, trapz(y, 0.5) -! 11.0 -end program demo_trapz +{!test/examples/quadrature/demo_trapz.f90!} ``` ## `trapz_weights` - trapezoidal rule weights for given abscissas @@ -78,17 +69,7 @@ If the size of `x` is one, then the sole element of the result is zero. ### Example ```fortran -program demo_trapz_weights - use stdlib_quadrature, only: trapz_weights - implicit none - real :: x(5) = [0., 1., 2., 3., 4.] - real :: y(5) = x**2 - real :: w(5) - w = trapz_weights(x) - print *, sum(w*y) -! 22.0 -end program demo_trapz_weights - +{!test/examples/quadrature/demo_trapz_weights.f90!} ``` ## `simps` - integrate sampled values using Simpson's rule @@ -130,16 +111,7 @@ If the size of `y` is two, the result is the same as if `trapz` had been called ### Example ```fortran -program demo_simps - use stdlib_quadrature, only: simps - implicit none - real :: x(5) = [0., 1., 2., 3., 4.] - real :: y(5) = 3.*x**2 - print *, simps(y, x) -! 64.0 - print *, simps(y, 0.5) -! 32.0 -end program demo_simps +{!test/examples/quadrature/demo_simps.f90!} ``` ## `simps_weights` - Simpson's rule weights for given abscissas @@ -175,16 +147,7 @@ If the size of `x` is two, then the result is the same as if `trapz_weights` had ### Example ```fortran -program demo_simps_weights - use stdlib_quadrature, only: simps_weights - implicit none - real :: x(5) = [0., 1., 2., 3., 4.] - real :: y(5) = 3.*x**2 - real :: w(5) - w = simps_weights(x) - print *, sum(w*y) -! 64.0 -end program demo_simps_weights +{!test/examples/quadrature/demo_simps_weights.f90!} ``` ## `gauss_legendre` - Gauss-Legendre quadrature (a.k.a. Gaussian quadrature) nodes and weights @@ -222,15 +185,7 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -program demo_gauss_legendre - use iso_fortran_env, dp => real64 - implicit none - - integer, parameter :: N = 6 - real(dp), dimension(N) :: x,w - call gauss_legendre(x,w) - print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) -end program demo_gauss_legendre +{!test/examples/quadrature/demo_gauss_legendre.f90!} ``` ## `gauss_legendre_lobatto` - Gauss-Legendre-Lobatto quadrature nodes and weights @@ -268,13 +223,5 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -program demo_gauss_legendre_lobatto - use iso_fortran_env, dp => real64 - implicit none - - integer, parameter :: N = 6 - real(dp), dimension(N) :: x,w - call gauss_legendre_lobatto(x,w) - print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) -end program demo_gauss_legendre_lobatto +{!test/examples/quadrature/demo_gauss_legendre_lobatto.f90!} ``` diff --git a/doc/specs/stdlib_random.md b/doc/specs/stdlib_random.md index f4586a4ae..3fd70cbf4 100644 --- a/doc/specs/stdlib_random.md +++ b/doc/specs/stdlib_random.md @@ -33,14 +33,7 @@ Return a scalar of type `integer`. ### Example ```fortran -program demo_random_seed - use stdlib_random, only : random_seed - implicit none - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) ! set and get current value of seed -end program demo_random_seed +{!test/examples/random/demo_random_seed.f90!} ``` ## `dist_rand` - Get a random integer with specified kind @@ -68,20 +61,5 @@ Return a scalar of type `integer`. ### Example ```fortran -program demo_dist_rand - use stdlib_random, only : dist_rand, random_seed - implicit none - integer :: put, get - - put = 135792468 - call random_seed(put, get) ! set and get current value of seed - print *, dist_rand(1_int8) ! random integer in [-2^7, 2^7 - 1] -! -90 - print *, dist_rand(1_int16) ! random integer in [-2^15, 2^15 - 1] -! -32725 - print *, dist_rand(1_int32) ! random integer in [-2^31, 2^31 - 1] -! -1601563881 - print *, dist_rand(1_int64) ! random integer in [-2^63, 2^63 - 1] -! 180977695517992208 -end program demo_dist_rand +{!test/examples/random/demo_dist_rand.f90!} ``` diff --git a/doc/specs/stdlib_selection.md b/doc/specs/stdlib_selection.md index d2d90a8f6..64a7dcfd4 100644 --- a/doc/specs/stdlib_selection.md +++ b/doc/specs/stdlib_selection.md @@ -107,33 +107,7 @@ code here to be released under stdlib's MIT license. ### Example ```fortran -program demo_select - use stdlib_selection, only: select - implicit none - - real, allocatable :: array(:) - real :: kth_smallest - integer :: k, left, right - - array = [3., 2., 7., 4., 5., 1., 4., -1.] - - k = 2 - call select(array, k, kth_smallest) - print*, kth_smallest ! print 1.0 - - k = 7 - ! Due to the previous call to select, we know for sure this is in an - ! index >= 2 - call select(array, k, kth_smallest, left=2) - print*, kth_smallest ! print 5.0 - - k = 6 - ! Due to the previous two calls to select, we know for sure this is in - ! an index >= 2 and <= 7 - call select(array, k, kth_smallest, left=2, right=7) - print*, kth_smallest ! print 4.0 - -end program demo_select +{!test/examples/selection/demo_select.f90!} ``` ## `arg_select` - find the index of the k-th smallest value in an input array @@ -216,35 +190,7 @@ code here to be released under stdlib's MIT license. ```fortran -program demo_arg_select - use stdlib_selection, only: arg_select - implicit none - - real, allocatable :: array(:) - integer, allocatable :: indx(:) - integer :: kth_smallest - integer :: k, left, right - - array = [3., 2., 7., 4., 5., 1., 4., -1.] - indx = [( k, k = 1, size(array) )] - - k = 2 - call arg_select(array, indx, k, kth_smallest) - print*, array(kth_smallest) ! print 1.0 - - k = 7 - ! Due to the previous call to arg_select, we know for sure this is in an - ! index >= 2 - call arg_select(array, indx, k, kth_smallest, left=2) - print*, array(kth_smallest) ! print 5.0 - - k = 6 - ! Due to the previous two calls to arg_select, we know for sure this is in - ! an index >= 2 and <= 7 - call arg_select(array, indx, k, kth_smallest, left=2, right=7) - print*, array(kth_smallest) ! print 4.0 - -end program demo_arg_select +{!test/examples/selection/demo_arg_select.f90!} ``` ## Comparison with using `sort` @@ -255,83 +201,7 @@ should see a speed improvement with the selection routines which grows like LOG(size(`array`)). ```fortran -program selection_vs_sort - use stdlib_kinds, only: dp, sp, int64 - use stdlib_selection, only: select, arg_select - use stdlib_sorting, only: sort - implicit none - - call compare_select_sort_for_median(1) - call compare_select_sort_for_median(11) - call compare_select_sort_for_median(101) - call compare_select_sort_for_median(1001) - call compare_select_sort_for_median(10001) - call compare_select_sort_for_median(100001) - - contains - subroutine compare_select_sort_for_median(N) - integer, intent(in) :: N - - integer :: i, k, result_arg_select, indx(N), indx_local(N) - real :: random_vals(N), local_random_vals(N) - integer, parameter :: test_reps = 100 - integer(int64) :: t0, t1 - real :: result_sort, result_select - integer(int64) :: time_sort, time_select, time_arg_select - logical :: select_test_passed, arg_select_test_passed - - ! Ensure N is odd - if(mod(N, 2) /= 1) stop - - time_sort = 0 - time_select = 0 - time_arg_select = 0 - - select_test_passed = .true. - arg_select_test_passed = .true. - - indx = (/( i, i = 1, N) /) - - k = (N+1)/2 ! Deliberate integer division - - do i = 1, test_reps - call random_number(random_vals) - - ! Compute the median with sorting - local_random_vals = random_vals - call system_clock(t0) - call sort(local_random_vals) - result_sort = local_random_vals(k) - call system_clock(t1) - time_sort = time_sort + (t1 - t0) - - ! Compute the median with selection, assuming N is odd - local_random_vals = random_vals - call system_clock(t0) - call select(local_random_vals, k, result_select) - call system_clock(t1) - time_select = time_select + (t1 - t0) - - ! Compute the median with arg_select, assuming N is odd - local_random_vals = random_vals - indx_local = indx - call system_clock(t0) - call arg_select(local_random_vals, indx_local, k, result_arg_select) - call system_clock(t1) - time_arg_select = time_arg_select + (t1 - t0) - - if(result_select /= result_sort) select_test_passed = .FALSE. - if(local_random_vals(result_arg_select) /= result_sort) arg_select_test_passed = .FALSE. - end do - - print*, "select ; N=", N, '; ', merge('PASS', 'FAIL', select_test_passed), & - '; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_select) - print*, "arg_select; N=", N, '; ', merge('PASS', 'FAIL', arg_select_test_passed), & - '; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_arg_select) - - end subroutine - -end program +{!test/examples/selection/selection_vs_sort.f90!} ``` The results seem consistent with expectations when the `array` is large; the program prints: diff --git a/doc/specs/stdlib_sorting.md b/doc/specs/stdlib_sorting.md index 7368c691e..b0b5b13e0 100644 --- a/doc/specs/stdlib_sorting.md +++ b/doc/specs/stdlib_sorting.md @@ -261,16 +261,7 @@ function `LGT`. ##### Example ```fortran - program demo_ord_sort - use stdlib_sorting, only: ord_sort - implicit none - integer, allocatable :: array1(:), work(:) - - array1 = [ 5, 4, 3, 1, 10, 4, 9] - allocate(work, mold = array1) - call ord_sort(array1, work) - print*, array1 !print [1, 3, 4, 4, 5, 9, 10] - end program demo_ord_sort +{!test/examples/sorting/demo_ord_sort.f90!} ``` #### `sort` - sorts an input array @@ -324,15 +315,7 @@ element of `array` is a `NaN`. Sorting of `CHARACTER(*)` and ```fortran - program demo_sort - use stdlib_sorting, only: sort - implicit none - integer, allocatable :: array(:) - - array = [ 5, 4, 3, 1, 10, 4, 9] - call sort(array) - print*, array !print [1, 3, 4, 4, 5, 9, 10] - end program demo_sort +{!test/examples/sorting/demo_sort.f90!} ``` #### `sort_index` - creates an array of sorting indices for an input array, while also sorting the array. @@ -453,21 +436,21 @@ Sorting a rank 2 array based on the data in a column Sorting an array of a derived type based on the data in one component ```fortran - subroutine sort_a_data( a_data, a, work, index, iwork ) - ! Sort `a_data` in terms or its component `a` - type(a_type), intent(inout) :: a_data(:) - integer(int32), intent(inout) :: a(:) - integer(int32), intent(out) :: work(:) - integer(int_size), intent(out) :: index(:) - integer(int_size), intent(out) :: iwork(:) - ! Extract a component of `a_data` - a(1:size(a_data)) = a_data(:) % a - ! Find the indices to sort the component - call sort_index(a(1:size(a_data)), index(1:size(a_data)),& - work(1:size(a_data)/2), iwork(1:size(a_data)/2)) - ! Sort a_data based on the sorting of that component - a_data(:) = a_data( index(1:size(a_data)) ) - end subroutine sort_a_data + subroutine sort_a_data( a_data, a, work, index, iwork ) + ! Sort `a_data` in terms or its component `a` + type(a_type), intent(inout) :: a_data(:) + integer(int32), intent(inout) :: a(:) + integer(int32), intent(out) :: work(:) + integer(int_size), intent(out) :: index(:) + integer(int_size), intent(out) :: iwork(:) + ! Extract a component of `a_data` + a(1:size(a_data)) = a_data(:) % a + ! Find the indices to sort the component + call sort_index(a(1:size(a_data)), index(1:size(a_data)),& + work(1:size(a_data)/2), iwork(1:size(a_data)/2)) + ! Sort a_data based on the sorting of that component + a_data(:) = a_data( index(1:size(a_data)) ) + end subroutine sort_a_data ``` diff --git a/doc/specs/stdlib_specialfunctions_gamma.md b/doc/specs/stdlib_specialfunctions_gamma.md index bd277d4d8..06b40f489 100644 --- a/doc/specs/stdlib_specialfunctions_gamma.md +++ b/doc/specs/stdlib_specialfunctions_gamma.md @@ -38,43 +38,7 @@ The function returns a value with the same type and kind as input argument. ### Example ```fortran -program demo_gamma - use stdlib_kinds, only : dp, int64 - use stdlib_specialfunctions_gamma, only : gamma - implicit none - - integer :: i - integer(int64) :: n - real :: x - real(dp) :: y - complex :: z - complex(dp) :: z1 - - i = 10 - n = 15_int64 - x = 2.5 - y = 4.3_dp - z = (2.3, 0.6) - z1 = (-4.2_dp, 3.1_dp) - - print *, gamma(i) !integer gives exact result -! 362880 - - print *, gamma(n) -! 87178291200 - - print *, gamma(x) ! intrinsic function call -! 1.32934034 - - print *, gamma(y) ! intrinsic function call -! 8.8553433604540341 - - print *, gamma(z) -! (0.988054395, 0.383354813) - - print *, gamma(z1) -! (-2.78916032990983999E-005, 9.83164600163221218E-006) -end program demo_gamma +{!test/examples/specialfunctions_gamma/demo_gamma.f90!} ``` ## `log_gamma` - Calculate the natural logarithm of the gamma function @@ -108,41 +72,7 @@ The function returns real single precision values for integer input arguments, w ### Example ```fortran -program demo_log_gamma - use stdlib_kinds, only : dp - use stdlib_specialfunctions_gamma, only : log_gamma - implicit none - - integer :: i - real :: x - real(dp) :: y - complex :: z - complex(dp) :: z1 - - i = 10 - x = 8.76 - y = x - z = (5.345, -3.467) - z1 = z - print *, log_gamma(i) !default single precision output -!12.8018274 - - print *, log_gamma(x) !intrinsic function call - -!10.0942659 - - print *, log_gamma(y) !intrinsic function call - -!10.094265528673880 - - print *, log_gamma(z) !same kind as input - -!(2.56165648, -5.73382425) - - print *, log_gamma(z1) - -!(2.5616575105114614, -5.7338247782852498) -end program demo_log_gamma +{!test/examples/specialfunctions_gamma/demo_log_gamma.f90!} ``` ## `log_factorial` - calculate the logarithm of a factorial @@ -173,21 +103,7 @@ The function returns real type values with single precision. ### Example ```fortran -program demo_log_factorial - use stdlib_kinds, only : int64 - use stdlib_specialfunctions_gamma, only : lf => log_factorial - implicit none - integer :: n - - n = 10 - print *, lf(n) - -! 15.1044130 - - print *, lf(35_int64) - -! 92.1361771 -end program demo_log_factorial +{!test/examples/specialfunctions_gamma/demo_log_factorial.f90!} ``` ## `lower_incomplete_gamma` - calculate lower incomplete gamma integral @@ -224,22 +140,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -program demo_ligamma - use stdlib_specialfunctions_gamma, only : lig => lower_incomplete_gamma - implicit none - integer :: p - real :: p1, x - - p = 3 - p1 = 2.3 - print *, lig(p, -5.0) - -! -2521.02417 - - print *, lig(p1, 5.0) - -! 1.09715652 -end demo_ligamma +{!test/examples/specialfunctions_gamma/demo_ligamma.f90!} ``` ## `upper_incomplete_gamma` - calculate the upper incomplete gamma integral @@ -276,18 +177,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -program demo_uigamma - use stdlib_specialfunctions_gamma, only : uig => upper_incomplete_gamma - implicit none - - print *, uig(3, -5.0) - -!2523.02295 - - print *, uig(2.3, 5.0) - -!6.95552528E-02 -end program demo_uigamma +{!test/examples/specialfunctions_gamma/demo_uigamma.f90!} ``` ## `log_lower_incomplete_gamma` - calculate the natural logarithm of the lower incomplete gamma integral @@ -382,14 +272,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -program demo_gamma_p - use stdlib_specialfunctions_gamma, only : rgp => regularized_gamma_p - implicit none - - print *, rgp(3.0, 5.0) - -! 0.875347972 -end program demo_gamma_p +{!test/examples/specialfunctions_gamma/demo_gamma_p.f90!} ``` ## `regularized_gamma_q` - calculate the gamma quotient Q @@ -426,12 +309,5 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -program demo_gamma_q - use stdlib_specialfunctions_gamma, only : rgq => regularized_gamma_q - implicit none - - print *, rgq(3.0, 5.0) - -! 0.124652028 -end program demo_gamma_q +{!test/examples/specialfunctions_gamma/demo_gamma_q.f90!} ``` diff --git a/doc/specs/stdlib_stats.md b/doc/specs/stdlib_stats.md index 0ce19b0eb..7b42f31fb 100644 --- a/doc/specs/stdlib_stats.md +++ b/doc/specs/stdlib_stats.md @@ -52,14 +52,7 @@ If `mask` is specified, the result is the Pearson correlation of all elements of ### Example ```fortran -program demo_corr - use stdlib_stats, only: corr - implicit none - real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] - real :: y(1:2, 1:3) = reshape([ -1., 40., -3., 4., 10., 6. ], [ 2, 3]) - print *, corr(x, 1) !returns 1. - print *, corr(y, 2) !returns reshape([ 1., -.32480, -.32480, 1. ], [ 2, 3]) -end program demo_corr +{!test/examples/stats/demo_corr.f90!} ``` ## `cov` - covariance of array elements @@ -115,15 +108,7 @@ If `mask` is specified, the result is the covariance of all elements of `array` ### Example ```fortran -program demo_cov - use stdlib_stats, only: cov - implicit none - real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] - real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) - print *, cov(x, 1) !returns 3.5 - print *, cov(x, 1, corrected = .false.) !returns 2.9167 - print *, cov(y, 1) !returns a square matrix of size 3 with all elements equal to 0.5 -end program demo_cov +{!test/examples/stats/demo_cov.f90!} ``` ## `mean` - mean of array elements @@ -166,16 +151,7 @@ If `mask` is specified, the result is the mean of all elements of `array` corres ### Example ```fortran -program demo_mean - use stdlib_stats, only: mean - implicit none - real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] - real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) - print *, mean(x) !returns 3.5 - print *, mean(y) !returns 3.5 - print *, mean(y, 1) !returns [ 1.5, 3.5, 5.5 ] - print *, mean(y, 1,y > 3.) !returns [ NaN, 4.0, 5.5 ] -end program demo_mean +{!test/examples/stats/demo_mean.f90!} ``` ## `median` - median of array elements @@ -240,16 +216,7 @@ If `mask` is specified, the result is the median of all elements of `array` corr ### Example ```fortran -program demo_median - use stdlib_stats, only: median - implicit none - real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] - real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) - print *, median(x) !returns 3.5 - print *, median(y) !returns 3.5 - print *, median(y, 1) !returns [ 1.5, 3.5, 5.5 ] - print *, median(y, 1,y > 3.) !returns [ NaN, 4.0, 5.5 ] -end program demo_median +{!test/examples/stats/demo_median.f90!} ``` ## `moment` - central moments of array elements @@ -313,18 +280,7 @@ If `mask` is specified, the result is the _k_-th (central) moment of all elemen ### Example ```fortran -program demo_moment - use stdlib_stats, only: moment - implicit none - real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] - real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) - print *, moment(x, 2) !returns 2.9167 - print *, moment(y, 2) !returns 2.9167 - print *, moment(y, 2, 1) !returns [0.25, 0.25, 0.25] - print *, moment(y, 2, 1, mask = (y > 3.)) !returns [NaN, 0., 0.25] - print *, moment(x, 2, center = 0.) !returns 15.1667 - print *, moment(y, 1, 1, center = 0.) !returns [1.5, 3.5, 5.5] -end program demo_moment +{!test/examples/stats/demo_moment.f90!} ``` ## `var` - variance of array elements @@ -382,16 +338,5 @@ If the variance is computed with only one single element, then the result is IEE ### Example ```fortran -program demo_var - use stdlib_stats, only: var - implicit none - real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] - real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) - print *, var(x) !returns 3.5 - print *, var(x, corrected = .false.) !returns 2.9167 - print *, var(y) !returns 3.5 - print *, var(y, 1) !returns [0.5, 0.5, 0.5] - print *, var(y, 1, y > 3.) !returns [NaN, NaN, 0.5] - print *, var(y, 1, y > 3., corrected=.false.) !returns [NaN, 0., 0.25] -end program demo_var +{!test/examples/stats/demo_var.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_exponential.md b/doc/specs/stdlib_stats_distribution_exponential.md index 9a53bee95..d755a7135 100644 --- a/doc/specs/stdlib_stats_distribution_exponential.md +++ b/doc/specs/stdlib_stats_distribution_exponential.md @@ -46,39 +46,7 @@ The result is a scalar or rank one array with a size of `array_size`, and has th ### Example ```fortran -program demo_exponential_rvs - use stdlib_random, only : random_seed - use stdlib_stats_distribution_exponential, only: rexp => rvs_exp - - implicit none - real :: a(2,3,4) - complex :: scale - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) - - print *, rexp( ) !single standard exponential random variate - -! 0.358690143 - - print *, rexp(2.0) !exponential random variate with lambda=2.0 - -! 0.816459715 - - print *, rexp(0.3, 10) !an array of 10 variates with lambda=0.3 - -! 1.84008647E-02 3.59742008E-02 0.136567295 0.262772143 3.62352766E-02 -! 0.547133625 0.213591918 4.10784185E-02 0.583882213 0.671128035 - - scale = (2.0, 0.7) - print *, rexp(scale) - !single complex exponential random variate with real part of lambda=2.0; - !imagainary part of lambda=0.7 - -! (1.41435969,4.081114382E-02) - -end program demo_exponential_rvs +{!test/examples/stats_distribution_exponential/demo_exponential_rvs.f90!} ``` ## `pdf_exp` - exponential distribution probability density function @@ -122,45 +90,7 @@ The result is a scalar or an array, with a shape conformable to arguments, and h ### Example ```fortran -program demo_exponential_pdf - use stdlib_random, only : random_seed - use stdlib_stats_distribution_exponential, only: exp_pdf => pdf_exp, & - rexp => rvs_exp - - implicit none - real :: x(2,3,4),a(2,3,4) - complex :: scale - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) - - print *, exp_pdf(1.0,1.0) !a probability density at 1.0 in standard expon - -! 0.367879450 - - print *, exp_pdf(2.0,2.0) !a probability density at 2.0 with lambda=2.0 - -! 3.66312787E-02 - - x = reshape(rexp(0.5, 24),[2,3,4]) ! standard expon random variates array - a(:,:,:) = 0.5 - print *, exp_pdf(x, a) ! a rank 3 standard expon probability density - -! 0.457115263 0.451488823 0.492391467 0.485233188 0.446215510 -! 0.401670188 0.485127628 0.316924453 0.418474048 0.483173639 -! 0.307366133 0.285812140 0.448017836 0.426440030 0.403896868 -! 0.334653258 0.410376132 0.485370994 0.333617479 0.263791025 -! 0.249779820 0.457159877 0.495636940 0.482243657 - - scale = (1.0, 2.) - print *, exp_pdf((1.5,1.0), scale) - ! a complex expon probability density function at (1.5,1.0) with real part - !of lambda=1.0 and imaginary part of lambda=2.0 - -! 6.03947677E-02 - -end program demo_exponential_pdf +{!test/examples/stats_distribution_exponential/demo_exponential_pdf.f90!} ``` ## `cdf_exp` - exponential cumulative distribution function @@ -204,45 +134,5 @@ The result is a scalar or an array, with a shape conformable to arguments, and h ### Example ```fortran -program demo_exponential_cdf - use stdlib_random, only : random_seed - use stdlib_stats_distribution_exponential, only : exp_cdf => cdf_exp, & - rexp => rvs_exp - - implicit none - real :: x(2,3,4),a(2,3,4) - complex :: scale - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) - - print *, exp_cdf(1.0, 1.0) ! a standard exponential cumulative at 1.0 - -! 0.632120550 - - print *, exp_cdf(2.0, 2.0) ! a cumulative at 2.0 with lambda=2 - -! 0.981684387 - - x = reshape(rexp(0.5, 24),[2,3,4]) - ! standard exponential random variates array - a(:,:,:) = 0.5 - print *, exp_cdf(x, a) ! a rank 3 array of standard exponential cumulative - -! 8.57694745E-02 9.70223546E-02 1.52170658E-02 2.95336246E-02 -! 0.107568979 0.196659625 2.97447443E-02 0.366151094 0.163051903 -! 3.36527228E-02 0.385267735 0.428375721 0.103964329 0.147119939 -! 0.192206264 0.330693483 0.179247737 2.92580128E-02 0.332765043 -! 0.472417951 0.500440359 8.56802464E-02 8.72612000E-03 3.55126858E-02 - - scale = (0.5,1.0) - print *, exp_cdf((0.5,0.5),scale) - !complex exponential cumulative distribution at (0.5,0.5) with real part of - !lambda=0.5 and imaginary part of lambda=1.0 - -! 8.70351046E-02 - -end program demo_exponential_cdf - +{!test/examples/stats_distribution_exponential/demo_exponential_cdf.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_normal.md b/doc/specs/stdlib_stats_distribution_normal.md index 860aec2dd..bab21f822 100644 --- a/doc/specs/stdlib_stats_distribution_normal.md +++ b/doc/specs/stdlib_stats_distribution_normal.md @@ -49,51 +49,7 @@ The result is a scalar or rank one array, with a size of `array_size`, and as th ### Example ```fortran -program demo_normal_rvs - use stdlib_random, only: random_seed - use stdlib_stats_distribution_normal, only: norm => rvs_normal - - implicit none - real :: a(2,3,4), b(2,3,4) - complx :: loc, scale - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) - - print *, norm( ) !single standard normal random variate - -! 0.563655198 - - print *, norm(1.0, 2.0) - !normal random variate mu=1.0, sigma=2.0 - -! -0.633261681 - - print *, norm(0.0, 1.0, 10) !an array of 10 standard norml random variates - -! -3.38123664E-02 -0.190365672 0.220678389 -0.424612164 -0.249541596 -! 0.865260184 1.11086845 -0.328349441 1.10873628 1.27049923 - - a(:,:,:) = 1.0 - b(:,:,:) = 1.0 - print *, norm(a,b) ! a rank 3 random variates array - -!0.152776539 -7.51764774E-02 1.47208166 0.180561781 1.32407105 -! 1.20383692 0.123445868 -0.455737948 -0.469808221 1.60750175 -! 1.05748117 0.720934749 0.407810807 1.48165631 2.31749439 -! 0.414566994 3.06084275 1.86505437 1.36338580 7.26878643E-02 -! 0.178585172 1.39557445 0.828021586 0.872084975 - - loc = (-1.0, 2.0) - scale = (2.0, 1.0) - print *, norm(loc, scale) - !single complex normal random variate with real part of mu=-1, sigma=2; - !imagainary part of mu=2.0 and sigma=1.0 - -! (1.22566295,2.12518454) - -end program demo_normal_rvs +{!test/examples/stats_distribution_normal/demo_normal_rvs.f90!} ``` ## `pdf_normal` - normal distribution probability density function @@ -137,50 +93,7 @@ The result is a scalar or an array, with a shape conformable to arguments, and a ### Example ```fortran -program demo_normal_pdf - use stdlib_random, only : random_seed - use stdlib_stats_distribution_normal, only : norm_pdf=>pdf_normal, & - norm => rvs_normal - - implicit none - real :: x(3,4,5),a(3,4,5),b(3,4,5) - complx :: loc, scale - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) - - print *, norm_pdf(1.0,0.,1.) !a probability density at 1.0 in standard normal - -! 0.241970733 - - print *, norm_pdf(2.0,-1.0, 2.0) - !a probability density at 2.0 with mu=-1.0 sigma=2.0 - -!6.47588000E-02 - - x = reshape(norm(0.0, 1.0, 60),[3,4,5]) - ! standard normal random variates array - - a(:,:,:) = 0.0 - b(:,:,:) = 1.0 - print *, norm_pdf(x, a, b) ! standard normal probability density array - -! 0.340346158 0.285823315 0.398714304 0.391778737 0.389345556 -! 0.364551932 0.386712372 0.274370432 0.215250477 0.378006011 -! 0.215760440 0.177990928 0.278640658 0.223813817 0.356875211 -! 0.285167664 0.378533930 0.390739858 0.271684974 0.138273031 -! 0.135456234 0.331718773 0.398283750 0.383706540 - - loc = (1.0, -0.5) - scale = (1.0, 2.) - print *, norm_pdf((1.5,1.0), loc, scale) - ! a complex normal probability density function at (1.5,1.0) with real part - ! of mu=1.0, sigma=1.0 and imaginary part of mu=-0.5, sigma=2.0 - -! 5.30100204E-02 - -end program demo_normal_pdf +{!test/examples/stats_distribution_normal/demo_normal_pdf.f90!} ``` ## `cdf_normal` - normal distribution cumulative distribution function @@ -224,49 +137,5 @@ The result is a scalar or an array, with a shape conformable to arguments, as th ### Example ```fortran -program demo_norm_cdf - use stdlib_random, only : random_seed - use stdlib_stats_distribution_normal, only : norm_cdf => cdf_normal, & - norm => rvs_normal - - implicit none - real :: x(2,3,4),a(2,3,4),b(2,3,4) - complx :: loc, scale - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) - - print *, norm_cdf(1.0, 0.0, 1.0) ! a standard normal cumulative at 1.0 - -! 0.841344714 - - print *, norm_cdf(2.0, -1.0, 2.0) - ! a cumulative at 2.0 with mu=-1 sigma=2 - -! 0.933192849 - - x = reshape(norm(0.0, 1.0, 24),[2,3,4]) - ! standard normal random variates array - - a(:,:,:) = 0.0 - b(:,:,:) = 1.0 - print *, norm_cdf(x, a, b) ! standard normal cumulative array - -! 0.713505626 0.207069695 0.486513376 0.424511284 0.587328553 -! 0.335559726 0.401470929 0.806552052 0.866687536 0.371323735 -! 0.866228044 0.898046613 0.198435277 0.141147852 0.681565762 -! 0.206268221 0.627057910 0.580759525 0.190364420 7.27325380E-02 -! 7.08068311E-02 0.728241026 0.522919059 0.390097380 - - loc = (1.0,0.0) - scale = (0.5,1.0) - print *, norm_cdf((0.5,-0.5),loc,scale) - !complex normal cumulative distribution at (0.5,-0.5) with real part of - !mu=1.0, sigma=0.5 and imaginary part of mu=0.0, sigma=1.0 - -!4.89511043E-02 - -end program demo_norm_cdf - +{!test/examples/stats_distribution_normal/demo_norm_cdf.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_uniform.md b/doc/specs/stdlib_stats_distribution_uniform.md index cd22d15fe..ead740a9a 100644 --- a/doc/specs/stdlib_stats_distribution_uniform.md +++ b/doc/specs/stdlib_stats_distribution_uniform.md @@ -35,36 +35,7 @@ Return a randomized rank one array of the input type. ### Example ```fortran -program demo_shuffle - use stdlib_random, only : random_seed - use stdlib_stats_distribution_uniform, only : shuffle - implicit none - integer :: seed_put, seed_get, i - real :: x(10) - integer :: n(10) - complex :: z(10) - - do i=1, 10 - n(i) = i - x(i) = real(i) - z(i) = cmplx(real(i), real(i)) - end do - seed_put = 32165498 - call random_seed(seed_put, seed_get) ! set and get current value of seed - print *, shuffle(n) ! get randomized n - -!10 6 9 2 8 1 3 5 7 4 - - print *, shuffle(x) ! get randomized x - -!5.0 10.0 9.0 4.0 3.0 8.0 2.0 1.0 7.0 6.0 - - print *, shuffle(z) ! get randomized z - -!(8.0, 8.0) (7.0, 7.0) (4.0, 4.0) (1.0, 1.0) (5.0, 5.0) -!(9.0, 9.0) (6.0, 6.0) (3.0, 3.0) (2.0, 2.0) (10.0, 10.0) - -end program demo_shuffle +{!test/examples/stats_distribution_uniform/demo_shuffle.f90!} ``` ## `rvs_uniform` - uniform distribution random variates @@ -114,85 +85,7 @@ The result is a scalar or a rank one array with size of `array_size`, of type `i ### Example ```fortran -program demo_uniform_rvs - use stdlib_random, only:random_seed - use stdlib_stats_distribution_uniform, only:uni=> rvs_uniform - - implicit none - complex :: loc, scale - real :: a(3,4,5), b(3,4,5) - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) - - print *, uni( ) !real standard uniform random variate in [0., 1.] -! 0.161520019 - - print *, uni(3.0) !an uniform random variate in [0., 3.] -! 1.65974522 - - print *, uni(-0.5, 1.0) !an uniform random variate in [-0.5, 0.5] -! 0.486900032 - - print *, uni(-1.0,2.0,10) - !an array of 10 uniform random variates in [-1., 1.] - -!0.884182811 -0.771520197 0.560377002 0.709313750 -7.12267756E-02 -!-0.431066573 0.497536063 -0.396331906 -0.325983286 0.137686729 - - print *, uni(20) !a random integer variate in [0, 20] -! 17 - - print *, uni(5,13) !a random integer variate in [5, 18] -! 15 - - print *, uni(3,19,10) !an array of 10 integer variates in [3,22] - -!7 16 16 12 9 21 19 4 3 19 - - loc = (-0.5, -0.5) - scale = (1.0, 1.0) - - print *, uni(scale) !a complex uniform random variate in unit square - -!(0.139202669, 0.361759573) - - print *, uni(loc,scale) - !a complex uniform random variate in [(-0.5, -0.5), (0.5, 0.5)] - -!(0.296536088,-0.143987954) - - print *, uni(loc, scale, 10) - !an array of 10 complex uniform random variate in [(-0.5, -0.5), (0.5, 0.5)] - -!(-0.302334785,-0.401923567) (0.281620383,9.534919262E-02) -! (-0.374348879,0.457528770) (0.442990601,-0.240510434) -! (-0.421572685,0.279313922) (-0.182090610,5.901372433E-02) -! (-7.864198089E-02,0.378484428) (-0.423258364,-0.201292425) -! (0.193327367,-0.353985727) (-0.397661150,0.355926156) - - a(:,:,:) = -0.5 - b(:,:,:) = 1.0 - - print *, uni(a,b) - !a rank 3 array of random variates in [-0.5,0.5] - -! -0.249188632 -0.199248433 -0.389813602 2.88307667E-03 0.238479793, -! 0.264856219 -0.205177426 -0.480921626 0.131218433 0.252170086, -! -0.303151041 -8.89462233E-02 -0.377370685 0.341802299 0.323204756, -! 0.358679056 -0.138909757 0.384329498 -0.109372199 0.132353067, -! 0.494320452 0.419343710 -0.103044361 0.461389005 0.403132677 -! 0.121850729 0.403839290 -0.349389791 0.490482628 0.156600773 -! 8.46788883E-02 -0.483680278 0.388107836 0.119698405 0.154214382 -! 0.153113484 0.236523747 0.155937552 -0.135760903 0.219589531 -! 0.394639254 6.30156994E-02 -0.342692465 -0.444846451 -0.215700030 -! 0.204189956 -0.208748132 0.355063021 8.98272395E-02 -0.237928331 -! 2.98077464E-02 -0.485149682 -8.06870461E-02 -0.372713923 -! -0.178335011 0.283877611 -2.13934183E-02 -9.21690464E-03 -! 4.56320047E-02 0.220112979 - -end program demo_uniform_rvs +{!test/examples/stats_distribution_uniform/demo_uniform_rvs.f90!} ``` ## `pdf_uniform` - Uniform distribution probability density function @@ -240,56 +133,7 @@ The result is a scalar or an array, with a shape conformable to arguments, of ty ### Example ```fortran -program demo_uniform_pdf - use stdlib_random, only : random_seed - use stdlib_stats_distribution_uniform, only : uni_pdf => pdf_uniform, & - uni => rvs_uniform - - implicit none - complex :: loc, scale - real :: a(3,4,5), b(3,4,5), x(3,4,5) - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) - - print *, uni_pdf(3, 2, 10) !probability density at 3 in range [2, 10] - -! 9.09090936E-02 - - print *, uni_pdf(0.5,0.0,1.0) !a probability density at 0.5 in [0., 1.] - -! 1.00000000 - - - print *, uni_pdf(0.7,-1.0,2.0) !a probability density at 0.7 in [-1., 1.] - -! 0.500000000 - - a(:,:,:) = 0.0 - b(:,:,:) = 2.0 - x = reshape(uni(0.,2.,60),[3,4,5])! uniform random variates array in [0., 2.] - print *, uni_pdf(x, a, b) ! probability density array in [0., 2.] - -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 - - loc = (-0.5,-0.5) - scale = (1.0,1.0) - print *, uni_pdf((-0.1,0.2), loc, scale) - ! joint probability density at (-0.1,0.2) in [(-0.5, -0.5), (0.5, 0.5)] - -! 1.00000000 -end program demo_uniform_pdf - +{!test/examples/stats_distribution_uniform/demo_uniform_pdf.f90!} ``` ## `cdf_uniform` - Uniform distribution cumulative distribution function @@ -339,53 +183,5 @@ The result is a scalar or an array, with a shape conformable to arguments, of ty ### Example ```fortran -program demo_uniform_cdf - use stdlib_random, only : random_seed - use stdlib_stats_distribution_uniform, only : uni_cdf => cdf_uniform, & - uni => rvs_uniform - - implicit none - real :: x(3,4,5), a(3,4,5), b(3,4,5) - complex :: loc, scale - integer :: seed_put, seed_get - - seed_put = 1234567 - call random_seed(seed_put, seed_get) - - print *, uni_cdf(0.5,0.,1.) ! a cumulative at 0.5 in [0., 1.] - -!0.500000000 - - print *, uni_cdf(0.7,-1.0,2.0) ! a cumulative at 0.7 in [-1.0, 1.0] - -! 0.850000024 - - print *, uni_cdf(6, 2, 10) ! a cumulative at 6 in [2, 10] - -! 0.454545468 - - a(:,:,:) = -1.0 - b(:,:,:) = 2.0 - x = reshape(uni(-1.0,2.0,60),[3,4,5]) ! uniform random variates array - print *, uni_cdf(x,a,b) ! cumulative array in [-1.0, 1.0] - -!0.161520004 0.553248405 0.986900032 0.942091405 0.114239901 0.780188501 -! 0.854656875 0.464386612 0.284466714 0.748768032 0.301834047 0.337008357 -!0.568843365 0.596165061 0.180993259 0.614166319 0.214835495 7.98164606E-02 -!0.641274095 0.607101977 0.701139212 0.230517209 1.97925568E-02 0.857982159 -!0.712761045 0.139202654 0.361759573 0.796536088 0.356012046 0.197665215 -!9.80764329E-02 0.781620383 0.595349193 0.125651121 0.957528770 0.942990601 -!0.259489566 7.84273148E-02 0.779313922 0.317909390 0.559013724 0.421358019 -!0.878484428 7.67416358E-02 0.298707575 0.693327367 0.146014273 0.102338850 -!0.855926156 0.250811368 0.300751567 0.110186398 0.502883077 0.738479793 -!0.764856219 0.294822574 1.90783739E-02 0.631218433 0.752170086 0.196848959 - - loc = (0., 0.) - scale=(2., 1.) - print *, uni_cdf((1.2,0.5), loc, scale) - ! joint cumulative distribution at (1.2,0.5) in [(0.,0.), (2.,1.)] - -! 0.300000012 -end program demo_uniform_cdf - +{!test/examples/stats_distribution_uniform/demo_uniform_cdf.f90!} ``` diff --git a/doc/specs/stdlib_string_type.md b/doc/specs/stdlib_string_type.md index 5873c1f8b..edba8639c 100644 --- a/doc/specs/stdlib_string_type.md +++ b/doc/specs/stdlib_string_type.md @@ -67,13 +67,7 @@ The result is an instance of `string_type` with zero length. #### Example ```fortran -program demo_constructor_empty - use stdlib_string_type - implicit none - type(string_type) :: string - string = string_type() - ! len(string) == 0 -end program demo_constructor_empty +{!test/examples/string_type/demo_constructor_empty.f90!} ``` @@ -111,15 +105,7 @@ The result is an instance of `string_type`. #### Example ```fortran -program demo_constructor_scalar - use stdlib_string_type - implicit none - type(string_type) :: string - string = string_type("Sequence") - ! len(string) == 8 - string = string_type(" S p a c e d ") - ! len(string) == 13 -end program demo_constructor_scalar +{!test/examples/string_type/demo_constructor_scalar.f90!} ``` @@ -153,15 +139,7 @@ The result is an instance of `string_type`. #### Example ```fortran -program demo_constructor_integer - use stdlib_string_type - implicit none - type(string_type) :: string - string = string_type(42) - ! len(string) == 2 - string = string_type(-289) - ! len(string) == 4 -end program demo_constructor_integer +{!test/examples/string_type/demo_constructor_integer.f90!} ``` @@ -195,15 +173,7 @@ The result is an instance of `string_type`. #### Example ```fortran -program demo_constructor_logical - use stdlib_string_type - implicit none - type(string_type) :: string - string = string_type(.true.) - ! len(string) == 1 - string = string_type(.false.) - ! len(string) == 1 -end program demo_constructor_logical +{!test/examples/string_type/demo_constructor_logical.f90!} ``` @@ -232,14 +202,7 @@ Elemental subroutine, `assignment(=)`. #### Example ```fortran -program demo_constructor_character - use stdlib_string_type - implicit none - type(string_type) :: string - ! len(string) == 0 - string = "Sequence" - ! len(string) == 8 -end program demo_constructor_character +{!test/examples/string_type/demo_constructor_character.f90!} ``` @@ -273,20 +236,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo_len - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: length - - string = "Some longer sentence for this example." - length = len(string) - ! length == 38 - - string = "Whitespace " - length = len(string) - ! length == 38 -end program demo_len +{!test/examples/string_type/demo_len.f90!} ``` @@ -321,20 +271,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo_len_trim - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: length - - string = "Some longer sentence for this example." - length = len_trim(string) - ! length == 38 - - string = "Whitespace " - length = len_trim(string) - ! length == 10 -end program demo_len_trim +{!test/examples/string_type/demo_len_trim.f90!} ``` @@ -369,15 +306,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo_trim - use stdlib_string_type - implicit none - type(string_type) :: string - - string = "Whitespace " - string = trim(string) - ! len(string) == 10 -end program demo_trim +{!test/examples/string_type/demo_trim.f90!} ``` @@ -412,15 +341,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo_adjustl - use stdlib_string_type - implicit none - type(string_type) :: string - - string = " Whitespace" - string = adjustl(string) - ! char(string) == "Whitespace " -end program demo_adjustl +{!test/examples/string_type/demo_adjustl.f90!} ``` @@ -455,15 +376,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo_adjustr - use stdlib_string_type - implicit none - type(string_type) :: string - - string = "Whitespace " - string = adjustr(string) - ! char(string) == " Whitespace" -end program demo_adjustr +{!test/examples/string_type/demo_adjustr.f90!} ``` @@ -499,15 +412,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo_repeat - use stdlib_string_type - implicit none - type(string_type) :: string - - string = "What? " - string = repeat(string, 3) - ! string == "What? What? What? " -end program demo_repeat +{!test/examples/string_type/demo_repeat.f90!} ``` @@ -541,16 +446,7 @@ The result is a scalar character value. #### Example ```fortran -program demo_char - use stdlib_string_type - implicit none - type(string_type) :: string - character(len=:), allocatable :: dlc - - string = "Character sequence" - dlc = char(string) - ! dlc == "Character sequence" -end program demo_char +{!test/examples/string_type/demo_char.f90!} ``` @@ -585,19 +481,7 @@ The result is a scalar character value. #### Example ```fortran -program demo_char_position - use stdlib_string_type - implicit none - type(string_type) :: string - character(len=:), allocatable :: dlc - character(len=1), allocatable :: chars(:) - - string = "Character sequence" - dlc = char(string, 3) - ! dlc == "a" - chars = char(string, [3, 5, 8, 12, 14, 15, 18]) - ! chars == ["a", "a", "e", "e", "u", "e", "e"] -end program demo_char_position +{!test/examples/string_type/demo_char_position.f90!} ``` @@ -633,16 +517,7 @@ The result is a scalar character value. #### Example ```fortran -program demo_char_range - use stdlib_string_type - implicit none - type(string_type) :: string - character(len=:), allocatable :: dlc - - string = "Fortran" - dlc = char(string, 1, 4) - ! dlc == "Fort" -end program demo_char_range +{!test/examples/string_type/demo_char_range.f90!} ``` @@ -679,15 +554,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo_ichar - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: code - - string = "Fortran" - code = ichar(string) -end program demo_ichar +{!test/examples/string_type/demo_ichar.f90!} ``` @@ -724,15 +591,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo_iachar - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: code - - string = "Fortran" - code = iachar(string) -end program demo_iachar +{!test/examples/string_type/demo_iachar.f90!} ``` @@ -772,22 +631,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo_index - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: pos - - string = "Search this string for this expression" - pos = index(string, "this") - ! pos == 8 - - pos = index(string, "this", back=.true.) - ! pos == 24 - - pos = index(string, "This") - ! pos == 0 -end program demo_index +{!test/examples/string_type/demo_index.f90!} ``` @@ -827,22 +671,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo_scan - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: pos - - string = "fortran" - pos = scan(string, "ao") - ! pos == 2 - - pos = scan(string, "ao", .true.) - ! pos == 6 - - pos = scan(string, "c++") - ! pos == 0 -end program demo_scan +{!test/examples/string_type/demo_scan.f90!} ``` @@ -882,28 +711,7 @@ The result is a default integer scalar value. #### Example ```fortran -program demo_verify - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: pos - - string = "fortran" - pos = verify(string, "ao") - ! pos == 1 - - pos = verify(string, "fo") - ! pos == 3 - - pos = verify(string, "c++") - ! pos == 1 - - pos = verify(string, "c++", back=.true.) - ! pos == 7 - - pos = verify(string, string) - ! pos == 0 -end program demo_verify +{!test/examples/string_type/demo_verify.f90!} ``` @@ -942,22 +750,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_lgt - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = lgt(string, "abc") - ! res .eqv. .true. - - res = lgt(string, "bcd") - ! res .eqv. .false. - - res = lgt(string, "cde") - ! res .eqv. .false. -end program demo_lgt +{!test/examples/string_type/demo_lgt.f90!} ``` @@ -996,22 +789,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_llt - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = llt(string, "abc") - ! res .eqv. .false. - - res = llt(string, "bcd") - ! res .eqv. .false. - - res = llt(string, "cde") - ! res .eqv. .true. -end program demo_llt +{!test/examples/string_type/demo_llt.f90!} ``` @@ -1051,22 +829,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_lge - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = lge(string, "abc") - ! res .eqv. .true. - - res = lge(string, "bcd") - ! res .eqv. .true. - - res = lge(string, "cde") - ! res .eqv. .false. -end program demo_lge +{!test/examples/string_type/demo_lge.f90!} ``` @@ -1106,22 +869,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_lle - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = lle(string, "abc") - ! res .eqv. .false. - - res = lle(string, "bcd") - ! res .eqv. .true. - - res = lle(string, "cde") - ! res .eqv. .true. -end program demo_lle +{!test/examples/string_type/demo_lle.f90!} ``` @@ -1156,18 +904,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo_to_lower - use stdlib_string_type - implicit none - type(string_type) :: string, lowercase_string - - string = "Lowercase This String" - ! string <-- "Lowercase This String" - - lowercase_string = to_lower(string) - ! string <-- "Lowercase This String" - ! lowercase_string <-- "lowercase this string" -end program demo_to_lower +{!test/examples/string_type/demo_to_lower.f90!} ``` @@ -1202,18 +939,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo_to_upper - use stdlib_string_type - implicit none - type(string_type) :: string, uppercase_string - - string = "Uppercase This String" - ! string <-- "Uppercase This String" - - uppercase_string = to_upper(string) - ! string <-- "Uppercase This String" - ! uppercase_string <-- "UPPERCASE THIS STRING" -end program demo_to_upper +{!test/examples/string_type/demo_to_upper.f90!} ``` @@ -1253,18 +979,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo_to_title - use stdlib_string_type - implicit none - type(string_type) :: string, titlecase_string - - string = "titlecase this string." - ! string <-- "titlecase this string." - - titlecase_string = to_title(string) - ! string <-- "titlecase this string." - ! titlecase_string <-- "Titlecase This String." -end program demo_to_title +{!test/examples/string_type/demo_to_title.f90!} ``` @@ -1301,18 +1016,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo_to_sentence - use stdlib_string_type - implicit none - type(string_type) :: string, sentencecase_string - - string = "sentencecase this string." - ! string <-- "sentencecase this string." - - sentencecase_string = to_sentence(string) - ! string <-- "sentencecase this string." - ! sentencecase_string <-- "Sentencecase this string." -end program demo_to_sentence +{!test/examples/string_type/demo_to_sentence.f90!} ``` @@ -1346,18 +1050,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -program demo_reverse - use stdlib_string_type - implicit none - type(string_type) :: string, reverse_string - - string = "Reverse This String" - ! string <-- "Reverse This String" - - reverse_string = reverse(string) - ! string <-- "Reverse This String" - ! reverse_string <-- "gnirtS sihT esreveR" -end program demo_reverse +{!test/examples/string_type/demo_reverse.f90!} ``` @@ -1399,22 +1092,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_gt - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = string > "abc" - ! res .eqv. .true. - - res = string > "bcd" - ! res .eqv. .false. - - res = string > "cde" - ! res .eqv. .false. -end program demo_gt +{!test/examples/string_type/demo_gt.f90!} ``` @@ -1456,22 +1134,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_lt - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = string < "abc" - ! res .eqv. .false. - - res = string < "bcd" - ! res .eqv. .false. - - res = string < "cde" - ! res .eqv. .true. -end program demo_lt +{!test/examples/string_type/demo_lt.f90!} ``` @@ -1513,22 +1176,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_ge - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = string >= "abc" - ! res .eqv. .true. - - res = string >= "bcd" - ! res .eqv. .true. - - res = string >= "cde" - ! res .eqv. .false. -end program demo_ge +{!test/examples/string_type/demo_ge.f90!} ``` @@ -1570,22 +1218,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_le - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = string <= "abc" - ! res .eqv. .false. - - res = string <= "bcd" - ! res .eqv. .true. - - res = string <= "cde" - ! res .eqv. .true. -end program demo_le +{!test/examples/string_type/demo_le.f90!} ``` @@ -1627,22 +1260,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_eq - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = string == "abc" - ! res .eqv. .false. - - res = string == "bcd" - ! res .eqv. .true. - - res = string == "cde" - ! res .eqv. .false. -end program demo_eq +{!test/examples/string_type/demo_eq.f90!} ``` @@ -1684,22 +1302,7 @@ The result is a default logical scalar value. #### Example ```fortran -program demo_ne - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res - - string = "bcd" - res = string /= "abc" - ! res .eqv. .true. - - res = string /= "bcd" - ! res .eqv. .false. - - res = string /= "cde" - ! res .eqv. .true. -end program demo_ne +{!test/examples/string_type/demo_ne.f90!} ``` @@ -1738,15 +1341,7 @@ The result is an instance of `string_type`. #### Example ```fortran -program demo_cont - use stdlib_string_type - implicit none - type(string_type) :: string - - string = "Hello, " - string = string // "World!" - ! len(string) == 13 -end program demo_cont +{!test/examples/string_type/demo_cont.f90!} ``` @@ -1783,21 +1378,7 @@ Unformatted user defined derived type output. #### Example ```fortran -program demo_uwrite - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: io - string = "Important saved value" - - open(newunit=io, form="unformatted", status="scratch") - write(io) string - - rewind(io) - - read(io) string - close(io) -end program demo_uwrite +{!test/examples/string_type/demo_uwrite.f90!} ``` @@ -1840,22 +1421,7 @@ Formatted user defined derived type output. #### Example ```fortran -program demo_fwrite - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: io - string = "Important saved value" - - open(newunit=io, form="formatted", status="scratch") - write(io, *) string - write(io, *) - - rewind(io) - - read(io, *) string - close(io) -end program demo_fwrite +{!test/examples/string_type/demo_fwrite.f90!} ``` @@ -1894,21 +1460,7 @@ Unformatted derived type input. #### Example ```fortran -program demo_uread - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: io - string = "Important saved value" - - open(newunit=io, form="unformatted", status="scratch") - write(io) string - - rewind(io) - - read(io) string - close(io) -end program demo_uread +{!test/examples/string_type/demo_uread.f90!} ``` @@ -1955,22 +1507,7 @@ Formatted derived type input. #### Example ```fortran -program demo_fread - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: io - string = "Important saved value" - - open(newunit=io, form="formatted", status="scratch") - write(io, *) string - write(io, *) - - rewind(io) - - read(io, *) string - close(io) -end program demo_fread +{!test/examples/string_type/demo_fread.f90!} ``` @@ -2005,25 +1542,5 @@ Pure subroutine (Elemental subroutine, only when both `from` and `to` are `type( #### Example ```fortran -program demo_move - use stdlib_string_type, only : string_type, assignment(=), move - implicit none - type(string_type) :: from_string - character(len=:), allocatable :: from_char, to_char - - from_string = "move this string" - from_char = "move this char" - ! from_string <-- "move this string" - ! from_char <-- "move this char" - ! to_char <-- (unallocated) - - call move(from_string, to_char) - ! from_string <-- "" - ! to_char <-- "move this string" - - call move(from_char, to_char) - ! from_char <-- (unallocated) - ! to_string <-- "move this char" - -end program demo_move +{!test/examples/string_type/demo_move.f90!} ``` diff --git a/doc/specs/stdlib_stringlist_type.md b/doc/specs/stdlib_stringlist_type.md index 7a4141d93..43fb0ca4d 100644 --- a/doc/specs/stdlib_stringlist_type.md +++ b/doc/specs/stdlib_stringlist_type.md @@ -72,19 +72,7 @@ The result is of type `stringlist_index_type`. #### Example ```fortran -program demo_fidx_bidx - use stdlib_stringlist_type, only: stringlist_index_type, fidx, bidx - implicit none - - type(stringlist_index_type) :: index - - index = fidx(1) - ! forward index 1 - - index = bidx(3) - ! backward index 3 - -end program demo_fidx_bidx +{!test/examples/stringlist_type/demo_fidx_bidx.f90!} ``` @@ -120,23 +108,7 @@ The result is an instance of type `stringlist_type`. #### Example ```fortran -program demo_constructor - use stdlib_stringlist_type, only: stringlist_type - use stdlib_string_type, only: string_type - implicit none - - type(stringlist_type) :: stringlist - - stringlist = stringlist_type() - ! stringlist <-- { } (empty stringlist) - - stringlist = stringlist_type(["#1", "#2", "#3"]) - ! stringlist <-- {"#1", "#2", "#3"} - - stringlist = stringlist_type([string_type("#1"), string_type("#2")]) - ! stringlist <-- {"#1", "#2"} - -end program demo_constructor +{!test/examples/stringlist_type/demo_constructor.f90!} ``` @@ -170,29 +142,7 @@ Pure subroutine. #### Example ```fortran -program demo_insert_at - use stdlib_stringlist_type, only: stringlist_type, stringlist_index_type, fidx, bidx - use stdlib_string_type, only: string_type - implicit none - - type(stringlist_type) :: stringlist - type(stringlist_index_type) :: index - - index = fidx(1) - call stringlist%insert_at( index, "Element No. one" ) - ! stringlist <-- {"Element No. one"} - - index = bidx(1) - call stringlist%insert_at( index, string_type( "Element No. two" ) ) - ! stringlist <-- {"Element No. one", "Element No. two"} - - call stringlist%insert_at( fidx(2), string_type( "Element No. three" ) ) - ! stringlist <-- {"Element No. one", "Element No. three", "Element No. two"} - - call stringlist%insert_at( bidx(1), "Element No. four" ) - ! stringlist <-- {"Element No. one", "Element No. three", "Element No. two", "Element No. four"} - -end program demo_insert_at +{!test/examples/stringlist_type/demo_insert_at.f90!} ``` @@ -227,34 +177,7 @@ The result is a string of type `string_type`. #### Example ```fortran -program demo_get - use stdlib_stringlist_type, only: stringlist_type, fidx, bidx - use stdlib_string_type, only: string_type - implicit none - - type(stringlist_type) :: stringlist - type(string_type) :: output - - !> inserting 4 elements to the stringlist - call stringlist%insert_at( fidx(1), "Element No. one" ) - call stringlist%insert_at( fidx(1), "Element No. two" ) - call stringlist%insert_at( fidx(1), "Element No. three" ) - call stringlist%insert_at( fidx(1), "Element No. four" ) - ! stringlist <-- {"Element No. four", "Element No. three", "Element No. two", "Element No. one"} - - output = stringlist%get( fidx(1) ) - ! output <-- "Element No. four" - - output = stringlist%get( bidx(1) ) - ! output <-- "Element No. one" - - !> accessing out of bounds index - output = stringlist%get( bidx(5) ) - ! output <-- "" - output = stringlist%get( fidx(0) ) - ! output <-- "" - -end program demo_get +{!test/examples/stringlist_type/demo_get.f90!} ``` @@ -288,25 +211,7 @@ The result is of type `integer`. #### Example ```fortran -program demo_len - use stdlib_stringlist_type, only: stringlist_type, bidx - implicit none - - type(stringlist_type) :: stringlist - integer :: output - - output = stringlist%len() - ! output <-- 0 - - !> inserting 2 elements to the stringlist - call stringlist%insert_at( bidx(1), "Element No. one" ) - call stringlist%insert_at( bidx(1), "Element No. two" ) - ! stringlist <-- {"Element No. one", "Element No. two"} - - print'(a)', stringlist%len() - ! 2 - -end program demo_len +{!test/examples/stringlist_type/demo_len.f90!} ``` @@ -336,25 +241,7 @@ No arguments. #### Example ```fortran -program demo_clear - use stdlib_stringlist_type, only: stringlist_type, fidx - implicit none - - type(stringlist_type) :: stringlist - - !> inserting 2 elements to the stringlist - call stringlist%insert_at( fidx(1), "Element No. one" ) - call stringlist%insert_at( fidx(1), "Element No. two" ) - ! stringlist <-- {"Element No. two", "Element No. one"} - - call stringlist%clear() - ! stringlist <-- { } (empty stringlist) - - !> inserting 1 element to the stringlist - call stringlist%insert_at( fidx(1), "Element No. one" ) - ! stringlist <-- {"Element No. one"} - -end program demo_clear +{!test/examples/stringlist_type/demo_clear.f90!} ``` @@ -396,35 +283,7 @@ The result is a default `logical` scalar value. #### Example ```fortran -program demo_equality_operator - use stdlib_stringlist_type, only: stringlist_type, fidx, list_head, operator(==) - use stdlib_string_type, only: string_type - implicit none - - type(stringlist_type) :: stringlist - type(string_type), allocatable :: stringarray(:) - logical :: res - - !> inserting 4 elements to the stringlist - call stringlist%insert_at( fidx(1), "#1" ) - call stringlist%insert_at( list_head, "#2" ) - call stringlist%insert_at( fidx(1), "#3" ) - call stringlist%insert_at( list_head, "#4" ) - ! stringlist <-- {"#4", "#3", "#2", "#1"} - - !> creating an array of 4 string_type elements - stringarray = [string_type("#4"), string_type("#3"), string_type("#2"), string_type("#1")] - - res = ( stringarray == stringlist ) - ! res <-- .true. - - res = ( stringlist == ["#4", "#3", "#2", "#1"] ) - ! res <-- .true. - - print'(a)', stringlist == ["#4", "#3", "#1"] - ! .false. - -end program demo_equality_operator +{!test/examples/stringlist_type/demo_equality_operator.f90!} ``` @@ -466,35 +325,7 @@ The result is a default `logical` scalar value. #### Example ```fortran -program demo_inequality_operator - use stdlib_stringlist_type, only: stringlist_type, bidx, list_tail, operator(/=) - use stdlib_string_type, only: string_type - implicit none - - type(stringlist_type) :: stringlist - type(string_type), allocatable :: stringarray(:) - logical :: res - - !> inserting 4 elements to the stringlist - call stringlist%insert_at( bidx(1), "#1" ) - call stringlist%insert_at( list_tail, "#2" ) - call stringlist%insert_at( bidx(1), "#3" ) - call stringlist%insert_at( list_tail, "#4" ) - ! stringlist <-- {"#1", "#2", "#3", "#4"} - - !> creating an array of 4 string_type elements - stringarray = [string_type("#1"), string_type("#2"), string_type("#3"), string_type("#4")] - - res = ( stringarray /= stringlist ) - ! res <-- .false. - - res = ( stringlist /= ["#111", "#222", "#333", "#444"] ) - ! res <-- .true. - - print'(a)', stringlist /= ["#4", "#3", "#1"] - ! .true. - -end program demo_inequality_operator +{!test/examples/stringlist_type/demo_inequality_operator.f90!} ``` @@ -534,31 +365,5 @@ The result is an instance of `[[stdlib_stringlist_type(module):stringlist_type(t #### Example ```fortran -program demo_concatenate_operator - use stdlib_stringlist_type, only: stringlist_type, operator(//) - use stdlib_string_type, only: string_type - implicit none - - type(stringlist_type) :: first_stringlist, second_stringlist - type(string_type), allocatable :: stringarray(:) - - first_stringlist = first_stringlist // "Element No. one" - ! first_stringlist <-- {"Element No. one"} - - second_stringlist = string_type("Element No. two") // first_stringlist - ! second_stringlist <-- {Element No. two, "Element No. one"} - - !> Creating an array of 2 string_type elements - stringarray = [string_type("Element No. three"), string_type("Element No. four")] - - second_stringlist = first_stringlist // stringarray - ! second_stringlist <-- {"Element No. one", "Element No. three", "Element No. four"} - - second_stringlist = ["#1", "#2"] // second_stringlist - ! second_stringlist <-- {"#1", "#2", "Element No. one", "Element No. three", "Element No. four"} - - first_stringlist = first_stringlist // second_stringlist - ! first_stringlist <-- {"Element No. one", "#1", "#2", "Element No. one", "Element No. three", "Element No. four"} - -end program demo_concatenate_operator +{!test/examples/stringlist_type/demo_concatenate_operator.f90!} ``` diff --git a/doc/specs/stdlib_strings.md b/doc/specs/stdlib_strings.md index 772486c29..bba57b4b8 100644 --- a/doc/specs/stdlib_strings.md +++ b/doc/specs/stdlib_strings.md @@ -45,16 +45,7 @@ The result is of the same type as `string`. #### Example ```fortran -program demo_strip - use stdlib_ascii, only : TAB, VT, NUL, LF, CR, FF - use stdlib_strings, only : strip - implicit none - print'(a)', strip(" hello ") ! "hello" - print'(a)', strip(TAB//"goodbye"//CR//LF) ! "goodbye" - print'(a)', strip(" "//TAB//LF//VT//FF//CR) ! "" - print'(a)', strip(" ! ")//"!" ! "!!" - print'(a)', strip("Hello") ! "Hello" -end program demo_strip +{!test/examples/strings/demo_strip.f90!} ``` @@ -93,20 +84,7 @@ The result is of the same type as `string`. #### Example ```fortran -program demo_chomp - use stdlib_ascii, only : TAB, VT, NUL, LF, CR, FF - use stdlib_strings, only : chomp - implicit none - print'(a)', chomp(" hello ") ! " hello" - print'(a)', chomp(TAB//"goodbye"//CR//LF) ! "\tgoodbye" - print'(a)', chomp(" "//TAB//LF//VT//FF//CR) ! "" - print'(a)', chomp(" ! ")//"!" ! " !!" - print'(a)', chomp("Hello") ! "Hello" - print'(a)', chomp("hello", ["l", "o"]) ! "he" - print'(a)', chomp("hello", set=["l", "o"]) ! "he" - print'(a)', chomp("hello", "lo") ! "hel" - print'(a)', chomp("hello", substring="lo") ! "hel" -end program demo_chomp +{!test/examples/strings/demo_chomp.f90!} ``` @@ -143,12 +121,7 @@ The result is of scalar logical type. #### Example ```fortran -program demo_starts_with - use stdlib_strings, only : starts_with - implicit none - print'(a)', starts_with("pattern", "pat") ! T - print'(a)', starts_with("pattern", "ern") ! F -end program demo_starts_with +{!test/examples/strings/demo_starts_with.f90!} ``` @@ -185,12 +158,7 @@ The result is of scalar logical type. #### Example ```fortran -program demo_ends_with - use stdlib_strings, only : ends_with - implicit none - print'(a)', ends_with("pattern", "ern") ! T - print'(a)', ends_with("pattern", "pat") ! F -end program demo_ends_with +{!test/examples/strings/demo_ends_with.f90!} ``` @@ -245,26 +213,7 @@ The result is of the same type as `string`. #### Example ```fortran -program demo_slice - use stdlib_string_type - use stdlib_strings, only : slice - implicit none - type(string_type) :: string - character(len=10) :: char - - string = "abcdefghij" - ! string <-- "abcdefghij" - - char = "abcdefghij" - ! char <-- "abcdefghij" - - print'(a)', slice("abcdefghij", 2, 6, 2) ! "bdf" - print'(a)', slice(char, 2, 6, 2) ! "bdf" - - string = slice(string, 2, 6, 2) - ! string <-- "bdf" - -end program demo_slice +{!test/examples/strings/demo_slice.f90!} ``` @@ -309,19 +258,7 @@ The result is a scalar of integer type or an integer array of rank equal to the #### Example ```fortran -program demo_find - use stdlib_string_type, only: string_type, assignment(=) - use stdlib_strings, only : find - implicit none - type(string_type) :: string - - string = "needle in the character-stack" - - print *, find(string, "needle") ! 1 - print *, find(string, ["a", "c"], [3, 2]) ! [27, 20] - print *, find("qwqwqwq", "qwq", 3, [.false., .true.]) ! [0, 5] - -end program demo_find +{!test/examples/strings/demo_find.f90!} ``` @@ -361,22 +298,7 @@ The result is of the same type as `string`. #### Example ```fortran -program demo_replace_all - use stdlib_string_type, only: string_type, assignment(=) - use stdlib_strings, only : replace_all - implicit none - type(string_type) :: string - - string = "hurdles here, hurdles there, hurdles everywhere" - ! string <-- "hurdles here, hurdles there, hurdles everywhere" - - print'(a)', replace_all(string, "hurdles", "learn from") - ! "learn from here, learn from there, learn from everywhere" - - string = replace_all(string, "hurdles", "technology") - ! string <-- "technology here, technology there, technology everywhere" - -end program demo_replace_all +{!test/examples/strings/demo_replace_all.f90!} ``` @@ -416,21 +338,7 @@ The result is of the same type as `string`. #### Example ```fortran -program demo_padl - use stdlib_string_type, only: string_type, assignment(=) - use stdlib_strings, only : padl - implicit none - string_type :: string - - string = "left pad this string" - ! string <-- "left pad this string" - - print *, padl(string, 25, "$") ! "$$$$$left pad this string" - - string = padl(string, 25) - ! string <-- " left pad this string" - -end program demo_padl +{!test/examples/strings/demo_padl.f90!} ``` @@ -470,21 +378,7 @@ The result is of the same type as `string`. #### Example ```fortran -program demo_padr - use stdlib_string_type, only: string_type, assignment(=) - use stdlib_strings, only : padr - implicit none - string_type :: string - - string = "right pad this string" - ! string <-- "right pad this string" - - print *, padr(string, 25, "$") ! "right pad this string$$$$" - - string = padr(string, 25) - ! string <-- "right pad this string " - -end program demo_padr +{!test/examples/strings/demo_padr.f90!} ``` @@ -524,19 +418,7 @@ The result is a scalar of integer type or an integer array of rank equal to the #### Example ```fortran -program demo_count - use stdlib_string_type, only: string_type, assignment(=) - use stdlib_strings, only : count - implicit none - type(string_type) :: string - - string = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?" - - print *, count(string, "wood") ! 4 - print *, count(string, ["would", "chuck", "could"]) ! [1, 4, 1] - print *, count("a long queueueueue", "ueu", [.false., .true.]) ! [2, 4] - -end program demo_count +{!test/examples/strings/demo_count.f90!} ``` @@ -575,35 +457,5 @@ The result is an `allocatable` length `character` scalar with up to `128` cached #### Example ```fortran -program demo_to_string - use stdlib_strings, only: to_string - - !> Example for `complex` type - print *, to_string((1, 1)) !! "(1.00000000,1.00000000)" - print *, to_string((1, 1), '(F6.2)') !! "( 1.00, 1.00)" - print *, to_string((1000, 1), '(ES0.2)'), to_string((1000, 1), '(SP,F6.3)') - !! "(1.00E+3,1.00)""(******,+1.000)" - !! Too narrow formatter for real number - !! Normal demonstration(`******` from Fortran Standard) - - !> Example for `integer` type - print *, to_string(-3) !! "-3" - print *, to_string(42, '(I4)') !! " 42" - print *, to_string(1, '(I0.4)'), to_string(2, '(B4)') !! "0001"" 10" - - !> Example for `real` type - print *, to_string(1.) !! "1.00000000" - print *, to_string(1., '(F6.2)') !! " 1.00" - print *, to_string(1., 'F6.2') !! " 1.00" - print *, to_string(1., '(SP,ES9.2)'), to_string(1, '(F7.3)') !! "+1.00E+00""[*]" - !! 1 wrong demonstration (`[*]` from `to_string`) - - !> Example for `logical` type - print *, to_string(.true.) !! "T" - print *, to_string(.true., '(L2)') !! " T" - print *, to_string(.true., 'L2') !! " T" - print *, to_string(.false., '(I5)') !! "[*]" - !! 1 wrong demonstrations(`[*]` from `to_string`) - -end program demo_to_string +{!test/examples/strings/demo_to_string.f90!} ``` diff --git a/doc/specs/stdlib_version.md b/doc/specs/stdlib_version.md index 2739fe2cf..d8fe031b0 100644 --- a/doc/specs/stdlib_version.md +++ b/doc/specs/stdlib_version.md @@ -54,11 +54,5 @@ Pure subroutine. #### Example ```fortran -program demo_version - use stdlib_version, only : get_stdlib_version - implicit none - character(len=:), allocatable :: version - call get_stdlib_version(string=version) - print '(a)', version -end program demo_version +{!test/examples/version/demo_version.f90!} ``` diff --git a/test/examples/array/demo_falseloc.f90 b/test/examples/array/demo_falseloc.f90 new file mode 100644 index 000000000..c004ef160 --- /dev/null +++ b/test/examples/array/demo_falseloc.f90 @@ -0,0 +1,8 @@ +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 diff --git a/test/examples/array/demo_trueloc.f90 b/test/examples/array/demo_trueloc.f90 new file mode 100644 index 000000000..b54752a48 --- /dev/null +++ b/test/examples/array/demo_trueloc.f90 @@ -0,0 +1,8 @@ +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 diff --git a/test/examples/ascii/demo_reverse.f90 b/test/examples/ascii/demo_reverse.f90 new file mode 100644 index 000000000..d6c240927 --- /dev/null +++ b/test/examples/ascii/demo_reverse.f90 @@ -0,0 +1,5 @@ +program demo_reverse +use stdlib_ascii, only : reverse +implicit none +print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH" +end program demo_reverse diff --git a/test/examples/ascii/demo_to_lower.f90 b/test/examples/ascii/demo_to_lower.f90 new file mode 100644 index 000000000..49caec3cf --- /dev/null +++ b/test/examples/ascii/demo_to_lower.f90 @@ -0,0 +1,5 @@ +program demo_to_lower +use stdlib_ascii, only : to_lower +implicit none +print'(a)', to_lower("HELLo!") ! returns "hello!" +end program demo_to_lower diff --git a/test/examples/ascii/demo_to_sentence.f90 b/test/examples/ascii/demo_to_sentence.f90 new file mode 100644 index 000000000..e015615b9 --- /dev/null +++ b/test/examples/ascii/demo_to_sentence.f90 @@ -0,0 +1,7 @@ +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 diff --git a/test/examples/ascii/demo_to_title.f90 b/test/examples/ascii/demo_to_title.f90 new file mode 100644 index 000000000..630d835da --- /dev/null +++ b/test/examples/ascii/demo_to_title.f90 @@ -0,0 +1,7 @@ +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 diff --git a/test/examples/ascii/demo_to_upper.f90 b/test/examples/ascii/demo_to_upper.f90 new file mode 100644 index 000000000..0e34ace77 --- /dev/null +++ b/test/examples/ascii/demo_to_upper.f90 @@ -0,0 +1,5 @@ +program demo_to_upper +use stdlib_ascii, only : to_upper +implicit none +print'(a)', to_upper("hello!") ! returns "HELLO!" +end program demo_to_upper diff --git a/test/examples/bitsets/demo_all.f90 b/test/examples/bitsets/demo_all.f90 new file mode 100644 index 000000000..d26564367 --- /dev/null +++ b/test/examples/bitsets/demo_all.f90 @@ -0,0 +1,14 @@ +program demo_all +use stdlib_bitsets +character(*), parameter :: & +bits_all = '111111111111111111111111111111111' +type(bitset_64) :: set0 +call set0 % from_string( bits_all ) +if ( .not. set0 % all() ) then +error stop "FROM_STRING failed to interpret" // & +"BITS_ALL's value properly." +else +write(*,*) "FROM_STRING transferred BITS_ALL properly" // & +" into set0." +end if +end program demo_all diff --git a/test/examples/bitsets/demo_and.f90 b/test/examples/bitsets/demo_and.f90 new file mode 100644 index 000000000..505ee1139 --- /dev/null +++ b/test/examples/bitsets/demo_and.f90 @@ -0,0 +1,17 @@ +program demo_and +use stdlib_bitsets +type(bitset_large) :: set0, set1 +call set0 % init(166) +call set1 % init(166) +call and( set0, set1 ) ! none none +if ( none(set0) ) write(*,*) 'First test of AND worked.' +call set0 % not() +call and( set0, set1 ) ! all none +if ( none(set0) ) write(*,*) 'Second test of AND worked.' +call set1 % not() +call and( set0, set1 ) ! none all +if ( none(set0) ) write(*,*) 'Third test of AND worked.' +call set0 % not() +call and( set0, set1 ) ! all all +if ( all(set0) ) write(*,*) 'Fourth test of AND worked.' +end program demo_and diff --git a/test/examples/bitsets/demo_and_not.f90 b/test/examples/bitsets/demo_and_not.f90 new file mode 100644 index 000000000..fd9f4bc19 --- /dev/null +++ b/test/examples/bitsets/demo_and_not.f90 @@ -0,0 +1,18 @@ +program demo_and_not +use stdlib_bitsets +type(bitset_large) :: set0, set1 +call set0 % init(166) +call set1 % init(166) +call and_not( set0, set1 ) ! none none +if ( none(set0) ) write(*,*) 'First test of AND_NOT worked.' +call set0 % not() +call and_not( set0, set1 ) ! all none +if ( all(set0) ) write(*,*) 'Second test of AND_NOT worked.' +call set0 % not() +call set1 % not() +call and_not( set0, set1 ) ! none all +if ( none(set0) ) write(*,*) 'Third test of AND_NOT worked.' +call set0 % not() +call and_not( set0, set1 ) ! all all +if ( none(set0) ) write(*,*) 'Fourth test of AND_NOT worked.' +end program demo_and_not diff --git a/test/examples/bitsets/demo_any.f90 b/test/examples/bitsets/demo_any.f90 new file mode 100644 index 000000000..9bb61d267 --- /dev/null +++ b/test/examples/bitsets/demo_any.f90 @@ -0,0 +1,15 @@ +program demo_any +use stdlib_bitsets +character(*), parameter :: & +bits_0 = '0000000000000000000' +type(bitset_64) :: set0 +call set0 % from_string( bits_0 ) +if ( .not. set0 % any() ) then +write(*,*) "FROM_STRING interpreted " // & +"BITS_0's value properly." +end if +call set0 % set(5) +if ( set0 % any() ) then +write(*,*) "ANY interpreted SET0's value properly." +end if +end program demo_any diff --git a/test/examples/bitsets/demo_assignment.f90 b/test/examples/bitsets/demo_assignment.f90 new file mode 100644 index 000000000..5eadbee61 --- /dev/null +++ b/test/examples/bitsets/demo_assignment.f90 @@ -0,0 +1,24 @@ +program demo_assignment +use stdlib_bitsets +logical(int8) :: logical1(64) = .true. +logical(int32), allocatable :: logical2(:) +type(bitset_64) :: set0, set1 +set0 = logical1 +if ( set0 % bits() /= 64 ) then +error stop procedure // & +' initialization with logical(int8) failed to set' // & +' the right size.' +else if ( .not. set0 % all() ) then +error stop procedure // ' initialization with' // & +' logical(int8) failed to set the right values.' +else +write(*,*) 'Initialization with logical(int8) succeeded.' +end if +set1 = set0 +if ( set1 == set0 ) & +write(*,*) 'Initialization by assignment succeeded' +logical2 = set1 +if ( all( logical2 ) ) then +write(*,*) 'Initialization of logical(int32) succeeded.' +end if +end program demo_assignment diff --git a/test/examples/bitsets/demo_bit_count.f90 b/test/examples/bitsets/demo_bit_count.f90 new file mode 100644 index 000000000..924285b30 --- /dev/null +++ b/test/examples/bitsets/demo_bit_count.f90 @@ -0,0 +1,15 @@ +program demo_bit_count +use stdlib_bitsets +character(*), parameter :: & +bits_0 = '0000000000000000000' +type(bitset_64) :: set0 +call set0 % from_string( bits_0 ) +if ( set0 % bit_count() == 0 ) then +write(*,*) "FROM_STRING interpreted " // & +"BITS_0's value properly." +end if +call set0 % set(5) +if ( set0 % bit_count() == 1 ) then +write(*,*) "BIT_COUNT interpreted SET0's value properly." +end if +end program demo_bit_count diff --git a/test/examples/bitsets/demo_bits.f90 b/test/examples/bitsets/demo_bits.f90 new file mode 100644 index 000000000..6491f308d --- /dev/null +++ b/test/examples/bitsets/demo_bits.f90 @@ -0,0 +1,11 @@ +program demo_bits +use stdlib_bitsets +character(*), parameter :: & +bits_0 = '0000000000000000000' +type(bitset_64) :: set0 +call set0 % from_string( bits_0 ) +if ( set0 % bits() == 19 ) then +write(*,*) "FROM_STRING interpreted " // & +"BITS_0's size properly." +end if +end program demo_bits diff --git a/test/examples/bitsets/demo_clear.f90 b/test/examples/bitsets/demo_clear.f90 new file mode 100644 index 000000000..51fb53071 --- /dev/null +++ b/test/examples/bitsets/demo_clear.f90 @@ -0,0 +1,11 @@ +program demo_clear +use stdlib_bitsets +type(bitset_large) :: set0 +call set0 % init(166) +call set0 % not() +if ( set0 % all() ) write(*,*) 'SET0 is properly initialized.' +call set0 % clear(165) +if ( .not. set0 % test(165) ) write(*,*) 'Bit 165 is cleared.' +call set0 % clear(0,164) +if ( set0 % none() ) write(*,*) 'All bits are cleared.' +end program demo_clear diff --git a/test/examples/bitsets/demo_equality.f90 b/test/examples/bitsets/demo_equality.f90 new file mode 100644 index 000000000..4e38821b4 --- /dev/null +++ b/test/examples/bitsets/demo_equality.f90 @@ -0,0 +1,16 @@ +program demo_equality +use stdlib_bitsets +type(bitset_64) :: set0, set1, set2 +call set0 % init( 33 ) +call set1 % init( 33 ) +call set2 % init( 33 ) +call set1 % set( 0 ) +call set2 % set( 32 ) +if ( set0 == set0 .and. set1 == set1 .and. set2 == set2 .and. & +.not. set0 == set1 .and. .not. set0 == set2 .and. .not. & +set1 == set2 ) then +write(*,*) 'Passed 64 bit equality tests.' +else +error stop 'Failed 64 bit equality tests.' +end if +end program demo_equality diff --git a/test/examples/bitsets/demo_extract.f90 b/test/examples/bitsets/demo_extract.f90 new file mode 100644 index 000000000..f3254ee5b --- /dev/null +++ b/test/examples/bitsets/demo_extract.f90 @@ -0,0 +1,10 @@ +program demo_extract +use stdlib_bitsets +type(bitset_large) :: set0, set1 +call set0 % init(166) +call set0 % set(100,150) +call extract( set1, set0, 100, 150) +if ( set1 % bits() == 51 ) & +write(*,*) 'SET1 has the proper size.' +if ( set1 % all() ) write(*,*) 'SET1 has the proper values.' +end program demo_extract diff --git a/test/examples/bitsets/demo_flip.f90 b/test/examples/bitsets/demo_flip.f90 new file mode 100644 index 000000000..bc7fc15f6 --- /dev/null +++ b/test/examples/bitsets/demo_flip.f90 @@ -0,0 +1,10 @@ +program demo_flip +use stdlib_bitsets +type(bitset_large) :: set0 +call set0 % init(166) +if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' +call set0 % flip(165) +if ( set0 % test(165) ) write(*,*) 'Bit 165 is flipped.' +call set0 % flip(0,164) +if ( set0 % all() ) write(*,*) 'All bits are flipped.' +end program demo_flip diff --git a/test/examples/bitsets/demo_from_string.f90 b/test/examples/bitsets/demo_from_string.f90 new file mode 100644 index 000000000..d2b63cf9c --- /dev/null +++ b/test/examples/bitsets/demo_from_string.f90 @@ -0,0 +1,17 @@ +program demo_from_string +use stdlib_bitsets +character(*), parameter :: & +bits_all = '111111111111111111111111111111111' +type(bitset_64) :: set0 +call set0 % from_string( bits_all ) +if ( bits(set0) /= 33 ) then +error stop "FROM_STRING failed to interpret " // & +'BITS_ALL's size properly." +else if ( .not. set0 % all() ) then +error stop "FROM_STRING failed to interpret" // & +"BITS_ALL's value properly." +else +write(*,*) "FROM_STRING transferred BITS_ALL properly" // & +" into set0." +end if +end program demo_from_string diff --git a/test/examples/bitsets/demo_ge.f90 b/test/examples/bitsets/demo_ge.f90 new file mode 100644 index 000000000..7b4db041c --- /dev/null +++ b/test/examples/bitsets/demo_ge.f90 @@ -0,0 +1,17 @@ +program demo_ge +use stdlib_bitsets +type(bitset_64) :: set0, set1, set2 +call set0 % init( 33 ) +call set1 % init( 33 ) +call set2 % init( 33 ) +call set1 % set( 0 ) +call set2 % set( 32 ) +if ( set1 >= set0 .and. set2 >= set1 .and. set2 >= set0 .and. & +set0 >= set0 .and. set1 >= set1 .and. set2 >= set2 .and. & +.not. set0 >= set1 .and. .not. set0 >= set2 .and. .not. & +set1 >= set2 ) then +write(*,*) 'Passed 64 bit greater than or equals tests.' +else +error stop 'Failed 64 bit greater than or equals tests.' +end if +end program demo_ge diff --git a/test/examples/bitsets/demo_gt.f90 b/test/examples/bitsets/demo_gt.f90 new file mode 100644 index 000000000..f595b1ac1 --- /dev/null +++ b/test/examples/bitsets/demo_gt.f90 @@ -0,0 +1,16 @@ +program demo_gt +use stdlib_bitsets +type(bitset_64) :: set0, set1, set2 +call set0 % init( 33 ) +call set1 % init( 33 ) +call set2 % init( 33 ) +call set1 % set( 0 ) +call set2 % set( 32 ) +if ( set1 > set0 .and. set2 > set1 .and. set2 > set0 .and. & +.not. set0 > set0 .and. .not. set0 > set1 .and. .not. & +set1 > set2 ) then +write(*,*) 'Passed 64 bit greater than tests.' +else +error stop 'Failed 64 bit greater than tests.' +end if +end program demo_gt diff --git a/test/examples/bitsets/demo_inequality.f90 b/test/examples/bitsets/demo_inequality.f90 new file mode 100644 index 000000000..1e3e9190b --- /dev/null +++ b/test/examples/bitsets/demo_inequality.f90 @@ -0,0 +1,16 @@ +program demo_inequality +use stdlib_bitsets +type(bitset_64) :: set0, set1, set2 +call set0 % init( 33 ) +call set1 % init( 33 ) +call set2 % init( 33 ) +call set1 % set( 0 ) +call set2 % set( 32 ) +if ( set0 /= set1 .and. set0 /= set2 .and. set1 /= set2 .and. & +.not. set0 /= set0 .and. .not. set1 /= set1 .and. .not. & +set2 /= set2 ) then +write(*,*) 'Passed 64 bit inequality tests.' +else +error stop 'Failed 64 bit inequality tests.' +end if +end program demo_inequality diff --git a/test/examples/bitsets/demo_init.f90 b/test/examples/bitsets/demo_init.f90 new file mode 100644 index 000000000..32f9a6abd --- /dev/null +++ b/test/examples/bitsets/demo_init.f90 @@ -0,0 +1,8 @@ +program demo_init +use stdlib_bitsets +type(bitset_large) :: set0 +call set0 % init(166) +if ( set0 % bits() == 166 ) & +write(*,*) 'SET0 has the proper size.' +if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' +end program demo_init diff --git a/test/examples/bitsets/demo_input.f90 b/test/examples/bitsets/demo_input.f90 new file mode 100644 index 000000000..ad7d55f40 --- /dev/null +++ b/test/examples/bitsets/demo_input.f90 @@ -0,0 +1,30 @@ +program demo_input +character(*), parameter :: & +bits_0 = '000000000000000000000000000000000', & +bits_1 = '000000000000000000000000000000001', & +bits_33 = '100000000000000000000000000000000' +integer :: unit +type(bitset_64) :: set0, set1, set2, set3, set4, set5 +call set0 % from_string( bits_0 ) +call set1 % from_string( bits_1 ) +call set2 % from_string( bits_33 ) +open( newunit=unit, file='test.bin', status='replace', & +form='unformatted', action='write' ) +call set2 % output(unit) +call set1 % output(unit) +call set0 % output(unit) +close( unit ) +open( newunit=unit, file='test.bin', status='old', & +form='unformatted', action='read' ) +call set5 % input(unit) +call set4 % input(unit) +call set3 % input(unit) +close( unit ) +if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then +error stop 'Transfer to and from units using ' // & +' output and input failed.' +else +write(*,*) 'Transfer to and from units using ' // & +'output and input succeeded.' +end if +end program demo_input diff --git a/test/examples/bitsets/demo_le.f90 b/test/examples/bitsets/demo_le.f90 new file mode 100644 index 000000000..3c39d902e --- /dev/null +++ b/test/examples/bitsets/demo_le.f90 @@ -0,0 +1,17 @@ +program demo_le +use stdlib_bitsets +type(bitset_64) :: set0, set1, set2 +call set0 % init( 33 ) +call set1 % init( 33 ) +call set2 % init( 33 ) +call set1 % set( 0 ) +call set2 % set( 32 ) +if ( set0 <= set1 .and. set1 <= set2 .and. set0 <= set2 .and. & +set0 <= set0 .and. set1 <= set1 .and. set2 <= set2 .and. & +.not. set1 <= set0 .and. .not. set2 <= set0 .and. .not. & +set2 <= set1 ) then +write(*,*) 'Passed 64 bit less than or equal tests.' +else +error stop 'Failed 64 bit less than or equal tests.' +end if +end program demo_le diff --git a/test/examples/bitsets/demo_lt.f90 b/test/examples/bitsets/demo_lt.f90 new file mode 100644 index 000000000..f357fdf62 --- /dev/null +++ b/test/examples/bitsets/demo_lt.f90 @@ -0,0 +1,16 @@ +program demo_lt +use stdlib_bitsets +type(bitset_64) :: set0, set1, set2 +call set0 % init( 33 ) +call set1 % init( 33 ) +call set2 % init( 33 ) +call set1 % set( 0 ) +call set2 % set( 32 ) +if ( set0 < set1 .and. set1 < set2 .and. set0 < set2 .and. & +.not. set0 < set0 .and. .not. set2 < set0 .and. .not. & +set2 < set1 ) then +write(*,*) 'Passed 64 bit less than tests.' +else +error stop 'Failed 64 bit less than tests.' +end if +end program demo_lt diff --git a/test/examples/bitsets/demo_none.f90 b/test/examples/bitsets/demo_none.f90 new file mode 100644 index 000000000..0de092a82 --- /dev/null +++ b/test/examples/bitsets/demo_none.f90 @@ -0,0 +1,15 @@ +program demo_none +use stdlib_bitsets +character(*), parameter :: & +bits_0 = '0000000000000000000' +type(bitset_large) :: set0 +call set0 % from_string( bits_0 ) +if ( set0 % none() ) then +write(*,*) "FROM_STRING interpreted " // & +"BITS_0's value properly." +end if +call set0 % set(5) +if ( .not. set0 % none() ) then +write(*,*) "NONE interpreted SET0's value properly." +end if +end program demo_none diff --git a/test/examples/bitsets/demo_not.f90 b/test/examples/bitsets/demo_not.f90 new file mode 100644 index 000000000..4a461834c --- /dev/null +++ b/test/examples/bitsets/demo_not.f90 @@ -0,0 +1,13 @@ +program demo_not +use stdlib_bitsets +type(bitset_large) :: set0 +call set0 % init( 155 ) +if ( set0 % none() ) then +write(*,*) "FROM_STRING interpreted " // & +"BITS_0's value properly." +end if +call set0 % not() +if ( set0 % all() ) then +write(*,*) "ALL interpreted SET0's value properly." +end if +end program demo_not diff --git a/test/examples/bitsets/demo_or.f90 b/test/examples/bitsets/demo_or.f90 new file mode 100644 index 000000000..e063466ee --- /dev/null +++ b/test/examples/bitsets/demo_or.f90 @@ -0,0 +1,18 @@ +program demo_or +use stdlib_bitsets +type(bitset_large) :: set0, set1 +call set0 % init(166) +call set1 % init(166) +call or( set0, set1 ) ! none none +if ( none(set0) ) write(*,*) 'First test of OR worked.' +call set0 % not() +call or( set0, set1 ) ! all none +if ( all(set0) ) write(*,*) 'Second test of OR worked.' +call set0 % not() +call set1 % not() +call or( set0, set1 ) ! none all +if ( all(set0) ) write(*,*) 'Third test of OR worked.' +call set0 % not() +call or( set0, set1 ) ! all all +if ( all(set0) ) write(*,*) 'Fourth test of OR worked.' +end program demo_or diff --git a/test/examples/bitsets/demo_output.f90 b/test/examples/bitsets/demo_output.f90 new file mode 100644 index 000000000..eb9b5045b --- /dev/null +++ b/test/examples/bitsets/demo_output.f90 @@ -0,0 +1,30 @@ +program demo_output +character(*), parameter :: & +bits_0 = '000000000000000000000000000000000', & +bits_1 = '000000000000000000000000000000001', & +bits_33 = '100000000000000000000000000000000' +integer :: unit +type(bitset_64) :: set0, set1, set2, set3, set4, set5 +call set0 % from_string( bits_0 ) +call set1 % from_string( bits_1 ) +call set2 % from_string( bits_33 ) +open( newunit=unit, file='test.bin', status='replace', & +form='unformatted', action='write' ) +call set2 % output(unit) +call set1 % output(unit) +call set0 % output(unit) +close( unit ) +open( newunit=unit, file='test.bin', status='old', & +form='unformatted', action='read' ) +call set5 % input(unit) +call set4 % input(unit) +call set3 % input(unit) +close( unit ) +if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then +error stop 'Transfer to and from units using ' // & +' output and input failed.' +else +write(*,*) 'Transfer to and from units using ' // & +'output and input succeeded.' +end if +end program demo_output diff --git a/test/examples/bitsets/demo_read_bitset.f90 b/test/examples/bitsets/demo_read_bitset.f90 new file mode 100644 index 000000000..307a14980 --- /dev/null +++ b/test/examples/bitsets/demo_read_bitset.f90 @@ -0,0 +1,33 @@ +program demo_read_bitset +character(*), parameter :: & +bits_0 = 'S33B000000000000000000000000000000000', & +bits_1 = 'S33B000000000000000000000000000000001', & +bits_33 = 'S33B100000000000000000000000000000000' +character(:), allocatable :: test_0, test_1, test_2 +integer :: unit +type(bitset_64) :: set0, set1, set2, set3, set4, set5 +call set0 % read_bitset( bits_0, status ) +call set1 % read_bitset( bits_1, status ) +call set2 % read_bitset( bits_2, status ) +call set0 % write_bitset( test_0, status ) +call set1 % write_bitset( test_1, status ) +call set2 % write_bitset( test_2, status ) +if ( bits_0 == test_0 .and. bits_1 == test_1 .and. & +bits_2 == test_2 ) then +write(*,*) 'READ_BITSET to WRITE_BITSET strings worked.' +end if +open( newunit=unit, file='test.txt', status='replace', & +form='formatted', action='write' ) +call set2 % write_bitset(unit, advance='no') +call set1 % write_bitset(unit, advance='no') +call set0 % write_bitset(unit) +close( unit ) +open( newunit=unit, file='test.txt', status='old', & +form='formatted', action='read' ) +call set3 % read_bitset(unit, advance='no') +call set4 % read_bitset(unit, advance='no') +call set5 % read_bitset(unit) +if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then +write(*,*) WRITE_BITSET to READ_BITSET through unit worked.' +end if +end program demo_read_bitset diff --git a/test/examples/bitsets/demo_set.f90 b/test/examples/bitsets/demo_set.f90 new file mode 100644 index 000000000..7ff429599 --- /dev/null +++ b/test/examples/bitsets/demo_set.f90 @@ -0,0 +1,10 @@ +program demo_set +use stdlib_bitsets +type(bitset_large) :: set0 +call set0 % init(166) +if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' +call set0 % set(165) +if ( set0 % test(165) ) write(*,*) 'Bit 165 is set.' +call set0 % set(0,164) +if ( set0 % all() ) write(*,*) 'All bits are set.' +end program demo_set diff --git a/test/examples/bitsets/demo_test.f90 b/test/examples/bitsets/demo_test.f90 new file mode 100644 index 000000000..a46f43ef3 --- /dev/null +++ b/test/examples/bitsets/demo_test.f90 @@ -0,0 +1,11 @@ +program demo_test +use stdlib_bitsets +type(bitset_large) :: set0 +call set0 % init(166) +call set0 % not() +if ( set0 % all() ) write(*,*) 'SET0 is properly initialized.' +call set0 % clear(165) +if ( .not. set0 % test(165) ) write(*,*) 'Bit 165 is cleared.' +call set0 % set(165) +if ( set0 % test(165) ) write(*,*) 'Bit 165 is set.' +end program demo_test diff --git a/test/examples/bitsets/demo_to_string.f90 b/test/examples/bitsets/demo_to_string.f90 new file mode 100644 index 000000000..99a2b5fc5 --- /dev/null +++ b/test/examples/bitsets/demo_to_string.f90 @@ -0,0 +1,14 @@ +program demo_to_string +use stdlib_bitsets +character(*), parameter :: & +bits_all = '111111111111111111111111111111111' +type(bitset_64) :: set0 +character(:), allocatable :: new_string +call set0 % init(33) +call set0 % not() +call set0 % to_string( new_string ) +if ( new_string == bits_all ) then +write(*,*) "TO_STRING transferred BITS0 properly" // & +" into NEW_STRING." +end if +end program demo_to_string diff --git a/test/examples/bitsets/demo_value.f90 b/test/examples/bitsets/demo_value.f90 new file mode 100644 index 000000000..e42e35bec --- /dev/null +++ b/test/examples/bitsets/demo_value.f90 @@ -0,0 +1,11 @@ +program demo_value +use stdlib_bitsets +type(bitset_large) :: set0 +call set0 % init(166) +call set0 % not() +if ( set0 % all() ) write(*,*) 'SET0 is properly initialized.' +call set0 % clear(165) +if ( set0 % value(165) == 0 ) write(*,*) 'Bit 165 is cleared.' +call set0 % set(165) +if ( set0 % value(165) == 1 ) write(*,*) 'Bit 165 is set.' +end program demo_value diff --git a/test/examples/bitsets/demo_write_bitset.f90 b/test/examples/bitsets/demo_write_bitset.f90 new file mode 100644 index 000000000..263850b32 --- /dev/null +++ b/test/examples/bitsets/demo_write_bitset.f90 @@ -0,0 +1,33 @@ +program demo_write_bitset +character(*), parameter :: & +bits_0 = 'S33B000000000000000000000000000000000', & +bits_1 = 'S33B000000000000000000000000000000001', & +bits_33 = 'S33B100000000000000000000000000000000' +character(:), allocatable :: test_0, test_1, test_2 +integer :: unit +type(bitset_64) :: set0, set1, set2, set3, set4, set5 +call set0 % read_bitset( bits_0, status ) +call set1 % read_bitset( bits_1, status ) +call set2 % read_bitset( bits_2, status ) +call set0 % write_bitset( test_0, status ) +call set1 % write_bitset( test_1, status ) +call set2 % write_bitset( test_2, status ) +if ( bits_0 == test_0 .and. bits_1 == test_1 .and. & +bits_2 == test_2 ) then +write(*,*) 'READ_BITSET to WRITE_BITSET strings worked.' +end if +open( newunit=unit, file='test.txt', status='replace', & +form='formatted', action='write' ) +call set2 % write_bitset(unit, advance='no') +call set1 % write_bitset(unit, advance='no') +call set0 % write_bitset(unit) +close( unit ) +open( newunit=unit, file='test.txt', status='old', & +form='formatted', action='read' ) +call set3 % read_bitset(unit, advance='no') +call set4 % read_bitset(unit, advance='no') +call set5 % read_bitset(unit) +if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then +write(*,*) WRITE_BITSET to READ_BITSET through unit worked.' +end if +end program demo_write_bitset diff --git a/test/examples/bitsets/demo_xor.f90 b/test/examples/bitsets/demo_xor.f90 new file mode 100644 index 000000000..df8338860 --- /dev/null +++ b/test/examples/bitsets/demo_xor.f90 @@ -0,0 +1,18 @@ +program demo_xor +use stdlib_bitsets +type(bitset_large) :: set0, set1 +call set0 % init(166) +call set1 % init(166) +call xor( set0, set1 ) ! none none +if ( none(set0) ) write(*,*) 'First test of XOR worked.' +call set0 % not() +call xor( set0, set1 ) ! all none +if ( all(set0) ) write(*,*) 'Second test of XOR worked.' +call set0 % not() +call set1 % not() +call xor( set0, set1 ) ! none all +if ( all(set0) ) write(*,*) 'Third test of XOR worked.' +call set0 % not() +call xor( set0, set1 ) ! all all +if ( none(set0) ) write(*,*) 'Fourth test of XOR worked.' +end program demo_xor diff --git a/test/examples/error/demo_check1.f90 b/test/examples/error/demo_check1.f90 new file mode 100644 index 000000000..707587b48 --- /dev/null +++ b/test/examples/error/demo_check1.f90 @@ -0,0 +1,7 @@ +program demo_check1 +use stdlib_error, only: check +implicit none +integer :: a = 1 +! If a /= 5, stops the program with exit code 1 and prints 'Check failed.' +call check(a == 5) +end program demo_check1 diff --git a/test/examples/error/demo_check2.f90 b/test/examples/error/demo_check2.f90 new file mode 100644 index 000000000..c6f58eeab --- /dev/null +++ b/test/examples/error/demo_check2.f90 @@ -0,0 +1,7 @@ +program demo_check2 +use stdlib_error, only: check +implicit none +integer :: a = 1 +! If a /= 5, stops the program with exit code 1 and prints 'a == 5 failed.' +call check(a == 5, msg='a == 5 failed.') +end program demo_check2 diff --git a/test/examples/error/demo_check3.f90 b/test/examples/error/demo_check3.f90 new file mode 100644 index 000000000..37cf1b639 --- /dev/null +++ b/test/examples/error/demo_check3.f90 @@ -0,0 +1,7 @@ +program demo_check3 +use stdlib_error, only: check +implicit none +integer :: a = 1 +! If a /= 5, prints 'a == 5 failed.', but doesn't stop the program. +call check(a == 5, msg='a == 5 failed.', warn=.true.) +end program demo_check3 diff --git a/test/examples/error/demo_check4.f90 b/test/examples/error/demo_check4.f90 new file mode 100644 index 000000000..54ce9073c --- /dev/null +++ b/test/examples/error/demo_check4.f90 @@ -0,0 +1,7 @@ +program demo_check4 +use stdlib_error, only: check +implicit none +integer :: a = 1 +! If a /= 5, stops the program with exit code 77 and prints 'a == 5 failed.' +call check(a == 5, msg='a == 5 failed.', code=77) +end program demo_check4 diff --git a/test/examples/error/demo_error_stop1.f90 b/test/examples/error/demo_error_stop1.f90 new file mode 100644 index 000000000..2e453077c --- /dev/null +++ b/test/examples/error/demo_error_stop1.f90 @@ -0,0 +1,5 @@ +program demo_error_stop1 +use stdlib_error, only: error_stop +implicit none +call error_stop("Invalid argument") +end program demo_error_stop1 diff --git a/test/examples/error/demo_error_stop2.f90 b/test/examples/error/demo_error_stop2.f90 new file mode 100644 index 000000000..61f18037b --- /dev/null +++ b/test/examples/error/demo_error_stop2.f90 @@ -0,0 +1,5 @@ +program demo_error_stop2 +use stdlib_error, only: error_stop +implicit none +call error_stop("Invalid argument", code = 123) +end program demo_error_stop2 diff --git a/test/examples/hash_procedures/demo_fibonacci_hash.f90 b/test/examples/hash_procedures/demo_fibonacci_hash.f90 new file mode 100644 index 000000000..784befda6 --- /dev/null +++ b/test/examples/hash_procedures/demo_fibonacci_hash.f90 @@ -0,0 +1,13 @@ +program demo_fibonacci_hash +use stdlib_hash_32bit, only: fibonacci_hash +use iso_fortran_env, only: int32 +implicit none +integer, allocatable :: array1(:) +integer(int32) :: hash, source +allocate( array1(0:2**6-1) ) +array1(:) = 0 +source = 42_int32 +hash = fibonacci_hash(source, 6) +array1(hash) = source +print *, hash +end program demo_fibonacci_hash diff --git a/test/examples/hash_procedures/demo_fibonacci_hash_64.f90 b/test/examples/hash_procedures/demo_fibonacci_hash_64.f90 new file mode 100644 index 000000000..a16fa8552 --- /dev/null +++ b/test/examples/hash_procedures/demo_fibonacci_hash_64.f90 @@ -0,0 +1,13 @@ +program demo_fibonacci_hash_64 +use stdlib_hash_64bit, only: fibonacci_hash +use iso_fortran_env, only: int64 +implicit none +integer, allocatable :: array1(:) +integer(int64) :: hash, source +allocate( array1(0:2**6-1) ) +array1(:) = 0 +source = int(Z'1FFFFFFFF', int64) +hash = fibonacci_hash(source, 6) +array1(hash) = source +print *, hash +end program demo_fibonacci_hash_64 diff --git a/test/examples/hash_procedures/demo_fnv_1_hash.f90 b/test/examples/hash_procedures/demo_fnv_1_hash.f90 new file mode 100644 index 000000000..31214cffd --- /dev/null +++ b/test/examples/hash_procedures/demo_fnv_1_hash.f90 @@ -0,0 +1,8 @@ +program demo_fnv_1_hash +use stdlib_hash_32bit, only: fnv_1_hash +use iso_fortran_env, only: int32 +implicit none +integer(int32) :: hash +hash = fnv_1_hash([ 5, 4, 3, 1, 10, 4, 9]) +print *, hash +end program demo_fnv_1_hash diff --git a/test/examples/hash_procedures/demo_fnv_1_hash_64.f90 b/test/examples/hash_procedures/demo_fnv_1_hash_64.f90 new file mode 100644 index 000000000..f3c4dde2c --- /dev/null +++ b/test/examples/hash_procedures/demo_fnv_1_hash_64.f90 @@ -0,0 +1,10 @@ +program demo_fnv_1_hash_64 +use stdlib_hash_64bit, only: fnv_1_hash +use iso_fortran_env, only: int64 +implicit none +integer, allocatable :: array1(:) +integer(int64) :: hash +array1 = [ 5, 4, 3, 1, 10, 4, 9] +hash = fnv_1_hash(array1) +print *, hash +end program demo_fnv_1_hash_64 diff --git a/test/examples/hash_procedures/demo_fnv_1a_hash.f90 b/test/examples/hash_procedures/demo_fnv_1a_hash.f90 new file mode 100644 index 000000000..28dad75ec --- /dev/null +++ b/test/examples/hash_procedures/demo_fnv_1a_hash.f90 @@ -0,0 +1,8 @@ +program demo_fnv_1a_hash +use stdlib_hash_32bit, only: fnv_1a_hash +use iso_fortran_env, only: int32 +implicit none +integer(int32) :: hash +hash = fnv_1a_hash( [ 5, 4, 3, 1, 10, 4, 9] ) +print *, hash +end program demo_fnv_1a_hash diff --git a/test/examples/hash_procedures/demo_fnv_1a_hash_64.f90 b/test/examples/hash_procedures/demo_fnv_1a_hash_64.f90 new file mode 100644 index 000000000..05e4fac28 --- /dev/null +++ b/test/examples/hash_procedures/demo_fnv_1a_hash_64.f90 @@ -0,0 +1,10 @@ +program demo_fnv_1a_hash_64 +use stdlib_hash_64bit, only: fnv_1a_hash +use iso_fortran_env, only: int64 +implicit none +integer, allocatable :: array1(:) +integer(int64) :: hash +array1 = [ 5, 4, 3, 1, 10, 4, 9] +hash = fnv_1a_hash(array1) +print *, hash +end program demo_fnv_1a_hash_64 diff --git a/test/examples/hash_procedures/demo_nmhash32.f90 b/test/examples/hash_procedures/demo_nmhash32.f90 new file mode 100644 index 000000000..f86cd6fc5 --- /dev/null +++ b/test/examples/hash_procedures/demo_nmhash32.f90 @@ -0,0 +1,11 @@ +program demo_nmhash32 +use stdlib_hash_32bit, only: nmhash32, & +new_nmhash32_seed +use iso_fortran_env, only: int32 +implicit none +integer(int32) :: hash +integer(int32) :: seed = 42_int32 +call new_nmhash32_seed(seed) +hash = nmhash32([ 5, 4, 3, 1, 10, 4, 9], seed) +print *, seed, hash +end program demo_nmhash32 diff --git a/test/examples/hash_procedures/demo_nmhash32x.f90 b/test/examples/hash_procedures/demo_nmhash32x.f90 new file mode 100644 index 000000000..a785d1e12 --- /dev/null +++ b/test/examples/hash_procedures/demo_nmhash32x.f90 @@ -0,0 +1,11 @@ +program demo_nmhash32x +use stdlib_hash_32bit, only: nmhash32x, & +new_nmhash32x_seed +use iso_fortran_env, only: int32 +implicit none +integer(int32) :: hash +integer(int32) :: seed = 42_int32 +call new_nmhash32x_seed(seed) +hash = nmhash32x([ 5, 4, 3, 1, 10, 4, 9], seed) +print *, seed, hash +end program demo_nmhash32x diff --git a/test/examples/hash_procedures/demo_pengy_hash.f90 b/test/examples/hash_procedures/demo_pengy_hash.f90 new file mode 100644 index 000000000..9c2fca0c0 --- /dev/null +++ b/test/examples/hash_procedures/demo_pengy_hash.f90 @@ -0,0 +1,13 @@ +program demo_pengy_hash +use stdlib_hash_64bit, only: new_pengy_hash_seed, pengy_hash +use iso_fortran_env, only: int32, int64 +implicit none +integer, allocatable :: key(:) +integer(int64) :: hash +integer(int32) :: seed +key = [ 0, 1, 2, 3 ] +seed = 0_int32 +call new_pengy_hash_seed( seed ) +hash = pengy_hash( key, seed ) +print *, seed, hash +end program demo_pengy_hash diff --git a/test/examples/hash_procedures/demo_spooky_hash.f90 b/test/examples/hash_procedures/demo_spooky_hash.f90 new file mode 100644 index 000000000..619e971b7 --- /dev/null +++ b/test/examples/hash_procedures/demo_spooky_hash.f90 @@ -0,0 +1,13 @@ +program demo_spooky_hash +use stdlib_hash_64bit, only: new_spooky_hash_seed, & +spooky_hash +use iso_fortran_env, only: int64 +implicit none +integer, allocatable :: key(:) +integer(int64) :: hash(2), seed(2) +key = [ 0, 1, 2, 3 ] +seed = [ 119_int64, 2_int64**41-1 ] +call new_spooky_hash_seed( seed ) +hash = spooky_hash( key, seed ) +print *, seed, hash +end program demo_spooky_hash diff --git a/test/examples/hash_procedures/demo_universal_mult_hash.f90 b/test/examples/hash_procedures/demo_universal_mult_hash.f90 new file mode 100644 index 000000000..080b554b3 --- /dev/null +++ b/test/examples/hash_procedures/demo_universal_mult_hash.f90 @@ -0,0 +1,18 @@ +program demo_universal_mult_hash +use stdlib_hash_32bit, only: odd_random_integer, & +universal_mult_hash +use iso_fortran_env, only: int32 +implicit none +integer, allocatable :: array1(:) +integer(int32) :: hash, i, seed, source +seed = 0 +allocate( array1(0:2**6-1) ) +do i = 0, 2**6-1 +array1(i) = i +end do +call odd_random_integer( seed ) +source = 42_int32 +hash = universal_mult_hash(source, seed, 6) +array1(hash) = source +print *, seed, hash, array1 +end program demo_universal_mult_hash diff --git a/test/examples/hash_procedures/demo_universal_mult_hash_64.f90 b/test/examples/hash_procedures/demo_universal_mult_hash_64.f90 new file mode 100644 index 000000000..430ff1b1b --- /dev/null +++ b/test/examples/hash_procedures/demo_universal_mult_hash_64.f90 @@ -0,0 +1,16 @@ +program demo_universal_mult_hash_64 +use stdlib_hash_32bit, only: odd_random_integer, & +universal_mult_hash +use iso_fortran_env, only: int64 +implicit none +integer, allocatable :: array1(:) +integer(int64) :: hash, i, seed, source +seed = 0 +allocate( array1(0:2**6-1) ) +array1 = 0 +call odd_random_integer( seed ) +source = 42_int64 +hash = universal_mult_hash(source, seed, 6) +array1(hash) = source +print *, seed, hash, array1 +end program demo_universal_mult_hash_64 diff --git a/test/examples/hash_procedures/demo_water_hash.f90 b/test/examples/hash_procedures/demo_water_hash.f90 new file mode 100644 index 000000000..8912b076f --- /dev/null +++ b/test/examples/hash_procedures/demo_water_hash.f90 @@ -0,0 +1,11 @@ +program demo_water_hash +use stdlib_hash_32bit, only: water_hash, & +new_water_hash_seed +use iso_fortran_env, only: int32, int64 +implicit none +integer(int32) :: hash +integer(int64) :: seed = 42_int64 +call new_water_hash_seed( seed ) +hash = water_hash([ 5, 4, 3, 1, 10, 4, 9], seed) +print *, hash, seed +end program demo_water_hash diff --git a/test/examples/hashmaps/demo_calls.f90 b/test/examples/hashmaps/demo_calls.f90 new file mode 100644 index 000000000..3940f39a0 --- /dev/null +++ b/test/examples/hashmaps/demo_calls.f90 @@ -0,0 +1,10 @@ +program demo_calls +use stdlib_hashmaps, only: chaining_hashmap_type, int_calls +use stdlib_hashmap_wrappers, only: fnv_1_hasher +implicit none +type(chaining_hashmap_type) :: map +type(int_calls) :: initial_calls +call map % init( fnv_1_hasher ) +initial_calls = map % calls() +print *, "INITIAL_CALLS = ", initial_calls +end program demo_calls diff --git a/test/examples/hashmaps/demo_copy_key.f90 b/test/examples/hashmaps/demo_copy_key.f90 new file mode 100644 index 000000000..44f2d8741 --- /dev/null +++ b/test/examples/hashmaps/demo_copy_key.f90 @@ -0,0 +1,12 @@ +program demo_copy_key +use stdlib_hashmap_wrappers, only: & +copy_key, operator(==), key_type +use iso_fortran_env, only: int8 +implicit none +integer(int8) :: i, value(15) +type(key_type) :: old_key, new_key +value = [(i, i = 1, 15)] +call set( key_out, value ) +call copy_key( key_out, new_key ) +print *, "old_key == new_key = ", old_key == new_key +end program demo_copy_key diff --git a/test/examples/hashmaps/demo_copy_other.f90 b/test/examples/hashmaps/demo_copy_other.f90 new file mode 100644 index 000000000..5e821dfdd --- /dev/null +++ b/test/examples/hashmaps/demo_copy_other.f90 @@ -0,0 +1,23 @@ +program demo_copy_other +use stdlib_hashmap_wrappers, only: & +copy_other, get, other_type, set +use iso_fortran_env, only: int8 +implicit none +type(other_type) :: other_in, other_out +integer(int_8) :: i +class(*), allocatable :: dummy +type dummy_type +integer(int8) :: value(15) +end type +type(dummy_type) :: dummy_val +do i=1, 15 +dummy_val % value1(i) = i +end do +allocate(other_in % value, source=dummy_val) +call copy_other( other_in, other_out ) +select type(other_out) + type(dummy_type) +print *, "other_in == other_out = ", & +all( dummy_val % value == other_out % value ) +end select +end program demo_copy_other diff --git a/test/examples/hashmaps/demo_entries.f90 b/test/examples/hashmaps/demo_entries.f90 new file mode 100644 index 000000000..bdb8bf672 --- /dev/null +++ b/test/examples/hashmaps/demo_entries.f90 @@ -0,0 +1,10 @@ +program demo_entries +use stdlib_hashmaps, only: open_hashmap_type, int_index +use stdlib_hashmap_wrappers, only: fnv_1_hasher +implicit none +type(open_hashmap_type) :: map +type(int_index) :: initial_entries +call map % init( fnv_1_hasher ) +initial_entries = map % entries () +print *, "INITIAL_ENTRIES = ", initial_entries +end program demo_entries diff --git a/test/examples/hashmaps/demo_equal_keys.f90 b/test/examples/hashmaps/demo_equal_keys.f90 new file mode 100644 index 000000000..5313fd63e --- /dev/null +++ b/test/examples/hashmaps/demo_equal_keys.f90 @@ -0,0 +1,14 @@ +program demo_equal_keys +use stdlib_hashmap_wrappers, only: & +copy_key, operator(==), key_type, set +use iso_fortran_env, only: int8 +implicit none +integer(int8) :: i, value(15) +type(key_type) :: old_key, new_key +do i=1, 15 +value(i) = i +end do +call set( old_key, value ) +call copy_key( old_key, new_key ) +print *, "old_key == new_key = ", old_key == new_key +end program demo_equal_keys diff --git a/test/examples/hashmaps/demo_fnv_1_hasher.f90 b/test/examples/hashmaps/demo_fnv_1_hasher.f90 new file mode 100644 index 000000000..7b93ef1ab --- /dev/null +++ b/test/examples/hashmaps/demo_fnv_1_hasher.f90 @@ -0,0 +1,13 @@ +program demo_fnv_1_hasher +use stdlib_hashmap_wrappers, only: & +fnv_1_hasher, key_type, set +use iso_fortran_env, only: int32 +implicit none +integer(int8), allocatable :: array1(:) +integer(int32) :: hash +type(key_type) :: key +array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] +call set( key, array1 ) +hash = fnv_1_hasher(key) +print *, hash +end program demo_fnv_1_hasher diff --git a/test/examples/hashmaps/demo_fnv_1a_hasher.f90 b/test/examples/hashmaps/demo_fnv_1a_hasher.f90 new file mode 100644 index 000000000..85ecb2853 --- /dev/null +++ b/test/examples/hashmaps/demo_fnv_1a_hasher.f90 @@ -0,0 +1,13 @@ +program demo_fnv_1a_hasher +use stdlib_hashmap_wrappers, only: & +fnv_1a_hasher, key_type, set +use iso_fortran_env, only: int32 +implicit none +integer(int8), allocatable :: array1(:) +integer(int32) :: hash +type(key_type) :: key +array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] +call set( key, array1 ) +hash = fnv_1a_hasher(key) +print *, hash +end program demo_fnv_1a_hasher diff --git a/test/examples/hashmaps/demo_free_key.f90 b/test/examples/hashmaps/demo_free_key.f90 new file mode 100644 index 000000000..e6b069ba6 --- /dev/null +++ b/test/examples/hashmaps/demo_free_key.f90 @@ -0,0 +1,12 @@ +program demo_free_key +use stdlib_hashmap_wrappers, only: & +copy_key, free_key, key_type, set +use iso_fortran_env, only: int8 +implicit none +integer(int8) :: i, value(15) +type(key_type) :: old_key, new_key +value = [(i, i=1, 15)] +call set( old_key, value ) +call copy_key( old_key, new_key ) +call free_key( old_key ) +end program demo_free_key diff --git a/test/examples/hashmaps/demo_free_other.f90 b/test/examples/hashmaps/demo_free_other.f90 new file mode 100644 index 000000000..42e21ce0c --- /dev/null +++ b/test/examples/hashmaps/demo_free_other.f90 @@ -0,0 +1,18 @@ +program demo_free_other +use stdlib_hashmap_wrappers, only: & +copy_other, free_other, other_type, set +use iso_fortran_env, only: int8 +implicit none +type dummy_type +integer(int8) :: value(15) +end type dummy_type +typer(dummy_type) :: dummy_val +type(other_type), allocatable :: other_in, other_out +integer(int_8) :: i +do i=1, 15 +dummy_val % value(i) = i +end do +allocate(other_in, source=dummy_val) +call copy_other( other_in, other_out ) +call free_other( other_out ) +end program demo_free_other diff --git a/test/examples/hashmaps/demo_get.f90 b/test/examples/hashmaps/demo_get.f90 new file mode 100644 index 000000000..f0438f4bb --- /dev/null +++ b/test/examples/hashmaps/demo_get.f90 @@ -0,0 +1,16 @@ +program demo_get +use stdlib_hashmap_wrappers, only: & +get, key_type, set +use iso_fortran_env, only: int8 +implicit none +integer(int8), allocatable :: value(:), result(:) +type(key_type) :: key +integer(int_8) :: i +allocate( value(1:15) ) +do i=1, 15 +value(i) = i +end do +call set( key, value ) +call get( key, result ) +print *, 'RESULT == VALUE = ', all( value == result ) +end program demo_get diff --git a/test/examples/hashmaps/demo_get_other_data.f90 b/test/examples/hashmaps/demo_get_other_data.f90 new file mode 100644 index 000000000..6cceb59e6 --- /dev/null +++ b/test/examples/hashmaps/demo_get_other_data.f90 @@ -0,0 +1,33 @@ +program demo_get_other_data +use, intrinsic:: iso_fortran_env, only: & +int8 +use stdlib_hashmaps, only: chaining_hashmap_type, int_index +use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type + logical :: conflict, exists +type(key_type) :: key +type(other_type) :: other +type(chaining_hashmap_type) :: map +type dummy_type +integer(int8) :: value(4) +end type dummy_type + type(dummy_type) :: dummy +class(*), allocatable :: data +dummy % value = [ 4_int8, 3_int8, 2_int8, 1_int8 ] +allocate( data, source=dummy ) +call map % init( fnv_1_hasher ) +call set( key, [ 0_int8, 1_int8, 2_int8, 3_int8, 4_int8 ] ) +call set( other, data ) +call map % map_entry( key, other, conflict ) +if ( .not. conflict ) then +call map % get_other_data( key, other ) +else +stop 'Key is already present in the map.' +end if +call get( other, data ) +select type( data ) +type (dummy_type) +print *, 'Other data % value = ', data % value +type default +print *, 'Invalid data type in other' +end select +end program demo_get_other_data diff --git a/test/examples/hashmaps/demo_hasher_fun.f90 b/test/examples/hashmaps/demo_hasher_fun.f90 new file mode 100644 index 000000000..067637620 --- /dev/null +++ b/test/examples/hashmaps/demo_hasher_fun.f90 @@ -0,0 +1,15 @@ +program demo_hasher_fun +use stdlib_hashmap_wrappers, only: & +fnv_1a_hasher, hasher_fun, set +use iso_fortran_env, only: int8, int32 +implicit none +type(hasher_fun), pointer :: hasher_pointer +integer(int8), allocatable :: array1(:) +integer(int32) :: hash +type(key_type) :: key +hasher_pointer => fnv_1a_hasher +array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] +call set( key, array1 ) +hash = hasher_pointer(key) +print *, hash +end program demo_hasher_fun diff --git a/test/examples/hashmaps/demo_init.f90 b/test/examples/hashmaps/demo_init.f90 new file mode 100644 index 000000000..cea6eb8ec --- /dev/null +++ b/test/examples/hashmaps/demo_init.f90 @@ -0,0 +1,7 @@ +program demo_init +use stdlib_hashmaps, only: chaining_map_type +use stdlib_hashmap_wrappers, only: fnv_1_hasher +type(fnv_1a_type) :: fnv_1 +type(chaining_map_type) :: map +call map % init( fnv_1a, slots_bits=10 ) +end program demo_init diff --git a/test/examples/hashmaps/demo_key_test.f90 b/test/examples/hashmaps/demo_key_test.f90 new file mode 100644 index 000000000..55d6780e7 --- /dev/null +++ b/test/examples/hashmaps/demo_key_test.f90 @@ -0,0 +1,13 @@ +program demo_key_test +use stdlib_kinds, only: int8 +use stdlib_hashmaps, only: chaining_hashmap_type +use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type +implicit none +type(chaining_hashmap_type) :: map +type(key_type) :: key +logocal :: present +call map % init( fnv_1_hasher ) +call set(key, [0_int8, 1_int8] ) +call map % key_test ( key, present ) +print *, "Initial key of 10 present for empty map = ", present +end program demo_key_test diff --git a/test/examples/hashmaps/demo_loading.f90 b/test/examples/hashmaps/demo_loading.f90 new file mode 100644 index 000000000..3079e3c7c --- /dev/null +++ b/test/examples/hashmaps/demo_loading.f90 @@ -0,0 +1,10 @@ +program demo_loading +use stdlib_hashmaps, only: open_hashmap_type +use stdlib_hashmap_wrappers, only: fnv_1_hasher +implicit none +type(open_hashmap_type) :: map +real :: ratio +call map % init( fnv_1_hasher ) +ratio = map % loading () +print *, "Initial loading = ", ratio +end program demo_loading diff --git a/test/examples/hashmaps/demo_map_entry.f90 b/test/examples/hashmaps/demo_map_entry.f90 new file mode 100644 index 000000000..25f651869 --- /dev/null +++ b/test/examples/hashmaps/demo_map_entry.f90 @@ -0,0 +1,16 @@ +program demo_map_entry +use, intrinsic:: iso_fortran_env, only: int8 +use stdlib_hashmaps, only: chaining_hashmap_type +use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type +type(chaining_hashmap_type) :: map +type(key_type) :: key +logical :: conflict +type(other_type) :: other +class(*), allocatable :: dummy +allocate( dummy, source=4 ) +call map % init( fnv_1_hasher, slots_bits=10 ) +call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) +call set( other, dummy ) +call map % map_entry( key, other, conflict ) +print *, 'CONFLICT = ', conflict +end program demo_map_entry diff --git a/test/examples/hashmaps/demo_num_slots.f90 b/test/examples/hashmaps/demo_num_slots.f90 new file mode 100644 index 000000000..a12774ae5 --- /dev/null +++ b/test/examples/hashmaps/demo_num_slots.f90 @@ -0,0 +1,10 @@ +program demo_num_slots +use stdlib_hashmaps, only: chaining_hashmap_type, int_index +use stdlib_hashmap_wrappers, only: fnv_1_hasher +implicit none +type(chaining_hashmap_type) :: map +integer(int_index) :: initial_slots +call map % init( fnv_1_hasher ) +initial_slots = map % num_slots () +print *, "Initial slots = ", initial_slots +end program num_slots diff --git a/test/examples/hashmaps/demo_probes.f90 b/test/examples/hashmaps/demo_probes.f90 new file mode 100644 index 000000000..a64a4565f --- /dev/null +++ b/test/examples/hashmaps/demo_probes.f90 @@ -0,0 +1,10 @@ +program demo_probes +use stdlib_hashmaps, only: chaining_hashmap_type, int_index +use stdlib_hashmap_wrappers: fnv_1_hasher +implicit none +type(chaining_hashmap_type) :: map +real :: nprobes +call map % init( fnv_1_hasher ) +nprobes = map % probes() +print *, "Initial probes = ", nprobes +end program demo_probes diff --git a/test/examples/hashmaps/demo_rehash.f90 b/test/examples/hashmaps/demo_rehash.f90 new file mode 100644 index 000000000..92a59731e --- /dev/null +++ b/test/examples/hashmaps/demo_rehash.f90 @@ -0,0 +1,15 @@ +program demo_rehash +use stdlib_hashmaps, only: open_hashmap_type +use stdlib_hasmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher,& +key_type, other_type +type(openn_hashmap_type) :: map +type(key_type) :: key +type(other_type) :: other +class(*), allocatable :: dummy +allocate( dummy, source='a dummy value' ) +call map % init( fnv_1_hasher, slots_bits=10 ) +call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) +call set( other, dummy ) +call map % map_entry( key, other ) +call map % rehash( fnv_1a_hasher ) +end program demo_rehash diff --git a/test/examples/hashmaps/demo_remove.f90 b/test/examples/hashmaps/demo_remove.f90 new file mode 100644 index 000000000..811b7c862 --- /dev/null +++ b/test/examples/hashmaps/demo_remove.f90 @@ -0,0 +1,17 @@ +program demo_remove +use stdlib_hashmaps, only: open_hashmap_type, int_index +use stdlib_hashmap_wrappers, only: fnv_1_hasher, & +fnv_1a_hasher, key_type, other_type +type(open_hashmap_type) :: map +type(key_type) :: key +type(other_type) :: other +logical :: existed +class(*), allocatable :: dummy +allocate( dummy, source=4.0 ) +call map % init( fnv_1_hasher, slots_bits=10 ) +call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) +call set( other, dummy ) +call map % map_entry( key, other ) +call map % remove( key, existed ) +print *, "Removed key existed = ", existed +end program demo_remove diff --git a/test/examples/hashmaps/demo_seeded_nmhash32_hasher.f90 b/test/examples/hashmaps/demo_seeded_nmhash32_hasher.f90 new file mode 100644 index 000000000..33fe75dc7 --- /dev/null +++ b/test/examples/hashmaps/demo_seeded_nmhash32_hasher.f90 @@ -0,0 +1,13 @@ +program demo_seeded_nmhash32_hasher +use stdlib_hashmap_wrappers, only: & +seeded_nmhash32_hasher, key_type, set +use iso_fortran_env, only: int32 +implicit none +integer(int8), allocatable :: array1(:) +integer(int32) :: hash +type(key_type) :: key +array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] +call set( key, array1 ) +hash = seeded_nmhash32_hasher (key) +print *, hash +end program demo_seeded_nmhash32_hasher diff --git a/test/examples/hashmaps/demo_seeded_nmhash32x_hasher.f90 b/test/examples/hashmaps/demo_seeded_nmhash32x_hasher.f90 new file mode 100644 index 000000000..92a10f832 --- /dev/null +++ b/test/examples/hashmaps/demo_seeded_nmhash32x_hasher.f90 @@ -0,0 +1,13 @@ +program demo_seeded_nmhash32x_hasher +use stdlib_hashmap_wrappers, only: & +seeded_nmhash32x_hasher, key_type, set +use iso_fortran_env, only: int32 +implicit none +integer(int8), allocatable :: array1(:) +integer(int32) :: hash +type(key_type) :: key +array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] +call set( key, array1 ) +hash = seeded_nmhash32x_hasher (key) +print *, hash +end program demo_seeded_nmhash32x_hasher diff --git a/test/examples/hashmaps/demo_seeded_water_hasher.f90 b/test/examples/hashmaps/demo_seeded_water_hasher.f90 new file mode 100644 index 000000000..7295f1144 --- /dev/null +++ b/test/examples/hashmaps/demo_seeded_water_hasher.f90 @@ -0,0 +1,13 @@ +program demo_seeded_water_hasher +use stdlib_hashmap_wrappers, only: & +seeded_water_hasher, key_type, set +use iso_fortran_env, only: int32 +implicit none +integer(int8), allocatable :: array1(:) +integer(int32) :: hash +type(key_type) :: key +array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] +call set( key, array1 ) +hash = seeded_water_hasher (key) +print *, hash +end program demo_seeded_water_hasher diff --git a/test/examples/hashmaps/demo_set.f90 b/test/examples/hashmaps/demo_set.f90 new file mode 100644 index 000000000..5628db501 --- /dev/null +++ b/test/examples/hashmaps/demo_set.f90 @@ -0,0 +1,16 @@ +program demo_set +use stdlib_hashmap_wrappers, only: & +get, key_type, set +use iso_fortran_env, only: int8 +implicit none +integer(int8), allocatable :: value(:), result(:) +type(key_type) :: key +integer(int_8) :: i +allocate( value(1:15) ) +do i=1, 15 +value(i) = i +end do +call set( key, value ) +call get( key, result ) +print *, 'RESULT == VALUE = ', all( value == result ) +end program demo_set diff --git a/test/examples/hashmaps/demo_set_other_data.f90 b/test/examples/hashmaps/demo_set_other_data.f90 new file mode 100644 index 000000000..81937fddd --- /dev/null +++ b/test/examples/hashmaps/demo_set_other_data.f90 @@ -0,0 +1,19 @@ +program demo_set_other_data +use stdlib_hashmaps, only: open_hashmap_type +use stdlib_hashmap_wrappers, only: fnv_1_hasher, & +fnv_1a_hasher, key_type, other_type, set +type(open_hashmap_type) :: map +type(key_type) :: key +type(other_type) :: other +class(*), allocatable :: dummy +call map % init( fnv_1_hasher, slots_bits=10 ) +allocate( dummy, source='A value` ) +call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) +call set( other, dummy ) +call map % map_entry( key, other ) +deallocate( dummy ) +allocate( dummy, source='Another value` ) +call set( other, dummy ) +call map % set_other_data( key, other, exists ) +print *, 'The entry to have its other data replaced exists = ', exists +end program demo_set_other_data diff --git a/test/examples/hashmaps/demo_slots_bits.f90 b/test/examples/hashmaps/demo_slots_bits.f90 new file mode 100644 index 000000000..389e8fea7 --- /dev/null +++ b/test/examples/hashmaps/demo_slots_bits.f90 @@ -0,0 +1,10 @@ +program demo_slots_bits +use stdlib_hashmaps, only: chaining_hashmap_type +use stdlib_hashmap_wrappers, only: fnv_1_hasher +implicit none +type(chaining_hashmap_type) :: map +integer :: bits +call map % init( fnv_1_hasher ) +bits = map % slots_bits () +print *, "Initial slot bits = ", bits +end program demo_slots_bits diff --git a/test/examples/hashmaps/demo_total_depth.f90 b/test/examples/hashmaps/demo_total_depth.f90 new file mode 100644 index 000000000..6b87d095d --- /dev/null +++ b/test/examples/hashmaps/demo_total_depth.f90 @@ -0,0 +1,10 @@ +program demo_total_depth +use stdlib_hashmaps, only: chaining_hashmap_type, int_depth +use stdlib_hashmap_wrappers, only: fnv_1_hasher +implicit none +type(chaining_hashmap_type) :: map +integer(int_depth) :: initial_depth +call map % init( fnv_1_hasher ) +initial_depth = map % total_depth () +print *, "Initial total depth = ", initial_depth +end program demo_total_depth diff --git a/test/examples/io/demo_fmt_constants.f90 b/test/examples/io/demo_fmt_constants.f90 new file mode 100644 index 000000000..2e52c0e26 --- /dev/null +++ b/test/examples/io/demo_fmt_constants.f90 @@ -0,0 +1,26 @@ +program demo_fmt_constants +use, stdlib_kinds, only : int32, int64, sp, dp +use stdlib_io, only : FMT_INT, FMT_REAL_SP, FMT_REAL_DP, FMT_COMPLEX_SP, FMT_COMPLEX_DP +implicit none + +integer(kind=int32) :: i32 +integer(kind=int64) :: i64 +real(kind=sp) :: r32 +real(kind=dp) :: r64 +complex(kind=sp) :: c32 +complex(kind=dp) :: c64 + +i32 = 100_int32 +i64 = 100_int64 +r32 = 100.0_sp +r64 = 100.0_dp +c32 = cmplx(100.0_sp, kind=sp) +c64 = cmplx(100.0_dp, kind=dp) + +print "(2("//FMT_INT//",1x))", i32, i64 ! outputs: 100 100 +print FMT_REAL_SP, r32 ! outputs: 1.00000000E+02 +print FMT_REAL_DP, r64 ! outputs: 1.0000000000000000E+002 +print FMT_COMPLEX_SP, c32 ! outputs: 1.00000000E+02 0.00000000E+00 +print FMT_COMPLEX_DP, c64 ! outputs: 1.0000000000000000E+002 0.0000000000000000E+000 + +end program demo_fmt_constants diff --git a/test/examples/io/demo_getline.f90 b/test/examples/io/demo_getline.f90 new file mode 100644 index 000000000..c197b2087 --- /dev/null +++ b/test/examples/io/demo_getline.f90 @@ -0,0 +1,13 @@ +program demo_getline +use, intrinsic :: iso_fortran_env, only : input_unit, output_unit +use stdlib_io, only: getline +implicit none +character(len=:), allocatable :: line +integer :: stat + +call getline(input_unit, line, stat) +do while(stat == 0) +write(output_unit, '(a)') line +call getline(input_unit, line, stat) +end do +end program demo_getline diff --git a/test/examples/io/demo_loadnpy.f90 b/test/examples/io/demo_loadnpy.f90 new file mode 100644 index 000000000..d7148af3d --- /dev/null +++ b/test/examples/io/demo_loadnpy.f90 @@ -0,0 +1,6 @@ +program demo_loadnpy +use stdlib_io_npy, only: load_npy +implicit none +real, allocatable :: x(:,:) +call loadtxt('example.npy', x) +end program demo_loadnpy diff --git a/test/examples/io/demo_loadtxt.f90 b/test/examples/io/demo_loadtxt.f90 new file mode 100644 index 000000000..55360f938 --- /dev/null +++ b/test/examples/io/demo_loadtxt.f90 @@ -0,0 +1,6 @@ +program demo_loadtxt +use stdlib_io, only: loadtxt +implicit none +real, allocatable :: x(:,:) +call loadtxt('example.dat', x) +end program demo_loadtxt diff --git a/test/examples/io/demo_open.f90 b/test/examples/io/demo_open.f90 new file mode 100644 index 000000000..7792ac425 --- /dev/null +++ b/test/examples/io/demo_open.f90 @@ -0,0 +1,8 @@ +program demo_open +use stdlib_io, only: open +implicit none +integer :: u +u = open('example.dat', 'wt') +write(u,'(a)')'This is an example for open' +close(u) +end program demo_open diff --git a/test/examples/io/demo_savenpy.f90 b/test/examples/io/demo_savenpy.f90 new file mode 100644 index 000000000..8cac2fe7d --- /dev/null +++ b/test/examples/io/demo_savenpy.f90 @@ -0,0 +1,6 @@ +program demo_savenpy +use stdlib_io_npy, only: save_npy +implicit none +real :: x(3,2) = 1 +call save_npy('example.npy', x) +end program demo_savenpy diff --git a/test/examples/io/demo_savetxt.f90 b/test/examples/io/demo_savetxt.f90 new file mode 100644 index 000000000..507a6b0a5 --- /dev/null +++ b/test/examples/io/demo_savetxt.f90 @@ -0,0 +1,6 @@ +program demo_savetxt +use stdlib_io, only: savetxt +implicit none +real :: x(3,2) = 1 +call savetxt('example.dat', x) +end program demo_savetxt diff --git a/test/examples/linalg/demo_diag1.f90 b/test/examples/linalg/demo_diag1.f90 new file mode 100644 index 000000000..5e1b5c4bf --- /dev/null +++ b/test/examples/linalg/demo_diag1.f90 @@ -0,0 +1,7 @@ +program demo_diag1 +use stdlib_linalg, only: diag +implicit none +real, allocatable :: A(:,:) +integer :: i +A = diag([(1,i=1,10)]) ! creates a 10 by 10 identity matrix +end program demo_diag1 diff --git a/test/examples/linalg/demo_diag2.f90 b/test/examples/linalg/demo_diag2.f90 new file mode 100644 index 000000000..35fee6e0c --- /dev/null +++ b/test/examples/linalg/demo_diag2.f90 @@ -0,0 +1,9 @@ +program demo_diag2 +use stdlib_linalg, only: diag +implicit none +real :: v(:) +real, allocatable :: A(:,:) +integer :: i +v = [1,2,3,4,5] +A = diag(v) ! creates a 5 by 5 matrix with elements of v on the diagonal +end program demo_diag2 diff --git a/test/examples/linalg/demo_diag3.f90 b/test/examples/linalg/demo_diag3.f90 new file mode 100644 index 000000000..c9d1814f0 --- /dev/null +++ b/test/examples/linalg/demo_diag3.f90 @@ -0,0 +1,11 @@ +program demo_diag3 +use stdlib_linalg, only: diag +implicit none +integer, parameter :: n = 10 +real :: c(n), ul(n-1) +real :: A(n,n) +integer :: i +c = 2 +ul = -1 +A = diag(ul,-1) + diag(c) + diag(ul,1) ! Gil Strang's favorite matrix +end program demo_diag3 diff --git a/test/examples/linalg/demo_diag4.f90 b/test/examples/linalg/demo_diag4.f90 new file mode 100644 index 000000000..078f1e406 --- /dev/null +++ b/test/examples/linalg/demo_diag4.f90 @@ -0,0 +1,10 @@ +program demo_diag4 +use stdlib_linalg, only: diag +implicit none +integer, parameter :: n = 12 +real :: A(n,n) +real :: v(n) +integer :: i +call random_number(A) +v = diag(A) ! v contains diagonal elements of A +end program demo_diag4 diff --git a/test/examples/linalg/demo_diag5.f90 b/test/examples/linalg/demo_diag5.f90 new file mode 100644 index 000000000..a066f3160 --- /dev/null +++ b/test/examples/linalg/demo_diag5.f90 @@ -0,0 +1,11 @@ +program demo_diag5 +use stdlib_linalg, only: diag +implicit none +integer, parameter :: n = 3 +real :: A(n,n) +real, allocatable :: v(:) +integer :: i +A = reshape([1,2,3,4,5,6,7,8,9],[n,n]) +v = diag(A,-1) ! v is [2,6] +v = diag(A,1) ! v is [4,8] +end program demo_diag5 diff --git a/test/examples/linalg/demo_eye1.f90 b/test/examples/linalg/demo_eye1.f90 new file mode 100644 index 000000000..5cdb828b6 --- /dev/null +++ b/test/examples/linalg/demo_eye1.f90 @@ -0,0 +1,14 @@ +program demo_eye1 +use stdlib_linalg, only: eye +implicit none +integer :: i(2,2) +real :: a(3,3) +real :: b(2,3) !! Matrix is non-square. +complex :: c(2,2) +I = eye(2) !! [1,0; 0,1] +A = eye(3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] +A = eye(3,3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] +B = eye(2,3) !! [1.0,0.0,0.0; 0.0,1.0,0.0] +C = eye(2,2) !! [(1.0,0.0),(0.0,0.0); (0.0,0.0),(1.0,0.0)] +C = (1.0,1.0)*eye(2,2) !! [(1.0,1.0),(0.0,0.0); (0.0,0.0),(1.0,1.0)] +end program demo_eye1 diff --git a/test/examples/linalg/demo_eye2.f90 b/test/examples/linalg/demo_eye2.f90 new file mode 100644 index 000000000..1f899f264 --- /dev/null +++ b/test/examples/linalg/demo_eye2.f90 @@ -0,0 +1,5 @@ +program demo_eye2 +use stdlib_linalg, only: eye, diag +implicit none +print *, all(eye(4) == diag([1,1,1,1])) ! prints .true. +end program demo_eye2 diff --git a/test/examples/linalg/demo_is_diagonal.f90 b/test/examples/linalg/demo_is_diagonal.f90 new file mode 100644 index 000000000..b1d56ada0 --- /dev/null +++ b/test/examples/linalg/demo_is_diagonal.f90 @@ -0,0 +1,10 @@ +program demo_is_diagonal +use stdlib_linalg, only: is_diagonal +implicit none +real :: A(2,2), B(2,2) +logical :: res +A = reshape([1., 0., 0., 4.], shape(A)) +B = reshape([1., 0., 3., 4.], shape(B)) +res = is_diagonal(A) ! returns .true. +res = is_diagonal(B) ! returns .false. +end program demo_is_diagonal diff --git a/test/examples/linalg/demo_is_hermitian.f90 b/test/examples/linalg/demo_is_hermitian.f90 new file mode 100644 index 000000000..6b52e8c80 --- /dev/null +++ b/test/examples/linalg/demo_is_hermitian.f90 @@ -0,0 +1,10 @@ +program demo_is_hermitian +use stdlib_linalg, only: is_hermitian +implicit none +complex :: A(2,2), B(2,2) +logical :: res +A = reshape([cmplx(1.,0.), cmplx(3.,-1.), cmplx(3.,1.), cmplx(4.,0.)], shape(A)) +B = reshape([cmplx(1.,0.), cmplx(3.,1.), cmplx(3.,1.), cmplx(4.,0.)], shape(B)) +res = is_hermitian(A) ! returns .true. +res = is_hermitian(B) ! returns .false. +end program demo_is_hermitian diff --git a/test/examples/linalg/demo_is_hessenberg.f90 b/test/examples/linalg/demo_is_hessenberg.f90 new file mode 100644 index 000000000..e1e84aee1 --- /dev/null +++ b/test/examples/linalg/demo_is_hessenberg.f90 @@ -0,0 +1,10 @@ +program demo_is_hessenberg +use stdlib_linalg, only: is_hessenberg +implicit none +real :: A(3,3), B(3,3) +logical :: res +A = reshape([1., 2., 0., 4., 5., 6., 7., 8., 9.], shape(A)) +B = reshape([1., 2., 3., 4., 5., 6., 7., 8., 9.], shape(B)) +res = is_hessenberg(A,'u') ! returns .true. +res = is_hessenberg(B,'u') ! returns .false. +end program demo_is_hessenberg diff --git a/test/examples/linalg/demo_is_skew_symmetric.f90 b/test/examples/linalg/demo_is_skew_symmetric.f90 new file mode 100644 index 000000000..bfcfae4a9 --- /dev/null +++ b/test/examples/linalg/demo_is_skew_symmetric.f90 @@ -0,0 +1,10 @@ +program demo_is_skew_symmetric +use stdlib_linalg, only: is_skew_symmetric +implicit none +real :: A(2,2), B(2,2) +logical :: res +A = reshape([0., -3., 3., 0.], shape(A)) +B = reshape([0., 3., 3., 0.], shape(B)) +res = is_skew_symmetric(A) ! returns .true. +res = is_skew_symmetric(B) ! returns .false. +end program demo_is_skew_symmetric diff --git a/test/examples/linalg/demo_is_square.f90 b/test/examples/linalg/demo_is_square.f90 new file mode 100644 index 000000000..fccaf5c01 --- /dev/null +++ b/test/examples/linalg/demo_is_square.f90 @@ -0,0 +1,10 @@ +program demo_is_square +use stdlib_linalg, only: is_square +implicit none +real :: A(2,2), B(3,2) +logical :: res +A = reshape([1., 2., 3., 4.], shape(A)) +B = reshape([1., 2., 3., 4., 5., 6.], shape(B)) +res = is_square(A) ! returns .true. +res = is_square(B) ! returns .false. +end program demo_is_square diff --git a/test/examples/linalg/demo_is_symmetric.f90 b/test/examples/linalg/demo_is_symmetric.f90 new file mode 100644 index 000000000..b4c1f8c7b --- /dev/null +++ b/test/examples/linalg/demo_is_symmetric.f90 @@ -0,0 +1,10 @@ +program demo_is_symmetric +use stdlib_linalg, only: is_symmetric +implicit none +real :: A(2,2), B(2,2) +logical :: res +A = reshape([1., 3., 3., 4.], shape(A)) +B = reshape([1., 0., 3., 4.], shape(B)) +res = is_symmetric(A) ! returns .true. +res = is_symmetric(B) ! returns .false. +end program demo_is_symmetric diff --git a/test/examples/linalg/demo_is_triangular.f90 b/test/examples/linalg/demo_is_triangular.f90 new file mode 100644 index 000000000..097bd59f7 --- /dev/null +++ b/test/examples/linalg/demo_is_triangular.f90 @@ -0,0 +1,10 @@ +program demo_is_triangular +use stdlib_linalg, only: is_triangular +implicit none +real :: A(3,3), B(3,3) +logical :: res +A = reshape([1., 0., 0., 4., 5., 0., 7., 8., 9.], shape(A)) +B = reshape([1., 0., 3., 4., 5., 0., 7., 8., 9.], shape(B)) +res = is_triangular(A,'u') ! returns .true. +res = is_triangular(B,'u') ! returns .false. +end program demo_is_triangular diff --git a/test/examples/linalg/demo_outer_product.f90 b/test/examples/linalg/demo_outer_product.f90 new file mode 100644 index 000000000..0a461958c --- /dev/null +++ b/test/examples/linalg/demo_outer_product.f90 @@ -0,0 +1,9 @@ +program demo_outer_product +use stdlib_linalg, only: outer_product +implicit none +real, allocatable :: A(:,:), u(:), v(:) +u = [1., 2., 3. ] +v = [3., 4.] +A = outer_product(u,v) +!A = reshape([3., 6., 9., 4., 8., 12.], [3,2]) +end program demo_outer_product diff --git a/test/examples/linalg/demo_trace.f90 b/test/examples/linalg/demo_trace.f90 new file mode 100644 index 000000000..8770f16d0 --- /dev/null +++ b/test/examples/linalg/demo_trace.f90 @@ -0,0 +1,7 @@ +program demo_trace +use stdlib_linalg, only: trace +implicit none +real :: A(3,3) +A = reshape([1,2,3,4,5,6,7,8,9],[3,3]) +print *, trace(A) ! 1 + 5 + 9 +end program demo_trace diff --git a/test/examples/logger/demo_add_log_unit.f90 b/test/examples/logger/demo_add_log_unit.f90 new file mode 100644 index 000000000..aea0365ec --- /dev/null +++ b/test/examples/logger/demo_add_log_unit.f90 @@ -0,0 +1,22 @@ +program demo_add_log_unit +use stdlib_logger, only: global_logger, read_only_error + +character(256) :: iomsg +integer :: iostat, unit, stat + +open( newunit=unit, 'error_log.txt', & +form='formatted', status='replace', & +position='rewind', err=999, & +action='read', iostat=iostat, iomsg=iomsg ) + +call global_logger % add_log_unit( unit, stat ) +select case ( stat ) + +case ( read_only_error ) +error stop 'Unable to write to "error_log.txt".' + +end select + +999 error stop 'Unable to open "error_log.txt". + +end program demo_add_log_unit diff --git a/test/examples/logger/demo_configure.f90 b/test/examples/logger/demo_configure.f90 new file mode 100644 index 000000000..6e1d676a7 --- /dev/null +++ b/test/examples/logger/demo_configure.f90 @@ -0,0 +1,6 @@ +program demo_configure +use stdlib_logger, only: global => global_logger + +call global % configure( indent=.false., max_width=72 ) + +end program demo_configure diff --git a/test/examples/logger/demo_global_logger.f90 b/test/examples/logger/demo_global_logger.f90 new file mode 100644 index 000000000..982f350ad --- /dev/null +++ b/test/examples/logger/demo_global_logger.f90 @@ -0,0 +1,12 @@ +program demo_global_logger +use stdlib_logger, global => global_logger + +integer :: unit, stat + +call global % add_log_file( 'error_log.txt', unit, & +position='asis', stat=stat ) +if ( stat /= success ) then +error stop 'Unable to open "error_log.txt".' +end if + +end program demo_global_logger diff --git a/test/examples/logger/demo_log_io_error.f90 b/test/examples/logger/demo_log_io_error.f90 new file mode 100644 index 000000000..7ffbc58be --- /dev/null +++ b/test/examples/logger/demo_log_io_error.f90 @@ -0,0 +1,20 @@ +program demo_log_io_error +use stdlib_logger, global=>global_logger + +character(*), parameter :: filename = 'dummy.txt' +integer :: iostat, lun +character(128) :: iomsg +character(*), parameter :: message = & + 'Failure in opening "dummy.txt".' + +open( newunit=lun, file = filename, form='formatted', & +status='old', iostat=iostat, iomsg=iomsg ) +if ( iostat /= 0 ) then +call global % log_io_error( message, & +procedure = 'EXAMPLE', & +iostat=iostat, & +iomsg = iomsg ) +error stop 'Error on opening a file' +end if + +end program demo_log_io_error diff --git a/test/examples/logger/demo_log_text_error.f90 b/test/examples/logger/demo_log_text_error.f90 new file mode 100644 index 000000000..cd1372147 --- /dev/null +++ b/test/examples/logger/demo_log_text_error.f90 @@ -0,0 +1,24 @@ +program demo_log_text_error +use stdlib_logger + +character(*), parameter :: filename = 'dummy.txt' +integer :: col_no, line_no, lun +character(128) :: line +character(*), parameter :: message = 'Bad text found.' + +open( newunit=lun, file = filename, statu='old', & + form='formatted' ) +line_no = 0 +do +read( lun, fmt='(a)', end=900 ) line +line_no = line_no + 1 +call check_line( line, status, col_no ) +if ( status /= 0 ) +call global_logger % log_text_error( line, & +col_no, message, filename, line_no ) +error stop 'Error in reading ' // filename +end if +end do +900 continue + +end program demo_log_text_error diff --git a/test/examples/math/demo_clip_integer.f90 b/test/examples/math/demo_clip_integer.f90 new file mode 100644 index 000000000..9c652e26d --- /dev/null +++ b/test/examples/math/demo_clip_integer.f90 @@ -0,0 +1,16 @@ +program demo_clip_integer +use stdlib_math, only: clip +use stdlib_kinds, only: int32 +implicit none +integer(int32) :: x +integer(int32) :: xmin +integer(int32) :: xmax +integer(int32) :: clipped_value + +xmin = -5_int32 +xmax = 5_int32 +x = 12_int32 + +clipped_value = clip(x, xmin, xmax) +! clipped_value <- 5 +end program demo_clip_integer diff --git a/test/examples/math/demo_clip_real.f90 b/test/examples/math/demo_clip_real.f90 new file mode 100644 index 000000000..0299e3593 --- /dev/null +++ b/test/examples/math/demo_clip_real.f90 @@ -0,0 +1,16 @@ +program demo_clip_real +use stdlib_math, only: clip +use stdlib_kinds, only: sp +implicit none +real(sp) :: x +real(sp) :: xmin +real(sp) :: xmax +real(sp) :: clipped_value + +xmin = -5.769_sp +xmax = 3.025_sp +x = 3.025_sp + +clipped_value = clip(x, xmin, xmax) +! clipped_value <- 3.02500010 +end program demo_clip_real diff --git a/test/examples/math/demo_diff.f90 b/test/examples/math/demo_diff.f90 new file mode 100644 index 000000000..50ebdf502 --- /dev/null +++ b/test/examples/math/demo_diff.f90 @@ -0,0 +1,22 @@ +program demo_diff + +use stdlib_math, only: diff +implicit none + +integer :: i(7) = [1, 1, 2, 3, 5, 8, 13] +real :: x(6) = [0, 5, 15, 30, 50, 75] +integer :: A(3, 3) = reshape([1, 7, 17, 3, 11, 19, 5, 13, 23], [3, 3]) +integer :: Y(3, 2) + +print *, diff(i) ! [0, 1, 1, 2, 3, 5] +print *, diff(x, 2) ! [5.0, 5.0, 5.0, 5.0] + +Y = diff(A, n=1, dim=2) +print *, Y(1, :) ! [2, 2] +print *, Y(2, :) ! [4, 2] +print *, Y(3, :) ! [2, 4] + +print *, diff(i, prepend=[0]) ! [1, 0, 1, 1, 2, 3, 5] +print *, diff(i, append=[21]) ! [0, 1, 1, 2, 3, 5, 8] + +end program demo_diff diff --git a/test/examples/math/demo_gcd.f90 b/test/examples/math/demo_gcd.f90 new file mode 100644 index 000000000..bbf4a872e --- /dev/null +++ b/test/examples/math/demo_gcd.f90 @@ -0,0 +1,9 @@ +program demo_gcd +use stdlib_math, only: gcd +implicit none +integer :: a, b, c + +a = 48 +b = 18 +c = gcd(a, b) ! returns 6 +end program demo_gcd diff --git a/test/examples/math/demo_linspace_complex.f90 b/test/examples/math/demo_linspace_complex.f90 new file mode 100644 index 000000000..d09db00b9 --- /dev/null +++ b/test/examples/math/demo_linspace_complex.f90 @@ -0,0 +1,12 @@ +program demo_linspace_complex +use stdlib_math, only: linspace +use stdlib_kinds, only: dp +implicit none + +complex(dp) :: start = complex(10.0_dp, 5.0_dp) +complex(dp) :: end = complex(-10.0_dp, 15.0_dp) + +complex(dp) :: z(11) + +z = linspace(start, end, 11) +end program demo_linspace_complex diff --git a/test/examples/math/demo_linspace_int16.f90 b/test/examples/math/demo_linspace_int16.f90 new file mode 100644 index 000000000..7f1cad33e --- /dev/null +++ b/test/examples/math/demo_linspace_int16.f90 @@ -0,0 +1,12 @@ +program demo_linspace_int16 +use stdlib_math, only: linspace +use stdlib_kinds, only: int16, dp +implicit none + +integer(int16) :: start = 10_int16 +integer(int16) :: end = 23_int16 + +real(dp) :: r(15) + +r = linspace(start, end, 15) +end program demo_linspace_int16 diff --git a/test/examples/math/demo_logspace_complex.f90 b/test/examples/math/demo_logspace_complex.f90 new file mode 100644 index 000000000..b3095d86b --- /dev/null +++ b/test/examples/math/demo_logspace_complex.f90 @@ -0,0 +1,12 @@ +program demo_logspace_complex +use stdlib_math, only: logspace +use stdlib_kinds, only: dp +implicit none + +complex(dp) :: start = (10.0_dp, 5.0_dp) +complex(dp) :: end = (-10.0_dp, 15.0_dp) + +complex(dp) :: z(11) ! Complex values raised to complex powers results in complex values + +z = logspace(start, end, 11) +end program demo_logspace_complex diff --git a/test/examples/math/demo_logspace_int.f90 b/test/examples/math/demo_logspace_int.f90 new file mode 100644 index 000000000..6627e41ac --- /dev/null +++ b/test/examples/math/demo_logspace_int.f90 @@ -0,0 +1,13 @@ +program demo_logspace_int +use stdlib_math, only: logspace +use stdlib_kinds, only: dp +implicit none + +integer :: start = 10 +integer :: end = 23 +integer :: n = 15 + +real(dp) :: r(n) ! Integer values raised to real powers results in real values + +r = logspace(start, end, n) +end program demo_logspace_int diff --git a/test/examples/math/demo_logspace_rstart_cbase.f90 b/test/examples/math/demo_logspace_rstart_cbase.f90 new file mode 100644 index 000000000..c4c641737 --- /dev/null +++ b/test/examples/math/demo_logspace_rstart_cbase.f90 @@ -0,0 +1,15 @@ +program demo_logspace_rstart_cbase +use stdlib_math, only: logspace +use stdlib_kinds, only: dp +implicit none + +real(dp) :: start = 0.0_dp +real(dp) :: end = 3.0_dp +integer :: n = 4 +complex(dp) :: base = (0.0_dp, 1.0_dp) + +complex(dp) :: z(n) ! complex values raised to real powers result in complex values + +z = logspace(start, end, n, base) + +end program demo_logspace_rstart_cbase diff --git a/test/examples/math/demo_math_all_close.f90 b/test/examples/math/demo_math_all_close.f90 new file mode 100644 index 000000000..dd8cf5238 --- /dev/null +++ b/test/examples/math/demo_math_all_close.f90 @@ -0,0 +1,15 @@ +program demo_math_all_close + +use stdlib_math, only: all_close +real :: x(2) = [1, 2], y, NAN +complex :: z(4, 4) + +y = -3 +NAN = sqrt(y) +z = (1.0, 1.0) + +print *, all_close(z+cmplx(1.0e-11, 1.0e-11), z) ! T +print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.) +! NAN, F, T + +end program demo_math_all_close diff --git a/test/examples/math/demo_math_arange.f90 b/test/examples/math/demo_math_arange.f90 new file mode 100644 index 000000000..da35792e4 --- /dev/null +++ b/test/examples/math/demo_math_arange.f90 @@ -0,0 +1,19 @@ +program demo_math_arange +use stdlib_math, only: arange + +print *, arange(3) ! [1,2,3] +print *, arange(-1) ! [1,0,-1] +print *, arange(0,2) ! [0,1,2] +print *, arange(1,-1) ! [1,0,-1] +print *, arange(0, 2, 2) ! [0,2] + +print *, arange(3.0) ! [1.0,2.0,3.0] +print *, arange(0.0,5.0) ! [0.0,1.0,2.0,3.0,4.0,5.0] +print *, arange(0.0,6.0,2.5) ! [0.0,2.5,5.0] + +print *, (1.0,1.0)*arange(3) ! [(1.0,1.0),(2.0,2.0),[3.0,3.0]] + +print *, arange(0.0,2.0,-2.0) ! [0.0,2.0]. Not recommended: `step` argument is negative! +print *, arange(0.0,2.0,0.0) ! [0.0,1.0,2.0]. Not recommended: `step` argument is zero! + +end program demo_math_arange diff --git a/test/examples/math/demo_math_arg.f90 b/test/examples/math/demo_math_arg.f90 new file mode 100644 index 000000000..eaca24141 --- /dev/null +++ b/test/examples/math/demo_math_arg.f90 @@ -0,0 +1,7 @@ +program demo_math_arg +use stdlib_math, only: arg +print *, arg((0.0, 0.0)) ! 0.0 +print *, arg((3.0, 4.0)) ! 0.927 +print *, arg(2.0*exp((0.0, 0.5))) ! 0.5 +print *, arg([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [π/2, 0.0, -π/2, π] +end program demo_math_arg diff --git a/test/examples/math/demo_math_argd.f90 b/test/examples/math/demo_math_argd.f90 new file mode 100644 index 000000000..5db939c55 --- /dev/null +++ b/test/examples/math/demo_math_argd.f90 @@ -0,0 +1,7 @@ +program demo_math_argd +use stdlib_math, only: argd +print *, argd((0.0, 0.0)) ! 0.0° +print *, argd((3.0, 4.0)) ! 53.1° +print *, argd(2.0*exp((0.0, 0.5))) ! 28.64° +print *, argd([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [90°, 0°, -90°, 180°] +end program demo_math_argd diff --git a/test/examples/math/demo_math_argpi.f90 b/test/examples/math/demo_math_argpi.f90 new file mode 100644 index 000000000..0b9491735 --- /dev/null +++ b/test/examples/math/demo_math_argpi.f90 @@ -0,0 +1,7 @@ +program demo_math_argpi +use stdlib_math, only: argpi +print *, argpi((0.0, 0.0)) ! 0.0 +print *, argpi((3.0, 4.0)) ! 0.295 +print *, argpi(2.0*exp((0.0, 0.5))) ! 0.159 +print *, argpi([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [0.5, 0.0, -0.5, 1.0] +end program demo_math_argpi diff --git a/test/examples/math/demo_math_is_close.f90 b/test/examples/math/demo_math_is_close.f90 new file mode 100644 index 000000000..f5f956e4d --- /dev/null +++ b/test/examples/math/demo_math_is_close.f90 @@ -0,0 +1,14 @@ +program demo_math_is_close + +use stdlib_math, only: is_close +real :: x(2) = [1, 2], y, NAN + +y = -3 +NAN = sqrt(y) + +print *, is_close(x,[real :: 1, 2.1]) ! [T, F] +print *, is_close(2.0, 2.1, abs_tol=0.1) ! T +print *, NAN, is_close(2.0, NAN), is_close(2.0, NAN, equal_nan=.true.) ! NAN, F, F +print *, is_close(NAN, NAN), is_close(NAN, NAN, equal_nan=.true.) ! F, T + +end program demo_math_is_close diff --git a/test/examples/optval/demo_optval.f90 b/test/examples/optval/demo_optval.f90 new file mode 100644 index 000000000..7d0516f75 --- /dev/null +++ b/test/examples/optval/demo_optval.f90 @@ -0,0 +1,14 @@ +program demo_optval +use stdlib_optval, only: optval +implicit none +print *, root(64.0) +! 8.0 +print *, root(64.0, 3) +! 4.0 +contains +real function root(x, n) + real, intent(in) :: x +integer, intent(in), optional :: n +root = x**(1.0/optval(n, 2)) +end function root +end program demo_optval diff --git a/test/examples/quadrature/demo_gauss_legendre.f90 b/test/examples/quadrature/demo_gauss_legendre.f90 new file mode 100644 index 000000000..aec9468f4 --- /dev/null +++ b/test/examples/quadrature/demo_gauss_legendre.f90 @@ -0,0 +1,9 @@ +program demo_gauss_legendre + use iso_fortran_env, dp => real64 + implicit none + + integer, parameter :: N = 6 + real(dp), dimension(N) :: x,w + call gauss_legendre(x,w) + print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) +end program demo_gauss_legendre diff --git a/test/examples/quadrature/demo_gauss_legendre_lobatto.f90 b/test/examples/quadrature/demo_gauss_legendre_lobatto.f90 new file mode 100644 index 000000000..9360d1591 --- /dev/null +++ b/test/examples/quadrature/demo_gauss_legendre_lobatto.f90 @@ -0,0 +1,9 @@ +program demo_gauss_legendre_lobatto + use iso_fortran_env, dp => real64 + implicit none + + integer, parameter :: N = 6 + real(dp), dimension(N) :: x,w + call gauss_legendre_lobatto(x,w) + print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) +end program demo_gauss_legendre_lobatto diff --git a/test/examples/quadrature/demo_simps.f90 b/test/examples/quadrature/demo_simps.f90 new file mode 100644 index 000000000..21303c577 --- /dev/null +++ b/test/examples/quadrature/demo_simps.f90 @@ -0,0 +1,10 @@ +program demo_simps +use stdlib_quadrature, only: simps +implicit none +real :: x(5) = [0., 1., 2., 3., 4.] +real :: y(5) = 3.*x**2 +print *, simps(y, x) +! 64.0 +print *, simps(y, 0.5) +! 32.0 +end program demo_simps diff --git a/test/examples/quadrature/demo_simps_weights.f90 b/test/examples/quadrature/demo_simps_weights.f90 new file mode 100644 index 000000000..264ff9757 --- /dev/null +++ b/test/examples/quadrature/demo_simps_weights.f90 @@ -0,0 +1,10 @@ +program demo_simps_weights +use stdlib_quadrature, only: simps_weights +implicit none +real :: x(5) = [0., 1., 2., 3., 4.] +real :: y(5) = 3.*x**2 +real :: w(5) +w = simps_weights(x) +print *, sum(w*y) +! 64.0 +end program demo_simps_weights diff --git a/test/examples/quadrature/demo_trapz.f90 b/test/examples/quadrature/demo_trapz.f90 new file mode 100644 index 000000000..dc08cdf5f --- /dev/null +++ b/test/examples/quadrature/demo_trapz.f90 @@ -0,0 +1,10 @@ +program demo_trapz +use stdlib_quadrature, only: trapz +implicit none +real :: x(5) = [0., 1., 2., 3., 4.] +real :: y(5) = x**2 +print *, trapz(y, x) +! 22.0 +print *, trapz(y, 0.5) +! 11.0 +end program demo_trapz diff --git a/test/examples/quadrature/demo_trapz_weights.f90 b/test/examples/quadrature/demo_trapz_weights.f90 new file mode 100644 index 000000000..eff0a0f9c --- /dev/null +++ b/test/examples/quadrature/demo_trapz_weights.f90 @@ -0,0 +1,11 @@ +program demo_trapz_weights +use stdlib_quadrature, only: trapz_weights +implicit none +real :: x(5) = [0., 1., 2., 3., 4.] +real :: y(5) = x**2 +real :: w(5) +w = trapz_weights(x) +print *, sum(w*y) +! 22.0 +end program demo_trapz_weights + diff --git a/test/examples/random/demo_dist_rand.f90 b/test/examples/random/demo_dist_rand.f90 new file mode 100644 index 000000000..9d2dfa962 --- /dev/null +++ b/test/examples/random/demo_dist_rand.f90 @@ -0,0 +1,16 @@ +program demo_dist_rand +use stdlib_random, only : dist_rand, random_seed +implicit none +integer :: put, get + +put = 135792468 +call random_seed(put, get) ! set and get current value of seed +print *, dist_rand(1_int8) ! random integer in [-2^7, 2^7 - 1] +! -90 +print *, dist_rand(1_int16) ! random integer in [-2^15, 2^15 - 1] +! -32725 +print *, dist_rand(1_int32) ! random integer in [-2^31, 2^31 - 1] +! -1601563881 +print *, dist_rand(1_int64) ! random integer in [-2^63, 2^63 - 1] +! 180977695517992208 +end program demo_dist_rand diff --git a/test/examples/random/demo_random_seed.f90 b/test/examples/random/demo_random_seed.f90 new file mode 100644 index 000000000..28558f7f5 --- /dev/null +++ b/test/examples/random/demo_random_seed.f90 @@ -0,0 +1,8 @@ +program demo_random_seed +use stdlib_random, only : random_seed +implicit none +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) ! set and get current value of seed +end program demo_random_seed diff --git a/test/examples/selection/demo_arg_select.f90 b/test/examples/selection/demo_arg_select.f90 new file mode 100644 index 000000000..acb80a73c --- /dev/null +++ b/test/examples/selection/demo_arg_select.f90 @@ -0,0 +1,29 @@ +program demo_arg_select +use stdlib_selection, only: arg_select +implicit none + +real, allocatable :: array(:) +integer, allocatable :: indx(:) +integer :: kth_smallest +integer :: k, left, right + +array = [3., 2., 7., 4., 5., 1., 4., -1.] +indx = [( k, k = 1, size(array) )] + +k = 2 +call arg_select(array, indx, k, kth_smallest) +print*, array(kth_smallest) ! print 1.0 + +k = 7 +! Due to the previous call to arg_select, we know for sure this is in an +! index >= 2 +call arg_select(array, indx, k, kth_smallest, left=2) +print*, array(kth_smallest) ! print 5.0 + +k = 6 +! Due to the previous two calls to arg_select, we know for sure this is in +! an index >= 2 and <= 7 +call arg_select(array, indx, k, kth_smallest, left=2, right=7) +print*, array(kth_smallest) ! print 4.0 + +end program demo_arg_select diff --git a/test/examples/selection/demo_select.f90 b/test/examples/selection/demo_select.f90 new file mode 100644 index 000000000..ad903b0f0 --- /dev/null +++ b/test/examples/selection/demo_select.f90 @@ -0,0 +1,27 @@ +program demo_select +use stdlib_selection, only: select +implicit none + +real, allocatable :: array(:) +real :: kth_smallest +integer :: k, left, right + +array = [3., 2., 7., 4., 5., 1., 4., -1.] + +k = 2 +call select(array, k, kth_smallest) +print*, kth_smallest ! print 1.0 + +k = 7 +! Due to the previous call to select, we know for sure this is in an +! index >= 2 +call select(array, k, kth_smallest, left=2) +print*, kth_smallest ! print 5.0 + +k = 6 +! Due to the previous two calls to select, we know for sure this is in +! an index >= 2 and <= 7 +call select(array, k, kth_smallest, left=2, right=7) +print*, kth_smallest ! print 4.0 + +end program demo_select diff --git a/test/examples/selection/selection_vs_sort.f90 b/test/examples/selection/selection_vs_sort.f90 new file mode 100644 index 000000000..03b92dff3 --- /dev/null +++ b/test/examples/selection/selection_vs_sort.f90 @@ -0,0 +1,77 @@ +program selection_vs_sort +use stdlib_kinds, only: dp, sp, int64 +use stdlib_selection, only: select, arg_select +use stdlib_sorting, only: sort +implicit none + +call compare_select_sort_for_median(1) +call compare_select_sort_for_median(11) +call compare_select_sort_for_median(101) +call compare_select_sort_for_median(1001) +call compare_select_sort_for_median(10001) +call compare_select_sort_for_median(100001) + +contains +subroutine compare_select_sort_for_median(N) +integer, intent(in) :: N + +integer :: i, k, result_arg_select, indx(N), indx_local(N) +real :: random_vals(N), local_random_vals(N) +integer, parameter :: test_reps = 100 +integer(int64) :: t0, t1 +real :: result_sort, result_select +integer(int64) :: time_sort, time_select, time_arg_select +logical :: select_test_passed, arg_select_test_passed + +! Ensure N is odd +if(mod(N, 2) /= 1) stop + +time_sort = 0 +time_select = 0 +time_arg_select = 0 + +select_test_passed = .true. +arg_select_test_passed = .true. + +indx = (/( i, i = 1, N) /) + +k = (N+1)/2 ! Deliberate integer division + +do i = 1, test_reps +call random_number(random_vals) + +! Compute the median with sorting +local_random_vals = random_vals +call system_clock(t0) +call sort(local_random_vals) +result_sort = local_random_vals(k) +call system_clock(t1) +time_sort = time_sort + (t1 - t0) + +! Compute the median with selection, assuming N is odd +local_random_vals = random_vals +call system_clock(t0) +call select(local_random_vals, k, result_select) +call system_clock(t1) +time_select = time_select + (t1 - t0) + +! Compute the median with arg_select, assuming N is odd +local_random_vals = random_vals +indx_local = indx +call system_clock(t0) +call arg_select(local_random_vals, indx_local, k, result_arg_select) +call system_clock(t1) +time_arg_select = time_arg_select + (t1 - t0) + +if(result_select /= result_sort) select_test_passed = .FALSE. +if(local_random_vals(result_arg_select) /= result_sort) arg_select_test_passed = .FALSE. +end do + +print*, "select ; N=", N, '; ', merge('PASS', 'FAIL', select_test_passed), & +'; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_select) +print*, "arg_select; N=", N, '; ', merge('PASS', 'FAIL', arg_select_test_passed), & +'; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_arg_select) + +end subroutine + +end program diff --git a/test/examples/sorting/demo_ord_sort.f90 b/test/examples/sorting/demo_ord_sort.f90 new file mode 100644 index 000000000..1039ee662 --- /dev/null +++ b/test/examples/sorting/demo_ord_sort.f90 @@ -0,0 +1,10 @@ +program demo_ord_sort +use stdlib_sorting, only: ord_sort +implicit none +integer, allocatable :: array1(:), work(:) + +array1 = [ 5, 4, 3, 1, 10, 4, 9] +allocate(work, mold = array1) +call ord_sort(array1, work) +print*, array1 !print [1, 3, 4, 4, 5, 9, 10] +end program demo_ord_sort diff --git a/test/examples/sorting/demo_sort.f90 b/test/examples/sorting/demo_sort.f90 new file mode 100644 index 000000000..b89d7ee99 --- /dev/null +++ b/test/examples/sorting/demo_sort.f90 @@ -0,0 +1,9 @@ +program demo_sort +use stdlib_sorting, only: sort +implicit none +integer, allocatable :: array(:) + +array = [ 5, 4, 3, 1, 10, 4, 9] +call sort(array) +print*, array !print [1, 3, 4, 4, 5, 9, 10] +end program demo_sort diff --git a/test/examples/specialfunctions_gamma/demo_gamma.f90 b/test/examples/specialfunctions_gamma/demo_gamma.f90 new file mode 100644 index 000000000..cab60aee5 --- /dev/null +++ b/test/examples/specialfunctions_gamma/demo_gamma.f90 @@ -0,0 +1,37 @@ +program demo_gamma +use stdlib_kinds, only : dp, int64 +use stdlib_specialfunctions_gamma, only : gamma +implicit none + +integer :: i +integer(int64) :: n +real :: x +real(dp) :: y +complex :: z +complex(dp) :: z1 + +i = 10 +n = 15_int64 +x = 2.5 +y = 4.3_dp +z = (2.3, 0.6) +z1 = (-4.2_dp, 3.1_dp) + +print *, gamma(i) !integer gives exact result +! 362880 + +print *, gamma(n) +! 87178291200 + +print *, gamma(x) ! intrinsic function call +! 1.32934034 + +print *, gamma(y) ! intrinsic function call +! 8.8553433604540341 + +print *, gamma(z) +! (0.988054395, 0.383354813) + +print *, gamma(z1) +! (-2.78916032990983999E-005, 9.83164600163221218E-006) +end program demo_gamma diff --git a/test/examples/specialfunctions_gamma/demo_gamma_p.f90 b/test/examples/specialfunctions_gamma/demo_gamma_p.f90 new file mode 100644 index 000000000..10578df07 --- /dev/null +++ b/test/examples/specialfunctions_gamma/demo_gamma_p.f90 @@ -0,0 +1,8 @@ +program demo_gamma_p +use stdlib_specialfunctions_gamma, only : rgp => regularized_gamma_p +implicit none + +print *, rgp(3.0, 5.0) + +! 0.875347972 +end program demo_gamma_p diff --git a/test/examples/specialfunctions_gamma/demo_gamma_q.f90 b/test/examples/specialfunctions_gamma/demo_gamma_q.f90 new file mode 100644 index 000000000..49eafa550 --- /dev/null +++ b/test/examples/specialfunctions_gamma/demo_gamma_q.f90 @@ -0,0 +1,8 @@ +program demo_gamma_q +use stdlib_specialfunctions_gamma, only : rgq => regularized_gamma_q +implicit none + +print *, rgq(3.0, 5.0) + +! 0.124652028 +end program demo_gamma_q diff --git a/test/examples/specialfunctions_gamma/demo_ligamma.f90 b/test/examples/specialfunctions_gamma/demo_ligamma.f90 new file mode 100644 index 000000000..b3de02fad --- /dev/null +++ b/test/examples/specialfunctions_gamma/demo_ligamma.f90 @@ -0,0 +1,16 @@ +program demo_ligamma +use stdlib_specialfunctions_gamma, only : lig => lower_incomplete_gamma +implicit none +integer :: p +real :: p1, x + +p = 3 +p1 = 2.3 +print *, lig(p, -5.0) + +! -2521.02417 + +print *, lig(p1, 5.0) + +! 1.09715652 +end demo_ligamma diff --git a/test/examples/specialfunctions_gamma/demo_log_factorial.f90 b/test/examples/specialfunctions_gamma/demo_log_factorial.f90 new file mode 100644 index 000000000..3fd76f54f --- /dev/null +++ b/test/examples/specialfunctions_gamma/demo_log_factorial.f90 @@ -0,0 +1,15 @@ +program demo_log_factorial +use stdlib_kinds, only : int64 +use stdlib_specialfunctions_gamma, only : lf => log_factorial +implicit none +integer :: n + +n = 10 +print *, lf(n) + +! 15.1044130 + +print *, lf(35_int64) + +! 92.1361771 +end program demo_log_factorial diff --git a/test/examples/specialfunctions_gamma/demo_log_gamma.f90 b/test/examples/specialfunctions_gamma/demo_log_gamma.f90 new file mode 100644 index 000000000..c6d70910a --- /dev/null +++ b/test/examples/specialfunctions_gamma/demo_log_gamma.f90 @@ -0,0 +1,35 @@ +program demo_log_gamma +use stdlib_kinds, only : dp +use stdlib_specialfunctions_gamma, only : log_gamma +implicit none + +integer :: i +real :: x +real(dp) :: y +complex :: z +complex(dp) :: z1 + +i = 10 +x = 8.76 +y = x +z = (5.345, -3.467) +z1 = z +print *, log_gamma(i) !default single precision output +!12.8018274 + +print *, log_gamma(x) !intrinsic function call + +!10.0942659 + +print *, log_gamma(y) !intrinsic function call + +!10.094265528673880 + +print *, log_gamma(z) !same kind as input + +!(2.56165648, -5.73382425) + +print *, log_gamma(z1) + +!(2.5616575105114614, -5.7338247782852498) +end program demo_log_gamma diff --git a/test/examples/specialfunctions_gamma/demo_uigamma.f90 b/test/examples/specialfunctions_gamma/demo_uigamma.f90 new file mode 100644 index 000000000..3ce99bd89 --- /dev/null +++ b/test/examples/specialfunctions_gamma/demo_uigamma.f90 @@ -0,0 +1,12 @@ +program demo_uigamma +use stdlib_specialfunctions_gamma, only : uig => upper_incomplete_gamma +implicit none + +print *, uig(3, -5.0) + +!2523.02295 + +print *, uig(2.3, 5.0) + +!6.95552528E-02 +end program demo_uigamma diff --git a/test/examples/stats/demo_corr.f90 b/test/examples/stats/demo_corr.f90 new file mode 100644 index 000000000..841b6804b --- /dev/null +++ b/test/examples/stats/demo_corr.f90 @@ -0,0 +1,8 @@ +program demo_corr +use stdlib_stats, only: corr +implicit none +real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] +real :: y(1:2, 1:3) = reshape([ -1., 40., -3., 4., 10., 6. ], [ 2, 3]) +print *, corr(x, 1) !returns 1. +print *, corr(y, 2) !returns reshape([ 1., -.32480, -.32480, 1. ], [ 2, 3]) +end program demo_corr diff --git a/test/examples/stats/demo_cov.f90 b/test/examples/stats/demo_cov.f90 new file mode 100644 index 000000000..56637e82f --- /dev/null +++ b/test/examples/stats/demo_cov.f90 @@ -0,0 +1,9 @@ +program demo_cov +use stdlib_stats, only: cov +implicit none +real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] +real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) +print *, cov(x, 1) !returns 3.5 +print *, cov(x, 1, corrected = .false.) !returns 2.9167 +print *, cov(y, 1) !returns a square matrix of size 3 with all elements equal to 0.5 +end program demo_cov diff --git a/test/examples/stats/demo_mean.f90 b/test/examples/stats/demo_mean.f90 new file mode 100644 index 000000000..d5a0cd702 --- /dev/null +++ b/test/examples/stats/demo_mean.f90 @@ -0,0 +1,10 @@ +program demo_mean +use stdlib_stats, only: mean +implicit none +real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] +real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) +print *, mean(x) !returns 3.5 +print *, mean(y) !returns 3.5 +print *, mean(y, 1) !returns [ 1.5, 3.5, 5.5 ] +print *, mean(y, 1,y > 3.) !returns [ NaN, 4.0, 5.5 ] +end program demo_mean diff --git a/test/examples/stats/demo_median.f90 b/test/examples/stats/demo_median.f90 new file mode 100644 index 000000000..0025f8fd5 --- /dev/null +++ b/test/examples/stats/demo_median.f90 @@ -0,0 +1,10 @@ +program demo_median +use stdlib_stats, only: median +implicit none +real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] +real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) +print *, median(x) !returns 3.5 +print *, median(y) !returns 3.5 +print *, median(y, 1) !returns [ 1.5, 3.5, 5.5 ] +print *, median(y, 1,y > 3.) !returns [ NaN, 4.0, 5.5 ] +end program demo_median diff --git a/test/examples/stats/demo_moment.f90 b/test/examples/stats/demo_moment.f90 new file mode 100644 index 000000000..70753108e --- /dev/null +++ b/test/examples/stats/demo_moment.f90 @@ -0,0 +1,12 @@ +program demo_moment +use stdlib_stats, only: moment +implicit none +real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] +real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) +print *, moment(x, 2) !returns 2.9167 +print *, moment(y, 2) !returns 2.9167 +print *, moment(y, 2, 1) !returns [0.25, 0.25, 0.25] +print *, moment(y, 2, 1, mask = (y > 3.)) !returns [NaN, 0., 0.25] +print *, moment(x, 2, center = 0.) !returns 15.1667 +print *, moment(y, 1, 1, center = 0.) !returns [1.5, 3.5, 5.5] +end program demo_moment diff --git a/test/examples/stats/demo_var.f90 b/test/examples/stats/demo_var.f90 new file mode 100644 index 000000000..2357ae9d5 --- /dev/null +++ b/test/examples/stats/demo_var.f90 @@ -0,0 +1,12 @@ +program demo_var +use stdlib_stats, only: var +implicit none +real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] +real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) +print *, var(x) !returns 3.5 +print *, var(x, corrected = .false.) !returns 2.9167 +print *, var(y) !returns 3.5 +print *, var(y, 1) !returns [0.5, 0.5, 0.5] +print *, var(y, 1, y > 3.) !returns [NaN, NaN, 0.5] +print *, var(y, 1, y > 3., corrected=.false.) !returns [NaN, 0., 0.25] +end program demo_var diff --git a/test/examples/stats_distribution_exponential/demo_exponential_cdf.f90 b/test/examples/stats_distribution_exponential/demo_exponential_cdf.f90 new file mode 100644 index 000000000..e9348c651 --- /dev/null +++ b/test/examples/stats_distribution_exponential/demo_exponential_cdf.f90 @@ -0,0 +1,41 @@ +program demo_exponential_cdf +use stdlib_random, only : random_seed +use stdlib_stats_distribution_exponential, only : exp_cdf => cdf_exp, & +rexp => rvs_exp + +implicit none +real :: x(2,3,4),a(2,3,4) +complex :: scale +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) + +print *, exp_cdf(1.0, 1.0) ! a standard exponential cumulative at 1.0 + +! 0.632120550 + +print *, exp_cdf(2.0, 2.0) ! a cumulative at 2.0 with lambda=2 + +! 0.981684387 + +x = reshape(rexp(0.5, 24),[2,3,4]) +! standard exponential random variates array +a(:,:,:) = 0.5 +print *, exp_cdf(x, a) ! a rank 3 array of standard exponential cumulative + +! 8.57694745E-02 9.70223546E-02 1.52170658E-02 2.95336246E-02 +! 0.107568979 0.196659625 2.97447443E-02 0.366151094 0.163051903 +! 3.36527228E-02 0.385267735 0.428375721 0.103964329 0.147119939 +! 0.192206264 0.330693483 0.179247737 2.92580128E-02 0.332765043 +! 0.472417951 0.500440359 8.56802464E-02 8.72612000E-03 3.55126858E-02 + +scale = (0.5,1.0) +print *, exp_cdf((0.5,0.5),scale) +!complex exponential cumulative distribution at (0.5,0.5) with real part of +!lambda=0.5 and imaginary part of lambda=1.0 + +! 8.70351046E-02 + +end program demo_exponential_cdf + diff --git a/test/examples/stats_distribution_exponential/demo_exponential_pdf.f90 b/test/examples/stats_distribution_exponential/demo_exponential_pdf.f90 new file mode 100644 index 000000000..86b9c6250 --- /dev/null +++ b/test/examples/stats_distribution_exponential/demo_exponential_pdf.f90 @@ -0,0 +1,39 @@ +program demo_exponential_pdf +use stdlib_random, only : random_seed +use stdlib_stats_distribution_exponential, only: exp_pdf => pdf_exp, & +rexp => rvs_exp + +implicit none +real :: x(2,3,4),a(2,3,4) +complex :: scale +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) + +print *, exp_pdf(1.0,1.0) !a probability density at 1.0 in standard expon + +! 0.367879450 + +print *, exp_pdf(2.0,2.0) !a probability density at 2.0 with lambda=2.0 + +! 3.66312787E-02 + +x = reshape(rexp(0.5, 24),[2,3,4]) ! standard expon random variates array +a(:,:,:) = 0.5 +print *, exp_pdf(x, a) ! a rank 3 standard expon probability density + +! 0.457115263 0.451488823 0.492391467 0.485233188 0.446215510 +! 0.401670188 0.485127628 0.316924453 0.418474048 0.483173639 +! 0.307366133 0.285812140 0.448017836 0.426440030 0.403896868 +! 0.334653258 0.410376132 0.485370994 0.333617479 0.263791025 +! 0.249779820 0.457159877 0.495636940 0.482243657 + +scale = (1.0, 2.) +print *, exp_pdf((1.5,1.0), scale) +! a complex expon probability density function at (1.5,1.0) with real part +!of lambda=1.0 and imaginary part of lambda=2.0 + +! 6.03947677E-02 + +end program demo_exponential_pdf diff --git a/test/examples/stats_distribution_exponential/demo_exponential_rvs.f90 b/test/examples/stats_distribution_exponential/demo_exponential_rvs.f90 new file mode 100644 index 000000000..ad59a105b --- /dev/null +++ b/test/examples/stats_distribution_exponential/demo_exponential_rvs.f90 @@ -0,0 +1,33 @@ +program demo_exponential_rvs +use stdlib_random, only : random_seed +use stdlib_stats_distribution_exponential, only: rexp => rvs_exp + +implicit none +real :: a(2,3,4) +complex :: scale +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) + +print *, rexp( ) !single standard exponential random variate + +! 0.358690143 + +print *, rexp(2.0) !exponential random variate with lambda=2.0 + +! 0.816459715 + +print *, rexp(0.3, 10) !an array of 10 variates with lambda=0.3 + +! 1.84008647E-02 3.59742008E-02 0.136567295 0.262772143 3.62352766E-02 +! 0.547133625 0.213591918 4.10784185E-02 0.583882213 0.671128035 + +scale = (2.0, 0.7) +print *, rexp(scale) +!single complex exponential random variate with real part of lambda=2.0; +!imagainary part of lambda=0.7 + +! (1.41435969,4.081114382E-02) + +end program demo_exponential_rvs diff --git a/test/examples/stats_distribution_normal/demo_norm_cdf.f90 b/test/examples/stats_distribution_normal/demo_norm_cdf.f90 new file mode 100644 index 000000000..ccbb8ed1d --- /dev/null +++ b/test/examples/stats_distribution_normal/demo_norm_cdf.f90 @@ -0,0 +1,45 @@ +program demo_norm_cdf +use stdlib_random, only : random_seed +use stdlib_stats_distribution_normal, only : norm_cdf => cdf_normal, & +norm => rvs_normal + +implicit none +real :: x(2,3,4),a(2,3,4),b(2,3,4) +complx :: loc, scale +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) + +print *, norm_cdf(1.0, 0.0, 1.0) ! a standard normal cumulative at 1.0 + +! 0.841344714 + +print *, norm_cdf(2.0, -1.0, 2.0) +! a cumulative at 2.0 with mu=-1 sigma=2 + +! 0.933192849 + +x = reshape(norm(0.0, 1.0, 24),[2,3,4]) +! standard normal random variates array + +a(:,:,:) = 0.0 +b(:,:,:) = 1.0 +print *, norm_cdf(x, a, b) ! standard normal cumulative array + +! 0.713505626 0.207069695 0.486513376 0.424511284 0.587328553 +! 0.335559726 0.401470929 0.806552052 0.866687536 0.371323735 +! 0.866228044 0.898046613 0.198435277 0.141147852 0.681565762 +! 0.206268221 0.627057910 0.580759525 0.190364420 7.27325380E-02 +! 7.08068311E-02 0.728241026 0.522919059 0.390097380 + +loc = (1.0,0.0) +scale = (0.5,1.0) +print *, norm_cdf((0.5,-0.5),loc,scale) +!complex normal cumulative distribution at (0.5,-0.5) with real part of + !mu=1.0, sigma=0.5 and imaginary part of mu=0.0, sigma=1.0 + +!4.89511043E-02 + +end program demo_norm_cdf + diff --git a/test/examples/stats_distribution_normal/demo_normal_pdf.f90 b/test/examples/stats_distribution_normal/demo_normal_pdf.f90 new file mode 100644 index 000000000..ee2ce372a --- /dev/null +++ b/test/examples/stats_distribution_normal/demo_normal_pdf.f90 @@ -0,0 +1,44 @@ +program demo_normal_pdf +use stdlib_random, only : random_seed +use stdlib_stats_distribution_normal, only : norm_pdf=>pdf_normal, & +norm => rvs_normal + +implicit none +real :: x(3,4,5),a(3,4,5),b(3,4,5) +complx :: loc, scale +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) + +print *, norm_pdf(1.0,0.,1.) !a probability density at 1.0 in standard normal + +! 0.241970733 + +print *, norm_pdf(2.0,-1.0, 2.0) +!a probability density at 2.0 with mu=-1.0 sigma=2.0 + +!6.47588000E-02 + +x = reshape(norm(0.0, 1.0, 60),[3,4,5]) +! standard normal random variates array + +a(:,:,:) = 0.0 +b(:,:,:) = 1.0 +print *, norm_pdf(x, a, b) ! standard normal probability density array + +! 0.340346158 0.285823315 0.398714304 0.391778737 0.389345556 +! 0.364551932 0.386712372 0.274370432 0.215250477 0.378006011 +! 0.215760440 0.177990928 0.278640658 0.223813817 0.356875211 +! 0.285167664 0.378533930 0.390739858 0.271684974 0.138273031 +! 0.135456234 0.331718773 0.398283750 0.383706540 + +loc = (1.0, -0.5) +scale = (1.0, 2.) +print *, norm_pdf((1.5,1.0), loc, scale) +! a complex normal probability density function at (1.5,1.0) with real part + ! of mu=1.0, sigma=1.0 and imaginary part of mu=-0.5, sigma=2.0 + +! 5.30100204E-02 + +end program demo_normal_pdf diff --git a/test/examples/stats_distribution_normal/demo_normal_rvs.f90 b/test/examples/stats_distribution_normal/demo_normal_rvs.f90 new file mode 100644 index 000000000..bd044ff0e --- /dev/null +++ b/test/examples/stats_distribution_normal/demo_normal_rvs.f90 @@ -0,0 +1,45 @@ +program demo_normal_rvs +use stdlib_random, only: random_seed +use stdlib_stats_distribution_normal, only: norm => rvs_normal + +implicit none +real :: a(2,3,4), b(2,3,4) +complx :: loc, scale +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) + +print *, norm( ) !single standard normal random variate + +! 0.563655198 + +print *, norm(1.0, 2.0) +!normal random variate mu=1.0, sigma=2.0 + +! -0.633261681 + +print *, norm(0.0, 1.0, 10) !an array of 10 standard norml random variates + +! -3.38123664E-02 -0.190365672 0.220678389 -0.424612164 -0.249541596 +! 0.865260184 1.11086845 -0.328349441 1.10873628 1.27049923 + +a(:,:,:) = 1.0 +b(:,:,:) = 1.0 +print *, norm(a,b) ! a rank 3 random variates array + +!0.152776539 -7.51764774E-02 1.47208166 0.180561781 1.32407105 +! 1.20383692 0.123445868 -0.455737948 -0.469808221 1.60750175 +! 1.05748117 0.720934749 0.407810807 1.48165631 2.31749439 +! 0.414566994 3.06084275 1.86505437 1.36338580 7.26878643E-02 +! 0.178585172 1.39557445 0.828021586 0.872084975 + +loc = (-1.0, 2.0) +scale = (2.0, 1.0) +print *, norm(loc, scale) +!single complex normal random variate with real part of mu=-1, sigma=2; + !imagainary part of mu=2.0 and sigma=1.0 + +! (1.22566295,2.12518454) + +end program demo_normal_rvs diff --git a/test/examples/stats_distribution_uniform/demo_shuffle.f90 b/test/examples/stats_distribution_uniform/demo_shuffle.f90 new file mode 100644 index 000000000..a69ab59e9 --- /dev/null +++ b/test/examples/stats_distribution_uniform/demo_shuffle.f90 @@ -0,0 +1,30 @@ +program demo_shuffle +use stdlib_random, only : random_seed +use stdlib_stats_distribution_uniform, only : shuffle +implicit none +integer :: seed_put, seed_get, i +real :: x(10) +integer :: n(10) +complex :: z(10) + +do i=1, 10 +n(i) = i +x(i) = real(i) +z(i) = cmplx(real(i), real(i)) +end do +seed_put = 32165498 +call random_seed(seed_put, seed_get) ! set and get current value of seed +print *, shuffle(n) ! get randomized n + +!10 6 9 2 8 1 3 5 7 4 + +print *, shuffle(x) ! get randomized x + +!5.0 10.0 9.0 4.0 3.0 8.0 2.0 1.0 7.0 6.0 + +print *, shuffle(z) ! get randomized z + +!(8.0, 8.0) (7.0, 7.0) (4.0, 4.0) (1.0, 1.0) (5.0, 5.0) +!(9.0, 9.0) (6.0, 6.0) (3.0, 3.0) (2.0, 2.0) (10.0, 10.0) + +end program demo_shuffle diff --git a/test/examples/stats_distribution_uniform/demo_uniform_cdf.f90 b/test/examples/stats_distribution_uniform/demo_uniform_cdf.f90 new file mode 100644 index 000000000..f04a045f0 --- /dev/null +++ b/test/examples/stats_distribution_uniform/demo_uniform_cdf.f90 @@ -0,0 +1,49 @@ +program demo_uniform_cdf +use stdlib_random, only : random_seed +use stdlib_stats_distribution_uniform, only : uni_cdf => cdf_uniform, & +uni => rvs_uniform + +implicit none +real :: x(3,4,5), a(3,4,5), b(3,4,5) +complex :: loc, scale +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) + +print *, uni_cdf(0.5,0.,1.) ! a cumulative at 0.5 in [0., 1.] + +!0.500000000 + +print *, uni_cdf(0.7,-1.0,2.0) ! a cumulative at 0.7 in [-1.0, 1.0] + +! 0.850000024 + +print *, uni_cdf(6, 2, 10) ! a cumulative at 6 in [2, 10] + +! 0.454545468 + +a(:,:,:) = -1.0 +b(:,:,:) = 2.0 +x = reshape(uni(-1.0,2.0,60),[3,4,5]) ! uniform random variates array +print *, uni_cdf(x,a,b) ! cumulative array in [-1.0, 1.0] + +!0.161520004 0.553248405 0.986900032 0.942091405 0.114239901 0.780188501 +! 0.854656875 0.464386612 0.284466714 0.748768032 0.301834047 0.337008357 +!0.568843365 0.596165061 0.180993259 0.614166319 0.214835495 7.98164606E-02 +!0.641274095 0.607101977 0.701139212 0.230517209 1.97925568E-02 0.857982159 +!0.712761045 0.139202654 0.361759573 0.796536088 0.356012046 0.197665215 +!9.80764329E-02 0.781620383 0.595349193 0.125651121 0.957528770 0.942990601 +!0.259489566 7.84273148E-02 0.779313922 0.317909390 0.559013724 0.421358019 +!0.878484428 7.67416358E-02 0.298707575 0.693327367 0.146014273 0.102338850 +!0.855926156 0.250811368 0.300751567 0.110186398 0.502883077 0.738479793 +!0.764856219 0.294822574 1.90783739E-02 0.631218433 0.752170086 0.196848959 + +loc = (0., 0.) +scale=(2., 1.) +print *, uni_cdf((1.2,0.5), loc, scale) +! joint cumulative distribution at (1.2,0.5) in [(0.,0.), (2.,1.)] + +! 0.300000012 +end program demo_uniform_cdf + diff --git a/test/examples/stats_distribution_uniform/demo_uniform_pdf.f90 b/test/examples/stats_distribution_uniform/demo_uniform_pdf.f90 new file mode 100644 index 000000000..e90bb5d94 --- /dev/null +++ b/test/examples/stats_distribution_uniform/demo_uniform_pdf.f90 @@ -0,0 +1,50 @@ +program demo_uniform_pdf +use stdlib_random, only : random_seed +use stdlib_stats_distribution_uniform, only : uni_pdf => pdf_uniform, & +uni => rvs_uniform + +implicit none +complex :: loc, scale +real :: a(3,4,5), b(3,4,5), x(3,4,5) +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) + +print *, uni_pdf(3, 2, 10) !probability density at 3 in range [2, 10] + +! 9.09090936E-02 + +print *, uni_pdf(0.5,0.0,1.0) !a probability density at 0.5 in [0., 1.] + +! 1.00000000 + + +print *, uni_pdf(0.7,-1.0,2.0) !a probability density at 0.7 in [-1., 1.] + +! 0.500000000 + +a(:,:,:) = 0.0 +b(:,:,:) = 2.0 +x = reshape(uni(0.,2.,60),[3,4,5])! uniform random variates array in [0., 2.] +print *, uni_pdf(x, a, b) ! probability density array in [0., 2.] + +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 +! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 + +loc = (-0.5,-0.5) +scale = (1.0,1.0) +print *, uni_pdf((-0.1,0.2), loc, scale) +! joint probability density at (-0.1,0.2) in [(-0.5, -0.5), (0.5, 0.5)] + +! 1.00000000 +end program demo_uniform_pdf + diff --git a/test/examples/stats_distribution_uniform/demo_uniform_rvs.f90 b/test/examples/stats_distribution_uniform/demo_uniform_rvs.f90 new file mode 100644 index 000000000..4f36a18f2 --- /dev/null +++ b/test/examples/stats_distribution_uniform/demo_uniform_rvs.f90 @@ -0,0 +1,79 @@ +program demo_uniform_rvs +use stdlib_random, only:random_seed +use stdlib_stats_distribution_uniform, only:uni=> rvs_uniform + +implicit none +complex :: loc, scale +real :: a(3,4,5), b(3,4,5) +integer :: seed_put, seed_get + +seed_put = 1234567 +call random_seed(seed_put, seed_get) + +print *, uni( ) !real standard uniform random variate in [0., 1.] +! 0.161520019 + +print *, uni(3.0) !an uniform random variate in [0., 3.] +! 1.65974522 + +print *, uni(-0.5, 1.0) !an uniform random variate in [-0.5, 0.5] +! 0.486900032 + +print *, uni(-1.0,2.0,10) +!an array of 10 uniform random variates in [-1., 1.] + +!0.884182811 -0.771520197 0.560377002 0.709313750 -7.12267756E-02 +!-0.431066573 0.497536063 -0.396331906 -0.325983286 0.137686729 + +print *, uni(20) !a random integer variate in [0, 20] +! 17 + +print *, uni(5,13) !a random integer variate in [5, 18] +! 15 + +print *, uni(3,19,10) !an array of 10 integer variates in [3,22] + +!7 16 16 12 9 21 19 4 3 19 + +loc = (-0.5, -0.5) +scale = (1.0, 1.0) + +print *, uni(scale) !a complex uniform random variate in unit square + +!(0.139202669, 0.361759573) + +print *, uni(loc,scale) +!a complex uniform random variate in [(-0.5, -0.5), (0.5, 0.5)] + +!(0.296536088,-0.143987954) + +print *, uni(loc, scale, 10) +!an array of 10 complex uniform random variate in [(-0.5, -0.5), (0.5, 0.5)] + +!(-0.302334785,-0.401923567) (0.281620383,9.534919262E-02) +! (-0.374348879,0.457528770) (0.442990601,-0.240510434) +! (-0.421572685,0.279313922) (-0.182090610,5.901372433E-02) +! (-7.864198089E-02,0.378484428) (-0.423258364,-0.201292425) +! (0.193327367,-0.353985727) (-0.397661150,0.355926156) + +a(:,:,:) = -0.5 +b(:,:,:) = 1.0 + +print *, uni(a,b) +!a rank 3 array of random variates in [-0.5,0.5] + +! -0.249188632 -0.199248433 -0.389813602 2.88307667E-03 0.238479793, +! 0.264856219 -0.205177426 -0.480921626 0.131218433 0.252170086, +! -0.303151041 -8.89462233E-02 -0.377370685 0.341802299 0.323204756, +! 0.358679056 -0.138909757 0.384329498 -0.109372199 0.132353067, +! 0.494320452 0.419343710 -0.103044361 0.461389005 0.403132677 +! 0.121850729 0.403839290 -0.349389791 0.490482628 0.156600773 +! 8.46788883E-02 -0.483680278 0.388107836 0.119698405 0.154214382 +! 0.153113484 0.236523747 0.155937552 -0.135760903 0.219589531 +! 0.394639254 6.30156994E-02 -0.342692465 -0.444846451 -0.215700030 +! 0.204189956 -0.208748132 0.355063021 8.98272395E-02 -0.237928331 +! 2.98077464E-02 -0.485149682 -8.06870461E-02 -0.372713923 +! -0.178335011 0.283877611 -2.13934183E-02 -9.21690464E-03 +! 4.56320047E-02 0.220112979 + +end program demo_uniform_rvs diff --git a/test/examples/string_type/demo_adjustl.f90 b/test/examples/string_type/demo_adjustl.f90 new file mode 100644 index 000000000..9b97cd355 --- /dev/null +++ b/test/examples/string_type/demo_adjustl.f90 @@ -0,0 +1,9 @@ +program demo_adjustl +use stdlib_string_type +implicit none +type(string_type) :: string + +string = " Whitespace" +string = adjustl(string) +! char(string) == "Whitespace " +end program demo_adjustl diff --git a/test/examples/string_type/demo_adjustr.f90 b/test/examples/string_type/demo_adjustr.f90 new file mode 100644 index 000000000..df04b5917 --- /dev/null +++ b/test/examples/string_type/demo_adjustr.f90 @@ -0,0 +1,9 @@ +program demo_adjustr +use stdlib_string_type +implicit none +type(string_type) :: string + +string = "Whitespace " +string = adjustr(string) +! char(string) == " Whitespace" +end program demo_adjustr diff --git a/test/examples/string_type/demo_char.f90 b/test/examples/string_type/demo_char.f90 new file mode 100644 index 000000000..e186535b6 --- /dev/null +++ b/test/examples/string_type/demo_char.f90 @@ -0,0 +1,10 @@ +program demo_char +use stdlib_string_type +implicit none +type(string_type) :: string +character(len=:), allocatable :: dlc + +string = "Character sequence" +dlc = char(string) +! dlc == "Character sequence" +end program demo_char diff --git a/test/examples/string_type/demo_char_position.f90 b/test/examples/string_type/demo_char_position.f90 new file mode 100644 index 000000000..8524ae56a --- /dev/null +++ b/test/examples/string_type/demo_char_position.f90 @@ -0,0 +1,13 @@ +program demo_char_position +use stdlib_string_type +implicit none +type(string_type) :: string +character(len=:), allocatable :: dlc +character(len=1), allocatable :: chars(:) + +string = "Character sequence" +dlc = char(string, 3) +! dlc == "a" +chars = char(string, [3, 5, 8, 12, 14, 15, 18]) +! chars == ["a", "a", "e", "e", "u", "e", "e"] +end program demo_char_position diff --git a/test/examples/string_type/demo_char_range.f90 b/test/examples/string_type/demo_char_range.f90 new file mode 100644 index 000000000..978fa87b1 --- /dev/null +++ b/test/examples/string_type/demo_char_range.f90 @@ -0,0 +1,10 @@ +program demo_char_range +use stdlib_string_type +implicit none +type(string_type) :: string +character(len=:), allocatable :: dlc + +string = "Fortran" +dlc = char(string, 1, 4) +! dlc == "Fort" +end program demo_char_range diff --git a/test/examples/string_type/demo_constructor_character.f90 b/test/examples/string_type/demo_constructor_character.f90 new file mode 100644 index 000000000..4ad005c3a --- /dev/null +++ b/test/examples/string_type/demo_constructor_character.f90 @@ -0,0 +1,8 @@ +program demo_constructor_character +use stdlib_string_type +implicit none +type(string_type) :: string +! len(string) == 0 +string = "Sequence" +! len(string) == 8 +end program demo_constructor_character diff --git a/test/examples/string_type/demo_constructor_empty.f90 b/test/examples/string_type/demo_constructor_empty.f90 new file mode 100644 index 000000000..be22f2ddd --- /dev/null +++ b/test/examples/string_type/demo_constructor_empty.f90 @@ -0,0 +1,7 @@ +program demo_constructor_empty +use stdlib_string_type +implicit none +type(string_type) :: string +string = string_type() +! len(string) == 0 +end program demo_constructor_empty diff --git a/test/examples/string_type/demo_constructor_integer.f90 b/test/examples/string_type/demo_constructor_integer.f90 new file mode 100644 index 000000000..bd7f417d8 --- /dev/null +++ b/test/examples/string_type/demo_constructor_integer.f90 @@ -0,0 +1,9 @@ +program demo_constructor_integer +use stdlib_string_type +implicit none +type(string_type) :: string +string = string_type(42) +! len(string) == 2 +string = string_type(-289) +! len(string) == 4 +end program demo_constructor_integer diff --git a/test/examples/string_type/demo_constructor_logical.f90 b/test/examples/string_type/demo_constructor_logical.f90 new file mode 100644 index 000000000..fc43f343a --- /dev/null +++ b/test/examples/string_type/demo_constructor_logical.f90 @@ -0,0 +1,9 @@ +program demo_constructor_logical +use stdlib_string_type +implicit none +type(string_type) :: string +string = string_type(.true.) +! len(string) == 1 +string = string_type(.false.) +! len(string) == 1 +end program demo_constructor_logical diff --git a/test/examples/string_type/demo_constructor_scalar.f90 b/test/examples/string_type/demo_constructor_scalar.f90 new file mode 100644 index 000000000..1799fc9d9 --- /dev/null +++ b/test/examples/string_type/demo_constructor_scalar.f90 @@ -0,0 +1,9 @@ +program demo_constructor_scalar +use stdlib_string_type +implicit none +type(string_type) :: string +string = string_type("Sequence") +! len(string) == 8 +string = string_type(" S p a c e d ") +! len(string) == 13 +end program demo_constructor_scalar diff --git a/test/examples/string_type/demo_cont.f90 b/test/examples/string_type/demo_cont.f90 new file mode 100644 index 000000000..a535c427a --- /dev/null +++ b/test/examples/string_type/demo_cont.f90 @@ -0,0 +1,9 @@ +program demo_cont +use stdlib_string_type +implicit none +type(string_type) :: string + +string = "Hello, " +string = string // "World!" +! len(string) == 13 +end program demo_cont diff --git a/test/examples/string_type/demo_eq.f90 b/test/examples/string_type/demo_eq.f90 new file mode 100644 index 000000000..908bcb391 --- /dev/null +++ b/test/examples/string_type/demo_eq.f90 @@ -0,0 +1,16 @@ +program demo_eq +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = string == "abc" +! res .eqv. .false. + +res = string == "bcd" +! res .eqv. .true. + +res = string == "cde" +! res .eqv. .false. +end program demo_eq diff --git a/test/examples/string_type/demo_fread.f90 b/test/examples/string_type/demo_fread.f90 new file mode 100644 index 000000000..fbdac0c1e --- /dev/null +++ b/test/examples/string_type/demo_fread.f90 @@ -0,0 +1,16 @@ +program demo_fread +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: io +string = "Important saved value" + +open(newunit=io, form="formatted", status="scratch") +write(io, *) string +write(io, *) + +rewind(io) + +read(io, *) string +close(io) +end program demo_fread diff --git a/test/examples/string_type/demo_fwrite.f90 b/test/examples/string_type/demo_fwrite.f90 new file mode 100644 index 000000000..d86261d55 --- /dev/null +++ b/test/examples/string_type/demo_fwrite.f90 @@ -0,0 +1,16 @@ +program demo_fwrite +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: io +string = "Important saved value" + +open(newunit=io, form="formatted", status="scratch") +write(io, *) string +write(io, *) + +rewind(io) + +read(io, *) string +close(io) +end program demo_fwrite diff --git a/test/examples/string_type/demo_ge.f90 b/test/examples/string_type/demo_ge.f90 new file mode 100644 index 000000000..4ea9cac29 --- /dev/null +++ b/test/examples/string_type/demo_ge.f90 @@ -0,0 +1,16 @@ +program demo_ge +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = string >= "abc" +! res .eqv. .true. + +res = string >= "bcd" +! res .eqv. .true. + +res = string >= "cde" +! res .eqv. .false. +end program demo_ge diff --git a/test/examples/string_type/demo_gt.f90 b/test/examples/string_type/demo_gt.f90 new file mode 100644 index 000000000..c8ffa2bd0 --- /dev/null +++ b/test/examples/string_type/demo_gt.f90 @@ -0,0 +1,16 @@ +program demo_gt +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = string > "abc" +! res .eqv. .true. + +res = string > "bcd" +! res .eqv. .false. + +res = string > "cde" +! res .eqv. .false. +end program demo_gt diff --git a/test/examples/string_type/demo_iachar.f90 b/test/examples/string_type/demo_iachar.f90 new file mode 100644 index 000000000..1417ed972 --- /dev/null +++ b/test/examples/string_type/demo_iachar.f90 @@ -0,0 +1,9 @@ +program demo_iachar +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: code + +string = "Fortran" +code = iachar(string) +end program demo_iachar diff --git a/test/examples/string_type/demo_ichar.f90 b/test/examples/string_type/demo_ichar.f90 new file mode 100644 index 000000000..7eca0f761 --- /dev/null +++ b/test/examples/string_type/demo_ichar.f90 @@ -0,0 +1,9 @@ +program demo_ichar +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: code + +string = "Fortran" +code = ichar(string) +end program demo_ichar diff --git a/test/examples/string_type/demo_index.f90 b/test/examples/string_type/demo_index.f90 new file mode 100644 index 000000000..b0674bfa9 --- /dev/null +++ b/test/examples/string_type/demo_index.f90 @@ -0,0 +1,16 @@ +program demo_index +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: pos + +string = "Search this string for this expression" +pos = index(string, "this") +! pos == 8 + +pos = index(string, "this", back=.true.) +! pos == 24 + +pos = index(string, "This") +! pos == 0 +end program demo_index diff --git a/test/examples/string_type/demo_le.f90 b/test/examples/string_type/demo_le.f90 new file mode 100644 index 000000000..adda4ff21 --- /dev/null +++ b/test/examples/string_type/demo_le.f90 @@ -0,0 +1,16 @@ +program demo_le +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = string <= "abc" +! res .eqv. .false. + +res = string <= "bcd" +! res .eqv. .true. + +res = string <= "cde" +! res .eqv. .true. +end program demo_le diff --git a/test/examples/string_type/demo_len.f90 b/test/examples/string_type/demo_len.f90 new file mode 100644 index 000000000..c4a16b064 --- /dev/null +++ b/test/examples/string_type/demo_len.f90 @@ -0,0 +1,14 @@ +program demo_len +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: length + +string = "Some longer sentence for this example." +length = len(string) +! length == 38 + +string = "Whitespace " +length = len(string) +! length == 38 +end program demo_len diff --git a/test/examples/string_type/demo_len_trim.f90 b/test/examples/string_type/demo_len_trim.f90 new file mode 100644 index 000000000..4e8ec23c0 --- /dev/null +++ b/test/examples/string_type/demo_len_trim.f90 @@ -0,0 +1,14 @@ +program demo_len_trim +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: length + +string = "Some longer sentence for this example." +length = len_trim(string) +! length == 38 + +string = "Whitespace " +length = len_trim(string) +! length == 10 +end program demo_len_trim diff --git a/test/examples/string_type/demo_lge.f90 b/test/examples/string_type/demo_lge.f90 new file mode 100644 index 000000000..f51ae1de3 --- /dev/null +++ b/test/examples/string_type/demo_lge.f90 @@ -0,0 +1,16 @@ +program demo_lge +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = lge(string, "abc") +! res .eqv. .true. + +res = lge(string, "bcd") +! res .eqv. .true. + +res = lge(string, "cde") +! res .eqv. .false. +end program demo_lge diff --git a/test/examples/string_type/demo_lgt.f90 b/test/examples/string_type/demo_lgt.f90 new file mode 100644 index 000000000..42cb112c5 --- /dev/null +++ b/test/examples/string_type/demo_lgt.f90 @@ -0,0 +1,16 @@ +program demo_lgt +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = lgt(string, "abc") +! res .eqv. .true. + +res = lgt(string, "bcd") +! res .eqv. .false. + +res = lgt(string, "cde") +! res .eqv. .false. +end program demo_lgt diff --git a/test/examples/string_type/demo_lle.f90 b/test/examples/string_type/demo_lle.f90 new file mode 100644 index 000000000..3e3b7c3d4 --- /dev/null +++ b/test/examples/string_type/demo_lle.f90 @@ -0,0 +1,16 @@ +program demo_lle +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = lle(string, "abc") +! res .eqv. .false. + +res = lle(string, "bcd") +! res .eqv. .true. + +res = lle(string, "cde") +! res .eqv. .true. +end program demo_lle diff --git a/test/examples/string_type/demo_llt.f90 b/test/examples/string_type/demo_llt.f90 new file mode 100644 index 000000000..6443cdca7 --- /dev/null +++ b/test/examples/string_type/demo_llt.f90 @@ -0,0 +1,16 @@ +program demo_llt +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = llt(string, "abc") +! res .eqv. .false. + +res = llt(string, "bcd") +! res .eqv. .false. + +res = llt(string, "cde") +! res .eqv. .true. +end program demo_llt diff --git a/test/examples/string_type/demo_lt.f90 b/test/examples/string_type/demo_lt.f90 new file mode 100644 index 000000000..31679ccae --- /dev/null +++ b/test/examples/string_type/demo_lt.f90 @@ -0,0 +1,16 @@ +program demo_lt +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = string < "abc" +! res .eqv. .false. + +res = string < "bcd" +! res .eqv. .false. + +res = string < "cde" +! res .eqv. .true. +end program demo_lt diff --git a/test/examples/string_type/demo_move.f90 b/test/examples/string_type/demo_move.f90 new file mode 100644 index 000000000..fabe1ce3f --- /dev/null +++ b/test/examples/string_type/demo_move.f90 @@ -0,0 +1,21 @@ +program demo_move +use stdlib_string_type, only : string_type, assignment(=), move +implicit none +type(string_type) :: from_string +character(len=:), allocatable :: from_char, to_char + +from_string = "move this string" +from_char = "move this char" +! from_string <-- "move this string" +! from_char <-- "move this char" +! to_char <-- (unallocated) + +call move(from_string, to_char) +! from_string <-- "" +! to_char <-- "move this string" + +call move(from_char, to_char) +! from_char <-- (unallocated) +! to_string <-- "move this char" + +end program demo_move diff --git a/test/examples/string_type/demo_ne.f90 b/test/examples/string_type/demo_ne.f90 new file mode 100644 index 000000000..0f172c838 --- /dev/null +++ b/test/examples/string_type/demo_ne.f90 @@ -0,0 +1,16 @@ +program demo_ne +use stdlib_string_type +implicit none +type(string_type) :: string +logical :: res + +string = "bcd" +res = string /= "abc" +! res .eqv. .true. + +res = string /= "bcd" +! res .eqv. .false. + +res = string /= "cde" +! res .eqv. .true. +end program demo_ne diff --git a/test/examples/string_type/demo_repeat.f90 b/test/examples/string_type/demo_repeat.f90 new file mode 100644 index 000000000..1f2e26a92 --- /dev/null +++ b/test/examples/string_type/demo_repeat.f90 @@ -0,0 +1,9 @@ +program demo_repeat +use stdlib_string_type +implicit none +type(string_type) :: string + +string = "What? " +string = repeat(string, 3) +! string == "What? What? What? " +end program demo_repeat diff --git a/test/examples/string_type/demo_reverse.f90 b/test/examples/string_type/demo_reverse.f90 new file mode 100644 index 000000000..4f2ab5abb --- /dev/null +++ b/test/examples/string_type/demo_reverse.f90 @@ -0,0 +1,12 @@ +program demo_reverse +use stdlib_string_type +implicit none +type(string_type) :: string, reverse_string + +string = "Reverse This String" +! string <-- "Reverse This String" + +reverse_string = reverse(string) +! string <-- "Reverse This String" +! reverse_string <-- "gnirtS sihT esreveR" +end program demo_reverse diff --git a/test/examples/string_type/demo_scan.f90 b/test/examples/string_type/demo_scan.f90 new file mode 100644 index 000000000..66973e7da --- /dev/null +++ b/test/examples/string_type/demo_scan.f90 @@ -0,0 +1,16 @@ +program demo_scan +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: pos + +string = "fortran" +pos = scan(string, "ao") +! pos == 2 + +pos = scan(string, "ao", .true.) +! pos == 6 + +pos = scan(string, "c++") +! pos == 0 +end program demo_scan diff --git a/test/examples/string_type/demo_to_lower.f90 b/test/examples/string_type/demo_to_lower.f90 new file mode 100644 index 000000000..cb3c277b5 --- /dev/null +++ b/test/examples/string_type/demo_to_lower.f90 @@ -0,0 +1,12 @@ +program demo_to_lower +use stdlib_string_type +implicit none +type(string_type) :: string, lowercase_string + +string = "Lowercase This String" +! string <-- "Lowercase This String" + +lowercase_string = to_lower(string) +! string <-- "Lowercase This String" +! lowercase_string <-- "lowercase this string" +end program demo_to_lower diff --git a/test/examples/string_type/demo_to_sentence.f90 b/test/examples/string_type/demo_to_sentence.f90 new file mode 100644 index 000000000..7450a55bb --- /dev/null +++ b/test/examples/string_type/demo_to_sentence.f90 @@ -0,0 +1,12 @@ +program demo_to_sentence +use stdlib_string_type +implicit none +type(string_type) :: string, sentencecase_string + +string = "sentencecase this string." +! string <-- "sentencecase this string." + +sentencecase_string = to_sentence(string) +! string <-- "sentencecase this string." +! sentencecase_string <-- "Sentencecase this string." +end program demo_to_sentence diff --git a/test/examples/string_type/demo_to_title.f90 b/test/examples/string_type/demo_to_title.f90 new file mode 100644 index 000000000..0f64d655d --- /dev/null +++ b/test/examples/string_type/demo_to_title.f90 @@ -0,0 +1,12 @@ +program demo_to_title +use stdlib_string_type +implicit none +type(string_type) :: string, titlecase_string + +string = "titlecase this string." +! string <-- "titlecase this string." + +titlecase_string = to_title(string) +! string <-- "titlecase this string." +! titlecase_string <-- "Titlecase This String." +end program demo_to_title diff --git a/test/examples/string_type/demo_to_upper.f90 b/test/examples/string_type/demo_to_upper.f90 new file mode 100644 index 000000000..3b8a51ea2 --- /dev/null +++ b/test/examples/string_type/demo_to_upper.f90 @@ -0,0 +1,12 @@ +program demo_to_upper +use stdlib_string_type +implicit none +type(string_type) :: string, uppercase_string + +string = "Uppercase This String" +! string <-- "Uppercase This String" + +uppercase_string = to_upper(string) +! string <-- "Uppercase This String" +! uppercase_string <-- "UPPERCASE THIS STRING" +end program demo_to_upper diff --git a/test/examples/string_type/demo_trim.f90 b/test/examples/string_type/demo_trim.f90 new file mode 100644 index 000000000..27d0294ec --- /dev/null +++ b/test/examples/string_type/demo_trim.f90 @@ -0,0 +1,9 @@ +program demo_trim +use stdlib_string_type +implicit none +type(string_type) :: string + +string = "Whitespace " +string = trim(string) +! len(string) == 10 +end program demo_trim diff --git a/test/examples/string_type/demo_uread.f90 b/test/examples/string_type/demo_uread.f90 new file mode 100644 index 000000000..347fb9b9a --- /dev/null +++ b/test/examples/string_type/demo_uread.f90 @@ -0,0 +1,15 @@ +program demo_uread +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: io +string = "Important saved value" + +open(newunit=io, form="unformatted", status="scratch") +write(io) string + +rewind(io) + +read(io) string +close(io) +end program demo_uread diff --git a/test/examples/string_type/demo_uwrite.f90 b/test/examples/string_type/demo_uwrite.f90 new file mode 100644 index 000000000..79e942494 --- /dev/null +++ b/test/examples/string_type/demo_uwrite.f90 @@ -0,0 +1,15 @@ +program demo_uwrite +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: io +string = "Important saved value" + +open(newunit=io, form="unformatted", status="scratch") +write(io) string + +rewind(io) + +read(io) string +close(io) +end program demo_uwrite diff --git a/test/examples/string_type/demo_verify.f90 b/test/examples/string_type/demo_verify.f90 new file mode 100644 index 000000000..4eb157c67 --- /dev/null +++ b/test/examples/string_type/demo_verify.f90 @@ -0,0 +1,22 @@ +program demo_verify +use stdlib_string_type +implicit none +type(string_type) :: string +integer :: pos + +string = "fortran" +pos = verify(string, "ao") +! pos == 1 + +pos = verify(string, "fo") +! pos == 3 + +pos = verify(string, "c++") +! pos == 1 + +pos = verify(string, "c++", back=.true.) +! pos == 7 + +pos = verify(string, string) +! pos == 0 +end program demo_verify diff --git a/test/examples/stringlist_type/demo_clear.f90 b/test/examples/stringlist_type/demo_clear.f90 new file mode 100644 index 000000000..74b24ccc7 --- /dev/null +++ b/test/examples/stringlist_type/demo_clear.f90 @@ -0,0 +1,19 @@ +program demo_clear +use stdlib_stringlist_type, only: stringlist_type, fidx +implicit none + +type(stringlist_type) :: stringlist + +!> inserting 2 elements to the stringlist +call stringlist%insert_at( fidx(1), "Element No. one" ) +call stringlist%insert_at( fidx(1), "Element No. two" ) +! stringlist <-- {"Element No. two", "Element No. one"} + +call stringlist%clear() +! stringlist <-- { } (empty stringlist) + +!> inserting 1 element to the stringlist +call stringlist%insert_at( fidx(1), "Element No. one" ) +! stringlist <-- {"Element No. one"} + +end program demo_clear diff --git a/test/examples/stringlist_type/demo_concatenate_operator.f90 b/test/examples/stringlist_type/demo_concatenate_operator.f90 new file mode 100644 index 000000000..c0422aade --- /dev/null +++ b/test/examples/stringlist_type/demo_concatenate_operator.f90 @@ -0,0 +1,27 @@ +program demo_concatenate_operator +use stdlib_stringlist_type, only: stringlist_type, operator(//) +use stdlib_string_type, only: string_type +implicit none + +type(stringlist_type) :: first_stringlist, second_stringlist +type(string_type), allocatable :: stringarray(:) + +first_stringlist = first_stringlist // "Element No. one" +! first_stringlist <-- {"Element No. one"} + +second_stringlist = string_type("Element No. two") // first_stringlist +! second_stringlist <-- {Element No. two, "Element No. one"} + +!> Creating an array of 2 string_type elements +stringarray = [string_type("Element No. three"), string_type("Element No. four")] + +second_stringlist = first_stringlist // stringarray +! second_stringlist <-- {"Element No. one", "Element No. three", "Element No. four"} + +second_stringlist = ["#1", "#2"] // second_stringlist +! second_stringlist <-- {"#1", "#2", "Element No. one", "Element No. three", "Element No. four"} + +first_stringlist = first_stringlist // second_stringlist +! first_stringlist <-- {"Element No. one", "#1", "#2", "Element No. one", "Element No. three", "Element No. four"} + +end program demo_concatenate_operator diff --git a/test/examples/stringlist_type/demo_constructor.f90 b/test/examples/stringlist_type/demo_constructor.f90 new file mode 100644 index 000000000..a1b466210 --- /dev/null +++ b/test/examples/stringlist_type/demo_constructor.f90 @@ -0,0 +1,17 @@ +program demo_constructor +use stdlib_stringlist_type, only: stringlist_type +use stdlib_string_type, only: string_type +implicit none + +type(stringlist_type) :: stringlist + +stringlist = stringlist_type() +! stringlist <-- { } (empty stringlist) + +stringlist = stringlist_type(["#1", "#2", "#3"]) +! stringlist <-- {"#1", "#2", "#3"} + +stringlist = stringlist_type([string_type("#1"), string_type("#2")]) +! stringlist <-- {"#1", "#2"} + +end program demo_constructor diff --git a/test/examples/stringlist_type/demo_equality_operator.f90 b/test/examples/stringlist_type/demo_equality_operator.f90 new file mode 100644 index 000000000..96920a1bf --- /dev/null +++ b/test/examples/stringlist_type/demo_equality_operator.f90 @@ -0,0 +1,29 @@ +program demo_equality_operator +use stdlib_stringlist_type, only: stringlist_type, fidx, list_head, operator(==) +use stdlib_string_type, only: string_type +implicit none + +type(stringlist_type) :: stringlist +type(string_type), allocatable :: stringarray(:) +logical :: res + +!> inserting 4 elements to the stringlist +call stringlist%insert_at( fidx(1), "#1" ) +call stringlist%insert_at( list_head, "#2" ) +call stringlist%insert_at( fidx(1), "#3" ) +call stringlist%insert_at( list_head, "#4" ) +! stringlist <-- {"#4", "#3", "#2", "#1"} + +!> creating an array of 4 string_type elements +stringarray = [string_type("#4"), string_type("#3"), string_type("#2"), string_type("#1")] + +res = ( stringarray == stringlist ) +! res <-- .true. + +res = ( stringlist == ["#4", "#3", "#2", "#1"] ) +! res <-- .true. + +print'(a)', stringlist == ["#4", "#3", "#1"] +! .false. + +end program demo_equality_operator diff --git a/test/examples/stringlist_type/demo_fidx_bidx.f90 b/test/examples/stringlist_type/demo_fidx_bidx.f90 new file mode 100644 index 000000000..64f94477e --- /dev/null +++ b/test/examples/stringlist_type/demo_fidx_bidx.f90 @@ -0,0 +1,13 @@ +program demo_fidx_bidx +use stdlib_stringlist_type, only: stringlist_index_type, fidx, bidx +implicit none + +type(stringlist_index_type) :: index + +index = fidx(1) +! forward index 1 + +index = bidx(3) +! backward index 3 + +end program demo_fidx_bidx diff --git a/test/examples/stringlist_type/demo_get.f90 b/test/examples/stringlist_type/demo_get.f90 new file mode 100644 index 000000000..b1d95f23d --- /dev/null +++ b/test/examples/stringlist_type/demo_get.f90 @@ -0,0 +1,28 @@ +program demo_get +use stdlib_stringlist_type, only: stringlist_type, fidx, bidx +use stdlib_string_type, only: string_type +implicit none + +type(stringlist_type) :: stringlist +type(string_type) :: output + +!> inserting 4 elements to the stringlist +call stringlist%insert_at( fidx(1), "Element No. one" ) +call stringlist%insert_at( fidx(1), "Element No. two" ) +call stringlist%insert_at( fidx(1), "Element No. three" ) +call stringlist%insert_at( fidx(1), "Element No. four" ) +! stringlist <-- {"Element No. four", "Element No. three", "Element No. two", "Element No. one"} + +output = stringlist%get( fidx(1) ) +! output <-- "Element No. four" + +output = stringlist%get( bidx(1) ) +! output <-- "Element No. one" + +!> accessing out of bounds index +output = stringlist%get( bidx(5) ) +! output <-- "" +output = stringlist%get( fidx(0) ) +! output <-- "" + +end program demo_get diff --git a/test/examples/stringlist_type/demo_inequality_operator.f90 b/test/examples/stringlist_type/demo_inequality_operator.f90 new file mode 100644 index 000000000..eb6a1286d --- /dev/null +++ b/test/examples/stringlist_type/demo_inequality_operator.f90 @@ -0,0 +1,29 @@ +program demo_inequality_operator +use stdlib_stringlist_type, only: stringlist_type, bidx, list_tail, operator(/=) +use stdlib_string_type, only: string_type +implicit none + +type(stringlist_type) :: stringlist +type(string_type), allocatable :: stringarray(:) +logical :: res + +!> inserting 4 elements to the stringlist +call stringlist%insert_at( bidx(1), "#1" ) +call stringlist%insert_at( list_tail, "#2" ) +call stringlist%insert_at( bidx(1), "#3" ) +call stringlist%insert_at( list_tail, "#4" ) +! stringlist <-- {"#1", "#2", "#3", "#4"} + +!> creating an array of 4 string_type elements +stringarray = [string_type("#1"), string_type("#2"), string_type("#3"), string_type("#4")] + +res = ( stringarray /= stringlist ) +! res <-- .false. + +res = ( stringlist /= ["#111", "#222", "#333", "#444"] ) +! res <-- .true. + +print'(a)', stringlist /= ["#4", "#3", "#1"] +! .true. + +end program demo_inequality_operator diff --git a/test/examples/stringlist_type/demo_insert_at.f90 b/test/examples/stringlist_type/demo_insert_at.f90 new file mode 100644 index 000000000..60ba59ce1 --- /dev/null +++ b/test/examples/stringlist_type/demo_insert_at.f90 @@ -0,0 +1,23 @@ +program demo_insert_at +use stdlib_stringlist_type, only: stringlist_type, stringlist_index_type, fidx, bidx +use stdlib_string_type, only: string_type +implicit none + +type(stringlist_type) :: stringlist +type(stringlist_index_type) :: index + +index = fidx(1) +call stringlist%insert_at( index, "Element No. one" ) +! stringlist <-- {"Element No. one"} + +index = bidx(1) +call stringlist%insert_at( index, string_type( "Element No. two" ) ) +! stringlist <-- {"Element No. one", "Element No. two"} + +call stringlist%insert_at( fidx(2), string_type( "Element No. three" ) ) +! stringlist <-- {"Element No. one", "Element No. three", "Element No. two"} + +call stringlist%insert_at( bidx(1), "Element No. four" ) +! stringlist <-- {"Element No. one", "Element No. three", "Element No. two", "Element No. four"} + +end program demo_insert_at diff --git a/test/examples/stringlist_type/demo_len.f90 b/test/examples/stringlist_type/demo_len.f90 new file mode 100644 index 000000000..0818148b3 --- /dev/null +++ b/test/examples/stringlist_type/demo_len.f90 @@ -0,0 +1,19 @@ +program demo_len +use stdlib_stringlist_type, only: stringlist_type, bidx +implicit none + +type(stringlist_type) :: stringlist +integer :: output + +output = stringlist%len() +! output <-- 0 + +!> inserting 2 elements to the stringlist +call stringlist%insert_at( bidx(1), "Element No. one" ) +call stringlist%insert_at( bidx(1), "Element No. two" ) +! stringlist <-- {"Element No. one", "Element No. two"} + +print'(a)', stringlist%len() +! 2 + +end program demo_len diff --git a/test/examples/strings/demo_chomp.f90 b/test/examples/strings/demo_chomp.f90 new file mode 100644 index 000000000..ed97aacab --- /dev/null +++ b/test/examples/strings/demo_chomp.f90 @@ -0,0 +1,14 @@ +program demo_chomp +use stdlib_ascii, only : TAB, VT, NUL, LF, CR, FF +use stdlib_strings, only : chomp +implicit none +print'(a)', chomp(" hello ") ! " hello" +print'(a)', chomp(TAB//"goodbye"//CR//LF) ! "\tgoodbye" +print'(a)', chomp(" "//TAB//LF//VT//FF//CR) ! "" +print'(a)', chomp(" ! ")//"!" ! " !!" +print'(a)', chomp("Hello") ! "Hello" +print'(a)', chomp("hello", ["l", "o"]) ! "he" +print'(a)', chomp("hello", set=["l", "o"]) ! "he" +print'(a)', chomp("hello", "lo") ! "hel" +print'(a)', chomp("hello", substring="lo") ! "hel" +end program demo_chomp diff --git a/test/examples/strings/demo_count.f90 b/test/examples/strings/demo_count.f90 new file mode 100644 index 000000000..db9a2d8b1 --- /dev/null +++ b/test/examples/strings/demo_count.f90 @@ -0,0 +1,13 @@ +program demo_count +use stdlib_string_type, only: string_type, assignment(=) +use stdlib_strings, only : count +implicit none +type(string_type) :: string + +string = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?" + +print *, count(string, "wood") ! 4 +print *, count(string, ["would", "chuck", "could"]) ! [1, 4, 1] +print *, count("a long queueueueue", "ueu", [.false., .true.]) ! [2, 4] + +end program demo_count diff --git a/test/examples/strings/demo_ends_with.f90 b/test/examples/strings/demo_ends_with.f90 new file mode 100644 index 000000000..b883cca25 --- /dev/null +++ b/test/examples/strings/demo_ends_with.f90 @@ -0,0 +1,6 @@ +program demo_ends_with +use stdlib_strings, only : ends_with +implicit none +print'(a)', ends_with("pattern", "ern") ! T +print'(a)', ends_with("pattern", "pat") ! F +end program demo_ends_with diff --git a/test/examples/strings/demo_find.f90 b/test/examples/strings/demo_find.f90 new file mode 100644 index 000000000..797743009 --- /dev/null +++ b/test/examples/strings/demo_find.f90 @@ -0,0 +1,13 @@ +program demo_find +use stdlib_string_type, only: string_type, assignment(=) +use stdlib_strings, only : find +implicit none +type(string_type) :: string + +string = "needle in the character-stack" + +print *, find(string, "needle") ! 1 +print *, find(string, ["a", "c"], [3, 2]) ! [27, 20] +print *, find("qwqwqwq", "qwq", 3, [.false., .true.]) ! [0, 5] + +end program demo_find diff --git a/test/examples/strings/demo_padl.f90 b/test/examples/strings/demo_padl.f90 new file mode 100644 index 000000000..54f54026d --- /dev/null +++ b/test/examples/strings/demo_padl.f90 @@ -0,0 +1,15 @@ +program demo_padl +use stdlib_string_type, only: string_type, assignment(=) +use stdlib_strings, only : padl +implicit none +string_type :: string + +string = "left pad this string" +! string <-- "left pad this string" + +print *, padl(string, 25, "$") ! "$$$$$left pad this string" + +string = padl(string, 25) +! string <-- " left pad this string" + +end program demo_padl diff --git a/test/examples/strings/demo_padr.f90 b/test/examples/strings/demo_padr.f90 new file mode 100644 index 000000000..5ee376e45 --- /dev/null +++ b/test/examples/strings/demo_padr.f90 @@ -0,0 +1,15 @@ +program demo_padr +use stdlib_string_type, only: string_type, assignment(=) +use stdlib_strings, only : padr +implicit none +string_type :: string + +string = "right pad this string" +! string <-- "right pad this string" + +print *, padr(string, 25, "$") ! "right pad this string$$$$" + +string = padr(string, 25) +! string <-- "right pad this string " + +end program demo_padr diff --git a/test/examples/strings/demo_replace_all.f90 b/test/examples/strings/demo_replace_all.f90 new file mode 100644 index 000000000..a9b53679c --- /dev/null +++ b/test/examples/strings/demo_replace_all.f90 @@ -0,0 +1,16 @@ +program demo_replace_all +use stdlib_string_type, only: string_type, assignment(=) +use stdlib_strings, only : replace_all +implicit none +type(string_type) :: string + +string = "hurdles here, hurdles there, hurdles everywhere" +! string <-- "hurdles here, hurdles there, hurdles everywhere" + +print'(a)', replace_all(string, "hurdles", "learn from") +! "learn from here, learn from there, learn from everywhere" + +string = replace_all(string, "hurdles", "technology") +! string <-- "technology here, technology there, technology everywhere" + +end program demo_replace_all diff --git a/test/examples/strings/demo_slice.f90 b/test/examples/strings/demo_slice.f90 new file mode 100644 index 000000000..c3c3af269 --- /dev/null +++ b/test/examples/strings/demo_slice.f90 @@ -0,0 +1,20 @@ +program demo_slice +use stdlib_string_type +use stdlib_strings, only : slice +implicit none +type(string_type) :: string +character(len=10) :: char + +string = "abcdefghij" +! string <-- "abcdefghij" + +char = "abcdefghij" +! char <-- "abcdefghij" + +print'(a)', slice("abcdefghij", 2, 6, 2) ! "bdf" +print'(a)', slice(char, 2, 6, 2) ! "bdf" + +string = slice(string, 2, 6, 2) +! string <-- "bdf" + +end program demo_slice diff --git a/test/examples/strings/demo_starts_with.f90 b/test/examples/strings/demo_starts_with.f90 new file mode 100644 index 000000000..2a8510352 --- /dev/null +++ b/test/examples/strings/demo_starts_with.f90 @@ -0,0 +1,6 @@ +program demo_starts_with +use stdlib_strings, only : starts_with +implicit none +print'(a)', starts_with("pattern", "pat") ! T +print'(a)', starts_with("pattern", "ern") ! F +end program demo_starts_with diff --git a/test/examples/strings/demo_strip.f90 b/test/examples/strings/demo_strip.f90 new file mode 100644 index 000000000..f9a26dfef --- /dev/null +++ b/test/examples/strings/demo_strip.f90 @@ -0,0 +1,10 @@ +program demo_strip +use stdlib_ascii, only : TAB, VT, NUL, LF, CR, FF +use stdlib_strings, only : strip +implicit none +print'(a)', strip(" hello ") ! "hello" +print'(a)', strip(TAB//"goodbye"//CR//LF) ! "goodbye" +print'(a)', strip(" "//TAB//LF//VT//FF//CR) ! "" +print'(a)', strip(" ! ")//"!" ! "!!" +print'(a)', strip("Hello") ! "Hello" +end program demo_strip diff --git a/test/examples/strings/demo_to_string.f90 b/test/examples/strings/demo_to_string.f90 new file mode 100644 index 000000000..049e09da5 --- /dev/null +++ b/test/examples/strings/demo_to_string.f90 @@ -0,0 +1,31 @@ +program demo_to_string +use stdlib_strings, only: to_string + +!> Example for `complex` type +print *, to_string((1, 1)) !! "(1.00000000,1.00000000)" +print *, to_string((1, 1), '(F6.2)') !! "( 1.00, 1.00)" +print *, to_string((1000, 1), '(ES0.2)'), to_string((1000, 1), '(SP,F6.3)') +!! "(1.00E+3,1.00)""(******,+1.000)" +!! Too narrow formatter for real number +!! Normal demonstration(`******` from Fortran Standard) + +!> Example for `integer` type +print *, to_string(-3) !! "-3" +print *, to_string(42, '(I4)') !! " 42" +print *, to_string(1, '(I0.4)'), to_string(2, '(B4)') !! "0001"" 10" + +!> Example for `real` type +print *, to_string(1.) !! "1.00000000" +print *, to_string(1., '(F6.2)') !! " 1.00" +print *, to_string(1., 'F6.2') !! " 1.00" +print *, to_string(1., '(SP,ES9.2)'), to_string(1, '(F7.3)') !! "+1.00E+00""[*]" +!! 1 wrong demonstration (`[*]` from `to_string`) + +!> Example for `logical` type +print *, to_string(.true.) !! "T" +print *, to_string(.true., '(L2)') !! " T" +print *, to_string(.true., 'L2') !! " T" +print *, to_string(.false., '(I5)') !! "[*]" +!! 1 wrong demonstrations(`[*]` from `to_string`) + +end program demo_to_string diff --git a/test/examples/version/demo_version.f90 b/test/examples/version/demo_version.f90 new file mode 100644 index 000000000..9a5ad492e --- /dev/null +++ b/test/examples/version/demo_version.f90 @@ -0,0 +1,7 @@ +program demo_version +use stdlib_version, only : get_stdlib_version +implicit none +character(len=:), allocatable :: version +call get_stdlib_version(string=version) +print '(a)', version +end program demo_version From 3d4d8a7ec027158331bf05578e0c22582844008f Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 21 Jun 2022 08:19:42 +0200 Subject: [PATCH 03/38] rename examples to example --- test/{examples => example}/array/demo_falseloc.f90 | 0 test/{examples => example}/array/demo_trueloc.f90 | 0 test/{examples => example}/ascii/demo_reverse.f90 | 0 test/{examples => example}/ascii/demo_to_lower.f90 | 0 test/{examples => example}/ascii/demo_to_sentence.f90 | 0 test/{examples => example}/ascii/demo_to_title.f90 | 0 test/{examples => example}/ascii/demo_to_upper.f90 | 0 test/{examples => example}/bitsets/demo_all.f90 | 0 test/{examples => example}/bitsets/demo_and.f90 | 0 test/{examples => example}/bitsets/demo_and_not.f90 | 0 test/{examples => example}/bitsets/demo_any.f90 | 0 test/{examples => example}/bitsets/demo_assignment.f90 | 0 test/{examples => example}/bitsets/demo_bit_count.f90 | 0 test/{examples => example}/bitsets/demo_bits.f90 | 0 test/{examples => example}/bitsets/demo_clear.f90 | 0 test/{examples => example}/bitsets/demo_equality.f90 | 0 test/{examples => example}/bitsets/demo_extract.f90 | 0 test/{examples => example}/bitsets/demo_flip.f90 | 0 test/{examples => example}/bitsets/demo_from_string.f90 | 0 test/{examples => example}/bitsets/demo_ge.f90 | 0 test/{examples => example}/bitsets/demo_gt.f90 | 0 test/{examples => example}/bitsets/demo_inequality.f90 | 0 test/{examples => example}/bitsets/demo_init.f90 | 0 test/{examples => example}/bitsets/demo_input.f90 | 0 test/{examples => example}/bitsets/demo_le.f90 | 0 test/{examples => example}/bitsets/demo_lt.f90 | 0 test/{examples => example}/bitsets/demo_none.f90 | 0 test/{examples => example}/bitsets/demo_not.f90 | 0 test/{examples => example}/bitsets/demo_or.f90 | 0 test/{examples => example}/bitsets/demo_output.f90 | 0 test/{examples => example}/bitsets/demo_read_bitset.f90 | 0 test/{examples => example}/bitsets/demo_set.f90 | 0 test/{examples => example}/bitsets/demo_test.f90 | 0 test/{examples => example}/bitsets/demo_to_string.f90 | 0 test/{examples => example}/bitsets/demo_value.f90 | 0 test/{examples => example}/bitsets/demo_write_bitset.f90 | 0 test/{examples => example}/bitsets/demo_xor.f90 | 0 test/{examples => example}/error/demo_check1.f90 | 0 test/{examples => example}/error/demo_check2.f90 | 0 test/{examples => example}/error/demo_check3.f90 | 0 test/{examples => example}/error/demo_check4.f90 | 0 test/{examples => example}/error/demo_error_stop1.f90 | 0 test/{examples => example}/error/demo_error_stop2.f90 | 0 .../{examples => example}/hash_procedures/demo_fibonacci_hash.f90 | 0 .../hash_procedures/demo_fibonacci_hash_64.f90 | 0 test/{examples => example}/hash_procedures/demo_fnv_1_hash.f90 | 0 test/{examples => example}/hash_procedures/demo_fnv_1_hash_64.f90 | 0 test/{examples => example}/hash_procedures/demo_fnv_1a_hash.f90 | 0 .../{examples => example}/hash_procedures/demo_fnv_1a_hash_64.f90 | 0 test/{examples => example}/hash_procedures/demo_nmhash32.f90 | 0 test/{examples => example}/hash_procedures/demo_nmhash32x.f90 | 0 test/{examples => example}/hash_procedures/demo_pengy_hash.f90 | 0 test/{examples => example}/hash_procedures/demo_spooky_hash.f90 | 0 .../hash_procedures/demo_universal_mult_hash.f90 | 0 .../hash_procedures/demo_universal_mult_hash_64.f90 | 0 test/{examples => example}/hash_procedures/demo_water_hash.f90 | 0 test/{examples => example}/hashmaps/demo_calls.f90 | 0 test/{examples => example}/hashmaps/demo_copy_key.f90 | 0 test/{examples => example}/hashmaps/demo_copy_other.f90 | 0 test/{examples => example}/hashmaps/demo_entries.f90 | 0 test/{examples => example}/hashmaps/demo_equal_keys.f90 | 0 test/{examples => example}/hashmaps/demo_fnv_1_hasher.f90 | 0 test/{examples => example}/hashmaps/demo_fnv_1a_hasher.f90 | 0 test/{examples => example}/hashmaps/demo_free_key.f90 | 0 test/{examples => example}/hashmaps/demo_free_other.f90 | 0 test/{examples => example}/hashmaps/demo_get.f90 | 0 test/{examples => example}/hashmaps/demo_get_other_data.f90 | 0 test/{examples => example}/hashmaps/demo_hasher_fun.f90 | 0 test/{examples => example}/hashmaps/demo_init.f90 | 0 test/{examples => example}/hashmaps/demo_key_test.f90 | 0 test/{examples => example}/hashmaps/demo_loading.f90 | 0 test/{examples => example}/hashmaps/demo_map_entry.f90 | 0 test/{examples => example}/hashmaps/demo_num_slots.f90 | 0 test/{examples => example}/hashmaps/demo_probes.f90 | 0 test/{examples => example}/hashmaps/demo_rehash.f90 | 0 test/{examples => example}/hashmaps/demo_remove.f90 | 0 .../hashmaps/demo_seeded_nmhash32_hasher.f90 | 0 .../hashmaps/demo_seeded_nmhash32x_hasher.f90 | 0 test/{examples => example}/hashmaps/demo_seeded_water_hasher.f90 | 0 test/{examples => example}/hashmaps/demo_set.f90 | 0 test/{examples => example}/hashmaps/demo_set_other_data.f90 | 0 test/{examples => example}/hashmaps/demo_slots_bits.f90 | 0 test/{examples => example}/hashmaps/demo_total_depth.f90 | 0 test/{examples => example}/io/demo_fmt_constants.f90 | 0 test/{examples => example}/io/demo_getline.f90 | 0 test/{examples => example}/io/demo_loadnpy.f90 | 0 test/{examples => example}/io/demo_loadtxt.f90 | 0 test/{examples => example}/io/demo_open.f90 | 0 test/{examples => example}/io/demo_savenpy.f90 | 0 test/{examples => example}/io/demo_savetxt.f90 | 0 test/{examples => example}/linalg/demo_diag1.f90 | 0 test/{examples => example}/linalg/demo_diag2.f90 | 0 test/{examples => example}/linalg/demo_diag3.f90 | 0 test/{examples => example}/linalg/demo_diag4.f90 | 0 test/{examples => example}/linalg/demo_diag5.f90 | 0 test/{examples => example}/linalg/demo_eye1.f90 | 0 test/{examples => example}/linalg/demo_eye2.f90 | 0 test/{examples => example}/linalg/demo_is_diagonal.f90 | 0 test/{examples => example}/linalg/demo_is_hermitian.f90 | 0 test/{examples => example}/linalg/demo_is_hessenberg.f90 | 0 test/{examples => example}/linalg/demo_is_skew_symmetric.f90 | 0 test/{examples => example}/linalg/demo_is_square.f90 | 0 test/{examples => example}/linalg/demo_is_symmetric.f90 | 0 test/{examples => example}/linalg/demo_is_triangular.f90 | 0 test/{examples => example}/linalg/demo_outer_product.f90 | 0 test/{examples => example}/linalg/demo_trace.f90 | 0 test/{examples => example}/logger/demo_add_log_unit.f90 | 0 test/{examples => example}/logger/demo_configure.f90 | 0 test/{examples => example}/logger/demo_global_logger.f90 | 0 test/{examples => example}/logger/demo_log_io_error.f90 | 0 test/{examples => example}/logger/demo_log_text_error.f90 | 0 test/{examples => example}/math/demo_clip_integer.f90 | 0 test/{examples => example}/math/demo_clip_real.f90 | 0 test/{examples => example}/math/demo_diff.f90 | 0 test/{examples => example}/math/demo_gcd.f90 | 0 test/{examples => example}/math/demo_linspace_complex.f90 | 0 test/{examples => example}/math/demo_linspace_int16.f90 | 0 test/{examples => example}/math/demo_logspace_complex.f90 | 0 test/{examples => example}/math/demo_logspace_int.f90 | 0 test/{examples => example}/math/demo_logspace_rstart_cbase.f90 | 0 test/{examples => example}/math/demo_math_all_close.f90 | 0 test/{examples => example}/math/demo_math_arange.f90 | 0 test/{examples => example}/math/demo_math_arg.f90 | 0 test/{examples => example}/math/demo_math_argd.f90 | 0 test/{examples => example}/math/demo_math_argpi.f90 | 0 test/{examples => example}/math/demo_math_is_close.f90 | 0 test/{examples => example}/optval/demo_optval.f90 | 0 test/{examples => example}/quadrature/demo_gauss_legendre.f90 | 0 .../quadrature/demo_gauss_legendre_lobatto.f90 | 0 test/{examples => example}/quadrature/demo_simps.f90 | 0 test/{examples => example}/quadrature/demo_simps_weights.f90 | 0 test/{examples => example}/quadrature/demo_trapz.f90 | 0 test/{examples => example}/quadrature/demo_trapz_weights.f90 | 0 test/{examples => example}/random/demo_dist_rand.f90 | 0 test/{examples => example}/random/demo_random_seed.f90 | 0 test/{examples => example}/selection/demo_arg_select.f90 | 0 test/{examples => example}/selection/demo_select.f90 | 0 test/{examples => example}/selection/selection_vs_sort.f90 | 0 test/{examples => example}/sorting/demo_ord_sort.f90 | 0 test/{examples => example}/sorting/demo_sort.f90 | 0 test/{examples => example}/specialfunctions_gamma/demo_gamma.f90 | 0 .../{examples => example}/specialfunctions_gamma/demo_gamma_p.f90 | 0 .../{examples => example}/specialfunctions_gamma/demo_gamma_q.f90 | 0 .../{examples => example}/specialfunctions_gamma/demo_ligamma.f90 | 0 .../specialfunctions_gamma/demo_log_factorial.f90 | 0 .../specialfunctions_gamma/demo_log_gamma.f90 | 0 .../{examples => example}/specialfunctions_gamma/demo_uigamma.f90 | 0 test/{examples => example}/stats/demo_corr.f90 | 0 test/{examples => example}/stats/demo_cov.f90 | 0 test/{examples => example}/stats/demo_mean.f90 | 0 test/{examples => example}/stats/demo_median.f90 | 0 test/{examples => example}/stats/demo_moment.f90 | 0 test/{examples => example}/stats/demo_var.f90 | 0 .../stats_distribution_exponential/demo_exponential_cdf.f90 | 0 .../stats_distribution_exponential/demo_exponential_pdf.f90 | 0 .../stats_distribution_exponential/demo_exponential_rvs.f90 | 0 .../stats_distribution_normal/demo_norm_cdf.f90 | 0 .../stats_distribution_normal/demo_normal_pdf.f90 | 0 .../stats_distribution_normal/demo_normal_rvs.f90 | 0 .../stats_distribution_uniform/demo_shuffle.f90 | 0 .../stats_distribution_uniform/demo_uniform_cdf.f90 | 0 .../stats_distribution_uniform/demo_uniform_pdf.f90 | 0 .../stats_distribution_uniform/demo_uniform_rvs.f90 | 0 test/{examples => example}/string_type/demo_adjustl.f90 | 0 test/{examples => example}/string_type/demo_adjustr.f90 | 0 test/{examples => example}/string_type/demo_char.f90 | 0 test/{examples => example}/string_type/demo_char_position.f90 | 0 test/{examples => example}/string_type/demo_char_range.f90 | 0 .../string_type/demo_constructor_character.f90 | 0 test/{examples => example}/string_type/demo_constructor_empty.f90 | 0 .../string_type/demo_constructor_integer.f90 | 0 .../string_type/demo_constructor_logical.f90 | 0 .../{examples => example}/string_type/demo_constructor_scalar.f90 | 0 test/{examples => example}/string_type/demo_cont.f90 | 0 test/{examples => example}/string_type/demo_eq.f90 | 0 test/{examples => example}/string_type/demo_fread.f90 | 0 test/{examples => example}/string_type/demo_fwrite.f90 | 0 test/{examples => example}/string_type/demo_ge.f90 | 0 test/{examples => example}/string_type/demo_gt.f90 | 0 test/{examples => example}/string_type/demo_iachar.f90 | 0 test/{examples => example}/string_type/demo_ichar.f90 | 0 test/{examples => example}/string_type/demo_index.f90 | 0 test/{examples => example}/string_type/demo_le.f90 | 0 test/{examples => example}/string_type/demo_len.f90 | 0 test/{examples => example}/string_type/demo_len_trim.f90 | 0 test/{examples => example}/string_type/demo_lge.f90 | 0 test/{examples => example}/string_type/demo_lgt.f90 | 0 test/{examples => example}/string_type/demo_lle.f90 | 0 test/{examples => example}/string_type/demo_llt.f90 | 0 test/{examples => example}/string_type/demo_lt.f90 | 0 test/{examples => example}/string_type/demo_move.f90 | 0 test/{examples => example}/string_type/demo_ne.f90 | 0 test/{examples => example}/string_type/demo_repeat.f90 | 0 test/{examples => example}/string_type/demo_reverse.f90 | 0 test/{examples => example}/string_type/demo_scan.f90 | 0 test/{examples => example}/string_type/demo_to_lower.f90 | 0 test/{examples => example}/string_type/demo_to_sentence.f90 | 0 test/{examples => example}/string_type/demo_to_title.f90 | 0 test/{examples => example}/string_type/demo_to_upper.f90 | 0 test/{examples => example}/string_type/demo_trim.f90 | 0 test/{examples => example}/string_type/demo_uread.f90 | 0 test/{examples => example}/string_type/demo_uwrite.f90 | 0 test/{examples => example}/string_type/demo_verify.f90 | 0 test/{examples => example}/stringlist_type/demo_clear.f90 | 0 .../stringlist_type/demo_concatenate_operator.f90 | 0 test/{examples => example}/stringlist_type/demo_constructor.f90 | 0 .../stringlist_type/demo_equality_operator.f90 | 0 test/{examples => example}/stringlist_type/demo_fidx_bidx.f90 | 0 test/{examples => example}/stringlist_type/demo_get.f90 | 0 .../stringlist_type/demo_inequality_operator.f90 | 0 test/{examples => example}/stringlist_type/demo_insert_at.f90 | 0 test/{examples => example}/stringlist_type/demo_len.f90 | 0 test/{examples => example}/strings/demo_chomp.f90 | 0 test/{examples => example}/strings/demo_count.f90 | 0 test/{examples => example}/strings/demo_ends_with.f90 | 0 test/{examples => example}/strings/demo_find.f90 | 0 test/{examples => example}/strings/demo_padl.f90 | 0 test/{examples => example}/strings/demo_padr.f90 | 0 test/{examples => example}/strings/demo_replace_all.f90 | 0 test/{examples => example}/strings/demo_slice.f90 | 0 test/{examples => example}/strings/demo_starts_with.f90 | 0 test/{examples => example}/strings/demo_strip.f90 | 0 test/{examples => example}/strings/demo_to_string.f90 | 0 test/{examples => example}/version/demo_version.f90 | 0 224 files changed, 0 insertions(+), 0 deletions(-) rename test/{examples => example}/array/demo_falseloc.f90 (100%) rename test/{examples => example}/array/demo_trueloc.f90 (100%) rename test/{examples => example}/ascii/demo_reverse.f90 (100%) rename test/{examples => example}/ascii/demo_to_lower.f90 (100%) rename test/{examples => example}/ascii/demo_to_sentence.f90 (100%) rename test/{examples => example}/ascii/demo_to_title.f90 (100%) rename test/{examples => example}/ascii/demo_to_upper.f90 (100%) rename test/{examples => example}/bitsets/demo_all.f90 (100%) rename test/{examples => example}/bitsets/demo_and.f90 (100%) rename test/{examples => example}/bitsets/demo_and_not.f90 (100%) rename test/{examples => example}/bitsets/demo_any.f90 (100%) rename test/{examples => example}/bitsets/demo_assignment.f90 (100%) rename test/{examples => example}/bitsets/demo_bit_count.f90 (100%) rename test/{examples => example}/bitsets/demo_bits.f90 (100%) rename test/{examples => example}/bitsets/demo_clear.f90 (100%) rename test/{examples => example}/bitsets/demo_equality.f90 (100%) rename test/{examples => example}/bitsets/demo_extract.f90 (100%) rename test/{examples => example}/bitsets/demo_flip.f90 (100%) rename test/{examples => example}/bitsets/demo_from_string.f90 (100%) rename test/{examples => example}/bitsets/demo_ge.f90 (100%) rename test/{examples => example}/bitsets/demo_gt.f90 (100%) rename test/{examples => example}/bitsets/demo_inequality.f90 (100%) rename test/{examples => example}/bitsets/demo_init.f90 (100%) rename test/{examples => example}/bitsets/demo_input.f90 (100%) rename test/{examples => example}/bitsets/demo_le.f90 (100%) rename test/{examples => example}/bitsets/demo_lt.f90 (100%) rename test/{examples => example}/bitsets/demo_none.f90 (100%) rename test/{examples => example}/bitsets/demo_not.f90 (100%) rename test/{examples => example}/bitsets/demo_or.f90 (100%) rename test/{examples => example}/bitsets/demo_output.f90 (100%) rename test/{examples => example}/bitsets/demo_read_bitset.f90 (100%) rename test/{examples => example}/bitsets/demo_set.f90 (100%) rename test/{examples => example}/bitsets/demo_test.f90 (100%) rename test/{examples => example}/bitsets/demo_to_string.f90 (100%) rename test/{examples => example}/bitsets/demo_value.f90 (100%) rename test/{examples => example}/bitsets/demo_write_bitset.f90 (100%) rename test/{examples => example}/bitsets/demo_xor.f90 (100%) rename test/{examples => example}/error/demo_check1.f90 (100%) rename test/{examples => example}/error/demo_check2.f90 (100%) rename test/{examples => example}/error/demo_check3.f90 (100%) rename test/{examples => example}/error/demo_check4.f90 (100%) rename test/{examples => example}/error/demo_error_stop1.f90 (100%) rename test/{examples => example}/error/demo_error_stop2.f90 (100%) rename test/{examples => example}/hash_procedures/demo_fibonacci_hash.f90 (100%) rename test/{examples => example}/hash_procedures/demo_fibonacci_hash_64.f90 (100%) rename test/{examples => example}/hash_procedures/demo_fnv_1_hash.f90 (100%) rename test/{examples => example}/hash_procedures/demo_fnv_1_hash_64.f90 (100%) rename test/{examples => example}/hash_procedures/demo_fnv_1a_hash.f90 (100%) rename test/{examples => example}/hash_procedures/demo_fnv_1a_hash_64.f90 (100%) rename test/{examples => example}/hash_procedures/demo_nmhash32.f90 (100%) rename test/{examples => example}/hash_procedures/demo_nmhash32x.f90 (100%) rename test/{examples => example}/hash_procedures/demo_pengy_hash.f90 (100%) rename test/{examples => example}/hash_procedures/demo_spooky_hash.f90 (100%) rename test/{examples => example}/hash_procedures/demo_universal_mult_hash.f90 (100%) rename test/{examples => example}/hash_procedures/demo_universal_mult_hash_64.f90 (100%) rename test/{examples => example}/hash_procedures/demo_water_hash.f90 (100%) rename test/{examples => example}/hashmaps/demo_calls.f90 (100%) rename test/{examples => example}/hashmaps/demo_copy_key.f90 (100%) rename test/{examples => example}/hashmaps/demo_copy_other.f90 (100%) rename test/{examples => example}/hashmaps/demo_entries.f90 (100%) rename test/{examples => example}/hashmaps/demo_equal_keys.f90 (100%) rename test/{examples => example}/hashmaps/demo_fnv_1_hasher.f90 (100%) rename test/{examples => example}/hashmaps/demo_fnv_1a_hasher.f90 (100%) rename test/{examples => example}/hashmaps/demo_free_key.f90 (100%) rename test/{examples => example}/hashmaps/demo_free_other.f90 (100%) rename test/{examples => example}/hashmaps/demo_get.f90 (100%) rename test/{examples => example}/hashmaps/demo_get_other_data.f90 (100%) rename test/{examples => example}/hashmaps/demo_hasher_fun.f90 (100%) rename test/{examples => example}/hashmaps/demo_init.f90 (100%) rename test/{examples => example}/hashmaps/demo_key_test.f90 (100%) rename test/{examples => example}/hashmaps/demo_loading.f90 (100%) rename test/{examples => example}/hashmaps/demo_map_entry.f90 (100%) rename test/{examples => example}/hashmaps/demo_num_slots.f90 (100%) rename test/{examples => example}/hashmaps/demo_probes.f90 (100%) rename test/{examples => example}/hashmaps/demo_rehash.f90 (100%) rename test/{examples => example}/hashmaps/demo_remove.f90 (100%) rename test/{examples => example}/hashmaps/demo_seeded_nmhash32_hasher.f90 (100%) rename test/{examples => example}/hashmaps/demo_seeded_nmhash32x_hasher.f90 (100%) rename test/{examples => example}/hashmaps/demo_seeded_water_hasher.f90 (100%) rename test/{examples => example}/hashmaps/demo_set.f90 (100%) rename test/{examples => example}/hashmaps/demo_set_other_data.f90 (100%) rename test/{examples => example}/hashmaps/demo_slots_bits.f90 (100%) rename test/{examples => example}/hashmaps/demo_total_depth.f90 (100%) rename test/{examples => example}/io/demo_fmt_constants.f90 (100%) rename test/{examples => example}/io/demo_getline.f90 (100%) rename test/{examples => example}/io/demo_loadnpy.f90 (100%) rename test/{examples => example}/io/demo_loadtxt.f90 (100%) rename test/{examples => example}/io/demo_open.f90 (100%) rename test/{examples => example}/io/demo_savenpy.f90 (100%) rename test/{examples => example}/io/demo_savetxt.f90 (100%) rename test/{examples => example}/linalg/demo_diag1.f90 (100%) rename test/{examples => example}/linalg/demo_diag2.f90 (100%) rename test/{examples => example}/linalg/demo_diag3.f90 (100%) rename test/{examples => example}/linalg/demo_diag4.f90 (100%) rename test/{examples => example}/linalg/demo_diag5.f90 (100%) rename test/{examples => example}/linalg/demo_eye1.f90 (100%) rename test/{examples => example}/linalg/demo_eye2.f90 (100%) rename test/{examples => example}/linalg/demo_is_diagonal.f90 (100%) rename test/{examples => example}/linalg/demo_is_hermitian.f90 (100%) rename test/{examples => example}/linalg/demo_is_hessenberg.f90 (100%) rename test/{examples => example}/linalg/demo_is_skew_symmetric.f90 (100%) rename test/{examples => example}/linalg/demo_is_square.f90 (100%) rename test/{examples => example}/linalg/demo_is_symmetric.f90 (100%) rename test/{examples => example}/linalg/demo_is_triangular.f90 (100%) rename test/{examples => example}/linalg/demo_outer_product.f90 (100%) rename test/{examples => example}/linalg/demo_trace.f90 (100%) rename test/{examples => example}/logger/demo_add_log_unit.f90 (100%) rename test/{examples => example}/logger/demo_configure.f90 (100%) rename test/{examples => example}/logger/demo_global_logger.f90 (100%) rename test/{examples => example}/logger/demo_log_io_error.f90 (100%) rename test/{examples => example}/logger/demo_log_text_error.f90 (100%) rename test/{examples => example}/math/demo_clip_integer.f90 (100%) rename test/{examples => example}/math/demo_clip_real.f90 (100%) rename test/{examples => example}/math/demo_diff.f90 (100%) rename test/{examples => example}/math/demo_gcd.f90 (100%) rename test/{examples => example}/math/demo_linspace_complex.f90 (100%) rename test/{examples => example}/math/demo_linspace_int16.f90 (100%) rename test/{examples => example}/math/demo_logspace_complex.f90 (100%) rename test/{examples => example}/math/demo_logspace_int.f90 (100%) rename test/{examples => example}/math/demo_logspace_rstart_cbase.f90 (100%) rename test/{examples => example}/math/demo_math_all_close.f90 (100%) rename test/{examples => example}/math/demo_math_arange.f90 (100%) rename test/{examples => example}/math/demo_math_arg.f90 (100%) rename test/{examples => example}/math/demo_math_argd.f90 (100%) rename test/{examples => example}/math/demo_math_argpi.f90 (100%) rename test/{examples => example}/math/demo_math_is_close.f90 (100%) rename test/{examples => example}/optval/demo_optval.f90 (100%) rename test/{examples => example}/quadrature/demo_gauss_legendre.f90 (100%) rename test/{examples => example}/quadrature/demo_gauss_legendre_lobatto.f90 (100%) rename test/{examples => example}/quadrature/demo_simps.f90 (100%) rename test/{examples => example}/quadrature/demo_simps_weights.f90 (100%) rename test/{examples => example}/quadrature/demo_trapz.f90 (100%) rename test/{examples => example}/quadrature/demo_trapz_weights.f90 (100%) rename test/{examples => example}/random/demo_dist_rand.f90 (100%) rename test/{examples => example}/random/demo_random_seed.f90 (100%) rename test/{examples => example}/selection/demo_arg_select.f90 (100%) rename test/{examples => example}/selection/demo_select.f90 (100%) rename test/{examples => example}/selection/selection_vs_sort.f90 (100%) rename test/{examples => example}/sorting/demo_ord_sort.f90 (100%) rename test/{examples => example}/sorting/demo_sort.f90 (100%) rename test/{examples => example}/specialfunctions_gamma/demo_gamma.f90 (100%) rename test/{examples => example}/specialfunctions_gamma/demo_gamma_p.f90 (100%) rename test/{examples => example}/specialfunctions_gamma/demo_gamma_q.f90 (100%) rename test/{examples => example}/specialfunctions_gamma/demo_ligamma.f90 (100%) rename test/{examples => example}/specialfunctions_gamma/demo_log_factorial.f90 (100%) rename test/{examples => example}/specialfunctions_gamma/demo_log_gamma.f90 (100%) rename test/{examples => example}/specialfunctions_gamma/demo_uigamma.f90 (100%) rename test/{examples => example}/stats/demo_corr.f90 (100%) rename test/{examples => example}/stats/demo_cov.f90 (100%) rename test/{examples => example}/stats/demo_mean.f90 (100%) rename test/{examples => example}/stats/demo_median.f90 (100%) rename test/{examples => example}/stats/demo_moment.f90 (100%) rename test/{examples => example}/stats/demo_var.f90 (100%) rename test/{examples => example}/stats_distribution_exponential/demo_exponential_cdf.f90 (100%) rename test/{examples => example}/stats_distribution_exponential/demo_exponential_pdf.f90 (100%) rename test/{examples => example}/stats_distribution_exponential/demo_exponential_rvs.f90 (100%) rename test/{examples => example}/stats_distribution_normal/demo_norm_cdf.f90 (100%) rename test/{examples => example}/stats_distribution_normal/demo_normal_pdf.f90 (100%) rename test/{examples => example}/stats_distribution_normal/demo_normal_rvs.f90 (100%) rename test/{examples => example}/stats_distribution_uniform/demo_shuffle.f90 (100%) rename test/{examples => example}/stats_distribution_uniform/demo_uniform_cdf.f90 (100%) rename test/{examples => example}/stats_distribution_uniform/demo_uniform_pdf.f90 (100%) rename test/{examples => example}/stats_distribution_uniform/demo_uniform_rvs.f90 (100%) rename test/{examples => example}/string_type/demo_adjustl.f90 (100%) rename test/{examples => example}/string_type/demo_adjustr.f90 (100%) rename test/{examples => example}/string_type/demo_char.f90 (100%) rename test/{examples => example}/string_type/demo_char_position.f90 (100%) rename test/{examples => example}/string_type/demo_char_range.f90 (100%) rename test/{examples => example}/string_type/demo_constructor_character.f90 (100%) rename test/{examples => example}/string_type/demo_constructor_empty.f90 (100%) rename test/{examples => example}/string_type/demo_constructor_integer.f90 (100%) rename test/{examples => example}/string_type/demo_constructor_logical.f90 (100%) rename test/{examples => example}/string_type/demo_constructor_scalar.f90 (100%) rename test/{examples => example}/string_type/demo_cont.f90 (100%) rename test/{examples => example}/string_type/demo_eq.f90 (100%) rename test/{examples => example}/string_type/demo_fread.f90 (100%) rename test/{examples => example}/string_type/demo_fwrite.f90 (100%) rename test/{examples => example}/string_type/demo_ge.f90 (100%) rename test/{examples => example}/string_type/demo_gt.f90 (100%) rename test/{examples => example}/string_type/demo_iachar.f90 (100%) rename test/{examples => example}/string_type/demo_ichar.f90 (100%) rename test/{examples => example}/string_type/demo_index.f90 (100%) rename test/{examples => example}/string_type/demo_le.f90 (100%) rename test/{examples => example}/string_type/demo_len.f90 (100%) rename test/{examples => example}/string_type/demo_len_trim.f90 (100%) rename test/{examples => example}/string_type/demo_lge.f90 (100%) rename test/{examples => example}/string_type/demo_lgt.f90 (100%) rename test/{examples => example}/string_type/demo_lle.f90 (100%) rename test/{examples => example}/string_type/demo_llt.f90 (100%) rename test/{examples => example}/string_type/demo_lt.f90 (100%) rename test/{examples => example}/string_type/demo_move.f90 (100%) rename test/{examples => example}/string_type/demo_ne.f90 (100%) rename test/{examples => example}/string_type/demo_repeat.f90 (100%) rename test/{examples => example}/string_type/demo_reverse.f90 (100%) rename test/{examples => example}/string_type/demo_scan.f90 (100%) rename test/{examples => example}/string_type/demo_to_lower.f90 (100%) rename test/{examples => example}/string_type/demo_to_sentence.f90 (100%) rename test/{examples => example}/string_type/demo_to_title.f90 (100%) rename test/{examples => example}/string_type/demo_to_upper.f90 (100%) rename test/{examples => example}/string_type/demo_trim.f90 (100%) rename test/{examples => example}/string_type/demo_uread.f90 (100%) rename test/{examples => example}/string_type/demo_uwrite.f90 (100%) rename test/{examples => example}/string_type/demo_verify.f90 (100%) rename test/{examples => example}/stringlist_type/demo_clear.f90 (100%) rename test/{examples => example}/stringlist_type/demo_concatenate_operator.f90 (100%) rename test/{examples => example}/stringlist_type/demo_constructor.f90 (100%) rename test/{examples => example}/stringlist_type/demo_equality_operator.f90 (100%) rename test/{examples => example}/stringlist_type/demo_fidx_bidx.f90 (100%) rename test/{examples => example}/stringlist_type/demo_get.f90 (100%) rename test/{examples => example}/stringlist_type/demo_inequality_operator.f90 (100%) rename test/{examples => example}/stringlist_type/demo_insert_at.f90 (100%) rename test/{examples => example}/stringlist_type/demo_len.f90 (100%) rename test/{examples => example}/strings/demo_chomp.f90 (100%) rename test/{examples => example}/strings/demo_count.f90 (100%) rename test/{examples => example}/strings/demo_ends_with.f90 (100%) rename test/{examples => example}/strings/demo_find.f90 (100%) rename test/{examples => example}/strings/demo_padl.f90 (100%) rename test/{examples => example}/strings/demo_padr.f90 (100%) rename test/{examples => example}/strings/demo_replace_all.f90 (100%) rename test/{examples => example}/strings/demo_slice.f90 (100%) rename test/{examples => example}/strings/demo_starts_with.f90 (100%) rename test/{examples => example}/strings/demo_strip.f90 (100%) rename test/{examples => example}/strings/demo_to_string.f90 (100%) rename test/{examples => example}/version/demo_version.f90 (100%) diff --git a/test/examples/array/demo_falseloc.f90 b/test/example/array/demo_falseloc.f90 similarity index 100% rename from test/examples/array/demo_falseloc.f90 rename to test/example/array/demo_falseloc.f90 diff --git a/test/examples/array/demo_trueloc.f90 b/test/example/array/demo_trueloc.f90 similarity index 100% rename from test/examples/array/demo_trueloc.f90 rename to test/example/array/demo_trueloc.f90 diff --git a/test/examples/ascii/demo_reverse.f90 b/test/example/ascii/demo_reverse.f90 similarity index 100% rename from test/examples/ascii/demo_reverse.f90 rename to test/example/ascii/demo_reverse.f90 diff --git a/test/examples/ascii/demo_to_lower.f90 b/test/example/ascii/demo_to_lower.f90 similarity index 100% rename from test/examples/ascii/demo_to_lower.f90 rename to test/example/ascii/demo_to_lower.f90 diff --git a/test/examples/ascii/demo_to_sentence.f90 b/test/example/ascii/demo_to_sentence.f90 similarity index 100% rename from test/examples/ascii/demo_to_sentence.f90 rename to test/example/ascii/demo_to_sentence.f90 diff --git a/test/examples/ascii/demo_to_title.f90 b/test/example/ascii/demo_to_title.f90 similarity index 100% rename from test/examples/ascii/demo_to_title.f90 rename to test/example/ascii/demo_to_title.f90 diff --git a/test/examples/ascii/demo_to_upper.f90 b/test/example/ascii/demo_to_upper.f90 similarity index 100% rename from test/examples/ascii/demo_to_upper.f90 rename to test/example/ascii/demo_to_upper.f90 diff --git a/test/examples/bitsets/demo_all.f90 b/test/example/bitsets/demo_all.f90 similarity index 100% rename from test/examples/bitsets/demo_all.f90 rename to test/example/bitsets/demo_all.f90 diff --git a/test/examples/bitsets/demo_and.f90 b/test/example/bitsets/demo_and.f90 similarity index 100% rename from test/examples/bitsets/demo_and.f90 rename to test/example/bitsets/demo_and.f90 diff --git a/test/examples/bitsets/demo_and_not.f90 b/test/example/bitsets/demo_and_not.f90 similarity index 100% rename from test/examples/bitsets/demo_and_not.f90 rename to test/example/bitsets/demo_and_not.f90 diff --git a/test/examples/bitsets/demo_any.f90 b/test/example/bitsets/demo_any.f90 similarity index 100% rename from test/examples/bitsets/demo_any.f90 rename to test/example/bitsets/demo_any.f90 diff --git a/test/examples/bitsets/demo_assignment.f90 b/test/example/bitsets/demo_assignment.f90 similarity index 100% rename from test/examples/bitsets/demo_assignment.f90 rename to test/example/bitsets/demo_assignment.f90 diff --git a/test/examples/bitsets/demo_bit_count.f90 b/test/example/bitsets/demo_bit_count.f90 similarity index 100% rename from test/examples/bitsets/demo_bit_count.f90 rename to test/example/bitsets/demo_bit_count.f90 diff --git a/test/examples/bitsets/demo_bits.f90 b/test/example/bitsets/demo_bits.f90 similarity index 100% rename from test/examples/bitsets/demo_bits.f90 rename to test/example/bitsets/demo_bits.f90 diff --git a/test/examples/bitsets/demo_clear.f90 b/test/example/bitsets/demo_clear.f90 similarity index 100% rename from test/examples/bitsets/demo_clear.f90 rename to test/example/bitsets/demo_clear.f90 diff --git a/test/examples/bitsets/demo_equality.f90 b/test/example/bitsets/demo_equality.f90 similarity index 100% rename from test/examples/bitsets/demo_equality.f90 rename to test/example/bitsets/demo_equality.f90 diff --git a/test/examples/bitsets/demo_extract.f90 b/test/example/bitsets/demo_extract.f90 similarity index 100% rename from test/examples/bitsets/demo_extract.f90 rename to test/example/bitsets/demo_extract.f90 diff --git a/test/examples/bitsets/demo_flip.f90 b/test/example/bitsets/demo_flip.f90 similarity index 100% rename from test/examples/bitsets/demo_flip.f90 rename to test/example/bitsets/demo_flip.f90 diff --git a/test/examples/bitsets/demo_from_string.f90 b/test/example/bitsets/demo_from_string.f90 similarity index 100% rename from test/examples/bitsets/demo_from_string.f90 rename to test/example/bitsets/demo_from_string.f90 diff --git a/test/examples/bitsets/demo_ge.f90 b/test/example/bitsets/demo_ge.f90 similarity index 100% rename from test/examples/bitsets/demo_ge.f90 rename to test/example/bitsets/demo_ge.f90 diff --git a/test/examples/bitsets/demo_gt.f90 b/test/example/bitsets/demo_gt.f90 similarity index 100% rename from test/examples/bitsets/demo_gt.f90 rename to test/example/bitsets/demo_gt.f90 diff --git a/test/examples/bitsets/demo_inequality.f90 b/test/example/bitsets/demo_inequality.f90 similarity index 100% rename from test/examples/bitsets/demo_inequality.f90 rename to test/example/bitsets/demo_inequality.f90 diff --git a/test/examples/bitsets/demo_init.f90 b/test/example/bitsets/demo_init.f90 similarity index 100% rename from test/examples/bitsets/demo_init.f90 rename to test/example/bitsets/demo_init.f90 diff --git a/test/examples/bitsets/demo_input.f90 b/test/example/bitsets/demo_input.f90 similarity index 100% rename from test/examples/bitsets/demo_input.f90 rename to test/example/bitsets/demo_input.f90 diff --git a/test/examples/bitsets/demo_le.f90 b/test/example/bitsets/demo_le.f90 similarity index 100% rename from test/examples/bitsets/demo_le.f90 rename to test/example/bitsets/demo_le.f90 diff --git a/test/examples/bitsets/demo_lt.f90 b/test/example/bitsets/demo_lt.f90 similarity index 100% rename from test/examples/bitsets/demo_lt.f90 rename to test/example/bitsets/demo_lt.f90 diff --git a/test/examples/bitsets/demo_none.f90 b/test/example/bitsets/demo_none.f90 similarity index 100% rename from test/examples/bitsets/demo_none.f90 rename to test/example/bitsets/demo_none.f90 diff --git a/test/examples/bitsets/demo_not.f90 b/test/example/bitsets/demo_not.f90 similarity index 100% rename from test/examples/bitsets/demo_not.f90 rename to test/example/bitsets/demo_not.f90 diff --git a/test/examples/bitsets/demo_or.f90 b/test/example/bitsets/demo_or.f90 similarity index 100% rename from test/examples/bitsets/demo_or.f90 rename to test/example/bitsets/demo_or.f90 diff --git a/test/examples/bitsets/demo_output.f90 b/test/example/bitsets/demo_output.f90 similarity index 100% rename from test/examples/bitsets/demo_output.f90 rename to test/example/bitsets/demo_output.f90 diff --git a/test/examples/bitsets/demo_read_bitset.f90 b/test/example/bitsets/demo_read_bitset.f90 similarity index 100% rename from test/examples/bitsets/demo_read_bitset.f90 rename to test/example/bitsets/demo_read_bitset.f90 diff --git a/test/examples/bitsets/demo_set.f90 b/test/example/bitsets/demo_set.f90 similarity index 100% rename from test/examples/bitsets/demo_set.f90 rename to test/example/bitsets/demo_set.f90 diff --git a/test/examples/bitsets/demo_test.f90 b/test/example/bitsets/demo_test.f90 similarity index 100% rename from test/examples/bitsets/demo_test.f90 rename to test/example/bitsets/demo_test.f90 diff --git a/test/examples/bitsets/demo_to_string.f90 b/test/example/bitsets/demo_to_string.f90 similarity index 100% rename from test/examples/bitsets/demo_to_string.f90 rename to test/example/bitsets/demo_to_string.f90 diff --git a/test/examples/bitsets/demo_value.f90 b/test/example/bitsets/demo_value.f90 similarity index 100% rename from test/examples/bitsets/demo_value.f90 rename to test/example/bitsets/demo_value.f90 diff --git a/test/examples/bitsets/demo_write_bitset.f90 b/test/example/bitsets/demo_write_bitset.f90 similarity index 100% rename from test/examples/bitsets/demo_write_bitset.f90 rename to test/example/bitsets/demo_write_bitset.f90 diff --git a/test/examples/bitsets/demo_xor.f90 b/test/example/bitsets/demo_xor.f90 similarity index 100% rename from test/examples/bitsets/demo_xor.f90 rename to test/example/bitsets/demo_xor.f90 diff --git a/test/examples/error/demo_check1.f90 b/test/example/error/demo_check1.f90 similarity index 100% rename from test/examples/error/demo_check1.f90 rename to test/example/error/demo_check1.f90 diff --git a/test/examples/error/demo_check2.f90 b/test/example/error/demo_check2.f90 similarity index 100% rename from test/examples/error/demo_check2.f90 rename to test/example/error/demo_check2.f90 diff --git a/test/examples/error/demo_check3.f90 b/test/example/error/demo_check3.f90 similarity index 100% rename from test/examples/error/demo_check3.f90 rename to test/example/error/demo_check3.f90 diff --git a/test/examples/error/demo_check4.f90 b/test/example/error/demo_check4.f90 similarity index 100% rename from test/examples/error/demo_check4.f90 rename to test/example/error/demo_check4.f90 diff --git a/test/examples/error/demo_error_stop1.f90 b/test/example/error/demo_error_stop1.f90 similarity index 100% rename from test/examples/error/demo_error_stop1.f90 rename to test/example/error/demo_error_stop1.f90 diff --git a/test/examples/error/demo_error_stop2.f90 b/test/example/error/demo_error_stop2.f90 similarity index 100% rename from test/examples/error/demo_error_stop2.f90 rename to test/example/error/demo_error_stop2.f90 diff --git a/test/examples/hash_procedures/demo_fibonacci_hash.f90 b/test/example/hash_procedures/demo_fibonacci_hash.f90 similarity index 100% rename from test/examples/hash_procedures/demo_fibonacci_hash.f90 rename to test/example/hash_procedures/demo_fibonacci_hash.f90 diff --git a/test/examples/hash_procedures/demo_fibonacci_hash_64.f90 b/test/example/hash_procedures/demo_fibonacci_hash_64.f90 similarity index 100% rename from test/examples/hash_procedures/demo_fibonacci_hash_64.f90 rename to test/example/hash_procedures/demo_fibonacci_hash_64.f90 diff --git a/test/examples/hash_procedures/demo_fnv_1_hash.f90 b/test/example/hash_procedures/demo_fnv_1_hash.f90 similarity index 100% rename from test/examples/hash_procedures/demo_fnv_1_hash.f90 rename to test/example/hash_procedures/demo_fnv_1_hash.f90 diff --git a/test/examples/hash_procedures/demo_fnv_1_hash_64.f90 b/test/example/hash_procedures/demo_fnv_1_hash_64.f90 similarity index 100% rename from test/examples/hash_procedures/demo_fnv_1_hash_64.f90 rename to test/example/hash_procedures/demo_fnv_1_hash_64.f90 diff --git a/test/examples/hash_procedures/demo_fnv_1a_hash.f90 b/test/example/hash_procedures/demo_fnv_1a_hash.f90 similarity index 100% rename from test/examples/hash_procedures/demo_fnv_1a_hash.f90 rename to test/example/hash_procedures/demo_fnv_1a_hash.f90 diff --git a/test/examples/hash_procedures/demo_fnv_1a_hash_64.f90 b/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 similarity index 100% rename from test/examples/hash_procedures/demo_fnv_1a_hash_64.f90 rename to test/example/hash_procedures/demo_fnv_1a_hash_64.f90 diff --git a/test/examples/hash_procedures/demo_nmhash32.f90 b/test/example/hash_procedures/demo_nmhash32.f90 similarity index 100% rename from test/examples/hash_procedures/demo_nmhash32.f90 rename to test/example/hash_procedures/demo_nmhash32.f90 diff --git a/test/examples/hash_procedures/demo_nmhash32x.f90 b/test/example/hash_procedures/demo_nmhash32x.f90 similarity index 100% rename from test/examples/hash_procedures/demo_nmhash32x.f90 rename to test/example/hash_procedures/demo_nmhash32x.f90 diff --git a/test/examples/hash_procedures/demo_pengy_hash.f90 b/test/example/hash_procedures/demo_pengy_hash.f90 similarity index 100% rename from test/examples/hash_procedures/demo_pengy_hash.f90 rename to test/example/hash_procedures/demo_pengy_hash.f90 diff --git a/test/examples/hash_procedures/demo_spooky_hash.f90 b/test/example/hash_procedures/demo_spooky_hash.f90 similarity index 100% rename from test/examples/hash_procedures/demo_spooky_hash.f90 rename to test/example/hash_procedures/demo_spooky_hash.f90 diff --git a/test/examples/hash_procedures/demo_universal_mult_hash.f90 b/test/example/hash_procedures/demo_universal_mult_hash.f90 similarity index 100% rename from test/examples/hash_procedures/demo_universal_mult_hash.f90 rename to test/example/hash_procedures/demo_universal_mult_hash.f90 diff --git a/test/examples/hash_procedures/demo_universal_mult_hash_64.f90 b/test/example/hash_procedures/demo_universal_mult_hash_64.f90 similarity index 100% rename from test/examples/hash_procedures/demo_universal_mult_hash_64.f90 rename to test/example/hash_procedures/demo_universal_mult_hash_64.f90 diff --git a/test/examples/hash_procedures/demo_water_hash.f90 b/test/example/hash_procedures/demo_water_hash.f90 similarity index 100% rename from test/examples/hash_procedures/demo_water_hash.f90 rename to test/example/hash_procedures/demo_water_hash.f90 diff --git a/test/examples/hashmaps/demo_calls.f90 b/test/example/hashmaps/demo_calls.f90 similarity index 100% rename from test/examples/hashmaps/demo_calls.f90 rename to test/example/hashmaps/demo_calls.f90 diff --git a/test/examples/hashmaps/demo_copy_key.f90 b/test/example/hashmaps/demo_copy_key.f90 similarity index 100% rename from test/examples/hashmaps/demo_copy_key.f90 rename to test/example/hashmaps/demo_copy_key.f90 diff --git a/test/examples/hashmaps/demo_copy_other.f90 b/test/example/hashmaps/demo_copy_other.f90 similarity index 100% rename from test/examples/hashmaps/demo_copy_other.f90 rename to test/example/hashmaps/demo_copy_other.f90 diff --git a/test/examples/hashmaps/demo_entries.f90 b/test/example/hashmaps/demo_entries.f90 similarity index 100% rename from test/examples/hashmaps/demo_entries.f90 rename to test/example/hashmaps/demo_entries.f90 diff --git a/test/examples/hashmaps/demo_equal_keys.f90 b/test/example/hashmaps/demo_equal_keys.f90 similarity index 100% rename from test/examples/hashmaps/demo_equal_keys.f90 rename to test/example/hashmaps/demo_equal_keys.f90 diff --git a/test/examples/hashmaps/demo_fnv_1_hasher.f90 b/test/example/hashmaps/demo_fnv_1_hasher.f90 similarity index 100% rename from test/examples/hashmaps/demo_fnv_1_hasher.f90 rename to test/example/hashmaps/demo_fnv_1_hasher.f90 diff --git a/test/examples/hashmaps/demo_fnv_1a_hasher.f90 b/test/example/hashmaps/demo_fnv_1a_hasher.f90 similarity index 100% rename from test/examples/hashmaps/demo_fnv_1a_hasher.f90 rename to test/example/hashmaps/demo_fnv_1a_hasher.f90 diff --git a/test/examples/hashmaps/demo_free_key.f90 b/test/example/hashmaps/demo_free_key.f90 similarity index 100% rename from test/examples/hashmaps/demo_free_key.f90 rename to test/example/hashmaps/demo_free_key.f90 diff --git a/test/examples/hashmaps/demo_free_other.f90 b/test/example/hashmaps/demo_free_other.f90 similarity index 100% rename from test/examples/hashmaps/demo_free_other.f90 rename to test/example/hashmaps/demo_free_other.f90 diff --git a/test/examples/hashmaps/demo_get.f90 b/test/example/hashmaps/demo_get.f90 similarity index 100% rename from test/examples/hashmaps/demo_get.f90 rename to test/example/hashmaps/demo_get.f90 diff --git a/test/examples/hashmaps/demo_get_other_data.f90 b/test/example/hashmaps/demo_get_other_data.f90 similarity index 100% rename from test/examples/hashmaps/demo_get_other_data.f90 rename to test/example/hashmaps/demo_get_other_data.f90 diff --git a/test/examples/hashmaps/demo_hasher_fun.f90 b/test/example/hashmaps/demo_hasher_fun.f90 similarity index 100% rename from test/examples/hashmaps/demo_hasher_fun.f90 rename to test/example/hashmaps/demo_hasher_fun.f90 diff --git a/test/examples/hashmaps/demo_init.f90 b/test/example/hashmaps/demo_init.f90 similarity index 100% rename from test/examples/hashmaps/demo_init.f90 rename to test/example/hashmaps/demo_init.f90 diff --git a/test/examples/hashmaps/demo_key_test.f90 b/test/example/hashmaps/demo_key_test.f90 similarity index 100% rename from test/examples/hashmaps/demo_key_test.f90 rename to test/example/hashmaps/demo_key_test.f90 diff --git a/test/examples/hashmaps/demo_loading.f90 b/test/example/hashmaps/demo_loading.f90 similarity index 100% rename from test/examples/hashmaps/demo_loading.f90 rename to test/example/hashmaps/demo_loading.f90 diff --git a/test/examples/hashmaps/demo_map_entry.f90 b/test/example/hashmaps/demo_map_entry.f90 similarity index 100% rename from test/examples/hashmaps/demo_map_entry.f90 rename to test/example/hashmaps/demo_map_entry.f90 diff --git a/test/examples/hashmaps/demo_num_slots.f90 b/test/example/hashmaps/demo_num_slots.f90 similarity index 100% rename from test/examples/hashmaps/demo_num_slots.f90 rename to test/example/hashmaps/demo_num_slots.f90 diff --git a/test/examples/hashmaps/demo_probes.f90 b/test/example/hashmaps/demo_probes.f90 similarity index 100% rename from test/examples/hashmaps/demo_probes.f90 rename to test/example/hashmaps/demo_probes.f90 diff --git a/test/examples/hashmaps/demo_rehash.f90 b/test/example/hashmaps/demo_rehash.f90 similarity index 100% rename from test/examples/hashmaps/demo_rehash.f90 rename to test/example/hashmaps/demo_rehash.f90 diff --git a/test/examples/hashmaps/demo_remove.f90 b/test/example/hashmaps/demo_remove.f90 similarity index 100% rename from test/examples/hashmaps/demo_remove.f90 rename to test/example/hashmaps/demo_remove.f90 diff --git a/test/examples/hashmaps/demo_seeded_nmhash32_hasher.f90 b/test/example/hashmaps/demo_seeded_nmhash32_hasher.f90 similarity index 100% rename from test/examples/hashmaps/demo_seeded_nmhash32_hasher.f90 rename to test/example/hashmaps/demo_seeded_nmhash32_hasher.f90 diff --git a/test/examples/hashmaps/demo_seeded_nmhash32x_hasher.f90 b/test/example/hashmaps/demo_seeded_nmhash32x_hasher.f90 similarity index 100% rename from test/examples/hashmaps/demo_seeded_nmhash32x_hasher.f90 rename to test/example/hashmaps/demo_seeded_nmhash32x_hasher.f90 diff --git a/test/examples/hashmaps/demo_seeded_water_hasher.f90 b/test/example/hashmaps/demo_seeded_water_hasher.f90 similarity index 100% rename from test/examples/hashmaps/demo_seeded_water_hasher.f90 rename to test/example/hashmaps/demo_seeded_water_hasher.f90 diff --git a/test/examples/hashmaps/demo_set.f90 b/test/example/hashmaps/demo_set.f90 similarity index 100% rename from test/examples/hashmaps/demo_set.f90 rename to test/example/hashmaps/demo_set.f90 diff --git a/test/examples/hashmaps/demo_set_other_data.f90 b/test/example/hashmaps/demo_set_other_data.f90 similarity index 100% rename from test/examples/hashmaps/demo_set_other_data.f90 rename to test/example/hashmaps/demo_set_other_data.f90 diff --git a/test/examples/hashmaps/demo_slots_bits.f90 b/test/example/hashmaps/demo_slots_bits.f90 similarity index 100% rename from test/examples/hashmaps/demo_slots_bits.f90 rename to test/example/hashmaps/demo_slots_bits.f90 diff --git a/test/examples/hashmaps/demo_total_depth.f90 b/test/example/hashmaps/demo_total_depth.f90 similarity index 100% rename from test/examples/hashmaps/demo_total_depth.f90 rename to test/example/hashmaps/demo_total_depth.f90 diff --git a/test/examples/io/demo_fmt_constants.f90 b/test/example/io/demo_fmt_constants.f90 similarity index 100% rename from test/examples/io/demo_fmt_constants.f90 rename to test/example/io/demo_fmt_constants.f90 diff --git a/test/examples/io/demo_getline.f90 b/test/example/io/demo_getline.f90 similarity index 100% rename from test/examples/io/demo_getline.f90 rename to test/example/io/demo_getline.f90 diff --git a/test/examples/io/demo_loadnpy.f90 b/test/example/io/demo_loadnpy.f90 similarity index 100% rename from test/examples/io/demo_loadnpy.f90 rename to test/example/io/demo_loadnpy.f90 diff --git a/test/examples/io/demo_loadtxt.f90 b/test/example/io/demo_loadtxt.f90 similarity index 100% rename from test/examples/io/demo_loadtxt.f90 rename to test/example/io/demo_loadtxt.f90 diff --git a/test/examples/io/demo_open.f90 b/test/example/io/demo_open.f90 similarity index 100% rename from test/examples/io/demo_open.f90 rename to test/example/io/demo_open.f90 diff --git a/test/examples/io/demo_savenpy.f90 b/test/example/io/demo_savenpy.f90 similarity index 100% rename from test/examples/io/demo_savenpy.f90 rename to test/example/io/demo_savenpy.f90 diff --git a/test/examples/io/demo_savetxt.f90 b/test/example/io/demo_savetxt.f90 similarity index 100% rename from test/examples/io/demo_savetxt.f90 rename to test/example/io/demo_savetxt.f90 diff --git a/test/examples/linalg/demo_diag1.f90 b/test/example/linalg/demo_diag1.f90 similarity index 100% rename from test/examples/linalg/demo_diag1.f90 rename to test/example/linalg/demo_diag1.f90 diff --git a/test/examples/linalg/demo_diag2.f90 b/test/example/linalg/demo_diag2.f90 similarity index 100% rename from test/examples/linalg/demo_diag2.f90 rename to test/example/linalg/demo_diag2.f90 diff --git a/test/examples/linalg/demo_diag3.f90 b/test/example/linalg/demo_diag3.f90 similarity index 100% rename from test/examples/linalg/demo_diag3.f90 rename to test/example/linalg/demo_diag3.f90 diff --git a/test/examples/linalg/demo_diag4.f90 b/test/example/linalg/demo_diag4.f90 similarity index 100% rename from test/examples/linalg/demo_diag4.f90 rename to test/example/linalg/demo_diag4.f90 diff --git a/test/examples/linalg/demo_diag5.f90 b/test/example/linalg/demo_diag5.f90 similarity index 100% rename from test/examples/linalg/demo_diag5.f90 rename to test/example/linalg/demo_diag5.f90 diff --git a/test/examples/linalg/demo_eye1.f90 b/test/example/linalg/demo_eye1.f90 similarity index 100% rename from test/examples/linalg/demo_eye1.f90 rename to test/example/linalg/demo_eye1.f90 diff --git a/test/examples/linalg/demo_eye2.f90 b/test/example/linalg/demo_eye2.f90 similarity index 100% rename from test/examples/linalg/demo_eye2.f90 rename to test/example/linalg/demo_eye2.f90 diff --git a/test/examples/linalg/demo_is_diagonal.f90 b/test/example/linalg/demo_is_diagonal.f90 similarity index 100% rename from test/examples/linalg/demo_is_diagonal.f90 rename to test/example/linalg/demo_is_diagonal.f90 diff --git a/test/examples/linalg/demo_is_hermitian.f90 b/test/example/linalg/demo_is_hermitian.f90 similarity index 100% rename from test/examples/linalg/demo_is_hermitian.f90 rename to test/example/linalg/demo_is_hermitian.f90 diff --git a/test/examples/linalg/demo_is_hessenberg.f90 b/test/example/linalg/demo_is_hessenberg.f90 similarity index 100% rename from test/examples/linalg/demo_is_hessenberg.f90 rename to test/example/linalg/demo_is_hessenberg.f90 diff --git a/test/examples/linalg/demo_is_skew_symmetric.f90 b/test/example/linalg/demo_is_skew_symmetric.f90 similarity index 100% rename from test/examples/linalg/demo_is_skew_symmetric.f90 rename to test/example/linalg/demo_is_skew_symmetric.f90 diff --git a/test/examples/linalg/demo_is_square.f90 b/test/example/linalg/demo_is_square.f90 similarity index 100% rename from test/examples/linalg/demo_is_square.f90 rename to test/example/linalg/demo_is_square.f90 diff --git a/test/examples/linalg/demo_is_symmetric.f90 b/test/example/linalg/demo_is_symmetric.f90 similarity index 100% rename from test/examples/linalg/demo_is_symmetric.f90 rename to test/example/linalg/demo_is_symmetric.f90 diff --git a/test/examples/linalg/demo_is_triangular.f90 b/test/example/linalg/demo_is_triangular.f90 similarity index 100% rename from test/examples/linalg/demo_is_triangular.f90 rename to test/example/linalg/demo_is_triangular.f90 diff --git a/test/examples/linalg/demo_outer_product.f90 b/test/example/linalg/demo_outer_product.f90 similarity index 100% rename from test/examples/linalg/demo_outer_product.f90 rename to test/example/linalg/demo_outer_product.f90 diff --git a/test/examples/linalg/demo_trace.f90 b/test/example/linalg/demo_trace.f90 similarity index 100% rename from test/examples/linalg/demo_trace.f90 rename to test/example/linalg/demo_trace.f90 diff --git a/test/examples/logger/demo_add_log_unit.f90 b/test/example/logger/demo_add_log_unit.f90 similarity index 100% rename from test/examples/logger/demo_add_log_unit.f90 rename to test/example/logger/demo_add_log_unit.f90 diff --git a/test/examples/logger/demo_configure.f90 b/test/example/logger/demo_configure.f90 similarity index 100% rename from test/examples/logger/demo_configure.f90 rename to test/example/logger/demo_configure.f90 diff --git a/test/examples/logger/demo_global_logger.f90 b/test/example/logger/demo_global_logger.f90 similarity index 100% rename from test/examples/logger/demo_global_logger.f90 rename to test/example/logger/demo_global_logger.f90 diff --git a/test/examples/logger/demo_log_io_error.f90 b/test/example/logger/demo_log_io_error.f90 similarity index 100% rename from test/examples/logger/demo_log_io_error.f90 rename to test/example/logger/demo_log_io_error.f90 diff --git a/test/examples/logger/demo_log_text_error.f90 b/test/example/logger/demo_log_text_error.f90 similarity index 100% rename from test/examples/logger/demo_log_text_error.f90 rename to test/example/logger/demo_log_text_error.f90 diff --git a/test/examples/math/demo_clip_integer.f90 b/test/example/math/demo_clip_integer.f90 similarity index 100% rename from test/examples/math/demo_clip_integer.f90 rename to test/example/math/demo_clip_integer.f90 diff --git a/test/examples/math/demo_clip_real.f90 b/test/example/math/demo_clip_real.f90 similarity index 100% rename from test/examples/math/demo_clip_real.f90 rename to test/example/math/demo_clip_real.f90 diff --git a/test/examples/math/demo_diff.f90 b/test/example/math/demo_diff.f90 similarity index 100% rename from test/examples/math/demo_diff.f90 rename to test/example/math/demo_diff.f90 diff --git a/test/examples/math/demo_gcd.f90 b/test/example/math/demo_gcd.f90 similarity index 100% rename from test/examples/math/demo_gcd.f90 rename to test/example/math/demo_gcd.f90 diff --git a/test/examples/math/demo_linspace_complex.f90 b/test/example/math/demo_linspace_complex.f90 similarity index 100% rename from test/examples/math/demo_linspace_complex.f90 rename to test/example/math/demo_linspace_complex.f90 diff --git a/test/examples/math/demo_linspace_int16.f90 b/test/example/math/demo_linspace_int16.f90 similarity index 100% rename from test/examples/math/demo_linspace_int16.f90 rename to test/example/math/demo_linspace_int16.f90 diff --git a/test/examples/math/demo_logspace_complex.f90 b/test/example/math/demo_logspace_complex.f90 similarity index 100% rename from test/examples/math/demo_logspace_complex.f90 rename to test/example/math/demo_logspace_complex.f90 diff --git a/test/examples/math/demo_logspace_int.f90 b/test/example/math/demo_logspace_int.f90 similarity index 100% rename from test/examples/math/demo_logspace_int.f90 rename to test/example/math/demo_logspace_int.f90 diff --git a/test/examples/math/demo_logspace_rstart_cbase.f90 b/test/example/math/demo_logspace_rstart_cbase.f90 similarity index 100% rename from test/examples/math/demo_logspace_rstart_cbase.f90 rename to test/example/math/demo_logspace_rstart_cbase.f90 diff --git a/test/examples/math/demo_math_all_close.f90 b/test/example/math/demo_math_all_close.f90 similarity index 100% rename from test/examples/math/demo_math_all_close.f90 rename to test/example/math/demo_math_all_close.f90 diff --git a/test/examples/math/demo_math_arange.f90 b/test/example/math/demo_math_arange.f90 similarity index 100% rename from test/examples/math/demo_math_arange.f90 rename to test/example/math/demo_math_arange.f90 diff --git a/test/examples/math/demo_math_arg.f90 b/test/example/math/demo_math_arg.f90 similarity index 100% rename from test/examples/math/demo_math_arg.f90 rename to test/example/math/demo_math_arg.f90 diff --git a/test/examples/math/demo_math_argd.f90 b/test/example/math/demo_math_argd.f90 similarity index 100% rename from test/examples/math/demo_math_argd.f90 rename to test/example/math/demo_math_argd.f90 diff --git a/test/examples/math/demo_math_argpi.f90 b/test/example/math/demo_math_argpi.f90 similarity index 100% rename from test/examples/math/demo_math_argpi.f90 rename to test/example/math/demo_math_argpi.f90 diff --git a/test/examples/math/demo_math_is_close.f90 b/test/example/math/demo_math_is_close.f90 similarity index 100% rename from test/examples/math/demo_math_is_close.f90 rename to test/example/math/demo_math_is_close.f90 diff --git a/test/examples/optval/demo_optval.f90 b/test/example/optval/demo_optval.f90 similarity index 100% rename from test/examples/optval/demo_optval.f90 rename to test/example/optval/demo_optval.f90 diff --git a/test/examples/quadrature/demo_gauss_legendre.f90 b/test/example/quadrature/demo_gauss_legendre.f90 similarity index 100% rename from test/examples/quadrature/demo_gauss_legendre.f90 rename to test/example/quadrature/demo_gauss_legendre.f90 diff --git a/test/examples/quadrature/demo_gauss_legendre_lobatto.f90 b/test/example/quadrature/demo_gauss_legendre_lobatto.f90 similarity index 100% rename from test/examples/quadrature/demo_gauss_legendre_lobatto.f90 rename to test/example/quadrature/demo_gauss_legendre_lobatto.f90 diff --git a/test/examples/quadrature/demo_simps.f90 b/test/example/quadrature/demo_simps.f90 similarity index 100% rename from test/examples/quadrature/demo_simps.f90 rename to test/example/quadrature/demo_simps.f90 diff --git a/test/examples/quadrature/demo_simps_weights.f90 b/test/example/quadrature/demo_simps_weights.f90 similarity index 100% rename from test/examples/quadrature/demo_simps_weights.f90 rename to test/example/quadrature/demo_simps_weights.f90 diff --git a/test/examples/quadrature/demo_trapz.f90 b/test/example/quadrature/demo_trapz.f90 similarity index 100% rename from test/examples/quadrature/demo_trapz.f90 rename to test/example/quadrature/demo_trapz.f90 diff --git a/test/examples/quadrature/demo_trapz_weights.f90 b/test/example/quadrature/demo_trapz_weights.f90 similarity index 100% rename from test/examples/quadrature/demo_trapz_weights.f90 rename to test/example/quadrature/demo_trapz_weights.f90 diff --git a/test/examples/random/demo_dist_rand.f90 b/test/example/random/demo_dist_rand.f90 similarity index 100% rename from test/examples/random/demo_dist_rand.f90 rename to test/example/random/demo_dist_rand.f90 diff --git a/test/examples/random/demo_random_seed.f90 b/test/example/random/demo_random_seed.f90 similarity index 100% rename from test/examples/random/demo_random_seed.f90 rename to test/example/random/demo_random_seed.f90 diff --git a/test/examples/selection/demo_arg_select.f90 b/test/example/selection/demo_arg_select.f90 similarity index 100% rename from test/examples/selection/demo_arg_select.f90 rename to test/example/selection/demo_arg_select.f90 diff --git a/test/examples/selection/demo_select.f90 b/test/example/selection/demo_select.f90 similarity index 100% rename from test/examples/selection/demo_select.f90 rename to test/example/selection/demo_select.f90 diff --git a/test/examples/selection/selection_vs_sort.f90 b/test/example/selection/selection_vs_sort.f90 similarity index 100% rename from test/examples/selection/selection_vs_sort.f90 rename to test/example/selection/selection_vs_sort.f90 diff --git a/test/examples/sorting/demo_ord_sort.f90 b/test/example/sorting/demo_ord_sort.f90 similarity index 100% rename from test/examples/sorting/demo_ord_sort.f90 rename to test/example/sorting/demo_ord_sort.f90 diff --git a/test/examples/sorting/demo_sort.f90 b/test/example/sorting/demo_sort.f90 similarity index 100% rename from test/examples/sorting/demo_sort.f90 rename to test/example/sorting/demo_sort.f90 diff --git a/test/examples/specialfunctions_gamma/demo_gamma.f90 b/test/example/specialfunctions_gamma/demo_gamma.f90 similarity index 100% rename from test/examples/specialfunctions_gamma/demo_gamma.f90 rename to test/example/specialfunctions_gamma/demo_gamma.f90 diff --git a/test/examples/specialfunctions_gamma/demo_gamma_p.f90 b/test/example/specialfunctions_gamma/demo_gamma_p.f90 similarity index 100% rename from test/examples/specialfunctions_gamma/demo_gamma_p.f90 rename to test/example/specialfunctions_gamma/demo_gamma_p.f90 diff --git a/test/examples/specialfunctions_gamma/demo_gamma_q.f90 b/test/example/specialfunctions_gamma/demo_gamma_q.f90 similarity index 100% rename from test/examples/specialfunctions_gamma/demo_gamma_q.f90 rename to test/example/specialfunctions_gamma/demo_gamma_q.f90 diff --git a/test/examples/specialfunctions_gamma/demo_ligamma.f90 b/test/example/specialfunctions_gamma/demo_ligamma.f90 similarity index 100% rename from test/examples/specialfunctions_gamma/demo_ligamma.f90 rename to test/example/specialfunctions_gamma/demo_ligamma.f90 diff --git a/test/examples/specialfunctions_gamma/demo_log_factorial.f90 b/test/example/specialfunctions_gamma/demo_log_factorial.f90 similarity index 100% rename from test/examples/specialfunctions_gamma/demo_log_factorial.f90 rename to test/example/specialfunctions_gamma/demo_log_factorial.f90 diff --git a/test/examples/specialfunctions_gamma/demo_log_gamma.f90 b/test/example/specialfunctions_gamma/demo_log_gamma.f90 similarity index 100% rename from test/examples/specialfunctions_gamma/demo_log_gamma.f90 rename to test/example/specialfunctions_gamma/demo_log_gamma.f90 diff --git a/test/examples/specialfunctions_gamma/demo_uigamma.f90 b/test/example/specialfunctions_gamma/demo_uigamma.f90 similarity index 100% rename from test/examples/specialfunctions_gamma/demo_uigamma.f90 rename to test/example/specialfunctions_gamma/demo_uigamma.f90 diff --git a/test/examples/stats/demo_corr.f90 b/test/example/stats/demo_corr.f90 similarity index 100% rename from test/examples/stats/demo_corr.f90 rename to test/example/stats/demo_corr.f90 diff --git a/test/examples/stats/demo_cov.f90 b/test/example/stats/demo_cov.f90 similarity index 100% rename from test/examples/stats/demo_cov.f90 rename to test/example/stats/demo_cov.f90 diff --git a/test/examples/stats/demo_mean.f90 b/test/example/stats/demo_mean.f90 similarity index 100% rename from test/examples/stats/demo_mean.f90 rename to test/example/stats/demo_mean.f90 diff --git a/test/examples/stats/demo_median.f90 b/test/example/stats/demo_median.f90 similarity index 100% rename from test/examples/stats/demo_median.f90 rename to test/example/stats/demo_median.f90 diff --git a/test/examples/stats/demo_moment.f90 b/test/example/stats/demo_moment.f90 similarity index 100% rename from test/examples/stats/demo_moment.f90 rename to test/example/stats/demo_moment.f90 diff --git a/test/examples/stats/demo_var.f90 b/test/example/stats/demo_var.f90 similarity index 100% rename from test/examples/stats/demo_var.f90 rename to test/example/stats/demo_var.f90 diff --git a/test/examples/stats_distribution_exponential/demo_exponential_cdf.f90 b/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 similarity index 100% rename from test/examples/stats_distribution_exponential/demo_exponential_cdf.f90 rename to test/example/stats_distribution_exponential/demo_exponential_cdf.f90 diff --git a/test/examples/stats_distribution_exponential/demo_exponential_pdf.f90 b/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 similarity index 100% rename from test/examples/stats_distribution_exponential/demo_exponential_pdf.f90 rename to test/example/stats_distribution_exponential/demo_exponential_pdf.f90 diff --git a/test/examples/stats_distribution_exponential/demo_exponential_rvs.f90 b/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 similarity index 100% rename from test/examples/stats_distribution_exponential/demo_exponential_rvs.f90 rename to test/example/stats_distribution_exponential/demo_exponential_rvs.f90 diff --git a/test/examples/stats_distribution_normal/demo_norm_cdf.f90 b/test/example/stats_distribution_normal/demo_norm_cdf.f90 similarity index 100% rename from test/examples/stats_distribution_normal/demo_norm_cdf.f90 rename to test/example/stats_distribution_normal/demo_norm_cdf.f90 diff --git a/test/examples/stats_distribution_normal/demo_normal_pdf.f90 b/test/example/stats_distribution_normal/demo_normal_pdf.f90 similarity index 100% rename from test/examples/stats_distribution_normal/demo_normal_pdf.f90 rename to test/example/stats_distribution_normal/demo_normal_pdf.f90 diff --git a/test/examples/stats_distribution_normal/demo_normal_rvs.f90 b/test/example/stats_distribution_normal/demo_normal_rvs.f90 similarity index 100% rename from test/examples/stats_distribution_normal/demo_normal_rvs.f90 rename to test/example/stats_distribution_normal/demo_normal_rvs.f90 diff --git a/test/examples/stats_distribution_uniform/demo_shuffle.f90 b/test/example/stats_distribution_uniform/demo_shuffle.f90 similarity index 100% rename from test/examples/stats_distribution_uniform/demo_shuffle.f90 rename to test/example/stats_distribution_uniform/demo_shuffle.f90 diff --git a/test/examples/stats_distribution_uniform/demo_uniform_cdf.f90 b/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 similarity index 100% rename from test/examples/stats_distribution_uniform/demo_uniform_cdf.f90 rename to test/example/stats_distribution_uniform/demo_uniform_cdf.f90 diff --git a/test/examples/stats_distribution_uniform/demo_uniform_pdf.f90 b/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 similarity index 100% rename from test/examples/stats_distribution_uniform/demo_uniform_pdf.f90 rename to test/example/stats_distribution_uniform/demo_uniform_pdf.f90 diff --git a/test/examples/stats_distribution_uniform/demo_uniform_rvs.f90 b/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 similarity index 100% rename from test/examples/stats_distribution_uniform/demo_uniform_rvs.f90 rename to test/example/stats_distribution_uniform/demo_uniform_rvs.f90 diff --git a/test/examples/string_type/demo_adjustl.f90 b/test/example/string_type/demo_adjustl.f90 similarity index 100% rename from test/examples/string_type/demo_adjustl.f90 rename to test/example/string_type/demo_adjustl.f90 diff --git a/test/examples/string_type/demo_adjustr.f90 b/test/example/string_type/demo_adjustr.f90 similarity index 100% rename from test/examples/string_type/demo_adjustr.f90 rename to test/example/string_type/demo_adjustr.f90 diff --git a/test/examples/string_type/demo_char.f90 b/test/example/string_type/demo_char.f90 similarity index 100% rename from test/examples/string_type/demo_char.f90 rename to test/example/string_type/demo_char.f90 diff --git a/test/examples/string_type/demo_char_position.f90 b/test/example/string_type/demo_char_position.f90 similarity index 100% rename from test/examples/string_type/demo_char_position.f90 rename to test/example/string_type/demo_char_position.f90 diff --git a/test/examples/string_type/demo_char_range.f90 b/test/example/string_type/demo_char_range.f90 similarity index 100% rename from test/examples/string_type/demo_char_range.f90 rename to test/example/string_type/demo_char_range.f90 diff --git a/test/examples/string_type/demo_constructor_character.f90 b/test/example/string_type/demo_constructor_character.f90 similarity index 100% rename from test/examples/string_type/demo_constructor_character.f90 rename to test/example/string_type/demo_constructor_character.f90 diff --git a/test/examples/string_type/demo_constructor_empty.f90 b/test/example/string_type/demo_constructor_empty.f90 similarity index 100% rename from test/examples/string_type/demo_constructor_empty.f90 rename to test/example/string_type/demo_constructor_empty.f90 diff --git a/test/examples/string_type/demo_constructor_integer.f90 b/test/example/string_type/demo_constructor_integer.f90 similarity index 100% rename from test/examples/string_type/demo_constructor_integer.f90 rename to test/example/string_type/demo_constructor_integer.f90 diff --git a/test/examples/string_type/demo_constructor_logical.f90 b/test/example/string_type/demo_constructor_logical.f90 similarity index 100% rename from test/examples/string_type/demo_constructor_logical.f90 rename to test/example/string_type/demo_constructor_logical.f90 diff --git a/test/examples/string_type/demo_constructor_scalar.f90 b/test/example/string_type/demo_constructor_scalar.f90 similarity index 100% rename from test/examples/string_type/demo_constructor_scalar.f90 rename to test/example/string_type/demo_constructor_scalar.f90 diff --git a/test/examples/string_type/demo_cont.f90 b/test/example/string_type/demo_cont.f90 similarity index 100% rename from test/examples/string_type/demo_cont.f90 rename to test/example/string_type/demo_cont.f90 diff --git a/test/examples/string_type/demo_eq.f90 b/test/example/string_type/demo_eq.f90 similarity index 100% rename from test/examples/string_type/demo_eq.f90 rename to test/example/string_type/demo_eq.f90 diff --git a/test/examples/string_type/demo_fread.f90 b/test/example/string_type/demo_fread.f90 similarity index 100% rename from test/examples/string_type/demo_fread.f90 rename to test/example/string_type/demo_fread.f90 diff --git a/test/examples/string_type/demo_fwrite.f90 b/test/example/string_type/demo_fwrite.f90 similarity index 100% rename from test/examples/string_type/demo_fwrite.f90 rename to test/example/string_type/demo_fwrite.f90 diff --git a/test/examples/string_type/demo_ge.f90 b/test/example/string_type/demo_ge.f90 similarity index 100% rename from test/examples/string_type/demo_ge.f90 rename to test/example/string_type/demo_ge.f90 diff --git a/test/examples/string_type/demo_gt.f90 b/test/example/string_type/demo_gt.f90 similarity index 100% rename from test/examples/string_type/demo_gt.f90 rename to test/example/string_type/demo_gt.f90 diff --git a/test/examples/string_type/demo_iachar.f90 b/test/example/string_type/demo_iachar.f90 similarity index 100% rename from test/examples/string_type/demo_iachar.f90 rename to test/example/string_type/demo_iachar.f90 diff --git a/test/examples/string_type/demo_ichar.f90 b/test/example/string_type/demo_ichar.f90 similarity index 100% rename from test/examples/string_type/demo_ichar.f90 rename to test/example/string_type/demo_ichar.f90 diff --git a/test/examples/string_type/demo_index.f90 b/test/example/string_type/demo_index.f90 similarity index 100% rename from test/examples/string_type/demo_index.f90 rename to test/example/string_type/demo_index.f90 diff --git a/test/examples/string_type/demo_le.f90 b/test/example/string_type/demo_le.f90 similarity index 100% rename from test/examples/string_type/demo_le.f90 rename to test/example/string_type/demo_le.f90 diff --git a/test/examples/string_type/demo_len.f90 b/test/example/string_type/demo_len.f90 similarity index 100% rename from test/examples/string_type/demo_len.f90 rename to test/example/string_type/demo_len.f90 diff --git a/test/examples/string_type/demo_len_trim.f90 b/test/example/string_type/demo_len_trim.f90 similarity index 100% rename from test/examples/string_type/demo_len_trim.f90 rename to test/example/string_type/demo_len_trim.f90 diff --git a/test/examples/string_type/demo_lge.f90 b/test/example/string_type/demo_lge.f90 similarity index 100% rename from test/examples/string_type/demo_lge.f90 rename to test/example/string_type/demo_lge.f90 diff --git a/test/examples/string_type/demo_lgt.f90 b/test/example/string_type/demo_lgt.f90 similarity index 100% rename from test/examples/string_type/demo_lgt.f90 rename to test/example/string_type/demo_lgt.f90 diff --git a/test/examples/string_type/demo_lle.f90 b/test/example/string_type/demo_lle.f90 similarity index 100% rename from test/examples/string_type/demo_lle.f90 rename to test/example/string_type/demo_lle.f90 diff --git a/test/examples/string_type/demo_llt.f90 b/test/example/string_type/demo_llt.f90 similarity index 100% rename from test/examples/string_type/demo_llt.f90 rename to test/example/string_type/demo_llt.f90 diff --git a/test/examples/string_type/demo_lt.f90 b/test/example/string_type/demo_lt.f90 similarity index 100% rename from test/examples/string_type/demo_lt.f90 rename to test/example/string_type/demo_lt.f90 diff --git a/test/examples/string_type/demo_move.f90 b/test/example/string_type/demo_move.f90 similarity index 100% rename from test/examples/string_type/demo_move.f90 rename to test/example/string_type/demo_move.f90 diff --git a/test/examples/string_type/demo_ne.f90 b/test/example/string_type/demo_ne.f90 similarity index 100% rename from test/examples/string_type/demo_ne.f90 rename to test/example/string_type/demo_ne.f90 diff --git a/test/examples/string_type/demo_repeat.f90 b/test/example/string_type/demo_repeat.f90 similarity index 100% rename from test/examples/string_type/demo_repeat.f90 rename to test/example/string_type/demo_repeat.f90 diff --git a/test/examples/string_type/demo_reverse.f90 b/test/example/string_type/demo_reverse.f90 similarity index 100% rename from test/examples/string_type/demo_reverse.f90 rename to test/example/string_type/demo_reverse.f90 diff --git a/test/examples/string_type/demo_scan.f90 b/test/example/string_type/demo_scan.f90 similarity index 100% rename from test/examples/string_type/demo_scan.f90 rename to test/example/string_type/demo_scan.f90 diff --git a/test/examples/string_type/demo_to_lower.f90 b/test/example/string_type/demo_to_lower.f90 similarity index 100% rename from test/examples/string_type/demo_to_lower.f90 rename to test/example/string_type/demo_to_lower.f90 diff --git a/test/examples/string_type/demo_to_sentence.f90 b/test/example/string_type/demo_to_sentence.f90 similarity index 100% rename from test/examples/string_type/demo_to_sentence.f90 rename to test/example/string_type/demo_to_sentence.f90 diff --git a/test/examples/string_type/demo_to_title.f90 b/test/example/string_type/demo_to_title.f90 similarity index 100% rename from test/examples/string_type/demo_to_title.f90 rename to test/example/string_type/demo_to_title.f90 diff --git a/test/examples/string_type/demo_to_upper.f90 b/test/example/string_type/demo_to_upper.f90 similarity index 100% rename from test/examples/string_type/demo_to_upper.f90 rename to test/example/string_type/demo_to_upper.f90 diff --git a/test/examples/string_type/demo_trim.f90 b/test/example/string_type/demo_trim.f90 similarity index 100% rename from test/examples/string_type/demo_trim.f90 rename to test/example/string_type/demo_trim.f90 diff --git a/test/examples/string_type/demo_uread.f90 b/test/example/string_type/demo_uread.f90 similarity index 100% rename from test/examples/string_type/demo_uread.f90 rename to test/example/string_type/demo_uread.f90 diff --git a/test/examples/string_type/demo_uwrite.f90 b/test/example/string_type/demo_uwrite.f90 similarity index 100% rename from test/examples/string_type/demo_uwrite.f90 rename to test/example/string_type/demo_uwrite.f90 diff --git a/test/examples/string_type/demo_verify.f90 b/test/example/string_type/demo_verify.f90 similarity index 100% rename from test/examples/string_type/demo_verify.f90 rename to test/example/string_type/demo_verify.f90 diff --git a/test/examples/stringlist_type/demo_clear.f90 b/test/example/stringlist_type/demo_clear.f90 similarity index 100% rename from test/examples/stringlist_type/demo_clear.f90 rename to test/example/stringlist_type/demo_clear.f90 diff --git a/test/examples/stringlist_type/demo_concatenate_operator.f90 b/test/example/stringlist_type/demo_concatenate_operator.f90 similarity index 100% rename from test/examples/stringlist_type/demo_concatenate_operator.f90 rename to test/example/stringlist_type/demo_concatenate_operator.f90 diff --git a/test/examples/stringlist_type/demo_constructor.f90 b/test/example/stringlist_type/demo_constructor.f90 similarity index 100% rename from test/examples/stringlist_type/demo_constructor.f90 rename to test/example/stringlist_type/demo_constructor.f90 diff --git a/test/examples/stringlist_type/demo_equality_operator.f90 b/test/example/stringlist_type/demo_equality_operator.f90 similarity index 100% rename from test/examples/stringlist_type/demo_equality_operator.f90 rename to test/example/stringlist_type/demo_equality_operator.f90 diff --git a/test/examples/stringlist_type/demo_fidx_bidx.f90 b/test/example/stringlist_type/demo_fidx_bidx.f90 similarity index 100% rename from test/examples/stringlist_type/demo_fidx_bidx.f90 rename to test/example/stringlist_type/demo_fidx_bidx.f90 diff --git a/test/examples/stringlist_type/demo_get.f90 b/test/example/stringlist_type/demo_get.f90 similarity index 100% rename from test/examples/stringlist_type/demo_get.f90 rename to test/example/stringlist_type/demo_get.f90 diff --git a/test/examples/stringlist_type/demo_inequality_operator.f90 b/test/example/stringlist_type/demo_inequality_operator.f90 similarity index 100% rename from test/examples/stringlist_type/demo_inequality_operator.f90 rename to test/example/stringlist_type/demo_inequality_operator.f90 diff --git a/test/examples/stringlist_type/demo_insert_at.f90 b/test/example/stringlist_type/demo_insert_at.f90 similarity index 100% rename from test/examples/stringlist_type/demo_insert_at.f90 rename to test/example/stringlist_type/demo_insert_at.f90 diff --git a/test/examples/stringlist_type/demo_len.f90 b/test/example/stringlist_type/demo_len.f90 similarity index 100% rename from test/examples/stringlist_type/demo_len.f90 rename to test/example/stringlist_type/demo_len.f90 diff --git a/test/examples/strings/demo_chomp.f90 b/test/example/strings/demo_chomp.f90 similarity index 100% rename from test/examples/strings/demo_chomp.f90 rename to test/example/strings/demo_chomp.f90 diff --git a/test/examples/strings/demo_count.f90 b/test/example/strings/demo_count.f90 similarity index 100% rename from test/examples/strings/demo_count.f90 rename to test/example/strings/demo_count.f90 diff --git a/test/examples/strings/demo_ends_with.f90 b/test/example/strings/demo_ends_with.f90 similarity index 100% rename from test/examples/strings/demo_ends_with.f90 rename to test/example/strings/demo_ends_with.f90 diff --git a/test/examples/strings/demo_find.f90 b/test/example/strings/demo_find.f90 similarity index 100% rename from test/examples/strings/demo_find.f90 rename to test/example/strings/demo_find.f90 diff --git a/test/examples/strings/demo_padl.f90 b/test/example/strings/demo_padl.f90 similarity index 100% rename from test/examples/strings/demo_padl.f90 rename to test/example/strings/demo_padl.f90 diff --git a/test/examples/strings/demo_padr.f90 b/test/example/strings/demo_padr.f90 similarity index 100% rename from test/examples/strings/demo_padr.f90 rename to test/example/strings/demo_padr.f90 diff --git a/test/examples/strings/demo_replace_all.f90 b/test/example/strings/demo_replace_all.f90 similarity index 100% rename from test/examples/strings/demo_replace_all.f90 rename to test/example/strings/demo_replace_all.f90 diff --git a/test/examples/strings/demo_slice.f90 b/test/example/strings/demo_slice.f90 similarity index 100% rename from test/examples/strings/demo_slice.f90 rename to test/example/strings/demo_slice.f90 diff --git a/test/examples/strings/demo_starts_with.f90 b/test/example/strings/demo_starts_with.f90 similarity index 100% rename from test/examples/strings/demo_starts_with.f90 rename to test/example/strings/demo_starts_with.f90 diff --git a/test/examples/strings/demo_strip.f90 b/test/example/strings/demo_strip.f90 similarity index 100% rename from test/examples/strings/demo_strip.f90 rename to test/example/strings/demo_strip.f90 diff --git a/test/examples/strings/demo_to_string.f90 b/test/example/strings/demo_to_string.f90 similarity index 100% rename from test/examples/strings/demo_to_string.f90 rename to test/example/strings/demo_to_string.f90 diff --git a/test/examples/version/demo_version.f90 b/test/example/version/demo_version.f90 similarity index 100% rename from test/examples/version/demo_version.f90 rename to test/example/version/demo_version.f90 From 03df63e37757c290654e8c3add042aef901c8d8e Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 21 Jun 2022 11:59:23 +0200 Subject: [PATCH 04/38] fix issues in most demo programs --- CMakeLists.txt | 1 + test/CMakeLists.txt | 1 + test/example/CMakeLists.txt | 32 +++++++++++++++ test/example/array/CMakeLists.txt | 2 + test/example/ascii/CMakeLists.txt | 5 +++ ...emo_reverse.f90 => demo_ascii_reverse.f90} | 0 ...o_to_lower.f90 => demo_ascii_to_lower.f90} | 0 ...entence.f90 => demo_ascii_to_sentence.f90} | 0 ...o_to_title.f90 => demo_ascii_to_title.f90} | 0 ...o_to_upper.f90 => demo_ascii_to_upper.f90} | 0 test/example/bitsets/CMakeLists.txt | 30 ++++++++++++++ .../{demo_all.f90 => demo_bitsets_all.f90} | 0 .../{demo_and.f90 => demo_bitsets_and.f90} | 8 ++-- ...o_and_not.f90 => demo_bitsets_and_not.f90} | 8 ++-- .../{demo_any.f90 => demo_bitsets_any.f90} | 0 ...gnment.f90 => demo_bitsets_assignment.f90} | 6 ++- ...t_count.f90 => demo_bitsets_bit_count.f90} | 0 .../{demo_bits.f90 => demo_bitsets_bits.f90} | 0 ...{demo_clear.f90 => demo_bitsets_clear.f90} | 0 ...equality.f90 => demo_bitsets_equality.f90} | 0 ...o_extract.f90 => demo_bitsets_extract.f90} | 0 .../{demo_flip.f90 => demo_bitsets_flip.f90} | 0 ...tring.f90 => demo_bitsets_from_string.f90} | 2 +- .../{demo_ge.f90 => demo_bitsets_ge.f90} | 0 .../{demo_gt.f90 => demo_bitsets_gt.f90} | 0 ...uality.f90 => demo_bitsets_inequality.f90} | 0 .../{demo_init.f90 => demo_bitsets_init.f90} | 0 ...{demo_input.f90 => demo_bitsets_input.f90} | 2 + .../{demo_le.f90 => demo_bitsets_le.f90} | 0 .../{demo_lt.f90 => demo_bitsets_lt.f90} | 0 .../{demo_none.f90 => demo_bitsets_none.f90} | 0 .../{demo_not.f90 => demo_bitsets_not.f90} | 0 .../{demo_or.f90 => demo_bitsets_or.f90} | 8 ++-- ...emo_output.f90 => demo_bitsets_output.f90} | 2 + ...itset.f90 => demo_bitsets_read_bitset.f90} | 8 ++-- .../{demo_set.f90 => demo_bitsets_set.f90} | 0 .../{demo_test.f90 => demo_bitsets_test.f90} | 0 ..._string.f90 => demo_bitsets_to_string.f90} | 0 ...{demo_value.f90 => demo_bitsets_value.f90} | 0 ...tset.f90 => demo_bitsets_write_bitset.f90} | 8 ++-- .../{demo_xor.f90 => demo_bitsets_xor.f90} | 8 ++-- test/example/error/CMakeLists.txt | 6 +++ test/example/hash_procedures/CMakeLists.txt | 13 ++++++ .../demo_universal_mult_hash_64.f90 | 2 +- test/example/hashmaps/CMakeLists.txt | 27 +++++++++++++ ...demo_calls.f90 => demo_hashmaps_calls.f90} | 2 +- ...opy_key.f90 => demo_hashmaps_copy_key.f90} | 6 +-- ...other.f90 => demo_hashmaps_copy_other.f90} | 8 ++-- ..._entries.f90 => demo_hashmaps_entries.f90} | 2 +- ..._keys.f90 => demo_hashmaps_equal_keys.f90} | 0 ...her.f90 => demo_hashmaps_fnv_1_hasher.f90} | 5 +-- ...er.f90 => demo_hashmaps_fnv_1a_hasher.f90} | 2 +- ...ree_key.f90 => demo_hashmaps_free_key.f90} | 0 ...other.f90 => demo_hashmaps_free_other.f90} | 8 ++-- .../{demo_get.f90 => demo_hashmaps_get.f90} | 2 +- ...a.f90 => demo_hashmaps_get_other_data.f90} | 15 ++++--- ...r_fun.f90 => demo_hashmaps_hasher_fun.f90} | 7 ++-- test/example/hashmaps/demo_hashmaps_init.f90 | 7 ++++ ...ey_test.f90 => demo_hashmaps_key_test.f90} | 4 +- ..._loading.f90 => demo_hashmaps_loading.f90} | 0 ..._entry.f90 => demo_hashmaps_map_entry.f90} | 2 +- ..._slots.f90 => demo_hashmaps_num_slots.f90} | 2 +- ...mo_probes.f90 => demo_hashmaps_probes.f90} | 4 +- ...mo_rehash.f90 => demo_hashmaps_rehash.f90} | 8 ++-- ...mo_remove.f90 => demo_hashmaps_remove.f90} | 3 +- ... demo_hashmaps_seeded_nmhash32_hasher.f90} | 2 +- ...demo_hashmaps_seeded_nmhash32x_hasher.f90} | 2 +- ... => demo_hashmaps_seeded_water_hasher.f90} | 2 +- .../{demo_set.f90 => demo_hashmaps_set.f90} | 2 +- ...a.f90 => demo_hashmaps_set_other_data.f90} | 7 +++- ..._bits.f90 => demo_hashmaps_slots_bits.f90} | 0 ...epth.f90 => demo_hashmaps_total_depth.f90} | 0 test/example/hashmaps/demo_init.f90 | 7 ---- test/example/io/CMakeLists.txt | 7 ++++ test/example/io/demo_fmt_constants.f90 | 2 +- test/example/io/demo_loadnpy.f90 | 2 +- test/example/linalg/CMakeLists.txt | 16 ++++++++ test/example/linalg/demo_diag2.f90 | 2 +- test/example/logger/CMakeLists.txt | 5 +++ test/example/logger/demo_add_log_unit.f90 | 4 +- test/example/logger/demo_log_text_error.f90 | 4 +- test/example/math/CMakeLists.txt | 15 +++++++ test/example/math/demo_logspace_int.f90 | 6 +-- .../math/demo_logspace_rstart_cbase.f90 | 2 +- test/example/optval/CMakeLists.txt | 1 + test/example/quadrature/CMakeLists.txt | 6 +++ .../quadrature/demo_gauss_legendre.f90 | 13 +++--- .../demo_gauss_legendre_lobatto.f90 | 13 +++--- test/example/quadrature/demo_simps.f90 | 2 +- .../example/quadrature/demo_simps_weights.f90 | 2 +- test/example/quadrature/demo_trapz.f90 | 2 +- .../example/quadrature/demo_trapz_weights.f90 | 2 +- test/example/random/CMakeLists.txt | 2 + test/example/random/demo_dist_rand.f90 | 1 + test/example/selection/CMakeLists.txt | 2 + test/example/sorting/CMakeLists.txt | 2 + .../specialfunctions_gamma/CMakeLists.txt | 7 ++++ .../specialfunctions_gamma/demo_ligamma.f90 | 2 +- test/example/stats/CMakeLists.txt | 6 +++ .../CMakeLists.txt | 3 ++ .../stats_distribution_normal/CMakeLists.txt | 3 ++ .../demo_norm_cdf.f90 | 2 +- .../demo_normal_pdf.f90 | 2 +- .../demo_normal_rvs.f90 | 2 +- .../stats_distribution_uniform/CMakeLists.txt | 4 ++ test/example/string_type/CMakeLists.txt | 40 +++++++++++++++++++ test/example/stringlist_type/CMakeLists.txt | 9 +++++ ...ear.f90 => demo_stringlist_type_clear.f90} | 0 ..._stringlist_type_concatenate_operator.f90} | 0 ...0 => demo_stringlist_type_constructor.f90} | 0 ...emo_stringlist_type_equality_operator.f90} | 0 ...f90 => demo_stringlist_type_fidx_bidx.f90} | 0 ...o_get.f90 => demo_stringlist_type_get.f90} | 0 ...o_stringlist_type_inequality_operator.f90} | 0 ...f90 => demo_stringlist_type_insert_at.f90} | 0 ...o_len.f90 => demo_stringlist_type_len.f90} | 0 test/example/strings/CMakeLists.txt | 11 +++++ test/example/strings/demo_slice.f90 | 8 ++-- test/example/version/CMakeLists.txt | 1 + 119 files changed, 387 insertions(+), 114 deletions(-) create mode 100644 test/CMakeLists.txt create mode 100644 test/example/CMakeLists.txt create mode 100644 test/example/array/CMakeLists.txt create mode 100644 test/example/ascii/CMakeLists.txt rename test/example/ascii/{demo_reverse.f90 => demo_ascii_reverse.f90} (100%) rename test/example/ascii/{demo_to_lower.f90 => demo_ascii_to_lower.f90} (100%) rename test/example/ascii/{demo_to_sentence.f90 => demo_ascii_to_sentence.f90} (100%) rename test/example/ascii/{demo_to_title.f90 => demo_ascii_to_title.f90} (100%) rename test/example/ascii/{demo_to_upper.f90 => demo_ascii_to_upper.f90} (100%) create mode 100644 test/example/bitsets/CMakeLists.txt rename test/example/bitsets/{demo_all.f90 => demo_bitsets_all.f90} (100%) rename test/example/bitsets/{demo_and.f90 => demo_bitsets_and.f90} (57%) rename test/example/bitsets/{demo_and_not.f90 => demo_bitsets_and_not.f90} (58%) rename test/example/bitsets/{demo_any.f90 => demo_bitsets_any.f90} (100%) rename test/example/bitsets/{demo_assignment.f90 => demo_bitsets_assignment.f90} (86%) rename test/example/bitsets/{demo_bit_count.f90 => demo_bitsets_bit_count.f90} (100%) rename test/example/bitsets/{demo_bits.f90 => demo_bitsets_bits.f90} (100%) rename test/example/bitsets/{demo_clear.f90 => demo_bitsets_clear.f90} (100%) rename test/example/bitsets/{demo_equality.f90 => demo_bitsets_equality.f90} (100%) rename test/example/bitsets/{demo_extract.f90 => demo_bitsets_extract.f90} (100%) rename test/example/bitsets/{demo_flip.f90 => demo_bitsets_flip.f90} (100%) rename test/example/bitsets/{demo_from_string.f90 => demo_bitsets_from_string.f90} (94%) rename test/example/bitsets/{demo_ge.f90 => demo_bitsets_ge.f90} (100%) rename test/example/bitsets/{demo_gt.f90 => demo_bitsets_gt.f90} (100%) rename test/example/bitsets/{demo_inequality.f90 => demo_bitsets_inequality.f90} (100%) rename test/example/bitsets/{demo_init.f90 => demo_bitsets_init.f90} (100%) rename test/example/bitsets/{demo_input.f90 => demo_bitsets_input.f90} (96%) rename test/example/bitsets/{demo_le.f90 => demo_bitsets_le.f90} (100%) rename test/example/bitsets/{demo_lt.f90 => demo_bitsets_lt.f90} (100%) rename test/example/bitsets/{demo_none.f90 => demo_bitsets_none.f90} (100%) rename test/example/bitsets/{demo_not.f90 => demo_bitsets_not.f90} (100%) rename test/example/bitsets/{demo_or.f90 => demo_bitsets_or.f90} (58%) rename test/example/bitsets/{demo_output.f90 => demo_bitsets_output.f90} (96%) rename test/example/bitsets/{demo_read_bitset.f90 => demo_bitsets_read_bitset.f90} (87%) rename test/example/bitsets/{demo_set.f90 => demo_bitsets_set.f90} (100%) rename test/example/bitsets/{demo_test.f90 => demo_bitsets_test.f90} (100%) rename test/example/bitsets/{demo_to_string.f90 => demo_bitsets_to_string.f90} (100%) rename test/example/bitsets/{demo_value.f90 => demo_bitsets_value.f90} (100%) rename test/example/bitsets/{demo_write_bitset.f90 => demo_bitsets_write_bitset.f90} (87%) rename test/example/bitsets/{demo_xor.f90 => demo_bitsets_xor.f90} (58%) create mode 100644 test/example/error/CMakeLists.txt create mode 100644 test/example/hash_procedures/CMakeLists.txt create mode 100644 test/example/hashmaps/CMakeLists.txt rename test/example/hashmaps/{demo_calls.f90 => demo_hashmaps_calls.f90} (89%) rename test/example/hashmaps/{demo_copy_key.f90 => demo_hashmaps_copy_key.f90} (73%) rename test/example/hashmaps/{demo_copy_other.f90 => demo_hashmaps_copy_other.f90} (81%) rename test/example/hashmaps/{demo_entries.f90 => demo_hashmaps_entries.f90} (89%) rename test/example/hashmaps/{demo_equal_keys.f90 => demo_hashmaps_equal_keys.f90} (100%) rename test/example/hashmaps/{demo_fnv_1_hasher.f90 => demo_hashmaps_fnv_1_hasher.f90} (73%) rename test/example/hashmaps/{demo_fnv_1a_hasher.f90 => demo_hashmaps_fnv_1a_hasher.f90} (89%) rename test/example/hashmaps/{demo_free_key.f90 => demo_hashmaps_free_key.f90} (100%) rename test/example/hashmaps/{demo_free_other.f90 => demo_hashmaps_free_other.f90} (73%) rename test/example/hashmaps/{demo_get.f90 => demo_hashmaps_get.f90} (94%) rename test/example/hashmaps/{demo_get_other_data.f90 => demo_hashmaps_get_other_data.f90} (80%) rename test/example/hashmaps/{demo_hasher_fun.f90 => demo_hashmaps_hasher_fun.f90} (65%) create mode 100644 test/example/hashmaps/demo_hashmaps_init.f90 rename test/example/hashmaps/{demo_key_test.f90 => demo_hashmaps_key_test.f90} (81%) rename test/example/hashmaps/{demo_loading.f90 => demo_hashmaps_loading.f90} (100%) rename test/example/hashmaps/{demo_map_entry.f90 => demo_hashmaps_map_entry.f90} (98%) rename test/example/hashmaps/{demo_num_slots.f90 => demo_hashmaps_num_slots.f90} (92%) rename test/example/hashmaps/{demo_probes.f90 => demo_hashmaps_probes.f90} (75%) rename test/example/hashmaps/{demo_rehash.f90 => demo_hashmaps_rehash.f90} (71%) rename test/example/hashmaps/{demo_remove.f90 => demo_hashmaps_remove.f90} (89%) rename test/example/hashmaps/{demo_seeded_nmhash32_hasher.f90 => demo_hashmaps_seeded_nmhash32_hasher.f90} (90%) rename test/example/hashmaps/{demo_seeded_nmhash32x_hasher.f90 => demo_hashmaps_seeded_nmhash32x_hasher.f90} (91%) rename test/example/hashmaps/{demo_seeded_water_hasher.f90 => demo_hashmaps_seeded_water_hasher.f90} (90%) rename test/example/hashmaps/{demo_set.f90 => demo_hashmaps_set.f90} (94%) rename test/example/hashmaps/{demo_set_other_data.f90 => demo_hashmaps_set_other_data.f90} (82%) rename test/example/hashmaps/{demo_slots_bits.f90 => demo_hashmaps_slots_bits.f90} (100%) rename test/example/hashmaps/{demo_total_depth.f90 => demo_hashmaps_total_depth.f90} (100%) delete mode 100644 test/example/hashmaps/demo_init.f90 create mode 100644 test/example/io/CMakeLists.txt create mode 100644 test/example/linalg/CMakeLists.txt create mode 100644 test/example/logger/CMakeLists.txt create mode 100644 test/example/math/CMakeLists.txt create mode 100644 test/example/optval/CMakeLists.txt create mode 100644 test/example/quadrature/CMakeLists.txt create mode 100644 test/example/random/CMakeLists.txt create mode 100644 test/example/selection/CMakeLists.txt create mode 100644 test/example/sorting/CMakeLists.txt create mode 100644 test/example/specialfunctions_gamma/CMakeLists.txt create mode 100644 test/example/stats/CMakeLists.txt create mode 100644 test/example/stats_distribution_exponential/CMakeLists.txt create mode 100644 test/example/stats_distribution_normal/CMakeLists.txt create mode 100644 test/example/stats_distribution_uniform/CMakeLists.txt create mode 100644 test/example/string_type/CMakeLists.txt create mode 100644 test/example/stringlist_type/CMakeLists.txt rename test/example/stringlist_type/{demo_clear.f90 => demo_stringlist_type_clear.f90} (100%) rename test/example/stringlist_type/{demo_concatenate_operator.f90 => demo_stringlist_type_concatenate_operator.f90} (100%) rename test/example/stringlist_type/{demo_constructor.f90 => demo_stringlist_type_constructor.f90} (100%) rename test/example/stringlist_type/{demo_equality_operator.f90 => demo_stringlist_type_equality_operator.f90} (100%) rename test/example/stringlist_type/{demo_fidx_bidx.f90 => demo_stringlist_type_fidx_bidx.f90} (100%) rename test/example/stringlist_type/{demo_get.f90 => demo_stringlist_type_get.f90} (100%) rename test/example/stringlist_type/{demo_inequality_operator.f90 => demo_stringlist_type_inequality_operator.f90} (100%) rename test/example/stringlist_type/{demo_insert_at.f90 => demo_stringlist_type_insert_at.f90} (100%) rename test/example/stringlist_type/{demo_len.f90 => demo_stringlist_type_len.f90} (100%) create mode 100644 test/example/strings/CMakeLists.txt create mode 100644 test/example/version/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b78699e8..5e4bc5b90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ if(NOT FYPP) endif() add_subdirectory(src) +add_subdirectory(test) install(EXPORT ${PROJECT_NAME}-targets NAMESPACE ${PROJECT_NAME}:: diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 000000000..a5c4dce3c --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(example) diff --git a/test/example/CMakeLists.txt b/test/example/CMakeLists.txt new file mode 100644 index 000000000..997397ff8 --- /dev/null +++ b/test/example/CMakeLists.txt @@ -0,0 +1,32 @@ +macro(ADD_DEMO name) + add_executable(demo_${name} demo_${name}.f90) + target_link_libraries(demo_${name} "${PROJECT_NAME}") +# add_test(NAME ${name} +# COMMAND $ ${CMAKE_CURRENT_BINARY_DIR} +# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endmacro(ADD_DEMO) + +add_subdirectory(array) +add_subdirectory(ascii) +add_subdirectory(bitsets) +add_subdirectory(error) +add_subdirectory(hashmaps) +add_subdirectory(hash_procedures) +add_subdirectory(io) +add_subdirectory(linalg) +add_subdirectory(logger) +add_subdirectory(math) +add_subdirectory(optval) +add_subdirectory(quadrature) +add_subdirectory(random) +add_subdirectory(selection) +add_subdirectory(sorting) +add_subdirectory(specialfunctions_gamma) +add_subdirectory(stats) +add_subdirectory(stats_distribution_exponential) +add_subdirectory(stats_distribution_normal) +add_subdirectory(stats_distribution_uniform) +add_subdirectory(stringlist_type) +add_subdirectory(strings) +add_subdirectory(string_type) +add_subdirectory(version) diff --git a/test/example/array/CMakeLists.txt b/test/example/array/CMakeLists.txt new file mode 100644 index 000000000..ef739854b --- /dev/null +++ b/test/example/array/CMakeLists.txt @@ -0,0 +1,2 @@ +#ADD_DEMO(falseloc) +ADD_DEMO(trueloc) diff --git a/test/example/ascii/CMakeLists.txt b/test/example/ascii/CMakeLists.txt new file mode 100644 index 000000000..c599d4127 --- /dev/null +++ b/test/example/ascii/CMakeLists.txt @@ -0,0 +1,5 @@ +ADD_DEMO(ascii_reverse) +ADD_DEMO(ascii_to_lower) +ADD_DEMO(ascii_to_sentence) +ADD_DEMO(ascii_to_title) +ADD_DEMO(ascii_to_upper) diff --git a/test/example/ascii/demo_reverse.f90 b/test/example/ascii/demo_ascii_reverse.f90 similarity index 100% rename from test/example/ascii/demo_reverse.f90 rename to test/example/ascii/demo_ascii_reverse.f90 diff --git a/test/example/ascii/demo_to_lower.f90 b/test/example/ascii/demo_ascii_to_lower.f90 similarity index 100% rename from test/example/ascii/demo_to_lower.f90 rename to test/example/ascii/demo_ascii_to_lower.f90 diff --git a/test/example/ascii/demo_to_sentence.f90 b/test/example/ascii/demo_ascii_to_sentence.f90 similarity index 100% rename from test/example/ascii/demo_to_sentence.f90 rename to test/example/ascii/demo_ascii_to_sentence.f90 diff --git a/test/example/ascii/demo_to_title.f90 b/test/example/ascii/demo_ascii_to_title.f90 similarity index 100% rename from test/example/ascii/demo_to_title.f90 rename to test/example/ascii/demo_ascii_to_title.f90 diff --git a/test/example/ascii/demo_to_upper.f90 b/test/example/ascii/demo_ascii_to_upper.f90 similarity index 100% rename from test/example/ascii/demo_to_upper.f90 rename to test/example/ascii/demo_ascii_to_upper.f90 diff --git a/test/example/bitsets/CMakeLists.txt b/test/example/bitsets/CMakeLists.txt new file mode 100644 index 000000000..f009bfea2 --- /dev/null +++ b/test/example/bitsets/CMakeLists.txt @@ -0,0 +1,30 @@ +ADD_DEMO(bitsets_all) +ADD_DEMO(bitsets_and) +ADD_DEMO(bitsets_and_not) +ADD_DEMO(bitsets_any) +ADD_DEMO(bitsets_assignment) +ADD_DEMO(bitsets_bit_count) +ADD_DEMO(bitsets_bits) +ADD_DEMO(bitsets_clear) +ADD_DEMO(bitsets_equality) +ADD_DEMO(bitsets_extract) +ADD_DEMO(bitsets_flip) +ADD_DEMO(bitsets_from_string) +ADD_DEMO(bitsets_ge) +ADD_DEMO(bitsets_gt) +ADD_DEMO(bitsets_inequality) +ADD_DEMO(bitsets_init) +ADD_DEMO(bitsets_input) +ADD_DEMO(bitsets_le) +ADD_DEMO(bitsets_lt) +ADD_DEMO(bitsets_none) +ADD_DEMO(bitsets_not) +ADD_DEMO(bitsets_or) +ADD_DEMO(bitsets_output) +ADD_DEMO(bitsets_read_bitset) +ADD_DEMO(bitsets_set) +ADD_DEMO(bitsets_test) +ADD_DEMO(bitsets_to_string) +ADD_DEMO(bitsets_value) +ADD_DEMO(bitsets_write_bitset) +ADD_DEMO(bitsets_xor) diff --git a/test/example/bitsets/demo_all.f90 b/test/example/bitsets/demo_bitsets_all.f90 similarity index 100% rename from test/example/bitsets/demo_all.f90 rename to test/example/bitsets/demo_bitsets_all.f90 diff --git a/test/example/bitsets/demo_and.f90 b/test/example/bitsets/demo_bitsets_and.f90 similarity index 57% rename from test/example/bitsets/demo_and.f90 rename to test/example/bitsets/demo_bitsets_and.f90 index 505ee1139..351fb8e3c 100644 --- a/test/example/bitsets/demo_and.f90 +++ b/test/example/bitsets/demo_bitsets_and.f90 @@ -4,14 +4,14 @@ program demo_and call set0 % init(166) call set1 % init(166) call and( set0, set1 ) ! none none -if ( none(set0) ) write(*,*) 'First test of AND worked.' +if ( set0 % none() ) write(*,*) 'First test of AND worked.' call set0 % not() call and( set0, set1 ) ! all none -if ( none(set0) ) write(*,*) 'Second test of AND worked.' +if ( set0 % none() ) write(*,*) 'Second test of AND worked.' call set1 % not() call and( set0, set1 ) ! none all -if ( none(set0) ) write(*,*) 'Third test of AND worked.' +if ( set0 % none() ) write(*,*) 'Third test of AND worked.' call set0 % not() call and( set0, set1 ) ! all all -if ( all(set0) ) write(*,*) 'Fourth test of AND worked.' +if ( set0 % all() ) write(*,*) 'Fourth test of AND worked.' end program demo_and diff --git a/test/example/bitsets/demo_and_not.f90 b/test/example/bitsets/demo_bitsets_and_not.f90 similarity index 58% rename from test/example/bitsets/demo_and_not.f90 rename to test/example/bitsets/demo_bitsets_and_not.f90 index fd9f4bc19..199db2996 100644 --- a/test/example/bitsets/demo_and_not.f90 +++ b/test/example/bitsets/demo_bitsets_and_not.f90 @@ -4,15 +4,15 @@ program demo_and_not call set0 % init(166) call set1 % init(166) call and_not( set0, set1 ) ! none none -if ( none(set0) ) write(*,*) 'First test of AND_NOT worked.' +if ( set0 % none() ) write(*,*) 'First test of AND_NOT worked.' call set0 % not() call and_not( set0, set1 ) ! all none -if ( all(set0) ) write(*,*) 'Second test of AND_NOT worked.' +if ( set0 % all() ) write(*,*) 'Second test of AND_NOT worked.' call set0 % not() call set1 % not() call and_not( set0, set1 ) ! none all -if ( none(set0) ) write(*,*) 'Third test of AND_NOT worked.' +if ( set0 % none() ) write(*,*) 'Third test of AND_NOT worked.' call set0 % not() call and_not( set0, set1 ) ! all all -if ( none(set0) ) write(*,*) 'Fourth test of AND_NOT worked.' +if ( set0 % none() ) write(*,*) 'Fourth test of AND_NOT worked.' end program demo_and_not diff --git a/test/example/bitsets/demo_any.f90 b/test/example/bitsets/demo_bitsets_any.f90 similarity index 100% rename from test/example/bitsets/demo_any.f90 rename to test/example/bitsets/demo_bitsets_any.f90 diff --git a/test/example/bitsets/demo_assignment.f90 b/test/example/bitsets/demo_bitsets_assignment.f90 similarity index 86% rename from test/example/bitsets/demo_assignment.f90 rename to test/example/bitsets/demo_bitsets_assignment.f90 index 5eadbee61..02dbe61e8 100644 --- a/test/example/bitsets/demo_assignment.f90 +++ b/test/example/bitsets/demo_bitsets_assignment.f90 @@ -1,15 +1,17 @@ program demo_assignment use stdlib_bitsets +use stdlib_kinds, only: int8, int32 +implicit none logical(int8) :: logical1(64) = .true. logical(int32), allocatable :: logical2(:) type(bitset_64) :: set0, set1 set0 = logical1 if ( set0 % bits() /= 64 ) then -error stop procedure // & +error stop & ' initialization with logical(int8) failed to set' // & ' the right size.' else if ( .not. set0 % all() ) then -error stop procedure // ' initialization with' // & +error stop ' initialization with' // & ' logical(int8) failed to set the right values.' else write(*,*) 'Initialization with logical(int8) succeeded.' diff --git a/test/example/bitsets/demo_bit_count.f90 b/test/example/bitsets/demo_bitsets_bit_count.f90 similarity index 100% rename from test/example/bitsets/demo_bit_count.f90 rename to test/example/bitsets/demo_bitsets_bit_count.f90 diff --git a/test/example/bitsets/demo_bits.f90 b/test/example/bitsets/demo_bitsets_bits.f90 similarity index 100% rename from test/example/bitsets/demo_bits.f90 rename to test/example/bitsets/demo_bitsets_bits.f90 diff --git a/test/example/bitsets/demo_clear.f90 b/test/example/bitsets/demo_bitsets_clear.f90 similarity index 100% rename from test/example/bitsets/demo_clear.f90 rename to test/example/bitsets/demo_bitsets_clear.f90 diff --git a/test/example/bitsets/demo_equality.f90 b/test/example/bitsets/demo_bitsets_equality.f90 similarity index 100% rename from test/example/bitsets/demo_equality.f90 rename to test/example/bitsets/demo_bitsets_equality.f90 diff --git a/test/example/bitsets/demo_extract.f90 b/test/example/bitsets/demo_bitsets_extract.f90 similarity index 100% rename from test/example/bitsets/demo_extract.f90 rename to test/example/bitsets/demo_bitsets_extract.f90 diff --git a/test/example/bitsets/demo_flip.f90 b/test/example/bitsets/demo_bitsets_flip.f90 similarity index 100% rename from test/example/bitsets/demo_flip.f90 rename to test/example/bitsets/demo_bitsets_flip.f90 diff --git a/test/example/bitsets/demo_from_string.f90 b/test/example/bitsets/demo_bitsets_from_string.f90 similarity index 94% rename from test/example/bitsets/demo_from_string.f90 rename to test/example/bitsets/demo_bitsets_from_string.f90 index d2b63cf9c..6f2bb8597 100644 --- a/test/example/bitsets/demo_from_string.f90 +++ b/test/example/bitsets/demo_bitsets_from_string.f90 @@ -6,7 +6,7 @@ program demo_from_string call set0 % from_string( bits_all ) if ( bits(set0) /= 33 ) then error stop "FROM_STRING failed to interpret " // & -'BITS_ALL's size properly." +"BITS_ALL's size properly." else if ( .not. set0 % all() ) then error stop "FROM_STRING failed to interpret" // & "BITS_ALL's value properly." diff --git a/test/example/bitsets/demo_ge.f90 b/test/example/bitsets/demo_bitsets_ge.f90 similarity index 100% rename from test/example/bitsets/demo_ge.f90 rename to test/example/bitsets/demo_bitsets_ge.f90 diff --git a/test/example/bitsets/demo_gt.f90 b/test/example/bitsets/demo_bitsets_gt.f90 similarity index 100% rename from test/example/bitsets/demo_gt.f90 rename to test/example/bitsets/demo_bitsets_gt.f90 diff --git a/test/example/bitsets/demo_inequality.f90 b/test/example/bitsets/demo_bitsets_inequality.f90 similarity index 100% rename from test/example/bitsets/demo_inequality.f90 rename to test/example/bitsets/demo_bitsets_inequality.f90 diff --git a/test/example/bitsets/demo_init.f90 b/test/example/bitsets/demo_bitsets_init.f90 similarity index 100% rename from test/example/bitsets/demo_init.f90 rename to test/example/bitsets/demo_bitsets_init.f90 diff --git a/test/example/bitsets/demo_input.f90 b/test/example/bitsets/demo_bitsets_input.f90 similarity index 96% rename from test/example/bitsets/demo_input.f90 rename to test/example/bitsets/demo_bitsets_input.f90 index ad7d55f40..26489b4da 100644 --- a/test/example/bitsets/demo_input.f90 +++ b/test/example/bitsets/demo_bitsets_input.f90 @@ -1,4 +1,6 @@ program demo_input +use stdlib_bitsets +implicit none character(*), parameter :: & bits_0 = '000000000000000000000000000000000', & bits_1 = '000000000000000000000000000000001', & diff --git a/test/example/bitsets/demo_le.f90 b/test/example/bitsets/demo_bitsets_le.f90 similarity index 100% rename from test/example/bitsets/demo_le.f90 rename to test/example/bitsets/demo_bitsets_le.f90 diff --git a/test/example/bitsets/demo_lt.f90 b/test/example/bitsets/demo_bitsets_lt.f90 similarity index 100% rename from test/example/bitsets/demo_lt.f90 rename to test/example/bitsets/demo_bitsets_lt.f90 diff --git a/test/example/bitsets/demo_none.f90 b/test/example/bitsets/demo_bitsets_none.f90 similarity index 100% rename from test/example/bitsets/demo_none.f90 rename to test/example/bitsets/demo_bitsets_none.f90 diff --git a/test/example/bitsets/demo_not.f90 b/test/example/bitsets/demo_bitsets_not.f90 similarity index 100% rename from test/example/bitsets/demo_not.f90 rename to test/example/bitsets/demo_bitsets_not.f90 diff --git a/test/example/bitsets/demo_or.f90 b/test/example/bitsets/demo_bitsets_or.f90 similarity index 58% rename from test/example/bitsets/demo_or.f90 rename to test/example/bitsets/demo_bitsets_or.f90 index e063466ee..28c325d9b 100644 --- a/test/example/bitsets/demo_or.f90 +++ b/test/example/bitsets/demo_bitsets_or.f90 @@ -4,15 +4,15 @@ program demo_or call set0 % init(166) call set1 % init(166) call or( set0, set1 ) ! none none -if ( none(set0) ) write(*,*) 'First test of OR worked.' +if ( set0 % none() ) write(*,*) 'First test of OR worked.' call set0 % not() call or( set0, set1 ) ! all none -if ( all(set0) ) write(*,*) 'Second test of OR worked.' +if ( set0 % all() ) write(*,*) 'Second test of OR worked.' call set0 % not() call set1 % not() call or( set0, set1 ) ! none all -if ( all(set0) ) write(*,*) 'Third test of OR worked.' +if ( set0 % all() ) write(*,*) 'Third test of OR worked.' call set0 % not() call or( set0, set1 ) ! all all -if ( all(set0) ) write(*,*) 'Fourth test of OR worked.' +if ( set0 % all() ) write(*,*) 'Fourth test of OR worked.' end program demo_or diff --git a/test/example/bitsets/demo_output.f90 b/test/example/bitsets/demo_bitsets_output.f90 similarity index 96% rename from test/example/bitsets/demo_output.f90 rename to test/example/bitsets/demo_bitsets_output.f90 index eb9b5045b..3e1e8c9d6 100644 --- a/test/example/bitsets/demo_output.f90 +++ b/test/example/bitsets/demo_bitsets_output.f90 @@ -1,4 +1,6 @@ program demo_output +use stdlib_bitsets +implicit none character(*), parameter :: & bits_0 = '000000000000000000000000000000000', & bits_1 = '000000000000000000000000000000001', & diff --git a/test/example/bitsets/demo_read_bitset.f90 b/test/example/bitsets/demo_bitsets_read_bitset.f90 similarity index 87% rename from test/example/bitsets/demo_read_bitset.f90 rename to test/example/bitsets/demo_bitsets_read_bitset.f90 index 307a14980..7d6d2c031 100644 --- a/test/example/bitsets/demo_read_bitset.f90 +++ b/test/example/bitsets/demo_bitsets_read_bitset.f90 @@ -1,10 +1,12 @@ program demo_read_bitset +use stdlib_bitsets +implicit none character(*), parameter :: & bits_0 = 'S33B000000000000000000000000000000000', & bits_1 = 'S33B000000000000000000000000000000001', & -bits_33 = 'S33B100000000000000000000000000000000' +bits_2 = 'S33B100000000000000000000000000000000' character(:), allocatable :: test_0, test_1, test_2 -integer :: unit +integer :: unit, status type(bitset_64) :: set0, set1, set2, set3, set4, set5 call set0 % read_bitset( bits_0, status ) call set1 % read_bitset( bits_1, status ) @@ -28,6 +30,6 @@ program demo_read_bitset call set4 % read_bitset(unit, advance='no') call set5 % read_bitset(unit) if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then -write(*,*) WRITE_BITSET to READ_BITSET through unit worked.' +write(*,*) 'WRITE_BITSET to READ_BITSET through unit worked.' end if end program demo_read_bitset diff --git a/test/example/bitsets/demo_set.f90 b/test/example/bitsets/demo_bitsets_set.f90 similarity index 100% rename from test/example/bitsets/demo_set.f90 rename to test/example/bitsets/demo_bitsets_set.f90 diff --git a/test/example/bitsets/demo_test.f90 b/test/example/bitsets/demo_bitsets_test.f90 similarity index 100% rename from test/example/bitsets/demo_test.f90 rename to test/example/bitsets/demo_bitsets_test.f90 diff --git a/test/example/bitsets/demo_to_string.f90 b/test/example/bitsets/demo_bitsets_to_string.f90 similarity index 100% rename from test/example/bitsets/demo_to_string.f90 rename to test/example/bitsets/demo_bitsets_to_string.f90 diff --git a/test/example/bitsets/demo_value.f90 b/test/example/bitsets/demo_bitsets_value.f90 similarity index 100% rename from test/example/bitsets/demo_value.f90 rename to test/example/bitsets/demo_bitsets_value.f90 diff --git a/test/example/bitsets/demo_write_bitset.f90 b/test/example/bitsets/demo_bitsets_write_bitset.f90 similarity index 87% rename from test/example/bitsets/demo_write_bitset.f90 rename to test/example/bitsets/demo_bitsets_write_bitset.f90 index 263850b32..7ad770abb 100644 --- a/test/example/bitsets/demo_write_bitset.f90 +++ b/test/example/bitsets/demo_bitsets_write_bitset.f90 @@ -1,10 +1,12 @@ program demo_write_bitset +use stdlib_bitsets +implicit none character(*), parameter :: & bits_0 = 'S33B000000000000000000000000000000000', & bits_1 = 'S33B000000000000000000000000000000001', & -bits_33 = 'S33B100000000000000000000000000000000' +bits_2 = 'S33B100000000000000000000000000000000' character(:), allocatable :: test_0, test_1, test_2 -integer :: unit +integer :: unit, status type(bitset_64) :: set0, set1, set2, set3, set4, set5 call set0 % read_bitset( bits_0, status ) call set1 % read_bitset( bits_1, status ) @@ -28,6 +30,6 @@ program demo_write_bitset call set4 % read_bitset(unit, advance='no') call set5 % read_bitset(unit) if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then -write(*,*) WRITE_BITSET to READ_BITSET through unit worked.' +write(*,*) 'WRITE_BITSET to READ_BITSET through unit worked.' end if end program demo_write_bitset diff --git a/test/example/bitsets/demo_xor.f90 b/test/example/bitsets/demo_bitsets_xor.f90 similarity index 58% rename from test/example/bitsets/demo_xor.f90 rename to test/example/bitsets/demo_bitsets_xor.f90 index df8338860..3c9b20095 100644 --- a/test/example/bitsets/demo_xor.f90 +++ b/test/example/bitsets/demo_bitsets_xor.f90 @@ -4,15 +4,15 @@ program demo_xor call set0 % init(166) call set1 % init(166) call xor( set0, set1 ) ! none none -if ( none(set0) ) write(*,*) 'First test of XOR worked.' +if ( set0 % none() ) write(*,*) 'First test of XOR worked.' call set0 % not() call xor( set0, set1 ) ! all none -if ( all(set0) ) write(*,*) 'Second test of XOR worked.' +if ( set0 % all() ) write(*,*) 'Second test of XOR worked.' call set0 % not() call set1 % not() call xor( set0, set1 ) ! none all -if ( all(set0) ) write(*,*) 'Third test of XOR worked.' +if ( set0 % all() ) write(*,*) 'Third test of XOR worked.' call set0 % not() call xor( set0, set1 ) ! all all -if ( none(set0) ) write(*,*) 'Fourth test of XOR worked.' +if ( set0 % none() ) write(*,*) 'Fourth test of XOR worked.' end program demo_xor diff --git a/test/example/error/CMakeLists.txt b/test/example/error/CMakeLists.txt new file mode 100644 index 000000000..a9cfa2e96 --- /dev/null +++ b/test/example/error/CMakeLists.txt @@ -0,0 +1,6 @@ +ADD_DEMO(check1) +ADD_DEMO(check2) +ADD_DEMO(check3) +ADD_DEMO(check4) +ADD_DEMO(error_stop1) +ADD_DEMO(error_stop2) diff --git a/test/example/hash_procedures/CMakeLists.txt b/test/example/hash_procedures/CMakeLists.txt new file mode 100644 index 000000000..236d46deb --- /dev/null +++ b/test/example/hash_procedures/CMakeLists.txt @@ -0,0 +1,13 @@ +ADD_DEMO(fibonacci_hash_64) +ADD_DEMO(fibonacci_hash) +ADD_DEMO(fnv_1a_hash_64) +ADD_DEMO(fnv_1a_hash) +ADD_DEMO(fnv_1_hash_64) +ADD_DEMO(fnv_1_hash) +ADD_DEMO(nmhash32) +ADD_DEMO(nmhash32x) +ADD_DEMO(pengy_hash) +ADD_DEMO(spooky_hash) +ADD_DEMO(universal_mult_hash_64) +ADD_DEMO(universal_mult_hash) +ADD_DEMO(water_hash) diff --git a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 b/test/example/hash_procedures/demo_universal_mult_hash_64.f90 index 430ff1b1b..8a34d4d6f 100644 --- a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 +++ b/test/example/hash_procedures/demo_universal_mult_hash_64.f90 @@ -1,5 +1,5 @@ program demo_universal_mult_hash_64 -use stdlib_hash_32bit, only: odd_random_integer, & +use stdlib_hash_64bit, only: odd_random_integer, & universal_mult_hash use iso_fortran_env, only: int64 implicit none diff --git a/test/example/hashmaps/CMakeLists.txt b/test/example/hashmaps/CMakeLists.txt new file mode 100644 index 000000000..14b55c326 --- /dev/null +++ b/test/example/hashmaps/CMakeLists.txt @@ -0,0 +1,27 @@ +ADD_DEMO(hashmaps_calls) +ADD_DEMO(hashmaps_copy_key) +#ADD_DEMO(hashmaps_copy_other) +ADD_DEMO(hashmaps_entries) +ADD_DEMO(hashmaps_equal_keys) +ADD_DEMO(hashmaps_fnv_1a_hasher) +ADD_DEMO(hashmaps_fnv_1_hasher) +ADD_DEMO(hashmaps_free_key) +ADD_DEMO(hashmaps_free_other) +ADD_DEMO(hashmaps_get) +ADD_DEMO(hashmaps_get_other_data) +ADD_DEMO(hashmaps_hasher_fun) +ADD_DEMO(hashmaps_init) +ADD_DEMO(hashmaps_key_test) +ADD_DEMO(hashmaps_loading) +ADD_DEMO(hashmaps_map_entry) +ADD_DEMO(hashmaps_num_slots) +ADD_DEMO(hashmaps_probes) +ADD_DEMO(hashmaps_rehash) +ADD_DEMO(hashmaps_remove) +ADD_DEMO(hashmaps_seeded_nmhash32_hasher) +ADD_DEMO(hashmaps_seeded_nmhash32x_hasher) +ADD_DEMO(hashmaps_seeded_water_hasher) +ADD_DEMO(hashmaps_set) +ADD_DEMO(hashmaps_set_other_data) +ADD_DEMO(hashmaps_slots_bits) +ADD_DEMO(hashmaps_total_depth) diff --git a/test/example/hashmaps/demo_calls.f90 b/test/example/hashmaps/demo_hashmaps_calls.f90 similarity index 89% rename from test/example/hashmaps/demo_calls.f90 rename to test/example/hashmaps/demo_hashmaps_calls.f90 index 3940f39a0..e7cbc59b6 100644 --- a/test/example/hashmaps/demo_calls.f90 +++ b/test/example/hashmaps/demo_hashmaps_calls.f90 @@ -3,7 +3,7 @@ program demo_calls use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none type(chaining_hashmap_type) :: map -type(int_calls) :: initial_calls +integer(int_calls) :: initial_calls call map % init( fnv_1_hasher ) initial_calls = map % calls() print *, "INITIAL_CALLS = ", initial_calls diff --git a/test/example/hashmaps/demo_copy_key.f90 b/test/example/hashmaps/demo_hashmaps_copy_key.f90 similarity index 73% rename from test/example/hashmaps/demo_copy_key.f90 rename to test/example/hashmaps/demo_hashmaps_copy_key.f90 index 44f2d8741..9a44eb0c3 100644 --- a/test/example/hashmaps/demo_copy_key.f90 +++ b/test/example/hashmaps/demo_hashmaps_copy_key.f90 @@ -1,12 +1,12 @@ program demo_copy_key use stdlib_hashmap_wrappers, only: & -copy_key, operator(==), key_type +copy_key, operator(==), key_type, set use iso_fortran_env, only: int8 implicit none integer(int8) :: i, value(15) type(key_type) :: old_key, new_key value = [(i, i = 1, 15)] -call set( key_out, value ) -call copy_key( key_out, new_key ) +call set( old_key, value ) +call copy_key( old_key, new_key ) print *, "old_key == new_key = ", old_key == new_key end program demo_copy_key diff --git a/test/example/hashmaps/demo_copy_other.f90 b/test/example/hashmaps/demo_hashmaps_copy_other.f90 similarity index 81% rename from test/example/hashmaps/demo_copy_other.f90 rename to test/example/hashmaps/demo_hashmaps_copy_other.f90 index 5e821dfdd..81e9c41f3 100644 --- a/test/example/hashmaps/demo_copy_other.f90 +++ b/test/example/hashmaps/demo_hashmaps_copy_other.f90 @@ -4,20 +4,20 @@ program demo_copy_other use iso_fortran_env, only: int8 implicit none type(other_type) :: other_in, other_out -integer(int_8) :: i +integer(int8) :: i class(*), allocatable :: dummy type dummy_type integer(int8) :: value(15) end type type(dummy_type) :: dummy_val do i=1, 15 -dummy_val % value1(i) = i +dummy_val % value(i) = i end do allocate(other_in % value, source=dummy_val) call copy_other( other_in, other_out ) select type(other_out) - type(dummy_type) +typeis (dummy_type) print *, "other_in == other_out = ", & -all( dummy_val % value == other_out % value ) +all( other_in % value == other_out % value ) end select end program demo_copy_other diff --git a/test/example/hashmaps/demo_entries.f90 b/test/example/hashmaps/demo_hashmaps_entries.f90 similarity index 89% rename from test/example/hashmaps/demo_entries.f90 rename to test/example/hashmaps/demo_hashmaps_entries.f90 index bdb8bf672..9dad49205 100644 --- a/test/example/hashmaps/demo_entries.f90 +++ b/test/example/hashmaps/demo_hashmaps_entries.f90 @@ -3,7 +3,7 @@ program demo_entries use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none type(open_hashmap_type) :: map -type(int_index) :: initial_entries +integer(int_index) :: initial_entries call map % init( fnv_1_hasher ) initial_entries = map % entries () print *, "INITIAL_ENTRIES = ", initial_entries diff --git a/test/example/hashmaps/demo_equal_keys.f90 b/test/example/hashmaps/demo_hashmaps_equal_keys.f90 similarity index 100% rename from test/example/hashmaps/demo_equal_keys.f90 rename to test/example/hashmaps/demo_hashmaps_equal_keys.f90 diff --git a/test/example/hashmaps/demo_fnv_1_hasher.f90 b/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 similarity index 73% rename from test/example/hashmaps/demo_fnv_1_hasher.f90 rename to test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 index 7b93ef1ab..973ee85a8 100644 --- a/test/example/hashmaps/demo_fnv_1_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 @@ -1,7 +1,6 @@ program demo_fnv_1_hasher -use stdlib_hashmap_wrappers, only: & -fnv_1_hasher, key_type, set -use iso_fortran_env, only: int32 +use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set +use iso_fortran_env, only: int8, int32 implicit none integer(int8), allocatable :: array1(:) integer(int32) :: hash diff --git a/test/example/hashmaps/demo_fnv_1a_hasher.f90 b/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 similarity index 89% rename from test/example/hashmaps/demo_fnv_1a_hasher.f90 rename to test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 index 85ecb2853..5bb9e4ab6 100644 --- a/test/example/hashmaps/demo_fnv_1a_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 @@ -1,7 +1,7 @@ program demo_fnv_1a_hasher use stdlib_hashmap_wrappers, only: & fnv_1a_hasher, key_type, set -use iso_fortran_env, only: int32 +use iso_fortran_env, only: int8, int32 implicit none integer(int8), allocatable :: array1(:) integer(int32) :: hash diff --git a/test/example/hashmaps/demo_free_key.f90 b/test/example/hashmaps/demo_hashmaps_free_key.f90 similarity index 100% rename from test/example/hashmaps/demo_free_key.f90 rename to test/example/hashmaps/demo_hashmaps_free_key.f90 diff --git a/test/example/hashmaps/demo_free_other.f90 b/test/example/hashmaps/demo_hashmaps_free_other.f90 similarity index 73% rename from test/example/hashmaps/demo_free_other.f90 rename to test/example/hashmaps/demo_hashmaps_free_other.f90 index 42e21ce0c..dfdecf010 100644 --- a/test/example/hashmaps/demo_free_other.f90 +++ b/test/example/hashmaps/demo_hashmaps_free_other.f90 @@ -1,18 +1,18 @@ program demo_free_other use stdlib_hashmap_wrappers, only: & -copy_other, free_other, other_type, set +copy_other, free_other, other_type use iso_fortran_env, only: int8 implicit none type dummy_type integer(int8) :: value(15) end type dummy_type -typer(dummy_type) :: dummy_val +type(dummy_type) :: dummy_val type(other_type), allocatable :: other_in, other_out -integer(int_8) :: i +integer(int8) :: i do i=1, 15 dummy_val % value(i) = i end do -allocate(other_in, source=dummy_val) +allocate(other_in % value , source=dummy_val) call copy_other( other_in, other_out ) call free_other( other_out ) end program demo_free_other diff --git a/test/example/hashmaps/demo_get.f90 b/test/example/hashmaps/demo_hashmaps_get.f90 similarity index 94% rename from test/example/hashmaps/demo_get.f90 rename to test/example/hashmaps/demo_hashmaps_get.f90 index f0438f4bb..d00977ace 100644 --- a/test/example/hashmaps/demo_get.f90 +++ b/test/example/hashmaps/demo_hashmaps_get.f90 @@ -5,7 +5,7 @@ program demo_get implicit none integer(int8), allocatable :: value(:), result(:) type(key_type) :: key -integer(int_8) :: i +integer(int8) :: i allocate( value(1:15) ) do i=1, 15 value(i) = i diff --git a/test/example/hashmaps/demo_get_other_data.f90 b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 similarity index 80% rename from test/example/hashmaps/demo_get_other_data.f90 rename to test/example/hashmaps/demo_hashmaps_get_other_data.f90 index 6cceb59e6..b49302f72 100644 --- a/test/example/hashmaps/demo_get_other_data.f90 +++ b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 @@ -1,16 +1,15 @@ program demo_get_other_data -use, intrinsic:: iso_fortran_env, only: & -int8 +use stdlib_kinds, only: int8 use stdlib_hashmaps, only: chaining_hashmap_type, int_index -use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type - logical :: conflict, exists +use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set, get +logical :: conflict, exists type(key_type) :: key type(other_type) :: other type(chaining_hashmap_type) :: map type dummy_type integer(int8) :: value(4) end type dummy_type - type(dummy_type) :: dummy +type(dummy_type) :: dummy class(*), allocatable :: data dummy % value = [ 4_int8, 3_int8, 2_int8, 1_int8 ] allocate( data, source=dummy ) @@ -21,13 +20,13 @@ program demo_get_other_data if ( .not. conflict ) then call map % get_other_data( key, other ) else -stop 'Key is already present in the map.' +error stop 'Key is already present in the map.' end if call get( other, data ) select type( data ) -type (dummy_type) +typeis (dummy_type) print *, 'Other data % value = ', data % value -type default +class default print *, 'Invalid data type in other' end select end program demo_get_other_data diff --git a/test/example/hashmaps/demo_hasher_fun.f90 b/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 similarity index 65% rename from test/example/hashmaps/demo_hasher_fun.f90 rename to test/example/hashmaps/demo_hashmaps_hasher_fun.f90 index 067637620..45cca12db 100644 --- a/test/example/hashmaps/demo_hasher_fun.f90 +++ b/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 @@ -1,9 +1,8 @@ program demo_hasher_fun -use stdlib_hashmap_wrappers, only: & -fnv_1a_hasher, hasher_fun, set -use iso_fortran_env, only: int8, int32 +use stdlib_hashmap_wrappers, only: fnv_1a_hasher, hasher_fun, set, key_type +use stdlib_kinds, only: int8, int32 implicit none -type(hasher_fun), pointer :: hasher_pointer +procedure(hasher_fun), pointer :: hasher_pointer integer(int8), allocatable :: array1(:) integer(int32) :: hash type(key_type) :: key diff --git a/test/example/hashmaps/demo_hashmaps_init.f90 b/test/example/hashmaps/demo_hashmaps_init.f90 new file mode 100644 index 000000000..344192dbe --- /dev/null +++ b/test/example/hashmaps/demo_hashmaps_init.f90 @@ -0,0 +1,7 @@ +program demo_init +use stdlib_hashmaps, only: chaining_hashmap_type +use stdlib_hashmap_wrappers, only: fnv_1_hasher +implicit none +type(chaining_hashmap_type) :: map +call map % init( fnv_1_hasher, slots_bits=10 ) +end program demo_init diff --git a/test/example/hashmaps/demo_key_test.f90 b/test/example/hashmaps/demo_hashmaps_key_test.f90 similarity index 81% rename from test/example/hashmaps/demo_key_test.f90 rename to test/example/hashmaps/demo_hashmaps_key_test.f90 index 55d6780e7..a91c942a2 100644 --- a/test/example/hashmaps/demo_key_test.f90 +++ b/test/example/hashmaps/demo_hashmaps_key_test.f90 @@ -1,11 +1,11 @@ program demo_key_test use stdlib_kinds, only: int8 use stdlib_hashmaps, only: chaining_hashmap_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type +use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set implicit none type(chaining_hashmap_type) :: map type(key_type) :: key -logocal :: present +logical :: present call map % init( fnv_1_hasher ) call set(key, [0_int8, 1_int8] ) call map % key_test ( key, present ) diff --git a/test/example/hashmaps/demo_loading.f90 b/test/example/hashmaps/demo_hashmaps_loading.f90 similarity index 100% rename from test/example/hashmaps/demo_loading.f90 rename to test/example/hashmaps/demo_hashmaps_loading.f90 diff --git a/test/example/hashmaps/demo_map_entry.f90 b/test/example/hashmaps/demo_hashmaps_map_entry.f90 similarity index 98% rename from test/example/hashmaps/demo_map_entry.f90 rename to test/example/hashmaps/demo_hashmaps_map_entry.f90 index 25f651869..4f4445d38 100644 --- a/test/example/hashmaps/demo_map_entry.f90 +++ b/test/example/hashmaps/demo_hashmaps_map_entry.f90 @@ -1,7 +1,7 @@ program demo_map_entry use, intrinsic:: iso_fortran_env, only: int8 use stdlib_hashmaps, only: chaining_hashmap_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type +use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set type(chaining_hashmap_type) :: map type(key_type) :: key logical :: conflict diff --git a/test/example/hashmaps/demo_num_slots.f90 b/test/example/hashmaps/demo_hashmaps_num_slots.f90 similarity index 92% rename from test/example/hashmaps/demo_num_slots.f90 rename to test/example/hashmaps/demo_hashmaps_num_slots.f90 index a12774ae5..7ee036677 100644 --- a/test/example/hashmaps/demo_num_slots.f90 +++ b/test/example/hashmaps/demo_hashmaps_num_slots.f90 @@ -7,4 +7,4 @@ program demo_num_slots call map % init( fnv_1_hasher ) initial_slots = map % num_slots () print *, "Initial slots = ", initial_slots -end program num_slots +end program demo_num_slots diff --git a/test/example/hashmaps/demo_probes.f90 b/test/example/hashmaps/demo_hashmaps_probes.f90 similarity index 75% rename from test/example/hashmaps/demo_probes.f90 rename to test/example/hashmaps/demo_hashmaps_probes.f90 index a64a4565f..ac16b6be7 100644 --- a/test/example/hashmaps/demo_probes.f90 +++ b/test/example/hashmaps/demo_hashmaps_probes.f90 @@ -1,10 +1,10 @@ program demo_probes use stdlib_hashmaps, only: chaining_hashmap_type, int_index -use stdlib_hashmap_wrappers: fnv_1_hasher +use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none type(chaining_hashmap_type) :: map real :: nprobes call map % init( fnv_1_hasher ) -nprobes = map % probes() +nprobes = map % map_probes() print *, "Initial probes = ", nprobes end program demo_probes diff --git a/test/example/hashmaps/demo_rehash.f90 b/test/example/hashmaps/demo_hashmaps_rehash.f90 similarity index 71% rename from test/example/hashmaps/demo_rehash.f90 rename to test/example/hashmaps/demo_hashmaps_rehash.f90 index 92a59731e..7290ea3bf 100644 --- a/test/example/hashmaps/demo_rehash.f90 +++ b/test/example/hashmaps/demo_hashmaps_rehash.f90 @@ -1,8 +1,10 @@ program demo_rehash +use stdlib_kinds, only: int8 use stdlib_hashmaps, only: open_hashmap_type -use stdlib_hasmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher,& -key_type, other_type -type(openn_hashmap_type) :: map +use stdlib_hashmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher,& +key_type, other_type, set +implicit none +type(open_hashmap_type) :: map type(key_type) :: key type(other_type) :: other class(*), allocatable :: dummy diff --git a/test/example/hashmaps/demo_remove.f90 b/test/example/hashmaps/demo_hashmaps_remove.f90 similarity index 89% rename from test/example/hashmaps/demo_remove.f90 rename to test/example/hashmaps/demo_hashmaps_remove.f90 index 811b7c862..c950f88bf 100644 --- a/test/example/hashmaps/demo_remove.f90 +++ b/test/example/hashmaps/demo_hashmaps_remove.f90 @@ -1,7 +1,8 @@ program demo_remove +use stdlib_kinds, only: int8 use stdlib_hashmaps, only: open_hashmap_type, int_index use stdlib_hashmap_wrappers, only: fnv_1_hasher, & -fnv_1a_hasher, key_type, other_type +fnv_1a_hasher, key_type, other_type, set type(open_hashmap_type) :: map type(key_type) :: key type(other_type) :: other diff --git a/test/example/hashmaps/demo_seeded_nmhash32_hasher.f90 b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 similarity index 90% rename from test/example/hashmaps/demo_seeded_nmhash32_hasher.f90 rename to test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 index 33fe75dc7..26b893c6a 100644 --- a/test/example/hashmaps/demo_seeded_nmhash32_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 @@ -1,7 +1,7 @@ program demo_seeded_nmhash32_hasher use stdlib_hashmap_wrappers, only: & seeded_nmhash32_hasher, key_type, set -use iso_fortran_env, only: int32 +use iso_fortran_env, only: int8, int32 implicit none integer(int8), allocatable :: array1(:) integer(int32) :: hash diff --git a/test/example/hashmaps/demo_seeded_nmhash32x_hasher.f90 b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 similarity index 91% rename from test/example/hashmaps/demo_seeded_nmhash32x_hasher.f90 rename to test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 index 92a10f832..cfa5ba575 100644 --- a/test/example/hashmaps/demo_seeded_nmhash32x_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 @@ -1,7 +1,7 @@ program demo_seeded_nmhash32x_hasher +use stdlib_kinds, only: int8, int32 use stdlib_hashmap_wrappers, only: & seeded_nmhash32x_hasher, key_type, set -use iso_fortran_env, only: int32 implicit none integer(int8), allocatable :: array1(:) integer(int32) :: hash diff --git a/test/example/hashmaps/demo_seeded_water_hasher.f90 b/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 similarity index 90% rename from test/example/hashmaps/demo_seeded_water_hasher.f90 rename to test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 index 7295f1144..3663b8141 100644 --- a/test/example/hashmaps/demo_seeded_water_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 @@ -1,7 +1,7 @@ program demo_seeded_water_hasher use stdlib_hashmap_wrappers, only: & seeded_water_hasher, key_type, set -use iso_fortran_env, only: int32 +use iso_fortran_env, only: int8, int32 implicit none integer(int8), allocatable :: array1(:) integer(int32) :: hash diff --git a/test/example/hashmaps/demo_set.f90 b/test/example/hashmaps/demo_hashmaps_set.f90 similarity index 94% rename from test/example/hashmaps/demo_set.f90 rename to test/example/hashmaps/demo_hashmaps_set.f90 index 5628db501..d9b87e6c7 100644 --- a/test/example/hashmaps/demo_set.f90 +++ b/test/example/hashmaps/demo_hashmaps_set.f90 @@ -5,7 +5,7 @@ program demo_set implicit none integer(int8), allocatable :: value(:), result(:) type(key_type) :: key -integer(int_8) :: i +integer(int8) :: i allocate( value(1:15) ) do i=1, 15 value(i) = i diff --git a/test/example/hashmaps/demo_set_other_data.f90 b/test/example/hashmaps/demo_hashmaps_set_other_data.f90 similarity index 82% rename from test/example/hashmaps/demo_set_other_data.f90 rename to test/example/hashmaps/demo_hashmaps_set_other_data.f90 index 81937fddd..4e470a978 100644 --- a/test/example/hashmaps/demo_set_other_data.f90 +++ b/test/example/hashmaps/demo_hashmaps_set_other_data.f90 @@ -1,18 +1,21 @@ program demo_set_other_data +use stdlib_kinds, only: int8 use stdlib_hashmaps, only: open_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher, & fnv_1a_hasher, key_type, other_type, set +implicit none +logical :: exists type(open_hashmap_type) :: map type(key_type) :: key type(other_type) :: other class(*), allocatable :: dummy call map % init( fnv_1_hasher, slots_bits=10 ) -allocate( dummy, source='A value` ) +allocate( dummy, source='A value' ) call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) call set( other, dummy ) call map % map_entry( key, other ) deallocate( dummy ) -allocate( dummy, source='Another value` ) +allocate( dummy, source='Another value' ) call set( other, dummy ) call map % set_other_data( key, other, exists ) print *, 'The entry to have its other data replaced exists = ', exists diff --git a/test/example/hashmaps/demo_slots_bits.f90 b/test/example/hashmaps/demo_hashmaps_slots_bits.f90 similarity index 100% rename from test/example/hashmaps/demo_slots_bits.f90 rename to test/example/hashmaps/demo_hashmaps_slots_bits.f90 diff --git a/test/example/hashmaps/demo_total_depth.f90 b/test/example/hashmaps/demo_hashmaps_total_depth.f90 similarity index 100% rename from test/example/hashmaps/demo_total_depth.f90 rename to test/example/hashmaps/demo_hashmaps_total_depth.f90 diff --git a/test/example/hashmaps/demo_init.f90 b/test/example/hashmaps/demo_init.f90 deleted file mode 100644 index cea6eb8ec..000000000 --- a/test/example/hashmaps/demo_init.f90 +++ /dev/null @@ -1,7 +0,0 @@ -program demo_init -use stdlib_hashmaps, only: chaining_map_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher -type(fnv_1a_type) :: fnv_1 -type(chaining_map_type) :: map -call map % init( fnv_1a, slots_bits=10 ) -end program demo_init diff --git a/test/example/io/CMakeLists.txt b/test/example/io/CMakeLists.txt new file mode 100644 index 000000000..0e4f22461 --- /dev/null +++ b/test/example/io/CMakeLists.txt @@ -0,0 +1,7 @@ +ADD_DEMO(fmt_constants) +ADD_DEMO(getline) +ADD_DEMO(loadnpy) +ADD_DEMO(loadtxt) +ADD_DEMO(open) +ADD_DEMO(savenpy) +ADD_DEMO(savetxt) diff --git a/test/example/io/demo_fmt_constants.f90 b/test/example/io/demo_fmt_constants.f90 index 2e52c0e26..01842def2 100644 --- a/test/example/io/demo_fmt_constants.f90 +++ b/test/example/io/demo_fmt_constants.f90 @@ -1,5 +1,5 @@ program demo_fmt_constants -use, stdlib_kinds, only : int32, int64, sp, dp +use stdlib_kinds, only : int32, int64, sp, dp use stdlib_io, only : FMT_INT, FMT_REAL_SP, FMT_REAL_DP, FMT_COMPLEX_SP, FMT_COMPLEX_DP implicit none diff --git a/test/example/io/demo_loadnpy.f90 b/test/example/io/demo_loadnpy.f90 index d7148af3d..5d4cc1b9e 100644 --- a/test/example/io/demo_loadnpy.f90 +++ b/test/example/io/demo_loadnpy.f90 @@ -2,5 +2,5 @@ program demo_loadnpy use stdlib_io_npy, only: load_npy implicit none real, allocatable :: x(:,:) -call loadtxt('example.npy', x) +call load_npy('example.npy', x) end program demo_loadnpy diff --git a/test/example/linalg/CMakeLists.txt b/test/example/linalg/CMakeLists.txt new file mode 100644 index 000000000..756644569 --- /dev/null +++ b/test/example/linalg/CMakeLists.txt @@ -0,0 +1,16 @@ +ADD_DEMO(diag1) +ADD_DEMO(diag2) +ADD_DEMO(diag3) +ADD_DEMO(diag4) +ADD_DEMO(diag5) +ADD_DEMO(eye1) +ADD_DEMO(eye2) +ADD_DEMO(is_diagonal) +ADD_DEMO(is_hermitian) +ADD_DEMO(is_hessenberg) +ADD_DEMO(is_skew_symmetric) +ADD_DEMO(is_square) +ADD_DEMO(is_symmetric) +ADD_DEMO(is_triangular) +ADD_DEMO(outer_product) +ADD_DEMO(trace) diff --git a/test/example/linalg/demo_diag2.f90 b/test/example/linalg/demo_diag2.f90 index 35fee6e0c..fbbe0bf65 100644 --- a/test/example/linalg/demo_diag2.f90 +++ b/test/example/linalg/demo_diag2.f90 @@ -1,7 +1,7 @@ program demo_diag2 use stdlib_linalg, only: diag implicit none -real :: v(:) +real, allocatable :: v(:) real, allocatable :: A(:,:) integer :: i v = [1,2,3,4,5] diff --git a/test/example/logger/CMakeLists.txt b/test/example/logger/CMakeLists.txt new file mode 100644 index 000000000..3c8eeec9e --- /dev/null +++ b/test/example/logger/CMakeLists.txt @@ -0,0 +1,5 @@ +ADD_DEMO(add_log_unit) +ADD_DEMO(configure) +ADD_DEMO(global_logger) +ADD_DEMO(log_io_error) +#ADD_DEMO(log_text_error) diff --git a/test/example/logger/demo_add_log_unit.f90 b/test/example/logger/demo_add_log_unit.f90 index aea0365ec..ebeee808b 100644 --- a/test/example/logger/demo_add_log_unit.f90 +++ b/test/example/logger/demo_add_log_unit.f90 @@ -4,7 +4,7 @@ program demo_add_log_unit character(256) :: iomsg integer :: iostat, unit, stat -open( newunit=unit, 'error_log.txt', & +open( newunit=unit, file = 'error_log.txt', & form='formatted', status='replace', & position='rewind', err=999, & action='read', iostat=iostat, iomsg=iomsg ) @@ -17,6 +17,6 @@ program demo_add_log_unit end select -999 error stop 'Unable to open "error_log.txt". +999 error stop 'Unable to open "error_log.txt".' end program demo_add_log_unit diff --git a/test/example/logger/demo_log_text_error.f90 b/test/example/logger/demo_log_text_error.f90 index cd1372147..e79795044 100644 --- a/test/example/logger/demo_log_text_error.f90 +++ b/test/example/logger/demo_log_text_error.f90 @@ -6,14 +6,14 @@ program demo_log_text_error character(128) :: line character(*), parameter :: message = 'Bad text found.' -open( newunit=lun, file = filename, statu='old', & +open( newunit=lun, file = filename, status = 'old', & form='formatted' ) line_no = 0 do read( lun, fmt='(a)', end=900 ) line line_no = line_no + 1 call check_line( line, status, col_no ) -if ( status /= 0 ) +if ( status /= 0 ) then call global_logger % log_text_error( line, & col_no, message, filename, line_no ) error stop 'Error in reading ' // filename diff --git a/test/example/math/CMakeLists.txt b/test/example/math/CMakeLists.txt new file mode 100644 index 000000000..7bb8b522c --- /dev/null +++ b/test/example/math/CMakeLists.txt @@ -0,0 +1,15 @@ +ADD_DEMO(clip_integer) +ADD_DEMO(clip_real) +ADD_DEMO(diff) +ADD_DEMO(gcd) +ADD_DEMO(linspace_complex) +ADD_DEMO(linspace_int16) +ADD_DEMO(logspace_complex) +ADD_DEMO(logspace_int) +ADD_DEMO(logspace_rstart_cbase) +ADD_DEMO(math_all_close) +ADD_DEMO(math_arange) +ADD_DEMO(math_argd) +ADD_DEMO(math_arg) +ADD_DEMO(math_argpi) +ADD_DEMO(math_is_close) diff --git a/test/example/math/demo_logspace_int.f90 b/test/example/math/demo_logspace_int.f90 index 6627e41ac..b055e0914 100644 --- a/test/example/math/demo_logspace_int.f90 +++ b/test/example/math/demo_logspace_int.f90 @@ -3,9 +3,9 @@ program demo_logspace_int use stdlib_kinds, only: dp implicit none -integer :: start = 10 -integer :: end = 23 -integer :: n = 15 +integer, parameter :: start = 10 +integer, parameter :: end = 23 +integer, parameter :: n = 15 real(dp) :: r(n) ! Integer values raised to real powers results in real values diff --git a/test/example/math/demo_logspace_rstart_cbase.f90 b/test/example/math/demo_logspace_rstart_cbase.f90 index c4c641737..73b8e49e1 100644 --- a/test/example/math/demo_logspace_rstart_cbase.f90 +++ b/test/example/math/demo_logspace_rstart_cbase.f90 @@ -5,7 +5,7 @@ program demo_logspace_rstart_cbase real(dp) :: start = 0.0_dp real(dp) :: end = 3.0_dp -integer :: n = 4 +integer, parameter :: n = 4 complex(dp) :: base = (0.0_dp, 1.0_dp) complex(dp) :: z(n) ! complex values raised to real powers result in complex values diff --git a/test/example/optval/CMakeLists.txt b/test/example/optval/CMakeLists.txt new file mode 100644 index 000000000..75af440b2 --- /dev/null +++ b/test/example/optval/CMakeLists.txt @@ -0,0 +1 @@ +ADD_DEMO(optval) diff --git a/test/example/quadrature/CMakeLists.txt b/test/example/quadrature/CMakeLists.txt new file mode 100644 index 000000000..c06d0f9f7 --- /dev/null +++ b/test/example/quadrature/CMakeLists.txt @@ -0,0 +1,6 @@ +ADD_DEMO(gauss_legendre) +ADD_DEMO(gauss_legendre_lobatto) +ADD_DEMO(simps) +ADD_DEMO(simps_weights) +ADD_DEMO(trapz) +ADD_DEMO(trapz_weights) diff --git a/test/example/quadrature/demo_gauss_legendre.f90 b/test/example/quadrature/demo_gauss_legendre.f90 index aec9468f4..1597543e8 100644 --- a/test/example/quadrature/demo_gauss_legendre.f90 +++ b/test/example/quadrature/demo_gauss_legendre.f90 @@ -1,9 +1,10 @@ program demo_gauss_legendre - use iso_fortran_env, dp => real64 - implicit none +use iso_fortran_env, dp => real64 +use stdlib_quadrature, only: gauss_legendre +implicit none - integer, parameter :: N = 6 - real(dp), dimension(N) :: x,w - call gauss_legendre(x,w) - print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) +integer, parameter :: N = 6 +real(dp), dimension(N) :: x,w +call gauss_legendre(x,w) +print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) end program demo_gauss_legendre diff --git a/test/example/quadrature/demo_gauss_legendre_lobatto.f90 b/test/example/quadrature/demo_gauss_legendre_lobatto.f90 index 9360d1591..8d373d368 100644 --- a/test/example/quadrature/demo_gauss_legendre_lobatto.f90 +++ b/test/example/quadrature/demo_gauss_legendre_lobatto.f90 @@ -1,9 +1,10 @@ program demo_gauss_legendre_lobatto - use iso_fortran_env, dp => real64 - implicit none +use iso_fortran_env, dp => real64 +use stdlib_quadrature, only: gauss_legendre_lobatto +implicit none - integer, parameter :: N = 6 - real(dp), dimension(N) :: x,w - call gauss_legendre_lobatto(x,w) - print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) +integer, parameter :: N = 6 +real(dp), dimension(N) :: x,w +call gauss_legendre_lobatto(x,w) +print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) end program demo_gauss_legendre_lobatto diff --git a/test/example/quadrature/demo_simps.f90 b/test/example/quadrature/demo_simps.f90 index 21303c577..f2ee73573 100644 --- a/test/example/quadrature/demo_simps.f90 +++ b/test/example/quadrature/demo_simps.f90 @@ -1,7 +1,7 @@ program demo_simps use stdlib_quadrature, only: simps implicit none -real :: x(5) = [0., 1., 2., 3., 4.] +real, parameter :: x(5) = [0., 1., 2., 3., 4.] real :: y(5) = 3.*x**2 print *, simps(y, x) ! 64.0 diff --git a/test/example/quadrature/demo_simps_weights.f90 b/test/example/quadrature/demo_simps_weights.f90 index 264ff9757..5d94a893b 100644 --- a/test/example/quadrature/demo_simps_weights.f90 +++ b/test/example/quadrature/demo_simps_weights.f90 @@ -1,7 +1,7 @@ program demo_simps_weights use stdlib_quadrature, only: simps_weights implicit none -real :: x(5) = [0., 1., 2., 3., 4.] +real, parameter :: x(5) = [0., 1., 2., 3., 4.] real :: y(5) = 3.*x**2 real :: w(5) w = simps_weights(x) diff --git a/test/example/quadrature/demo_trapz.f90 b/test/example/quadrature/demo_trapz.f90 index dc08cdf5f..3997f696f 100644 --- a/test/example/quadrature/demo_trapz.f90 +++ b/test/example/quadrature/demo_trapz.f90 @@ -1,7 +1,7 @@ program demo_trapz use stdlib_quadrature, only: trapz implicit none -real :: x(5) = [0., 1., 2., 3., 4.] +real, parameter :: x(5) = [0., 1., 2., 3., 4.] real :: y(5) = x**2 print *, trapz(y, x) ! 22.0 diff --git a/test/example/quadrature/demo_trapz_weights.f90 b/test/example/quadrature/demo_trapz_weights.f90 index eff0a0f9c..73a9e993a 100644 --- a/test/example/quadrature/demo_trapz_weights.f90 +++ b/test/example/quadrature/demo_trapz_weights.f90 @@ -1,7 +1,7 @@ program demo_trapz_weights use stdlib_quadrature, only: trapz_weights implicit none -real :: x(5) = [0., 1., 2., 3., 4.] +real, parameter :: x(5) = [0., 1., 2., 3., 4.] real :: y(5) = x**2 real :: w(5) w = trapz_weights(x) diff --git a/test/example/random/CMakeLists.txt b/test/example/random/CMakeLists.txt new file mode 100644 index 000000000..cf2dd6de1 --- /dev/null +++ b/test/example/random/CMakeLists.txt @@ -0,0 +1,2 @@ +ADD_DEMO(dist_rand) +ADD_DEMO(random_seed) diff --git a/test/example/random/demo_dist_rand.f90 b/test/example/random/demo_dist_rand.f90 index 9d2dfa962..09fab8825 100644 --- a/test/example/random/demo_dist_rand.f90 +++ b/test/example/random/demo_dist_rand.f90 @@ -1,4 +1,5 @@ program demo_dist_rand +use stdlib_kinds, only: int8, int16, int32, int64 use stdlib_random, only : dist_rand, random_seed implicit none integer :: put, get diff --git a/test/example/selection/CMakeLists.txt b/test/example/selection/CMakeLists.txt new file mode 100644 index 000000000..915b85c5d --- /dev/null +++ b/test/example/selection/CMakeLists.txt @@ -0,0 +1,2 @@ +ADD_DEMO(arg_select) +ADD_DEMO(select) diff --git a/test/example/sorting/CMakeLists.txt b/test/example/sorting/CMakeLists.txt new file mode 100644 index 000000000..807456c81 --- /dev/null +++ b/test/example/sorting/CMakeLists.txt @@ -0,0 +1,2 @@ +ADD_DEMO(ord_sort) +ADD_DEMO(sort) diff --git a/test/example/specialfunctions_gamma/CMakeLists.txt b/test/example/specialfunctions_gamma/CMakeLists.txt new file mode 100644 index 000000000..8c4091b9d --- /dev/null +++ b/test/example/specialfunctions_gamma/CMakeLists.txt @@ -0,0 +1,7 @@ +ADD_DEMO(gamma) +ADD_DEMO(gamma_p) +ADD_DEMO(gamma_q) +ADD_DEMO(ligamma) +ADD_DEMO(log_factorial) +ADD_DEMO(log_gamma) +ADD_DEMO(uigamma) diff --git a/test/example/specialfunctions_gamma/demo_ligamma.f90 b/test/example/specialfunctions_gamma/demo_ligamma.f90 index b3de02fad..1ba48c372 100644 --- a/test/example/specialfunctions_gamma/demo_ligamma.f90 +++ b/test/example/specialfunctions_gamma/demo_ligamma.f90 @@ -13,4 +13,4 @@ program demo_ligamma print *, lig(p1, 5.0) ! 1.09715652 -end demo_ligamma +end program demo_ligamma diff --git a/test/example/stats/CMakeLists.txt b/test/example/stats/CMakeLists.txt new file mode 100644 index 000000000..862f883af --- /dev/null +++ b/test/example/stats/CMakeLists.txt @@ -0,0 +1,6 @@ +ADD_DEMO(corr) +ADD_DEMO(cov) +ADD_DEMO(mean) +ADD_DEMO(median) +ADD_DEMO(moment) +ADD_DEMO(var) diff --git a/test/example/stats_distribution_exponential/CMakeLists.txt b/test/example/stats_distribution_exponential/CMakeLists.txt new file mode 100644 index 000000000..b2cf48649 --- /dev/null +++ b/test/example/stats_distribution_exponential/CMakeLists.txt @@ -0,0 +1,3 @@ +ADD_DEMO(exponential_cdf) +ADD_DEMO(exponential_pdf) +ADD_DEMO(exponential_rvs) diff --git a/test/example/stats_distribution_normal/CMakeLists.txt b/test/example/stats_distribution_normal/CMakeLists.txt new file mode 100644 index 000000000..897147e24 --- /dev/null +++ b/test/example/stats_distribution_normal/CMakeLists.txt @@ -0,0 +1,3 @@ +ADD_DEMO(normal_pdf) +#ADD_DEMO(normal_rvs) +ADD_DEMO(norm_cdf) diff --git a/test/example/stats_distribution_normal/demo_norm_cdf.f90 b/test/example/stats_distribution_normal/demo_norm_cdf.f90 index ccbb8ed1d..207e01c7a 100644 --- a/test/example/stats_distribution_normal/demo_norm_cdf.f90 +++ b/test/example/stats_distribution_normal/demo_norm_cdf.f90 @@ -5,7 +5,7 @@ program demo_norm_cdf implicit none real :: x(2,3,4),a(2,3,4),b(2,3,4) -complx :: loc, scale +complex :: loc, scale integer :: seed_put, seed_get seed_put = 1234567 diff --git a/test/example/stats_distribution_normal/demo_normal_pdf.f90 b/test/example/stats_distribution_normal/demo_normal_pdf.f90 index ee2ce372a..942a26e17 100644 --- a/test/example/stats_distribution_normal/demo_normal_pdf.f90 +++ b/test/example/stats_distribution_normal/demo_normal_pdf.f90 @@ -5,7 +5,7 @@ program demo_normal_pdf implicit none real :: x(3,4,5),a(3,4,5),b(3,4,5) -complx :: loc, scale +complex :: loc, scale integer :: seed_put, seed_get seed_put = 1234567 diff --git a/test/example/stats_distribution_normal/demo_normal_rvs.f90 b/test/example/stats_distribution_normal/demo_normal_rvs.f90 index bd044ff0e..685e5adf8 100644 --- a/test/example/stats_distribution_normal/demo_normal_rvs.f90 +++ b/test/example/stats_distribution_normal/demo_normal_rvs.f90 @@ -4,7 +4,7 @@ program demo_normal_rvs implicit none real :: a(2,3,4), b(2,3,4) -complx :: loc, scale +complex :: loc, scale integer :: seed_put, seed_get seed_put = 1234567 diff --git a/test/example/stats_distribution_uniform/CMakeLists.txt b/test/example/stats_distribution_uniform/CMakeLists.txt new file mode 100644 index 000000000..aae94c934 --- /dev/null +++ b/test/example/stats_distribution_uniform/CMakeLists.txt @@ -0,0 +1,4 @@ +ADD_DEMO(shuffle) +ADD_DEMO(uniform_cdf) +ADD_DEMO(uniform_pdf) +ADD_DEMO(uniform_rvs) diff --git a/test/example/string_type/CMakeLists.txt b/test/example/string_type/CMakeLists.txt new file mode 100644 index 000000000..1b6c3f4a7 --- /dev/null +++ b/test/example/string_type/CMakeLists.txt @@ -0,0 +1,40 @@ +ADD_DEMO(adjustl) +ADD_DEMO(adjustr) +ADD_DEMO(char) +ADD_DEMO(char_position) +ADD_DEMO(char_range) +ADD_DEMO(constructor_character) +ADD_DEMO(constructor_empty) +ADD_DEMO(constructor_integer) +ADD_DEMO(constructor_logical) +ADD_DEMO(constructor_scalar) +ADD_DEMO(cont) +ADD_DEMO(eq) +ADD_DEMO(fread) +ADD_DEMO(fwrite) +ADD_DEMO(ge) +ADD_DEMO(gt) +ADD_DEMO(iachar) +ADD_DEMO(ichar) +ADD_DEMO(index) +ADD_DEMO(le) +ADD_DEMO(len) +ADD_DEMO(len_trim) +ADD_DEMO(lge) +ADD_DEMO(lgt) +ADD_DEMO(lle) +ADD_DEMO(llt) +ADD_DEMO(lt) +ADD_DEMO(move) +ADD_DEMO(ne) +ADD_DEMO(repeat) +ADD_DEMO(reverse) +ADD_DEMO(scan) +ADD_DEMO(to_lower) +ADD_DEMO(to_sentence) +ADD_DEMO(to_title) +ADD_DEMO(to_upper) +ADD_DEMO(trim) +ADD_DEMO(uread) +ADD_DEMO(uwrite) +ADD_DEMO(verify) diff --git a/test/example/stringlist_type/CMakeLists.txt b/test/example/stringlist_type/CMakeLists.txt new file mode 100644 index 000000000..52c3f9a70 --- /dev/null +++ b/test/example/stringlist_type/CMakeLists.txt @@ -0,0 +1,9 @@ +ADD_DEMO(stringlist_type_clear) +ADD_DEMO(stringlist_type_concatenate_operator) +ADD_DEMO(stringlist_type_constructor) +ADD_DEMO(stringlist_type_equality_operator) +ADD_DEMO(stringlist_type_fidx_bidx) +ADD_DEMO(stringlist_type_get) +ADD_DEMO(stringlist_type_inequality_operator) +ADD_DEMO(stringlist_type_insert_at) +ADD_DEMO(stringlist_type_len) diff --git a/test/example/stringlist_type/demo_clear.f90 b/test/example/stringlist_type/demo_stringlist_type_clear.f90 similarity index 100% rename from test/example/stringlist_type/demo_clear.f90 rename to test/example/stringlist_type/demo_stringlist_type_clear.f90 diff --git a/test/example/stringlist_type/demo_concatenate_operator.f90 b/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 similarity index 100% rename from test/example/stringlist_type/demo_concatenate_operator.f90 rename to test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 diff --git a/test/example/stringlist_type/demo_constructor.f90 b/test/example/stringlist_type/demo_stringlist_type_constructor.f90 similarity index 100% rename from test/example/stringlist_type/demo_constructor.f90 rename to test/example/stringlist_type/demo_stringlist_type_constructor.f90 diff --git a/test/example/stringlist_type/demo_equality_operator.f90 b/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 similarity index 100% rename from test/example/stringlist_type/demo_equality_operator.f90 rename to test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 diff --git a/test/example/stringlist_type/demo_fidx_bidx.f90 b/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 similarity index 100% rename from test/example/stringlist_type/demo_fidx_bidx.f90 rename to test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 diff --git a/test/example/stringlist_type/demo_get.f90 b/test/example/stringlist_type/demo_stringlist_type_get.f90 similarity index 100% rename from test/example/stringlist_type/demo_get.f90 rename to test/example/stringlist_type/demo_stringlist_type_get.f90 diff --git a/test/example/stringlist_type/demo_inequality_operator.f90 b/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 similarity index 100% rename from test/example/stringlist_type/demo_inequality_operator.f90 rename to test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 diff --git a/test/example/stringlist_type/demo_insert_at.f90 b/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 similarity index 100% rename from test/example/stringlist_type/demo_insert_at.f90 rename to test/example/stringlist_type/demo_stringlist_type_insert_at.f90 diff --git a/test/example/stringlist_type/demo_len.f90 b/test/example/stringlist_type/demo_stringlist_type_len.f90 similarity index 100% rename from test/example/stringlist_type/demo_len.f90 rename to test/example/stringlist_type/demo_stringlist_type_len.f90 diff --git a/test/example/strings/CMakeLists.txt b/test/example/strings/CMakeLists.txt new file mode 100644 index 000000000..f3ae32b45 --- /dev/null +++ b/test/example/strings/CMakeLists.txt @@ -0,0 +1,11 @@ +ADD_DEMO(chomp) +ADD_DEMO(count) +ADD_DEMO(ends_with) +ADD_DEMO(find) +#ADD_DEMO(padl) +#ADD_DEMO(padr) +#ADD_DEMO(replace_all) +ADD_DEMO(slice) +ADD_DEMO(starts_with) +ADD_DEMO(strip) +ADD_DEMO(to_string) diff --git a/test/example/strings/demo_slice.f90 b/test/example/strings/demo_slice.f90 index c3c3af269..faea992f8 100644 --- a/test/example/strings/demo_slice.f90 +++ b/test/example/strings/demo_slice.f90 @@ -3,16 +3,16 @@ program demo_slice use stdlib_strings, only : slice implicit none type(string_type) :: string -character(len=10) :: char +character(len=10) :: chars string = "abcdefghij" ! string <-- "abcdefghij" -char = "abcdefghij" -! char <-- "abcdefghij" +chars = "abcdefghij" +! chars <-- "abcdefghij" print'(a)', slice("abcdefghij", 2, 6, 2) ! "bdf" -print'(a)', slice(char, 2, 6, 2) ! "bdf" +print'(a)', slice(chars, 2, 6, 2) ! "bdf" string = slice(string, 2, 6, 2) ! string <-- "bdf" diff --git a/test/example/version/CMakeLists.txt b/test/example/version/CMakeLists.txt new file mode 100644 index 000000000..4daa4252d --- /dev/null +++ b/test/example/version/CMakeLists.txt @@ -0,0 +1 @@ +ADD_DEMO(version) From 6e75462559cc592ed93db565943c9945af243e44 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 21 Jun 2022 12:01:36 +0200 Subject: [PATCH 05/38] fix issue hashmap_wrappers --- src/stdlib_hashmap_wrappers.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stdlib_hashmap_wrappers.f90 b/src/stdlib_hashmap_wrappers.f90 index 67b13b96e..a2a8b93d2 100755 --- a/src/stdlib_hashmap_wrappers.f90 +++ b/src/stdlib_hashmap_wrappers.f90 @@ -87,7 +87,8 @@ end function hasher_fun interface get module procedure get_char_key, & - get_int8_key + get_int8_key, & + get_other end interface get From f93dc4a52a6c3e27e03d1e87766fb82ca0f626e5 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 21 Jun 2022 12:23:54 +0200 Subject: [PATCH 06/38] add examples in fpm --- ci/fpm-deployment.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/fpm-deployment.sh b/ci/fpm-deployment.sh index 8d80c24f6..74ddeedb3 100644 --- a/ci/fpm-deployment.sh +++ b/ci/fpm-deployment.sh @@ -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" \ @@ -49,6 +49,7 @@ find src -maxdepth 1 -iname "*.fypp" \ find src -maxdepth 1 -iname "*.f90" -exec cp {} "$destdir/src/" \; find src/tests -name "test_*.f90" -exec cp {} "$destdir/test/" \; find src/tests -name "*.dat" -exec cp {} "$destdir/" \; +find test/example -name "demo_*.f90" -exec cp {} "$destdir/example/" \; # Include additional files cp "${include[@]}" "$destdir/" From 7bebf15c467c32105a00da8da22ba934c5449ae4 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 21 Jun 2022 13:49:55 +0200 Subject: [PATCH 07/38] formatting --- test/example/array/demo_falseloc.f90 | 12 +- test/example/array/demo_trueloc.f90 | 12 +- test/example/ascii/demo_ascii_reverse.f90 | 6 +- test/example/ascii/demo_ascii_to_lower.f90 | 6 +- test/example/ascii/demo_ascii_to_sentence.f90 | 10 +- test/example/ascii/demo_ascii_to_title.f90 | 10 +- test/example/ascii/demo_ascii_to_upper.f90 | 6 +- test/example/bitsets/demo_bitsets_all.f90 | 24 ++-- test/example/bitsets/demo_bitsets_and.f90 | 30 ++--- test/example/bitsets/demo_bitsets_and_not.f90 | 32 ++--- test/example/bitsets/demo_bitsets_any.f90 | 26 ++-- .../bitsets/demo_bitsets_assignment.f90 | 48 ++++---- .../bitsets/demo_bitsets_bit_count.f90 | 26 ++-- test/example/bitsets/demo_bitsets_bits.f90 | 18 +-- test/example/bitsets/demo_bitsets_clear.f90 | 18 +-- .../example/bitsets/demo_bitsets_equality.f90 | 28 ++--- test/example/bitsets/demo_bitsets_extract.f90 | 16 +-- test/example/bitsets/demo_bitsets_flip.f90 | 16 +-- .../bitsets/demo_bitsets_from_string.f90 | 30 ++--- test/example/bitsets/demo_bitsets_ge.f90 | 30 ++--- test/example/bitsets/demo_bitsets_gt.f90 | 28 ++--- .../bitsets/demo_bitsets_inequality.f90 | 28 ++--- test/example/bitsets/demo_bitsets_init.f90 | 12 +- test/example/bitsets/demo_bitsets_input.f90 | 60 ++++----- test/example/bitsets/demo_bitsets_le.f90 | 30 ++--- test/example/bitsets/demo_bitsets_lt.f90 | 28 ++--- test/example/bitsets/demo_bitsets_none.f90 | 26 ++-- test/example/bitsets/demo_bitsets_not.f90 | 22 ++-- test/example/bitsets/demo_bitsets_or.f90 | 32 ++--- test/example/bitsets/demo_bitsets_output.f90 | 60 ++++----- .../bitsets/demo_bitsets_read_bitset.f90 | 66 +++++----- test/example/bitsets/demo_bitsets_set.f90 | 16 +-- test/example/bitsets/demo_bitsets_test.f90 | 18 +-- .../bitsets/demo_bitsets_to_string.f90 | 24 ++-- test/example/bitsets/demo_bitsets_value.f90 | 18 +-- .../bitsets/demo_bitsets_write_bitset.f90 | 66 +++++----- test/example/bitsets/demo_bitsets_xor.f90 | 32 ++--- test/example/error/demo_check1.f90 | 8 +- test/example/error/demo_check2.f90 | 8 +- test/example/error/demo_check3.f90 | 8 +- test/example/error/demo_check4.f90 | 8 +- test/example/error/demo_error_stop1.f90 | 6 +- test/example/error/demo_error_stop2.f90 | 6 +- .../hash_procedures/demo_fibonacci_hash.f90 | 22 ++-- .../demo_fibonacci_hash_64.f90 | 22 ++-- .../hash_procedures/demo_fnv_1_hash.f90 | 12 +- .../hash_procedures/demo_fnv_1_hash_64.f90 | 16 +-- .../hash_procedures/demo_fnv_1a_hash.f90 | 12 +- .../hash_procedures/demo_fnv_1a_hash_64.f90 | 16 +-- .../example/hash_procedures/demo_nmhash32.f90 | 18 +-- .../hash_procedures/demo_nmhash32x.f90 | 18 +-- .../hash_procedures/demo_pengy_hash.f90 | 22 ++-- .../hash_procedures/demo_spooky_hash.f90 | 22 ++-- .../demo_universal_mult_hash.f90 | 32 ++--- .../demo_universal_mult_hash_64.f90 | 28 ++--- .../hash_procedures/demo_water_hash.f90 | 18 +-- test/example/hashmaps/demo_hashmaps_calls.f90 | 16 +-- .../hashmaps/demo_hashmaps_copy_key.f90 | 20 +-- .../hashmaps/demo_hashmaps_copy_other.f90 | 42 +++---- .../hashmaps/demo_hashmaps_entries.f90 | 16 +-- .../hashmaps/demo_hashmaps_equal_keys.f90 | 24 ++-- .../hashmaps/demo_hashmaps_fnv_1_hasher.f90 | 20 +-- .../hashmaps/demo_hashmaps_fnv_1a_hasher.f90 | 22 ++-- .../hashmaps/demo_hashmaps_free_key.f90 | 20 +-- .../hashmaps/demo_hashmaps_free_other.f90 | 32 ++--- test/example/hashmaps/demo_hashmaps_get.f90 | 28 ++--- .../hashmaps/demo_hashmaps_get_other_data.f90 | 60 ++++----- .../hashmaps/demo_hashmaps_hasher_fun.f90 | 24 ++-- test/example/hashmaps/demo_hashmaps_init.f90 | 10 +- .../hashmaps/demo_hashmaps_key_test.f90 | 22 ++-- .../hashmaps/demo_hashmaps_loading.f90 | 16 +-- .../hashmaps/demo_hashmaps_map_entry.f90 | 28 ++--- .../hashmaps/demo_hashmaps_num_slots.f90 | 16 +-- .../example/hashmaps/demo_hashmaps_probes.f90 | 16 +-- .../example/hashmaps/demo_hashmaps_rehash.f90 | 30 ++--- .../example/hashmaps/demo_hashmaps_remove.f90 | 32 ++--- .../demo_hashmaps_seeded_nmhash32_hasher.f90 | 22 ++-- .../demo_hashmaps_seeded_nmhash32x_hasher.f90 | 22 ++-- .../demo_hashmaps_seeded_water_hasher.f90 | 22 ++-- test/example/hashmaps/demo_hashmaps_set.f90 | 28 ++--- .../hashmaps/demo_hashmaps_set_other_data.f90 | 40 +++--- .../hashmaps/demo_hashmaps_slots_bits.f90 | 16 +-- .../hashmaps/demo_hashmaps_total_depth.f90 | 16 +-- test/example/io/demo_fmt_constants.f90 | 40 +++--- test/example/io/demo_getline.f90 | 20 +-- test/example/io/demo_loadnpy.f90 | 8 +- test/example/io/demo_loadtxt.f90 | 8 +- test/example/io/demo_open.f90 | 12 +- test/example/io/demo_savenpy.f90 | 8 +- test/example/io/demo_savetxt.f90 | 8 +- test/example/linalg/demo_diag1.f90 | 10 +- test/example/linalg/demo_diag2.f90 | 14 +-- test/example/linalg/demo_diag3.f90 | 18 +-- test/example/linalg/demo_diag4.f90 | 16 +-- test/example/linalg/demo_diag5.f90 | 18 +-- test/example/linalg/demo_eye1.f90 | 24 ++-- test/example/linalg/demo_eye2.f90 | 6 +- test/example/linalg/demo_is_diagonal.f90 | 16 +-- test/example/linalg/demo_is_hermitian.f90 | 16 +-- test/example/linalg/demo_is_hessenberg.f90 | 16 +-- .../example/linalg/demo_is_skew_symmetric.f90 | 16 +-- test/example/linalg/demo_is_square.f90 | 16 +-- test/example/linalg/demo_is_symmetric.f90 | 16 +-- test/example/linalg/demo_is_triangular.f90 | 16 +-- test/example/linalg/demo_outer_product.f90 | 12 +- test/example/linalg/demo_trace.f90 | 10 +- test/example/logger/demo_add_log_unit.f90 | 24 ++-- test/example/logger/demo_configure.f90 | 4 +- test/example/logger/demo_global_logger.f90 | 14 +-- test/example/logger/demo_log_io_error.f90 | 30 ++--- test/example/logger/demo_log_text_error.f90 | 36 +++--- test/example/math/demo_clip_integer.f90 | 22 ++-- test/example/math/demo_clip_real.f90 | 22 ++-- test/example/math/demo_diff.f90 | 28 ++--- test/example/math/demo_gcd.f90 | 12 +- test/example/math/demo_linspace_complex.f90 | 14 +-- test/example/math/demo_linspace_int16.f90 | 14 +-- test/example/math/demo_logspace_complex.f90 | 14 +-- test/example/math/demo_logspace_int.f90 | 16 +-- .../math/demo_logspace_rstart_cbase.f90 | 18 +-- test/example/math/demo_math_all_close.f90 | 16 +-- test/example/math/demo_math_arange.f90 | 24 ++-- test/example/math/demo_math_arg.f90 | 10 +- test/example/math/demo_math_argd.f90 | 10 +- test/example/math/demo_math_argpi.f90 | 10 +- test/example/math/demo_math_is_close.f90 | 16 +-- test/example/optval/demo_optval.f90 | 18 +-- .../quadrature/demo_gauss_legendre.f90 | 14 +-- .../demo_gauss_legendre_lobatto.f90 | 14 +-- test/example/quadrature/demo_simps.f90 | 12 +- .../example/quadrature/demo_simps_weights.f90 | 14 +-- test/example/quadrature/demo_trapz.f90 | 12 +- .../example/quadrature/demo_trapz_weights.f90 | 14 +-- test/example/random/demo_dist_rand.f90 | 20 +-- test/example/random/demo_random_seed.f90 | 10 +- test/example/selection/demo_arg_select.f90 | 34 ++--- test/example/selection/demo_select.f90 | 30 ++--- test/example/selection/selection_vs_sort.f90 | 116 +++++++++--------- test/example/sorting/demo_ord_sort.f90 | 14 +-- test/example/sorting/demo_sort.f90 | 12 +- .../specialfunctions_gamma/demo_gamma.f90 | 48 ++++---- .../specialfunctions_gamma/demo_gamma_p.f90 | 6 +- .../specialfunctions_gamma/demo_gamma_q.f90 | 6 +- .../specialfunctions_gamma/demo_ligamma.f90 | 16 +-- .../demo_log_factorial.f90 | 14 +-- .../specialfunctions_gamma/demo_log_gamma.f90 | 40 +++--- .../specialfunctions_gamma/demo_uigamma.f90 | 8 +- test/example/stats/demo_corr.f90 | 12 +- test/example/stats/demo_cov.f90 | 14 +-- test/example/stats/demo_mean.f90 | 16 +-- test/example/stats/demo_median.f90 | 16 +-- test/example/stats/demo_moment.f90 | 20 +-- test/example/stats/demo_var.f90 | 20 +-- .../demo_exponential_cdf.f90 | 32 ++--- .../demo_exponential_pdf.f90 | 32 ++--- .../demo_exponential_rvs.f90 | 26 ++-- .../demo_norm_cdf.f90 | 38 +++--- .../demo_normal_pdf.f90 | 38 +++--- .../demo_normal_rvs.f90 | 36 +++--- .../demo_shuffle.f90 | 34 ++--- .../demo_uniform_cdf.f90 | 38 +++--- .../demo_uniform_pdf.f90 | 39 +++--- .../demo_uniform_rvs.f90 | 46 +++---- test/example/string_type/demo_adjustl.f90 | 10 +- test/example/string_type/demo_adjustr.f90 | 10 +- test/example/string_type/demo_char.f90 | 12 +- .../string_type/demo_char_position.f90 | 16 +-- test/example/string_type/demo_char_range.f90 | 12 +- .../demo_constructor_character.f90 | 8 +- .../string_type/demo_constructor_empty.f90 | 8 +- .../string_type/demo_constructor_integer.f90 | 10 +- .../string_type/demo_constructor_logical.f90 | 10 +- .../string_type/demo_constructor_scalar.f90 | 10 +- test/example/string_type/demo_cont.f90 | 10 +- test/example/string_type/demo_eq.f90 | 16 +-- test/example/string_type/demo_fread.f90 | 22 ++-- test/example/string_type/demo_fwrite.f90 | 22 ++-- test/example/string_type/demo_ge.f90 | 16 +-- test/example/string_type/demo_gt.f90 | 16 +-- test/example/string_type/demo_iachar.f90 | 12 +- test/example/string_type/demo_ichar.f90 | 12 +- test/example/string_type/demo_index.f90 | 16 +-- test/example/string_type/demo_le.f90 | 16 +-- test/example/string_type/demo_len.f90 | 16 +-- test/example/string_type/demo_len_trim.f90 | 16 +-- test/example/string_type/demo_lge.f90 | 16 +-- test/example/string_type/demo_lgt.f90 | 16 +-- test/example/string_type/demo_lle.f90 | 16 +-- test/example/string_type/demo_llt.f90 | 16 +-- test/example/string_type/demo_lt.f90 | 16 +-- test/example/string_type/demo_move.f90 | 16 +-- test/example/string_type/demo_ne.f90 | 16 +-- test/example/string_type/demo_repeat.f90 | 10 +- test/example/string_type/demo_reverse.f90 | 10 +- test/example/string_type/demo_scan.f90 | 16 +-- test/example/string_type/demo_to_lower.f90 | 10 +- test/example/string_type/demo_to_sentence.f90 | 10 +- test/example/string_type/demo_to_title.f90 | 10 +- test/example/string_type/demo_to_upper.f90 | 10 +- test/example/string_type/demo_trim.f90 | 10 +- test/example/string_type/demo_uread.f90 | 20 +-- test/example/string_type/demo_uwrite.f90 | 20 +-- test/example/string_type/demo_verify.f90 | 20 +-- .../demo_stringlist_type_clear.f90 | 14 +-- ...o_stringlist_type_concatenate_operator.f90 | 22 ++-- .../demo_stringlist_type_constructor.f90 | 14 +-- ...demo_stringlist_type_equality_operator.f90 | 28 ++--- .../demo_stringlist_type_fidx_bidx.f90 | 10 +- .../demo_stringlist_type_get.f90 | 26 ++-- ...mo_stringlist_type_inequality_operator.f90 | 28 ++--- .../demo_stringlist_type_insert_at.f90 | 22 ++-- .../demo_stringlist_type_len.f90 | 16 +-- test/example/strings/demo_chomp.f90 | 24 ++-- test/example/strings/demo_count.f90 | 16 +-- test/example/strings/demo_ends_with.f90 | 8 +- test/example/strings/demo_find.f90 | 16 +-- test/example/strings/demo_padl.f90 | 14 +-- test/example/strings/demo_padr.f90 | 14 +-- test/example/strings/demo_replace_all.f90 | 14 +-- test/example/strings/demo_slice.f90 | 20 +-- test/example/strings/demo_starts_with.f90 | 8 +- test/example/strings/demo_strip.f90 | 16 +-- test/example/strings/demo_to_string.f90 | 30 ++--- test/example/version/demo_version.f90 | 10 +- 224 files changed, 2241 insertions(+), 2242 deletions(-) diff --git a/test/example/array/demo_falseloc.f90 b/test/example/array/demo_falseloc.f90 index c004ef160..c2ed1788a 100644 --- a/test/example/array/demo_falseloc.f90 +++ b/test/example/array/demo_falseloc.f90 @@ -1,8 +1,8 @@ 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 + 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 diff --git a/test/example/array/demo_trueloc.f90 b/test/example/array/demo_trueloc.f90 index b54752a48..1a57d6415 100644 --- a/test/example/array/demo_trueloc.f90 +++ b/test/example/array/demo_trueloc.f90 @@ -1,8 +1,8 @@ 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 + 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 diff --git a/test/example/ascii/demo_ascii_reverse.f90 b/test/example/ascii/demo_ascii_reverse.f90 index d6c240927..f9a119a1b 100644 --- a/test/example/ascii/demo_ascii_reverse.f90 +++ b/test/example/ascii/demo_ascii_reverse.f90 @@ -1,5 +1,5 @@ program demo_reverse -use stdlib_ascii, only : reverse -implicit none -print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH" + use stdlib_ascii, only: reverse + implicit none + print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH" end program demo_reverse diff --git a/test/example/ascii/demo_ascii_to_lower.f90 b/test/example/ascii/demo_ascii_to_lower.f90 index 49caec3cf..23e21bc9b 100644 --- a/test/example/ascii/demo_ascii_to_lower.f90 +++ b/test/example/ascii/demo_ascii_to_lower.f90 @@ -1,5 +1,5 @@ program demo_to_lower -use stdlib_ascii, only : to_lower -implicit none -print'(a)', to_lower("HELLo!") ! returns "hello!" + use stdlib_ascii, only: to_lower + implicit none + print'(a)', to_lower("HELLo!") ! returns "hello!" end program demo_to_lower diff --git a/test/example/ascii/demo_ascii_to_sentence.f90 b/test/example/ascii/demo_ascii_to_sentence.f90 index e015615b9..cee15bdd0 100644 --- a/test/example/ascii/demo_ascii_to_sentence.f90 +++ b/test/example/ascii/demo_ascii_to_sentence.f90 @@ -1,7 +1,7 @@ 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" + 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 diff --git a/test/example/ascii/demo_ascii_to_title.f90 b/test/example/ascii/demo_ascii_to_title.f90 index 630d835da..e93b672f4 100644 --- a/test/example/ascii/demo_ascii_to_title.f90 +++ b/test/example/ascii/demo_ascii_to_title.f90 @@ -1,7 +1,7 @@ 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" + 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 diff --git a/test/example/ascii/demo_ascii_to_upper.f90 b/test/example/ascii/demo_ascii_to_upper.f90 index 0e34ace77..734387fae 100644 --- a/test/example/ascii/demo_ascii_to_upper.f90 +++ b/test/example/ascii/demo_ascii_to_upper.f90 @@ -1,5 +1,5 @@ program demo_to_upper -use stdlib_ascii, only : to_upper -implicit none -print'(a)', to_upper("hello!") ! returns "HELLO!" + use stdlib_ascii, only: to_upper + implicit none + print'(a)', to_upper("hello!") ! returns "HELLO!" end program demo_to_upper diff --git a/test/example/bitsets/demo_bitsets_all.f90 b/test/example/bitsets/demo_bitsets_all.f90 index d26564367..49769f007 100644 --- a/test/example/bitsets/demo_bitsets_all.f90 +++ b/test/example/bitsets/demo_bitsets_all.f90 @@ -1,14 +1,14 @@ program demo_all -use stdlib_bitsets -character(*), parameter :: & -bits_all = '111111111111111111111111111111111' -type(bitset_64) :: set0 -call set0 % from_string( bits_all ) -if ( .not. set0 % all() ) then -error stop "FROM_STRING failed to interpret" // & -"BITS_ALL's value properly." -else -write(*,*) "FROM_STRING transferred BITS_ALL properly" // & -" into set0." -end if + use stdlib_bitsets + character(*), parameter :: & + bits_all = '111111111111111111111111111111111' + type(bitset_64) :: set0 + call set0%from_string(bits_all) + if (.not. set0%all()) then + error stop "FROM_STRING failed to interpret"// & + "BITS_ALL's value properly." + else + write (*, *) "FROM_STRING transferred BITS_ALL properly"// & + " into set0." + end if end program demo_all diff --git a/test/example/bitsets/demo_bitsets_and.f90 b/test/example/bitsets/demo_bitsets_and.f90 index 351fb8e3c..c848be5f9 100644 --- a/test/example/bitsets/demo_bitsets_and.f90 +++ b/test/example/bitsets/demo_bitsets_and.f90 @@ -1,17 +1,17 @@ program demo_and -use stdlib_bitsets -type(bitset_large) :: set0, set1 -call set0 % init(166) -call set1 % init(166) -call and( set0, set1 ) ! none none -if ( set0 % none() ) write(*,*) 'First test of AND worked.' -call set0 % not() -call and( set0, set1 ) ! all none -if ( set0 % none() ) write(*,*) 'Second test of AND worked.' -call set1 % not() -call and( set0, set1 ) ! none all -if ( set0 % none() ) write(*,*) 'Third test of AND worked.' -call set0 % not() -call and( set0, set1 ) ! all all -if ( set0 % all() ) write(*,*) 'Fourth test of AND worked.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set1%init(166) + call and(set0, set1) ! none none + if (set0%none()) write (*, *) 'First test of AND worked.' + call set0%not() + call and(set0, set1) ! all none + if (set0%none()) write (*, *) 'Second test of AND worked.' + call set1%not() + call and(set0, set1) ! none all + if (set0%none()) write (*, *) 'Third test of AND worked.' + call set0%not() + call and(set0, set1) ! all all + if (set0%all()) write (*, *) 'Fourth test of AND worked.' end program demo_and diff --git a/test/example/bitsets/demo_bitsets_and_not.f90 b/test/example/bitsets/demo_bitsets_and_not.f90 index 199db2996..042da308c 100644 --- a/test/example/bitsets/demo_bitsets_and_not.f90 +++ b/test/example/bitsets/demo_bitsets_and_not.f90 @@ -1,18 +1,18 @@ program demo_and_not -use stdlib_bitsets -type(bitset_large) :: set0, set1 -call set0 % init(166) -call set1 % init(166) -call and_not( set0, set1 ) ! none none -if ( set0 % none() ) write(*,*) 'First test of AND_NOT worked.' -call set0 % not() -call and_not( set0, set1 ) ! all none -if ( set0 % all() ) write(*,*) 'Second test of AND_NOT worked.' -call set0 % not() -call set1 % not() -call and_not( set0, set1 ) ! none all -if ( set0 % none() ) write(*,*) 'Third test of AND_NOT worked.' -call set0 % not() -call and_not( set0, set1 ) ! all all -if ( set0 % none() ) write(*,*) 'Fourth test of AND_NOT worked.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set1%init(166) + call and_not(set0, set1) ! none none + if (set0%none()) write (*, *) 'First test of AND_NOT worked.' + call set0%not() + call and_not(set0, set1) ! all none + if (set0%all()) write (*, *) 'Second test of AND_NOT worked.' + call set0%not() + call set1%not() + call and_not(set0, set1) ! none all + if (set0%none()) write (*, *) 'Third test of AND_NOT worked.' + call set0%not() + call and_not(set0, set1) ! all all + if (set0%none()) write (*, *) 'Fourth test of AND_NOT worked.' end program demo_and_not diff --git a/test/example/bitsets/demo_bitsets_any.f90 b/test/example/bitsets/demo_bitsets_any.f90 index 9bb61d267..d21eae959 100644 --- a/test/example/bitsets/demo_bitsets_any.f90 +++ b/test/example/bitsets/demo_bitsets_any.f90 @@ -1,15 +1,15 @@ program demo_any -use stdlib_bitsets -character(*), parameter :: & -bits_0 = '0000000000000000000' -type(bitset_64) :: set0 -call set0 % from_string( bits_0 ) -if ( .not. set0 % any() ) then -write(*,*) "FROM_STRING interpreted " // & -"BITS_0's value properly." -end if -call set0 % set(5) -if ( set0 % any() ) then -write(*,*) "ANY interpreted SET0's value properly." -end if + use stdlib_bitsets + character(*), parameter :: & + bits_0 = '0000000000000000000' + type(bitset_64) :: set0 + call set0%from_string(bits_0) + if (.not. set0%any()) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's value properly." + end if + call set0%set(5) + if (set0%any()) then + write (*, *) "ANY interpreted SET0's value properly." + end if end program demo_any diff --git a/test/example/bitsets/demo_bitsets_assignment.f90 b/test/example/bitsets/demo_bitsets_assignment.f90 index 02dbe61e8..bf337742e 100644 --- a/test/example/bitsets/demo_bitsets_assignment.f90 +++ b/test/example/bitsets/demo_bitsets_assignment.f90 @@ -1,26 +1,26 @@ program demo_assignment -use stdlib_bitsets -use stdlib_kinds, only: int8, int32 -implicit none -logical(int8) :: logical1(64) = .true. -logical(int32), allocatable :: logical2(:) -type(bitset_64) :: set0, set1 -set0 = logical1 -if ( set0 % bits() /= 64 ) then -error stop & -' initialization with logical(int8) failed to set' // & -' the right size.' -else if ( .not. set0 % all() ) then -error stop ' initialization with' // & -' logical(int8) failed to set the right values.' -else -write(*,*) 'Initialization with logical(int8) succeeded.' -end if -set1 = set0 -if ( set1 == set0 ) & -write(*,*) 'Initialization by assignment succeeded' -logical2 = set1 -if ( all( logical2 ) ) then -write(*,*) 'Initialization of logical(int32) succeeded.' -end if + use stdlib_bitsets + use stdlib_kinds, only: int8, int32 + implicit none + logical(int8) :: logical1(64) = .true. + logical(int32), allocatable :: logical2(:) + type(bitset_64) :: set0, set1 + set0 = logical1 + if (set0%bits() /= 64) then + error stop & + ' initialization with logical(int8) failed to set'// & + ' the right size.' + else if (.not. set0%all()) then + error stop ' initialization with'// & + ' logical(int8) failed to set the right values.' + else + write (*, *) 'Initialization with logical(int8) succeeded.' + end if + set1 = set0 + if (set1 == set0) & + write (*, *) 'Initialization by assignment succeeded' + logical2 = set1 + if (all(logical2)) then + write (*, *) 'Initialization of logical(int32) succeeded.' + end if end program demo_assignment diff --git a/test/example/bitsets/demo_bitsets_bit_count.f90 b/test/example/bitsets/demo_bitsets_bit_count.f90 index 924285b30..ca720d191 100644 --- a/test/example/bitsets/demo_bitsets_bit_count.f90 +++ b/test/example/bitsets/demo_bitsets_bit_count.f90 @@ -1,15 +1,15 @@ program demo_bit_count -use stdlib_bitsets -character(*), parameter :: & -bits_0 = '0000000000000000000' -type(bitset_64) :: set0 -call set0 % from_string( bits_0 ) -if ( set0 % bit_count() == 0 ) then -write(*,*) "FROM_STRING interpreted " // & -"BITS_0's value properly." -end if -call set0 % set(5) -if ( set0 % bit_count() == 1 ) then -write(*,*) "BIT_COUNT interpreted SET0's value properly." -end if + use stdlib_bitsets + character(*), parameter :: & + bits_0 = '0000000000000000000' + type(bitset_64) :: set0 + call set0%from_string(bits_0) + if (set0%bit_count() == 0) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's value properly." + end if + call set0%set(5) + if (set0%bit_count() == 1) then + write (*, *) "BIT_COUNT interpreted SET0's value properly." + end if end program demo_bit_count diff --git a/test/example/bitsets/demo_bitsets_bits.f90 b/test/example/bitsets/demo_bitsets_bits.f90 index 6491f308d..6c8c02d0f 100644 --- a/test/example/bitsets/demo_bitsets_bits.f90 +++ b/test/example/bitsets/demo_bitsets_bits.f90 @@ -1,11 +1,11 @@ program demo_bits -use stdlib_bitsets -character(*), parameter :: & -bits_0 = '0000000000000000000' -type(bitset_64) :: set0 -call set0 % from_string( bits_0 ) -if ( set0 % bits() == 19 ) then -write(*,*) "FROM_STRING interpreted " // & -"BITS_0's size properly." -end if + use stdlib_bitsets + character(*), parameter :: & + bits_0 = '0000000000000000000' + type(bitset_64) :: set0 + call set0%from_string(bits_0) + if (set0%bits() == 19) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's size properly." + end if end program demo_bits diff --git a/test/example/bitsets/demo_bitsets_clear.f90 b/test/example/bitsets/demo_bitsets_clear.f90 index 51fb53071..4761e30ac 100644 --- a/test/example/bitsets/demo_bitsets_clear.f90 +++ b/test/example/bitsets/demo_bitsets_clear.f90 @@ -1,11 +1,11 @@ program demo_clear -use stdlib_bitsets -type(bitset_large) :: set0 -call set0 % init(166) -call set0 % not() -if ( set0 % all() ) write(*,*) 'SET0 is properly initialized.' -call set0 % clear(165) -if ( .not. set0 % test(165) ) write(*,*) 'Bit 165 is cleared.' -call set0 % clear(0,164) -if ( set0 % none() ) write(*,*) 'All bits are cleared.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + call set0%not() + if (set0%all()) write (*, *) 'SET0 is properly initialized.' + call set0%clear(165) + if (.not. set0%test(165)) write (*, *) 'Bit 165 is cleared.' + call set0%clear(0, 164) + if (set0%none()) write (*, *) 'All bits are cleared.' end program demo_clear diff --git a/test/example/bitsets/demo_bitsets_equality.f90 b/test/example/bitsets/demo_bitsets_equality.f90 index 4e38821b4..889391068 100644 --- a/test/example/bitsets/demo_bitsets_equality.f90 +++ b/test/example/bitsets/demo_bitsets_equality.f90 @@ -1,16 +1,16 @@ program demo_equality -use stdlib_bitsets -type(bitset_64) :: set0, set1, set2 -call set0 % init( 33 ) -call set1 % init( 33 ) -call set2 % init( 33 ) -call set1 % set( 0 ) -call set2 % set( 32 ) -if ( set0 == set0 .and. set1 == set1 .and. set2 == set2 .and. & -.not. set0 == set1 .and. .not. set0 == set2 .and. .not. & -set1 == set2 ) then -write(*,*) 'Passed 64 bit equality tests.' -else -error stop 'Failed 64 bit equality tests.' -end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set0 == set0 .and. set1 == set1 .and. set2 == set2 .and. & + .not. set0 == set1 .and. .not. set0 == set2 .and. .not. & + set1 == set2) then + write (*, *) 'Passed 64 bit equality tests.' + else + error stop 'Failed 64 bit equality tests.' + end if end program demo_equality diff --git a/test/example/bitsets/demo_bitsets_extract.f90 b/test/example/bitsets/demo_bitsets_extract.f90 index f3254ee5b..8e2a7aef2 100644 --- a/test/example/bitsets/demo_bitsets_extract.f90 +++ b/test/example/bitsets/demo_bitsets_extract.f90 @@ -1,10 +1,10 @@ program demo_extract -use stdlib_bitsets -type(bitset_large) :: set0, set1 -call set0 % init(166) -call set0 % set(100,150) -call extract( set1, set0, 100, 150) -if ( set1 % bits() == 51 ) & -write(*,*) 'SET1 has the proper size.' -if ( set1 % all() ) write(*,*) 'SET1 has the proper values.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set0%set(100, 150) + call extract(set1, set0, 100, 150) + if (set1%bits() == 51) & + write (*, *) 'SET1 has the proper size.' + if (set1%all()) write (*, *) 'SET1 has the proper values.' end program demo_extract diff --git a/test/example/bitsets/demo_bitsets_flip.f90 b/test/example/bitsets/demo_bitsets_flip.f90 index bc7fc15f6..c3969b8cb 100644 --- a/test/example/bitsets/demo_bitsets_flip.f90 +++ b/test/example/bitsets/demo_bitsets_flip.f90 @@ -1,10 +1,10 @@ program demo_flip -use stdlib_bitsets -type(bitset_large) :: set0 -call set0 % init(166) -if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' -call set0 % flip(165) -if ( set0 % test(165) ) write(*,*) 'Bit 165 is flipped.' -call set0 % flip(0,164) -if ( set0 % all() ) write(*,*) 'All bits are flipped.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + if (set0%none()) write (*, *) 'SET0 is properly initialized.' + call set0%flip(165) + if (set0%test(165)) write (*, *) 'Bit 165 is flipped.' + call set0%flip(0, 164) + if (set0%all()) write (*, *) 'All bits are flipped.' end program demo_flip diff --git a/test/example/bitsets/demo_bitsets_from_string.f90 b/test/example/bitsets/demo_bitsets_from_string.f90 index 6f2bb8597..29408d819 100644 --- a/test/example/bitsets/demo_bitsets_from_string.f90 +++ b/test/example/bitsets/demo_bitsets_from_string.f90 @@ -1,17 +1,17 @@ program demo_from_string -use stdlib_bitsets -character(*), parameter :: & -bits_all = '111111111111111111111111111111111' -type(bitset_64) :: set0 -call set0 % from_string( bits_all ) -if ( bits(set0) /= 33 ) then -error stop "FROM_STRING failed to interpret " // & -"BITS_ALL's size properly." -else if ( .not. set0 % all() ) then -error stop "FROM_STRING failed to interpret" // & -"BITS_ALL's value properly." -else -write(*,*) "FROM_STRING transferred BITS_ALL properly" // & -" into set0." -end if + use stdlib_bitsets + character(*), parameter :: & + bits_all = '111111111111111111111111111111111' + type(bitset_64) :: set0 + call set0%from_string(bits_all) + if (bits(set0) /= 33) then + error stop "FROM_STRING failed to interpret "// & + "BITS_ALL's size properly." + else if (.not. set0%all()) then + error stop "FROM_STRING failed to interpret"// & + "BITS_ALL's value properly." + else + write (*, *) "FROM_STRING transferred BITS_ALL properly"// & + " into set0." + end if end program demo_from_string diff --git a/test/example/bitsets/demo_bitsets_ge.f90 b/test/example/bitsets/demo_bitsets_ge.f90 index 7b4db041c..e6fd8fbbc 100644 --- a/test/example/bitsets/demo_bitsets_ge.f90 +++ b/test/example/bitsets/demo_bitsets_ge.f90 @@ -1,17 +1,17 @@ program demo_ge -use stdlib_bitsets -type(bitset_64) :: set0, set1, set2 -call set0 % init( 33 ) -call set1 % init( 33 ) -call set2 % init( 33 ) -call set1 % set( 0 ) -call set2 % set( 32 ) -if ( set1 >= set0 .and. set2 >= set1 .and. set2 >= set0 .and. & -set0 >= set0 .and. set1 >= set1 .and. set2 >= set2 .and. & -.not. set0 >= set1 .and. .not. set0 >= set2 .and. .not. & -set1 >= set2 ) then -write(*,*) 'Passed 64 bit greater than or equals tests.' -else -error stop 'Failed 64 bit greater than or equals tests.' -end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set1 >= set0 .and. set2 >= set1 .and. set2 >= set0 .and. & + set0 >= set0 .and. set1 >= set1 .and. set2 >= set2 .and. & + .not. set0 >= set1 .and. .not. set0 >= set2 .and. .not. & + set1 >= set2) then + write (*, *) 'Passed 64 bit greater than or equals tests.' + else + error stop 'Failed 64 bit greater than or equals tests.' + end if end program demo_ge diff --git a/test/example/bitsets/demo_bitsets_gt.f90 b/test/example/bitsets/demo_bitsets_gt.f90 index f595b1ac1..c22d12a91 100644 --- a/test/example/bitsets/demo_bitsets_gt.f90 +++ b/test/example/bitsets/demo_bitsets_gt.f90 @@ -1,16 +1,16 @@ program demo_gt -use stdlib_bitsets -type(bitset_64) :: set0, set1, set2 -call set0 % init( 33 ) -call set1 % init( 33 ) -call set2 % init( 33 ) -call set1 % set( 0 ) -call set2 % set( 32 ) -if ( set1 > set0 .and. set2 > set1 .and. set2 > set0 .and. & -.not. set0 > set0 .and. .not. set0 > set1 .and. .not. & -set1 > set2 ) then -write(*,*) 'Passed 64 bit greater than tests.' -else -error stop 'Failed 64 bit greater than tests.' -end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set1 > set0 .and. set2 > set1 .and. set2 > set0 .and. & + .not. set0 > set0 .and. .not. set0 > set1 .and. .not. & + set1 > set2) then + write (*, *) 'Passed 64 bit greater than tests.' + else + error stop 'Failed 64 bit greater than tests.' + end if end program demo_gt diff --git a/test/example/bitsets/demo_bitsets_inequality.f90 b/test/example/bitsets/demo_bitsets_inequality.f90 index 1e3e9190b..d6e2fa63c 100644 --- a/test/example/bitsets/demo_bitsets_inequality.f90 +++ b/test/example/bitsets/demo_bitsets_inequality.f90 @@ -1,16 +1,16 @@ program demo_inequality -use stdlib_bitsets -type(bitset_64) :: set0, set1, set2 -call set0 % init( 33 ) -call set1 % init( 33 ) -call set2 % init( 33 ) -call set1 % set( 0 ) -call set2 % set( 32 ) -if ( set0 /= set1 .and. set0 /= set2 .and. set1 /= set2 .and. & -.not. set0 /= set0 .and. .not. set1 /= set1 .and. .not. & -set2 /= set2 ) then -write(*,*) 'Passed 64 bit inequality tests.' -else -error stop 'Failed 64 bit inequality tests.' -end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set0 /= set1 .and. set0 /= set2 .and. set1 /= set2 .and. & + .not. set0 /= set0 .and. .not. set1 /= set1 .and. .not. & + set2 /= set2) then + write (*, *) 'Passed 64 bit inequality tests.' + else + error stop 'Failed 64 bit inequality tests.' + end if end program demo_inequality diff --git a/test/example/bitsets/demo_bitsets_init.f90 b/test/example/bitsets/demo_bitsets_init.f90 index 32f9a6abd..a834a5988 100644 --- a/test/example/bitsets/demo_bitsets_init.f90 +++ b/test/example/bitsets/demo_bitsets_init.f90 @@ -1,8 +1,8 @@ program demo_init -use stdlib_bitsets -type(bitset_large) :: set0 -call set0 % init(166) -if ( set0 % bits() == 166 ) & -write(*,*) 'SET0 has the proper size.' -if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + if (set0%bits() == 166) & + write (*, *) 'SET0 has the proper size.' + if (set0%none()) write (*, *) 'SET0 is properly initialized.' end program demo_init diff --git a/test/example/bitsets/demo_bitsets_input.f90 b/test/example/bitsets/demo_bitsets_input.f90 index 26489b4da..5fb0660e2 100644 --- a/test/example/bitsets/demo_bitsets_input.f90 +++ b/test/example/bitsets/demo_bitsets_input.f90 @@ -1,32 +1,32 @@ program demo_input -use stdlib_bitsets -implicit none -character(*), parameter :: & -bits_0 = '000000000000000000000000000000000', & -bits_1 = '000000000000000000000000000000001', & -bits_33 = '100000000000000000000000000000000' -integer :: unit -type(bitset_64) :: set0, set1, set2, set3, set4, set5 -call set0 % from_string( bits_0 ) -call set1 % from_string( bits_1 ) -call set2 % from_string( bits_33 ) -open( newunit=unit, file='test.bin', status='replace', & -form='unformatted', action='write' ) -call set2 % output(unit) -call set1 % output(unit) -call set0 % output(unit) -close( unit ) -open( newunit=unit, file='test.bin', status='old', & -form='unformatted', action='read' ) -call set5 % input(unit) -call set4 % input(unit) -call set3 % input(unit) -close( unit ) -if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then -error stop 'Transfer to and from units using ' // & -' output and input failed.' -else -write(*,*) 'Transfer to and from units using ' // & -'output and input succeeded.' -end if + use stdlib_bitsets + implicit none + character(*), parameter :: & + bits_0 = '000000000000000000000000000000000', & + bits_1 = '000000000000000000000000000000001', & + bits_33 = '100000000000000000000000000000000' + integer :: unit + type(bitset_64) :: set0, set1, set2, set3, set4, set5 + call set0%from_string(bits_0) + call set1%from_string(bits_1) + call set2%from_string(bits_33) + open (newunit=unit, file='test.bin', status='replace', & + form='unformatted', action='write') + call set2%output(unit) + call set1%output(unit) + call set0%output(unit) + close (unit) + open (newunit=unit, file='test.bin', status='old', & + form='unformatted', action='read') + call set5%input(unit) + call set4%input(unit) + call set3%input(unit) + close (unit) + if (set3 /= set0 .or. set4 /= set1 .or. set5 /= set2) then + error stop 'Transfer to and from units using '// & + ' output and input failed.' + else + write (*, *) 'Transfer to and from units using '// & + 'output and input succeeded.' + end if end program demo_input diff --git a/test/example/bitsets/demo_bitsets_le.f90 b/test/example/bitsets/demo_bitsets_le.f90 index 3c39d902e..f806b7260 100644 --- a/test/example/bitsets/demo_bitsets_le.f90 +++ b/test/example/bitsets/demo_bitsets_le.f90 @@ -1,17 +1,17 @@ program demo_le -use stdlib_bitsets -type(bitset_64) :: set0, set1, set2 -call set0 % init( 33 ) -call set1 % init( 33 ) -call set2 % init( 33 ) -call set1 % set( 0 ) -call set2 % set( 32 ) -if ( set0 <= set1 .and. set1 <= set2 .and. set0 <= set2 .and. & -set0 <= set0 .and. set1 <= set1 .and. set2 <= set2 .and. & -.not. set1 <= set0 .and. .not. set2 <= set0 .and. .not. & -set2 <= set1 ) then -write(*,*) 'Passed 64 bit less than or equal tests.' -else -error stop 'Failed 64 bit less than or equal tests.' -end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set0 <= set1 .and. set1 <= set2 .and. set0 <= set2 .and. & + set0 <= set0 .and. set1 <= set1 .and. set2 <= set2 .and. & + .not. set1 <= set0 .and. .not. set2 <= set0 .and. .not. & + set2 <= set1) then + write (*, *) 'Passed 64 bit less than or equal tests.' + else + error stop 'Failed 64 bit less than or equal tests.' + end if end program demo_le diff --git a/test/example/bitsets/demo_bitsets_lt.f90 b/test/example/bitsets/demo_bitsets_lt.f90 index f357fdf62..9288dba2e 100644 --- a/test/example/bitsets/demo_bitsets_lt.f90 +++ b/test/example/bitsets/demo_bitsets_lt.f90 @@ -1,16 +1,16 @@ program demo_lt -use stdlib_bitsets -type(bitset_64) :: set0, set1, set2 -call set0 % init( 33 ) -call set1 % init( 33 ) -call set2 % init( 33 ) -call set1 % set( 0 ) -call set2 % set( 32 ) -if ( set0 < set1 .and. set1 < set2 .and. set0 < set2 .and. & -.not. set0 < set0 .and. .not. set2 < set0 .and. .not. & -set2 < set1 ) then -write(*,*) 'Passed 64 bit less than tests.' -else -error stop 'Failed 64 bit less than tests.' -end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set0 < set1 .and. set1 < set2 .and. set0 < set2 .and. & + .not. set0 < set0 .and. .not. set2 < set0 .and. .not. & + set2 < set1) then + write (*, *) 'Passed 64 bit less than tests.' + else + error stop 'Failed 64 bit less than tests.' + end if end program demo_lt diff --git a/test/example/bitsets/demo_bitsets_none.f90 b/test/example/bitsets/demo_bitsets_none.f90 index 0de092a82..8bfff9637 100644 --- a/test/example/bitsets/demo_bitsets_none.f90 +++ b/test/example/bitsets/demo_bitsets_none.f90 @@ -1,15 +1,15 @@ program demo_none -use stdlib_bitsets -character(*), parameter :: & -bits_0 = '0000000000000000000' -type(bitset_large) :: set0 -call set0 % from_string( bits_0 ) -if ( set0 % none() ) then -write(*,*) "FROM_STRING interpreted " // & -"BITS_0's value properly." -end if -call set0 % set(5) -if ( .not. set0 % none() ) then -write(*,*) "NONE interpreted SET0's value properly." -end if + use stdlib_bitsets + character(*), parameter :: & + bits_0 = '0000000000000000000' + type(bitset_large) :: set0 + call set0%from_string(bits_0) + if (set0%none()) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's value properly." + end if + call set0%set(5) + if (.not. set0%none()) then + write (*, *) "NONE interpreted SET0's value properly." + end if end program demo_none diff --git a/test/example/bitsets/demo_bitsets_not.f90 b/test/example/bitsets/demo_bitsets_not.f90 index 4a461834c..0f2788993 100644 --- a/test/example/bitsets/demo_bitsets_not.f90 +++ b/test/example/bitsets/demo_bitsets_not.f90 @@ -1,13 +1,13 @@ program demo_not -use stdlib_bitsets -type(bitset_large) :: set0 -call set0 % init( 155 ) -if ( set0 % none() ) then -write(*,*) "FROM_STRING interpreted " // & -"BITS_0's value properly." -end if -call set0 % not() -if ( set0 % all() ) then -write(*,*) "ALL interpreted SET0's value properly." -end if + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(155) + if (set0%none()) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's value properly." + end if + call set0%not() + if (set0%all()) then + write (*, *) "ALL interpreted SET0's value properly." + end if end program demo_not diff --git a/test/example/bitsets/demo_bitsets_or.f90 b/test/example/bitsets/demo_bitsets_or.f90 index 28c325d9b..31e04e5ce 100644 --- a/test/example/bitsets/demo_bitsets_or.f90 +++ b/test/example/bitsets/demo_bitsets_or.f90 @@ -1,18 +1,18 @@ program demo_or -use stdlib_bitsets -type(bitset_large) :: set0, set1 -call set0 % init(166) -call set1 % init(166) -call or( set0, set1 ) ! none none -if ( set0 % none() ) write(*,*) 'First test of OR worked.' -call set0 % not() -call or( set0, set1 ) ! all none -if ( set0 % all() ) write(*,*) 'Second test of OR worked.' -call set0 % not() -call set1 % not() -call or( set0, set1 ) ! none all -if ( set0 % all() ) write(*,*) 'Third test of OR worked.' -call set0 % not() -call or( set0, set1 ) ! all all -if ( set0 % all() ) write(*,*) 'Fourth test of OR worked.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set1%init(166) + call or(set0, set1) ! none none + if (set0%none()) write (*, *) 'First test of OR worked.' + call set0%not() + call or(set0, set1) ! all none + if (set0%all()) write (*, *) 'Second test of OR worked.' + call set0%not() + call set1%not() + call or(set0, set1) ! none all + if (set0%all()) write (*, *) 'Third test of OR worked.' + call set0%not() + call or(set0, set1) ! all all + if (set0%all()) write (*, *) 'Fourth test of OR worked.' end program demo_or diff --git a/test/example/bitsets/demo_bitsets_output.f90 b/test/example/bitsets/demo_bitsets_output.f90 index 3e1e8c9d6..686094927 100644 --- a/test/example/bitsets/demo_bitsets_output.f90 +++ b/test/example/bitsets/demo_bitsets_output.f90 @@ -1,32 +1,32 @@ program demo_output -use stdlib_bitsets -implicit none -character(*), parameter :: & -bits_0 = '000000000000000000000000000000000', & -bits_1 = '000000000000000000000000000000001', & -bits_33 = '100000000000000000000000000000000' -integer :: unit -type(bitset_64) :: set0, set1, set2, set3, set4, set5 -call set0 % from_string( bits_0 ) -call set1 % from_string( bits_1 ) -call set2 % from_string( bits_33 ) -open( newunit=unit, file='test.bin', status='replace', & -form='unformatted', action='write' ) -call set2 % output(unit) -call set1 % output(unit) -call set0 % output(unit) -close( unit ) -open( newunit=unit, file='test.bin', status='old', & -form='unformatted', action='read' ) -call set5 % input(unit) -call set4 % input(unit) -call set3 % input(unit) -close( unit ) -if ( set3 /= set0 .or. set4 /= set1 .or. set5 /= set2 ) then -error stop 'Transfer to and from units using ' // & -' output and input failed.' -else -write(*,*) 'Transfer to and from units using ' // & -'output and input succeeded.' -end if + use stdlib_bitsets + implicit none + character(*), parameter :: & + bits_0 = '000000000000000000000000000000000', & + bits_1 = '000000000000000000000000000000001', & + bits_33 = '100000000000000000000000000000000' + integer :: unit + type(bitset_64) :: set0, set1, set2, set3, set4, set5 + call set0%from_string(bits_0) + call set1%from_string(bits_1) + call set2%from_string(bits_33) + open (newunit=unit, file='test.bin', status='replace', & + form='unformatted', action='write') + call set2%output(unit) + call set1%output(unit) + call set0%output(unit) + close (unit) + open (newunit=unit, file='test.bin', status='old', & + form='unformatted', action='read') + call set5%input(unit) + call set4%input(unit) + call set3%input(unit) + close (unit) + if (set3 /= set0 .or. set4 /= set1 .or. set5 /= set2) then + error stop 'Transfer to and from units using '// & + ' output and input failed.' + else + write (*, *) 'Transfer to and from units using '// & + 'output and input succeeded.' + end if end program demo_output diff --git a/test/example/bitsets/demo_bitsets_read_bitset.f90 b/test/example/bitsets/demo_bitsets_read_bitset.f90 index 7d6d2c031..0ab9186a5 100644 --- a/test/example/bitsets/demo_bitsets_read_bitset.f90 +++ b/test/example/bitsets/demo_bitsets_read_bitset.f90 @@ -1,35 +1,35 @@ program demo_read_bitset -use stdlib_bitsets -implicit none -character(*), parameter :: & -bits_0 = 'S33B000000000000000000000000000000000', & -bits_1 = 'S33B000000000000000000000000000000001', & -bits_2 = 'S33B100000000000000000000000000000000' -character(:), allocatable :: test_0, test_1, test_2 -integer :: unit, status -type(bitset_64) :: set0, set1, set2, set3, set4, set5 -call set0 % read_bitset( bits_0, status ) -call set1 % read_bitset( bits_1, status ) -call set2 % read_bitset( bits_2, status ) -call set0 % write_bitset( test_0, status ) -call set1 % write_bitset( test_1, status ) -call set2 % write_bitset( test_2, status ) -if ( bits_0 == test_0 .and. bits_1 == test_1 .and. & -bits_2 == test_2 ) then -write(*,*) 'READ_BITSET to WRITE_BITSET strings worked.' -end if -open( newunit=unit, file='test.txt', status='replace', & -form='formatted', action='write' ) -call set2 % write_bitset(unit, advance='no') -call set1 % write_bitset(unit, advance='no') -call set0 % write_bitset(unit) -close( unit ) -open( newunit=unit, file='test.txt', status='old', & -form='formatted', action='read' ) -call set3 % read_bitset(unit, advance='no') -call set4 % read_bitset(unit, advance='no') -call set5 % read_bitset(unit) -if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then -write(*,*) 'WRITE_BITSET to READ_BITSET through unit worked.' -end if + use stdlib_bitsets + implicit none + character(*), parameter :: & + bits_0 = 'S33B000000000000000000000000000000000', & + bits_1 = 'S33B000000000000000000000000000000001', & + bits_2 = 'S33B100000000000000000000000000000000' + character(:), allocatable :: test_0, test_1, test_2 + integer :: unit, status + type(bitset_64) :: set0, set1, set2, set3, set4, set5 + call set0%read_bitset(bits_0, status) + call set1%read_bitset(bits_1, status) + call set2%read_bitset(bits_2, status) + call set0%write_bitset(test_0, status) + call set1%write_bitset(test_1, status) + call set2%write_bitset(test_2, status) + if (bits_0 == test_0 .and. bits_1 == test_1 .and. & + bits_2 == test_2) then + write (*, *) 'READ_BITSET to WRITE_BITSET strings worked.' + end if + open (newunit=unit, file='test.txt', status='replace', & + form='formatted', action='write') + call set2%write_bitset(unit, advance='no') + call set1%write_bitset(unit, advance='no') + call set0%write_bitset(unit) + close (unit) + open (newunit=unit, file='test.txt', status='old', & + form='formatted', action='read') + call set3%read_bitset(unit, advance='no') + call set4%read_bitset(unit, advance='no') + call set5%read_bitset(unit) + if (set3 == set0 .and. set4 == set1 .and. set5 == set2) then + write (*, *) 'WRITE_BITSET to READ_BITSET through unit worked.' + end if end program demo_read_bitset diff --git a/test/example/bitsets/demo_bitsets_set.f90 b/test/example/bitsets/demo_bitsets_set.f90 index 7ff429599..29d74a30f 100644 --- a/test/example/bitsets/demo_bitsets_set.f90 +++ b/test/example/bitsets/demo_bitsets_set.f90 @@ -1,10 +1,10 @@ program demo_set -use stdlib_bitsets -type(bitset_large) :: set0 -call set0 % init(166) -if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' -call set0 % set(165) -if ( set0 % test(165) ) write(*,*) 'Bit 165 is set.' -call set0 % set(0,164) -if ( set0 % all() ) write(*,*) 'All bits are set.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + if (set0%none()) write (*, *) 'SET0 is properly initialized.' + call set0%set(165) + if (set0%test(165)) write (*, *) 'Bit 165 is set.' + call set0%set(0, 164) + if (set0%all()) write (*, *) 'All bits are set.' end program demo_set diff --git a/test/example/bitsets/demo_bitsets_test.f90 b/test/example/bitsets/demo_bitsets_test.f90 index a46f43ef3..d2b402236 100644 --- a/test/example/bitsets/demo_bitsets_test.f90 +++ b/test/example/bitsets/demo_bitsets_test.f90 @@ -1,11 +1,11 @@ program demo_test -use stdlib_bitsets -type(bitset_large) :: set0 -call set0 % init(166) -call set0 % not() -if ( set0 % all() ) write(*,*) 'SET0 is properly initialized.' -call set0 % clear(165) -if ( .not. set0 % test(165) ) write(*,*) 'Bit 165 is cleared.' -call set0 % set(165) -if ( set0 % test(165) ) write(*,*) 'Bit 165 is set.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + call set0%not() + if (set0%all()) write (*, *) 'SET0 is properly initialized.' + call set0%clear(165) + if (.not. set0%test(165)) write (*, *) 'Bit 165 is cleared.' + call set0%set(165) + if (set0%test(165)) write (*, *) 'Bit 165 is set.' end program demo_test diff --git a/test/example/bitsets/demo_bitsets_to_string.f90 b/test/example/bitsets/demo_bitsets_to_string.f90 index 99a2b5fc5..09768449f 100644 --- a/test/example/bitsets/demo_bitsets_to_string.f90 +++ b/test/example/bitsets/demo_bitsets_to_string.f90 @@ -1,14 +1,14 @@ program demo_to_string -use stdlib_bitsets -character(*), parameter :: & -bits_all = '111111111111111111111111111111111' -type(bitset_64) :: set0 -character(:), allocatable :: new_string -call set0 % init(33) -call set0 % not() -call set0 % to_string( new_string ) -if ( new_string == bits_all ) then -write(*,*) "TO_STRING transferred BITS0 properly" // & -" into NEW_STRING." -end if + use stdlib_bitsets + character(*), parameter :: & + bits_all = '111111111111111111111111111111111' + type(bitset_64) :: set0 + character(:), allocatable :: new_string + call set0%init(33) + call set0%not() + call set0%to_string(new_string) + if (new_string == bits_all) then + write (*, *) "TO_STRING transferred BITS0 properly"// & + " into NEW_STRING." + end if end program demo_to_string diff --git a/test/example/bitsets/demo_bitsets_value.f90 b/test/example/bitsets/demo_bitsets_value.f90 index e42e35bec..32584075f 100644 --- a/test/example/bitsets/demo_bitsets_value.f90 +++ b/test/example/bitsets/demo_bitsets_value.f90 @@ -1,11 +1,11 @@ program demo_value -use stdlib_bitsets -type(bitset_large) :: set0 -call set0 % init(166) -call set0 % not() -if ( set0 % all() ) write(*,*) 'SET0 is properly initialized.' -call set0 % clear(165) -if ( set0 % value(165) == 0 ) write(*,*) 'Bit 165 is cleared.' -call set0 % set(165) -if ( set0 % value(165) == 1 ) write(*,*) 'Bit 165 is set.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + call set0%not() + if (set0%all()) write (*, *) 'SET0 is properly initialized.' + call set0%clear(165) + if (set0%value(165) == 0) write (*, *) 'Bit 165 is cleared.' + call set0%set(165) + if (set0%value(165) == 1) write (*, *) 'Bit 165 is set.' end program demo_value diff --git a/test/example/bitsets/demo_bitsets_write_bitset.f90 b/test/example/bitsets/demo_bitsets_write_bitset.f90 index 7ad770abb..5027b335a 100644 --- a/test/example/bitsets/demo_bitsets_write_bitset.f90 +++ b/test/example/bitsets/demo_bitsets_write_bitset.f90 @@ -1,35 +1,35 @@ program demo_write_bitset -use stdlib_bitsets -implicit none -character(*), parameter :: & -bits_0 = 'S33B000000000000000000000000000000000', & -bits_1 = 'S33B000000000000000000000000000000001', & -bits_2 = 'S33B100000000000000000000000000000000' -character(:), allocatable :: test_0, test_1, test_2 -integer :: unit, status -type(bitset_64) :: set0, set1, set2, set3, set4, set5 -call set0 % read_bitset( bits_0, status ) -call set1 % read_bitset( bits_1, status ) -call set2 % read_bitset( bits_2, status ) -call set0 % write_bitset( test_0, status ) -call set1 % write_bitset( test_1, status ) -call set2 % write_bitset( test_2, status ) -if ( bits_0 == test_0 .and. bits_1 == test_1 .and. & -bits_2 == test_2 ) then -write(*,*) 'READ_BITSET to WRITE_BITSET strings worked.' -end if -open( newunit=unit, file='test.txt', status='replace', & -form='formatted', action='write' ) -call set2 % write_bitset(unit, advance='no') -call set1 % write_bitset(unit, advance='no') -call set0 % write_bitset(unit) -close( unit ) -open( newunit=unit, file='test.txt', status='old', & -form='formatted', action='read' ) -call set3 % read_bitset(unit, advance='no') -call set4 % read_bitset(unit, advance='no') -call set5 % read_bitset(unit) -if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then -write(*,*) 'WRITE_BITSET to READ_BITSET through unit worked.' -end if + use stdlib_bitsets + implicit none + character(*), parameter :: & + bits_0 = 'S33B000000000000000000000000000000000', & + bits_1 = 'S33B000000000000000000000000000000001', & + bits_2 = 'S33B100000000000000000000000000000000' + character(:), allocatable :: test_0, test_1, test_2 + integer :: unit, status + type(bitset_64) :: set0, set1, set2, set3, set4, set5 + call set0%read_bitset(bits_0, status) + call set1%read_bitset(bits_1, status) + call set2%read_bitset(bits_2, status) + call set0%write_bitset(test_0, status) + call set1%write_bitset(test_1, status) + call set2%write_bitset(test_2, status) + if (bits_0 == test_0 .and. bits_1 == test_1 .and. & + bits_2 == test_2) then + write (*, *) 'READ_BITSET to WRITE_BITSET strings worked.' + end if + open (newunit=unit, file='test.txt', status='replace', & + form='formatted', action='write') + call set2%write_bitset(unit, advance='no') + call set1%write_bitset(unit, advance='no') + call set0%write_bitset(unit) + close (unit) + open (newunit=unit, file='test.txt', status='old', & + form='formatted', action='read') + call set3%read_bitset(unit, advance='no') + call set4%read_bitset(unit, advance='no') + call set5%read_bitset(unit) + if (set3 == set0 .and. set4 == set1 .and. set5 == set2) then + write (*, *) 'WRITE_BITSET to READ_BITSET through unit worked.' + end if end program demo_write_bitset diff --git a/test/example/bitsets/demo_bitsets_xor.f90 b/test/example/bitsets/demo_bitsets_xor.f90 index 3c9b20095..aa7245dc5 100644 --- a/test/example/bitsets/demo_bitsets_xor.f90 +++ b/test/example/bitsets/demo_bitsets_xor.f90 @@ -1,18 +1,18 @@ program demo_xor -use stdlib_bitsets -type(bitset_large) :: set0, set1 -call set0 % init(166) -call set1 % init(166) -call xor( set0, set1 ) ! none none -if ( set0 % none() ) write(*,*) 'First test of XOR worked.' -call set0 % not() -call xor( set0, set1 ) ! all none -if ( set0 % all() ) write(*,*) 'Second test of XOR worked.' -call set0 % not() -call set1 % not() -call xor( set0, set1 ) ! none all -if ( set0 % all() ) write(*,*) 'Third test of XOR worked.' -call set0 % not() -call xor( set0, set1 ) ! all all -if ( set0 % none() ) write(*,*) 'Fourth test of XOR worked.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set1%init(166) + call xor(set0, set1) ! none none + if (set0%none()) write (*, *) 'First test of XOR worked.' + call set0%not() + call xor(set0, set1) ! all none + if (set0%all()) write (*, *) 'Second test of XOR worked.' + call set0%not() + call set1%not() + call xor(set0, set1) ! none all + if (set0%all()) write (*, *) 'Third test of XOR worked.' + call set0%not() + call xor(set0, set1) ! all all + if (set0%none()) write (*, *) 'Fourth test of XOR worked.' end program demo_xor diff --git a/test/example/error/demo_check1.f90 b/test/example/error/demo_check1.f90 index 707587b48..3c7c77d0c 100644 --- a/test/example/error/demo_check1.f90 +++ b/test/example/error/demo_check1.f90 @@ -1,7 +1,7 @@ program demo_check1 -use stdlib_error, only: check -implicit none -integer :: a = 1 + use stdlib_error, only: check + implicit none + integer :: a = 1 ! If a /= 5, stops the program with exit code 1 and prints 'Check failed.' -call check(a == 5) + call check(a == 5) end program demo_check1 diff --git a/test/example/error/demo_check2.f90 b/test/example/error/demo_check2.f90 index c6f58eeab..fda527ba2 100644 --- a/test/example/error/demo_check2.f90 +++ b/test/example/error/demo_check2.f90 @@ -1,7 +1,7 @@ program demo_check2 -use stdlib_error, only: check -implicit none -integer :: a = 1 + use stdlib_error, only: check + implicit none + integer :: a = 1 ! If a /= 5, stops the program with exit code 1 and prints 'a == 5 failed.' -call check(a == 5, msg='a == 5 failed.') + call check(a == 5, msg='a == 5 failed.') end program demo_check2 diff --git a/test/example/error/demo_check3.f90 b/test/example/error/demo_check3.f90 index 37cf1b639..8c3f2f33e 100644 --- a/test/example/error/demo_check3.f90 +++ b/test/example/error/demo_check3.f90 @@ -1,7 +1,7 @@ program demo_check3 -use stdlib_error, only: check -implicit none -integer :: a = 1 + use stdlib_error, only: check + implicit none + integer :: a = 1 ! If a /= 5, prints 'a == 5 failed.', but doesn't stop the program. -call check(a == 5, msg='a == 5 failed.', warn=.true.) + call check(a == 5, msg='a == 5 failed.', warn=.true.) end program demo_check3 diff --git a/test/example/error/demo_check4.f90 b/test/example/error/demo_check4.f90 index 54ce9073c..25e5d7726 100644 --- a/test/example/error/demo_check4.f90 +++ b/test/example/error/demo_check4.f90 @@ -1,7 +1,7 @@ program demo_check4 -use stdlib_error, only: check -implicit none -integer :: a = 1 + use stdlib_error, only: check + implicit none + integer :: a = 1 ! If a /= 5, stops the program with exit code 77 and prints 'a == 5 failed.' -call check(a == 5, msg='a == 5 failed.', code=77) + call check(a == 5, msg='a == 5 failed.', code=77) end program demo_check4 diff --git a/test/example/error/demo_error_stop1.f90 b/test/example/error/demo_error_stop1.f90 index 2e453077c..45f8fb46c 100644 --- a/test/example/error/demo_error_stop1.f90 +++ b/test/example/error/demo_error_stop1.f90 @@ -1,5 +1,5 @@ program demo_error_stop1 -use stdlib_error, only: error_stop -implicit none -call error_stop("Invalid argument") + use stdlib_error, only: error_stop + implicit none + call error_stop("Invalid argument") end program demo_error_stop1 diff --git a/test/example/error/demo_error_stop2.f90 b/test/example/error/demo_error_stop2.f90 index 61f18037b..6502c3225 100644 --- a/test/example/error/demo_error_stop2.f90 +++ b/test/example/error/demo_error_stop2.f90 @@ -1,5 +1,5 @@ program demo_error_stop2 -use stdlib_error, only: error_stop -implicit none -call error_stop("Invalid argument", code = 123) + use stdlib_error, only: error_stop + implicit none + call error_stop("Invalid argument", code=123) end program demo_error_stop2 diff --git a/test/example/hash_procedures/demo_fibonacci_hash.f90 b/test/example/hash_procedures/demo_fibonacci_hash.f90 index 784befda6..6f1a213a7 100644 --- a/test/example/hash_procedures/demo_fibonacci_hash.f90 +++ b/test/example/hash_procedures/demo_fibonacci_hash.f90 @@ -1,13 +1,13 @@ program demo_fibonacci_hash -use stdlib_hash_32bit, only: fibonacci_hash -use iso_fortran_env, only: int32 -implicit none -integer, allocatable :: array1(:) -integer(int32) :: hash, source -allocate( array1(0:2**6-1) ) -array1(:) = 0 -source = 42_int32 -hash = fibonacci_hash(source, 6) -array1(hash) = source -print *, hash + use stdlib_hash_32bit, only: fibonacci_hash + use iso_fortran_env, only: int32 + implicit none + integer, allocatable :: array1(:) + integer(int32) :: hash, source + allocate (array1(0:2**6 - 1)) + array1(:) = 0 + source = 42_int32 + hash = fibonacci_hash(source, 6) + array1(hash) = source + print *, hash end program demo_fibonacci_hash diff --git a/test/example/hash_procedures/demo_fibonacci_hash_64.f90 b/test/example/hash_procedures/demo_fibonacci_hash_64.f90 index a16fa8552..c1a479580 100644 --- a/test/example/hash_procedures/demo_fibonacci_hash_64.f90 +++ b/test/example/hash_procedures/demo_fibonacci_hash_64.f90 @@ -1,13 +1,13 @@ program demo_fibonacci_hash_64 -use stdlib_hash_64bit, only: fibonacci_hash -use iso_fortran_env, only: int64 -implicit none -integer, allocatable :: array1(:) -integer(int64) :: hash, source -allocate( array1(0:2**6-1) ) -array1(:) = 0 -source = int(Z'1FFFFFFFF', int64) -hash = fibonacci_hash(source, 6) -array1(hash) = source -print *, hash + use stdlib_hash_64bit, only: fibonacci_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: array1(:) + integer(int64) :: hash, source + allocate (array1(0:2**6 - 1)) + array1(:) = 0 + source = int(Z'1FFFFFFFF', int64) + hash = fibonacci_hash(source, 6) + array1(hash) = source + print *, hash end program demo_fibonacci_hash_64 diff --git a/test/example/hash_procedures/demo_fnv_1_hash.f90 b/test/example/hash_procedures/demo_fnv_1_hash.f90 index 31214cffd..fafb6e701 100644 --- a/test/example/hash_procedures/demo_fnv_1_hash.f90 +++ b/test/example/hash_procedures/demo_fnv_1_hash.f90 @@ -1,8 +1,8 @@ program demo_fnv_1_hash -use stdlib_hash_32bit, only: fnv_1_hash -use iso_fortran_env, only: int32 -implicit none -integer(int32) :: hash -hash = fnv_1_hash([ 5, 4, 3, 1, 10, 4, 9]) -print *, hash + use stdlib_hash_32bit, only: fnv_1_hash + use iso_fortran_env, only: int32 + implicit none + integer(int32) :: hash + hash = fnv_1_hash([5, 4, 3, 1, 10, 4, 9]) + print *, hash end program demo_fnv_1_hash diff --git a/test/example/hash_procedures/demo_fnv_1_hash_64.f90 b/test/example/hash_procedures/demo_fnv_1_hash_64.f90 index f3c4dde2c..b8727477f 100644 --- a/test/example/hash_procedures/demo_fnv_1_hash_64.f90 +++ b/test/example/hash_procedures/demo_fnv_1_hash_64.f90 @@ -1,10 +1,10 @@ program demo_fnv_1_hash_64 -use stdlib_hash_64bit, only: fnv_1_hash -use iso_fortran_env, only: int64 -implicit none -integer, allocatable :: array1(:) -integer(int64) :: hash -array1 = [ 5, 4, 3, 1, 10, 4, 9] -hash = fnv_1_hash(array1) -print *, hash + use stdlib_hash_64bit, only: fnv_1_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: array1(:) + integer(int64) :: hash + array1 = [5, 4, 3, 1, 10, 4, 9] + hash = fnv_1_hash(array1) + print *, hash end program demo_fnv_1_hash_64 diff --git a/test/example/hash_procedures/demo_fnv_1a_hash.f90 b/test/example/hash_procedures/demo_fnv_1a_hash.f90 index 28dad75ec..524bdacaf 100644 --- a/test/example/hash_procedures/demo_fnv_1a_hash.f90 +++ b/test/example/hash_procedures/demo_fnv_1a_hash.f90 @@ -1,8 +1,8 @@ program demo_fnv_1a_hash -use stdlib_hash_32bit, only: fnv_1a_hash -use iso_fortran_env, only: int32 -implicit none -integer(int32) :: hash -hash = fnv_1a_hash( [ 5, 4, 3, 1, 10, 4, 9] ) -print *, hash + use stdlib_hash_32bit, only: fnv_1a_hash + use iso_fortran_env, only: int32 + implicit none + integer(int32) :: hash + hash = fnv_1a_hash([5, 4, 3, 1, 10, 4, 9]) + print *, hash end program demo_fnv_1a_hash diff --git a/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 b/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 index 05e4fac28..16c03d396 100644 --- a/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 +++ b/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 @@ -1,10 +1,10 @@ program demo_fnv_1a_hash_64 -use stdlib_hash_64bit, only: fnv_1a_hash -use iso_fortran_env, only: int64 -implicit none -integer, allocatable :: array1(:) -integer(int64) :: hash -array1 = [ 5, 4, 3, 1, 10, 4, 9] -hash = fnv_1a_hash(array1) -print *, hash + use stdlib_hash_64bit, only: fnv_1a_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: array1(:) + integer(int64) :: hash + array1 = [5, 4, 3, 1, 10, 4, 9] + hash = fnv_1a_hash(array1) + print *, hash end program demo_fnv_1a_hash_64 diff --git a/test/example/hash_procedures/demo_nmhash32.f90 b/test/example/hash_procedures/demo_nmhash32.f90 index f86cd6fc5..4317c2696 100644 --- a/test/example/hash_procedures/demo_nmhash32.f90 +++ b/test/example/hash_procedures/demo_nmhash32.f90 @@ -1,11 +1,11 @@ program demo_nmhash32 -use stdlib_hash_32bit, only: nmhash32, & -new_nmhash32_seed -use iso_fortran_env, only: int32 -implicit none -integer(int32) :: hash -integer(int32) :: seed = 42_int32 -call new_nmhash32_seed(seed) -hash = nmhash32([ 5, 4, 3, 1, 10, 4, 9], seed) -print *, seed, hash + use stdlib_hash_32bit, only: nmhash32, & + new_nmhash32_seed + use iso_fortran_env, only: int32 + implicit none + integer(int32) :: hash + integer(int32) :: seed = 42_int32 + call new_nmhash32_seed(seed) + hash = nmhash32([5, 4, 3, 1, 10, 4, 9], seed) + print *, seed, hash end program demo_nmhash32 diff --git a/test/example/hash_procedures/demo_nmhash32x.f90 b/test/example/hash_procedures/demo_nmhash32x.f90 index a785d1e12..da1cc3cc6 100644 --- a/test/example/hash_procedures/demo_nmhash32x.f90 +++ b/test/example/hash_procedures/demo_nmhash32x.f90 @@ -1,11 +1,11 @@ program demo_nmhash32x -use stdlib_hash_32bit, only: nmhash32x, & -new_nmhash32x_seed -use iso_fortran_env, only: int32 -implicit none -integer(int32) :: hash -integer(int32) :: seed = 42_int32 -call new_nmhash32x_seed(seed) -hash = nmhash32x([ 5, 4, 3, 1, 10, 4, 9], seed) -print *, seed, hash + use stdlib_hash_32bit, only: nmhash32x, & + new_nmhash32x_seed + use iso_fortran_env, only: int32 + implicit none + integer(int32) :: hash + integer(int32) :: seed = 42_int32 + call new_nmhash32x_seed(seed) + hash = nmhash32x([5, 4, 3, 1, 10, 4, 9], seed) + print *, seed, hash end program demo_nmhash32x diff --git a/test/example/hash_procedures/demo_pengy_hash.f90 b/test/example/hash_procedures/demo_pengy_hash.f90 index 9c2fca0c0..a33f89b65 100644 --- a/test/example/hash_procedures/demo_pengy_hash.f90 +++ b/test/example/hash_procedures/demo_pengy_hash.f90 @@ -1,13 +1,13 @@ program demo_pengy_hash -use stdlib_hash_64bit, only: new_pengy_hash_seed, pengy_hash -use iso_fortran_env, only: int32, int64 -implicit none -integer, allocatable :: key(:) -integer(int64) :: hash -integer(int32) :: seed -key = [ 0, 1, 2, 3 ] -seed = 0_int32 -call new_pengy_hash_seed( seed ) -hash = pengy_hash( key, seed ) -print *, seed, hash + use stdlib_hash_64bit, only: new_pengy_hash_seed, pengy_hash + use iso_fortran_env, only: int32, int64 + implicit none + integer, allocatable :: key(:) + integer(int64) :: hash + integer(int32) :: seed + key = [0, 1, 2, 3] + seed = 0_int32 + call new_pengy_hash_seed(seed) + hash = pengy_hash(key, seed) + print *, seed, hash end program demo_pengy_hash diff --git a/test/example/hash_procedures/demo_spooky_hash.f90 b/test/example/hash_procedures/demo_spooky_hash.f90 index 619e971b7..18ce61517 100644 --- a/test/example/hash_procedures/demo_spooky_hash.f90 +++ b/test/example/hash_procedures/demo_spooky_hash.f90 @@ -1,13 +1,13 @@ program demo_spooky_hash -use stdlib_hash_64bit, only: new_spooky_hash_seed, & -spooky_hash -use iso_fortran_env, only: int64 -implicit none -integer, allocatable :: key(:) -integer(int64) :: hash(2), seed(2) -key = [ 0, 1, 2, 3 ] -seed = [ 119_int64, 2_int64**41-1 ] -call new_spooky_hash_seed( seed ) -hash = spooky_hash( key, seed ) -print *, seed, hash + use stdlib_hash_64bit, only: new_spooky_hash_seed, & + spooky_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: key(:) + integer(int64) :: hash(2), seed(2) + key = [0, 1, 2, 3] + seed = [119_int64, 2_int64**41 - 1] + call new_spooky_hash_seed(seed) + hash = spooky_hash(key, seed) + print *, seed, hash end program demo_spooky_hash diff --git a/test/example/hash_procedures/demo_universal_mult_hash.f90 b/test/example/hash_procedures/demo_universal_mult_hash.f90 index 080b554b3..9e606a3cb 100644 --- a/test/example/hash_procedures/demo_universal_mult_hash.f90 +++ b/test/example/hash_procedures/demo_universal_mult_hash.f90 @@ -1,18 +1,18 @@ program demo_universal_mult_hash -use stdlib_hash_32bit, only: odd_random_integer, & -universal_mult_hash -use iso_fortran_env, only: int32 -implicit none -integer, allocatable :: array1(:) -integer(int32) :: hash, i, seed, source -seed = 0 -allocate( array1(0:2**6-1) ) -do i = 0, 2**6-1 -array1(i) = i -end do -call odd_random_integer( seed ) -source = 42_int32 -hash = universal_mult_hash(source, seed, 6) -array1(hash) = source -print *, seed, hash, array1 + use stdlib_hash_32bit, only: odd_random_integer, & + universal_mult_hash + use iso_fortran_env, only: int32 + implicit none + integer, allocatable :: array1(:) + integer(int32) :: hash, i, seed, source + seed = 0 + allocate (array1(0:2**6 - 1)) + do i = 0, 2**6 - 1 + array1(i) = i + end do + call odd_random_integer(seed) + source = 42_int32 + hash = universal_mult_hash(source, seed, 6) + array1(hash) = source + print *, seed, hash, array1 end program demo_universal_mult_hash diff --git a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 b/test/example/hash_procedures/demo_universal_mult_hash_64.f90 index 8a34d4d6f..909738497 100644 --- a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 +++ b/test/example/hash_procedures/demo_universal_mult_hash_64.f90 @@ -1,16 +1,16 @@ program demo_universal_mult_hash_64 -use stdlib_hash_64bit, only: odd_random_integer, & -universal_mult_hash -use iso_fortran_env, only: int64 -implicit none -integer, allocatable :: array1(:) -integer(int64) :: hash, i, seed, source -seed = 0 -allocate( array1(0:2**6-1) ) -array1 = 0 -call odd_random_integer( seed ) -source = 42_int64 -hash = universal_mult_hash(source, seed, 6) -array1(hash) = source -print *, seed, hash, array1 + use stdlib_hash_64bit, only: odd_random_integer, & + universal_mult_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: array1(:) + integer(int64) :: hash, i, seed, source + seed = 0 + allocate (array1(0:2**6 - 1)) + array1 = 0 + call odd_random_integer(seed) + source = 42_int64 + hash = universal_mult_hash(source, seed, 6) + array1(hash) = source + print *, seed, hash, array1 end program demo_universal_mult_hash_64 diff --git a/test/example/hash_procedures/demo_water_hash.f90 b/test/example/hash_procedures/demo_water_hash.f90 index 8912b076f..56cecb256 100644 --- a/test/example/hash_procedures/demo_water_hash.f90 +++ b/test/example/hash_procedures/demo_water_hash.f90 @@ -1,11 +1,11 @@ program demo_water_hash -use stdlib_hash_32bit, only: water_hash, & -new_water_hash_seed -use iso_fortran_env, only: int32, int64 -implicit none -integer(int32) :: hash -integer(int64) :: seed = 42_int64 -call new_water_hash_seed( seed ) -hash = water_hash([ 5, 4, 3, 1, 10, 4, 9], seed) -print *, hash, seed + use stdlib_hash_32bit, only: water_hash, & + new_water_hash_seed + use iso_fortran_env, only: int32, int64 + implicit none + integer(int32) :: hash + integer(int64) :: seed = 42_int64 + call new_water_hash_seed(seed) + hash = water_hash([5, 4, 3, 1, 10, 4, 9], seed) + print *, hash, seed end program demo_water_hash diff --git a/test/example/hashmaps/demo_hashmaps_calls.f90 b/test/example/hashmaps/demo_hashmaps_calls.f90 index e7cbc59b6..b1919de71 100644 --- a/test/example/hashmaps/demo_hashmaps_calls.f90 +++ b/test/example/hashmaps/demo_hashmaps_calls.f90 @@ -1,10 +1,10 @@ program demo_calls -use stdlib_hashmaps, only: chaining_hashmap_type, int_calls -use stdlib_hashmap_wrappers, only: fnv_1_hasher -implicit none -type(chaining_hashmap_type) :: map -integer(int_calls) :: initial_calls -call map % init( fnv_1_hasher ) -initial_calls = map % calls() -print *, "INITIAL_CALLS = ", initial_calls + use stdlib_hashmaps, only: chaining_hashmap_type, int_calls + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + integer(int_calls) :: initial_calls + call map%init(fnv_1_hasher) + initial_calls = map%calls() + print *, "INITIAL_CALLS = ", initial_calls end program demo_calls diff --git a/test/example/hashmaps/demo_hashmaps_copy_key.f90 b/test/example/hashmaps/demo_hashmaps_copy_key.f90 index 9a44eb0c3..09aefd3df 100644 --- a/test/example/hashmaps/demo_hashmaps_copy_key.f90 +++ b/test/example/hashmaps/demo_hashmaps_copy_key.f90 @@ -1,12 +1,12 @@ program demo_copy_key -use stdlib_hashmap_wrappers, only: & -copy_key, operator(==), key_type, set -use iso_fortran_env, only: int8 -implicit none -integer(int8) :: i, value(15) -type(key_type) :: old_key, new_key -value = [(i, i = 1, 15)] -call set( old_key, value ) -call copy_key( old_key, new_key ) -print *, "old_key == new_key = ", old_key == new_key + use stdlib_hashmap_wrappers, only: & + copy_key, operator(==), key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8) :: i, value(15) + type(key_type) :: old_key, new_key + value = [(i, i=1, 15)] + call set(old_key, value) + call copy_key(old_key, new_key) + print *, "old_key == new_key = ", old_key == new_key end program demo_copy_key diff --git a/test/example/hashmaps/demo_hashmaps_copy_other.f90 b/test/example/hashmaps/demo_hashmaps_copy_other.f90 index 81e9c41f3..e5dcd177b 100644 --- a/test/example/hashmaps/demo_hashmaps_copy_other.f90 +++ b/test/example/hashmaps/demo_hashmaps_copy_other.f90 @@ -1,23 +1,23 @@ program demo_copy_other -use stdlib_hashmap_wrappers, only: & -copy_other, get, other_type, set -use iso_fortran_env, only: int8 -implicit none -type(other_type) :: other_in, other_out -integer(int8) :: i -class(*), allocatable :: dummy -type dummy_type -integer(int8) :: value(15) -end type -type(dummy_type) :: dummy_val -do i=1, 15 -dummy_val % value(i) = i -end do -allocate(other_in % value, source=dummy_val) -call copy_other( other_in, other_out ) -select type(other_out) -typeis (dummy_type) -print *, "other_in == other_out = ", & -all( other_in % value == other_out % value ) -end select + use stdlib_hashmap_wrappers, only: & + copy_other, get, other_type, set + use iso_fortran_env, only: int8 + implicit none + type(other_type) :: other_in, other_out + integer(int8) :: i + class(*), allocatable :: dummy + type dummy_type + integer(int8) :: value(15) + end type + type(dummy_type) :: dummy_val + do i = 1, 15 + dummy_val%value(i) = i + end do + allocate (other_in%value, source=dummy_val) + call copy_other(other_in, other_out) + select type (other_out) + typeis(dummy_type) + print *, "other_in == other_out = ", & + all(other_in%value == other_out%value) + end select end program demo_copy_other diff --git a/test/example/hashmaps/demo_hashmaps_entries.f90 b/test/example/hashmaps/demo_hashmaps_entries.f90 index 9dad49205..7bb38a877 100644 --- a/test/example/hashmaps/demo_hashmaps_entries.f90 +++ b/test/example/hashmaps/demo_hashmaps_entries.f90 @@ -1,10 +1,10 @@ program demo_entries -use stdlib_hashmaps, only: open_hashmap_type, int_index -use stdlib_hashmap_wrappers, only: fnv_1_hasher -implicit none -type(open_hashmap_type) :: map -integer(int_index) :: initial_entries -call map % init( fnv_1_hasher ) -initial_entries = map % entries () -print *, "INITIAL_ENTRIES = ", initial_entries + use stdlib_hashmaps, only: open_hashmap_type, int_index + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(open_hashmap_type) :: map + integer(int_index) :: initial_entries + call map%init(fnv_1_hasher) + initial_entries = map%entries() + print *, "INITIAL_ENTRIES = ", initial_entries end program demo_entries diff --git a/test/example/hashmaps/demo_hashmaps_equal_keys.f90 b/test/example/hashmaps/demo_hashmaps_equal_keys.f90 index 5313fd63e..15571f20f 100644 --- a/test/example/hashmaps/demo_hashmaps_equal_keys.f90 +++ b/test/example/hashmaps/demo_hashmaps_equal_keys.f90 @@ -1,14 +1,14 @@ program demo_equal_keys -use stdlib_hashmap_wrappers, only: & -copy_key, operator(==), key_type, set -use iso_fortran_env, only: int8 -implicit none -integer(int8) :: i, value(15) -type(key_type) :: old_key, new_key -do i=1, 15 -value(i) = i -end do -call set( old_key, value ) -call copy_key( old_key, new_key ) -print *, "old_key == new_key = ", old_key == new_key + use stdlib_hashmap_wrappers, only: & + copy_key, operator(==), key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8) :: i, value(15) + type(key_type) :: old_key, new_key + do i = 1, 15 + value(i) = i + end do + call set(old_key, value) + call copy_key(old_key, new_key) + print *, "old_key == new_key = ", old_key == new_key end program demo_equal_keys diff --git a/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 b/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 index 973ee85a8..c947508f4 100644 --- a/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 @@ -1,12 +1,12 @@ program demo_fnv_1_hasher -use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set -use iso_fortran_env, only: int8, int32 -implicit none -integer(int8), allocatable :: array1(:) -integer(int32) :: hash -type(key_type) :: key -array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] -call set( key, array1 ) -hash = fnv_1_hasher(key) -print *, hash + use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set + use iso_fortran_env, only: int8, int32 + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = fnv_1_hasher(key) + print *, hash end program demo_fnv_1_hasher diff --git a/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 b/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 index 5bb9e4ab6..bf8abadd2 100644 --- a/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 @@ -1,13 +1,13 @@ program demo_fnv_1a_hasher -use stdlib_hashmap_wrappers, only: & -fnv_1a_hasher, key_type, set -use iso_fortran_env, only: int8, int32 -implicit none -integer(int8), allocatable :: array1(:) -integer(int32) :: hash -type(key_type) :: key -array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] -call set( key, array1 ) -hash = fnv_1a_hasher(key) -print *, hash + use stdlib_hashmap_wrappers, only: & + fnv_1a_hasher, key_type, set + use iso_fortran_env, only: int8, int32 + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = fnv_1a_hasher(key) + print *, hash end program demo_fnv_1a_hasher diff --git a/test/example/hashmaps/demo_hashmaps_free_key.f90 b/test/example/hashmaps/demo_hashmaps_free_key.f90 index e6b069ba6..91d3106ef 100644 --- a/test/example/hashmaps/demo_hashmaps_free_key.f90 +++ b/test/example/hashmaps/demo_hashmaps_free_key.f90 @@ -1,12 +1,12 @@ program demo_free_key -use stdlib_hashmap_wrappers, only: & -copy_key, free_key, key_type, set -use iso_fortran_env, only: int8 -implicit none -integer(int8) :: i, value(15) -type(key_type) :: old_key, new_key -value = [(i, i=1, 15)] -call set( old_key, value ) -call copy_key( old_key, new_key ) -call free_key( old_key ) + use stdlib_hashmap_wrappers, only: & + copy_key, free_key, key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8) :: i, value(15) + type(key_type) :: old_key, new_key + value = [(i, i=1, 15)] + call set(old_key, value) + call copy_key(old_key, new_key) + call free_key(old_key) end program demo_free_key diff --git a/test/example/hashmaps/demo_hashmaps_free_other.f90 b/test/example/hashmaps/demo_hashmaps_free_other.f90 index dfdecf010..583640ad6 100644 --- a/test/example/hashmaps/demo_hashmaps_free_other.f90 +++ b/test/example/hashmaps/demo_hashmaps_free_other.f90 @@ -1,18 +1,18 @@ program demo_free_other -use stdlib_hashmap_wrappers, only: & -copy_other, free_other, other_type -use iso_fortran_env, only: int8 -implicit none -type dummy_type -integer(int8) :: value(15) -end type dummy_type -type(dummy_type) :: dummy_val -type(other_type), allocatable :: other_in, other_out -integer(int8) :: i -do i=1, 15 -dummy_val % value(i) = i -end do -allocate(other_in % value , source=dummy_val) -call copy_other( other_in, other_out ) -call free_other( other_out ) + use stdlib_hashmap_wrappers, only: & + copy_other, free_other, other_type + use iso_fortran_env, only: int8 + implicit none + type dummy_type + integer(int8) :: value(15) + end type dummy_type + type(dummy_type) :: dummy_val + type(other_type), allocatable :: other_in, other_out + integer(int8) :: i + do i = 1, 15 + dummy_val%value(i) = i + end do + allocate (other_in%value, source=dummy_val) + call copy_other(other_in, other_out) + call free_other(other_out) end program demo_free_other diff --git a/test/example/hashmaps/demo_hashmaps_get.f90 b/test/example/hashmaps/demo_hashmaps_get.f90 index d00977ace..699883ff6 100644 --- a/test/example/hashmaps/demo_hashmaps_get.f90 +++ b/test/example/hashmaps/demo_hashmaps_get.f90 @@ -1,16 +1,16 @@ program demo_get -use stdlib_hashmap_wrappers, only: & -get, key_type, set -use iso_fortran_env, only: int8 -implicit none -integer(int8), allocatable :: value(:), result(:) -type(key_type) :: key -integer(int8) :: i -allocate( value(1:15) ) -do i=1, 15 -value(i) = i -end do -call set( key, value ) -call get( key, result ) -print *, 'RESULT == VALUE = ', all( value == result ) + use stdlib_hashmap_wrappers, only: & + get, key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8), allocatable :: value(:), result(:) + type(key_type) :: key + integer(int8) :: i + allocate (value(1:15)) + do i = 1, 15 + value(i) = i + end do + call set(key, value) + call get(key, result) + print *, 'RESULT == VALUE = ', all(value == result) end program demo_get diff --git a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 index b49302f72..3fbd7e682 100644 --- a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 +++ b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 @@ -1,32 +1,32 @@ program demo_get_other_data -use stdlib_kinds, only: int8 -use stdlib_hashmaps, only: chaining_hashmap_type, int_index -use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set, get -logical :: conflict, exists -type(key_type) :: key -type(other_type) :: other -type(chaining_hashmap_type) :: map -type dummy_type -integer(int8) :: value(4) -end type dummy_type -type(dummy_type) :: dummy -class(*), allocatable :: data -dummy % value = [ 4_int8, 3_int8, 2_int8, 1_int8 ] -allocate( data, source=dummy ) -call map % init( fnv_1_hasher ) -call set( key, [ 0_int8, 1_int8, 2_int8, 3_int8, 4_int8 ] ) -call set( other, data ) -call map % map_entry( key, other, conflict ) -if ( .not. conflict ) then -call map % get_other_data( key, other ) -else -error stop 'Key is already present in the map.' -end if -call get( other, data ) -select type( data ) -typeis (dummy_type) -print *, 'Other data % value = ', data % value -class default -print *, 'Invalid data type in other' -end select + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: chaining_hashmap_type, int_index + use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set, get + logical :: conflict, exists + type(key_type) :: key + type(other_type) :: other + type(chaining_hashmap_type) :: map + type dummy_type + integer(int8) :: value(4) + end type dummy_type + type(dummy_type) :: dummy + class(*), allocatable :: data + dummy%value = [4_int8, 3_int8, 2_int8, 1_int8] + allocate (data, source=dummy) + call map%init(fnv_1_hasher) + call set(key, [0_int8, 1_int8, 2_int8, 3_int8, 4_int8]) + call set(other, data) + call map%map_entry(key, other, conflict) + if (.not. conflict) then + call map%get_other_data(key, other) + else + error stop 'Key is already present in the map.' + end if + call get(other, data) + select type (data) + typeis(dummy_type) + print *, 'Other data % value = ', data%value + class default + print *, 'Invalid data type in other' + end select end program demo_get_other_data diff --git a/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 b/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 index 45cca12db..328d39c6e 100644 --- a/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 +++ b/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 @@ -1,14 +1,14 @@ program demo_hasher_fun -use stdlib_hashmap_wrappers, only: fnv_1a_hasher, hasher_fun, set, key_type -use stdlib_kinds, only: int8, int32 -implicit none -procedure(hasher_fun), pointer :: hasher_pointer -integer(int8), allocatable :: array1(:) -integer(int32) :: hash -type(key_type) :: key -hasher_pointer => fnv_1a_hasher -array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] -call set( key, array1 ) -hash = hasher_pointer(key) -print *, hash + use stdlib_hashmap_wrappers, only: fnv_1a_hasher, hasher_fun, set, key_type + use stdlib_kinds, only: int8, int32 + implicit none + procedure(hasher_fun), pointer :: hasher_pointer + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + hasher_pointer => fnv_1a_hasher + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = hasher_pointer(key) + print *, hash end program demo_hasher_fun diff --git a/test/example/hashmaps/demo_hashmaps_init.f90 b/test/example/hashmaps/demo_hashmaps_init.f90 index 344192dbe..78f213883 100644 --- a/test/example/hashmaps/demo_hashmaps_init.f90 +++ b/test/example/hashmaps/demo_hashmaps_init.f90 @@ -1,7 +1,7 @@ program demo_init -use stdlib_hashmaps, only: chaining_hashmap_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher -implicit none -type(chaining_hashmap_type) :: map -call map % init( fnv_1_hasher, slots_bits=10 ) + use stdlib_hashmaps, only: chaining_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + call map%init(fnv_1_hasher, slots_bits=10) end program demo_init diff --git a/test/example/hashmaps/demo_hashmaps_key_test.f90 b/test/example/hashmaps/demo_hashmaps_key_test.f90 index a91c942a2..d91a96897 100644 --- a/test/example/hashmaps/demo_hashmaps_key_test.f90 +++ b/test/example/hashmaps/demo_hashmaps_key_test.f90 @@ -1,13 +1,13 @@ program demo_key_test -use stdlib_kinds, only: int8 -use stdlib_hashmaps, only: chaining_hashmap_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set -implicit none -type(chaining_hashmap_type) :: map -type(key_type) :: key -logical :: present -call map % init( fnv_1_hasher ) -call set(key, [0_int8, 1_int8] ) -call map % key_test ( key, present ) -print *, "Initial key of 10 present for empty map = ", present + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: chaining_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set + implicit none + type(chaining_hashmap_type) :: map + type(key_type) :: key + logical :: present + call map%init(fnv_1_hasher) + call set(key, [0_int8, 1_int8]) + call map%key_test(key, present) + print *, "Initial key of 10 present for empty map = ", present end program demo_key_test diff --git a/test/example/hashmaps/demo_hashmaps_loading.f90 b/test/example/hashmaps/demo_hashmaps_loading.f90 index 3079e3c7c..75cf80438 100644 --- a/test/example/hashmaps/demo_hashmaps_loading.f90 +++ b/test/example/hashmaps/demo_hashmaps_loading.f90 @@ -1,10 +1,10 @@ program demo_loading -use stdlib_hashmaps, only: open_hashmap_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher -implicit none -type(open_hashmap_type) :: map -real :: ratio -call map % init( fnv_1_hasher ) -ratio = map % loading () -print *, "Initial loading = ", ratio + use stdlib_hashmaps, only: open_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(open_hashmap_type) :: map + real :: ratio + call map%init(fnv_1_hasher) + ratio = map%loading() + print *, "Initial loading = ", ratio end program demo_loading diff --git a/test/example/hashmaps/demo_hashmaps_map_entry.f90 b/test/example/hashmaps/demo_hashmaps_map_entry.f90 index 4f4445d38..ecebb2c79 100644 --- a/test/example/hashmaps/demo_hashmaps_map_entry.f90 +++ b/test/example/hashmaps/demo_hashmaps_map_entry.f90 @@ -1,16 +1,16 @@ program demo_map_entry -use, intrinsic:: iso_fortran_env, only: int8 -use stdlib_hashmaps, only: chaining_hashmap_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set -type(chaining_hashmap_type) :: map -type(key_type) :: key -logical :: conflict -type(other_type) :: other -class(*), allocatable :: dummy -allocate( dummy, source=4 ) -call map % init( fnv_1_hasher, slots_bits=10 ) -call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) -call set( other, dummy ) -call map % map_entry( key, other, conflict ) -print *, 'CONFLICT = ', conflict + use, intrinsic:: iso_fortran_env, only: int8 + use stdlib_hashmaps, only: chaining_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set + type(chaining_hashmap_type) :: map + type(key_type) :: key + logical :: conflict + type(other_type) :: other + class(*), allocatable :: dummy + allocate (dummy, source=4) + call map%init(fnv_1_hasher, slots_bits=10) + call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) + call set(other, dummy) + call map%map_entry(key, other, conflict) + print *, 'CONFLICT = ', conflict end program demo_map_entry diff --git a/test/example/hashmaps/demo_hashmaps_num_slots.f90 b/test/example/hashmaps/demo_hashmaps_num_slots.f90 index 7ee036677..af99d62d2 100644 --- a/test/example/hashmaps/demo_hashmaps_num_slots.f90 +++ b/test/example/hashmaps/demo_hashmaps_num_slots.f90 @@ -1,10 +1,10 @@ program demo_num_slots -use stdlib_hashmaps, only: chaining_hashmap_type, int_index -use stdlib_hashmap_wrappers, only: fnv_1_hasher -implicit none -type(chaining_hashmap_type) :: map -integer(int_index) :: initial_slots -call map % init( fnv_1_hasher ) -initial_slots = map % num_slots () -print *, "Initial slots = ", initial_slots + use stdlib_hashmaps, only: chaining_hashmap_type, int_index + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + integer(int_index) :: initial_slots + call map%init(fnv_1_hasher) + initial_slots = map%num_slots() + print *, "Initial slots = ", initial_slots end program demo_num_slots diff --git a/test/example/hashmaps/demo_hashmaps_probes.f90 b/test/example/hashmaps/demo_hashmaps_probes.f90 index ac16b6be7..43a5d2b5d 100644 --- a/test/example/hashmaps/demo_hashmaps_probes.f90 +++ b/test/example/hashmaps/demo_hashmaps_probes.f90 @@ -1,10 +1,10 @@ program demo_probes -use stdlib_hashmaps, only: chaining_hashmap_type, int_index -use stdlib_hashmap_wrappers, only: fnv_1_hasher -implicit none -type(chaining_hashmap_type) :: map -real :: nprobes -call map % init( fnv_1_hasher ) -nprobes = map % map_probes() -print *, "Initial probes = ", nprobes + use stdlib_hashmaps, only: chaining_hashmap_type, int_index + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + real :: nprobes + call map%init(fnv_1_hasher) + nprobes = map%map_probes() + print *, "Initial probes = ", nprobes end program demo_probes diff --git a/test/example/hashmaps/demo_hashmaps_rehash.f90 b/test/example/hashmaps/demo_hashmaps_rehash.f90 index 7290ea3bf..dea398a00 100644 --- a/test/example/hashmaps/demo_hashmaps_rehash.f90 +++ b/test/example/hashmaps/demo_hashmaps_rehash.f90 @@ -1,17 +1,17 @@ program demo_rehash -use stdlib_kinds, only: int8 -use stdlib_hashmaps, only: open_hashmap_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher,& -key_type, other_type, set -implicit none -type(open_hashmap_type) :: map -type(key_type) :: key -type(other_type) :: other -class(*), allocatable :: dummy -allocate( dummy, source='a dummy value' ) -call map % init( fnv_1_hasher, slots_bits=10 ) -call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) -call set( other, dummy ) -call map % map_entry( key, other ) -call map % rehash( fnv_1a_hasher ) + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: open_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher, & + key_type, other_type, set + implicit none + type(open_hashmap_type) :: map + type(key_type) :: key + type(other_type) :: other + class(*), allocatable :: dummy + allocate (dummy, source='a dummy value') + call map%init(fnv_1_hasher, slots_bits=10) + call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) + call set(other, dummy) + call map%map_entry(key, other) + call map%rehash(fnv_1a_hasher) end program demo_rehash diff --git a/test/example/hashmaps/demo_hashmaps_remove.f90 b/test/example/hashmaps/demo_hashmaps_remove.f90 index c950f88bf..f112596e6 100644 --- a/test/example/hashmaps/demo_hashmaps_remove.f90 +++ b/test/example/hashmaps/demo_hashmaps_remove.f90 @@ -1,18 +1,18 @@ program demo_remove -use stdlib_kinds, only: int8 -use stdlib_hashmaps, only: open_hashmap_type, int_index -use stdlib_hashmap_wrappers, only: fnv_1_hasher, & -fnv_1a_hasher, key_type, other_type, set -type(open_hashmap_type) :: map -type(key_type) :: key -type(other_type) :: other -logical :: existed -class(*), allocatable :: dummy -allocate( dummy, source=4.0 ) -call map % init( fnv_1_hasher, slots_bits=10 ) -call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) -call set( other, dummy ) -call map % map_entry( key, other ) -call map % remove( key, existed ) -print *, "Removed key existed = ", existed + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: open_hashmap_type, int_index + use stdlib_hashmap_wrappers, only: fnv_1_hasher, & + fnv_1a_hasher, key_type, other_type, set + type(open_hashmap_type) :: map + type(key_type) :: key + type(other_type) :: other + logical :: existed + class(*), allocatable :: dummy + allocate (dummy, source=4.0) + call map%init(fnv_1_hasher, slots_bits=10) + call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) + call set(other, dummy) + call map%map_entry(key, other) + call map%remove(key, existed) + print *, "Removed key existed = ", existed end program demo_remove diff --git a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 index 26b893c6a..67c23477a 100644 --- a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 @@ -1,13 +1,13 @@ program demo_seeded_nmhash32_hasher -use stdlib_hashmap_wrappers, only: & -seeded_nmhash32_hasher, key_type, set -use iso_fortran_env, only: int8, int32 -implicit none -integer(int8), allocatable :: array1(:) -integer(int32) :: hash -type(key_type) :: key -array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] -call set( key, array1 ) -hash = seeded_nmhash32_hasher (key) -print *, hash + use stdlib_hashmap_wrappers, only: & + seeded_nmhash32_hasher, key_type, set + use iso_fortran_env, only: int8, int32 + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = seeded_nmhash32_hasher(key) + print *, hash end program demo_seeded_nmhash32_hasher diff --git a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 index cfa5ba575..81680b3e5 100644 --- a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 @@ -1,13 +1,13 @@ program demo_seeded_nmhash32x_hasher -use stdlib_kinds, only: int8, int32 -use stdlib_hashmap_wrappers, only: & -seeded_nmhash32x_hasher, key_type, set -implicit none -integer(int8), allocatable :: array1(:) -integer(int32) :: hash -type(key_type) :: key -array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] -call set( key, array1 ) -hash = seeded_nmhash32x_hasher (key) -print *, hash + use stdlib_kinds, only: int8, int32 + use stdlib_hashmap_wrappers, only: & + seeded_nmhash32x_hasher, key_type, set + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = seeded_nmhash32x_hasher(key) + print *, hash end program demo_seeded_nmhash32x_hasher diff --git a/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 b/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 index 3663b8141..4234a6726 100644 --- a/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 @@ -1,13 +1,13 @@ program demo_seeded_water_hasher -use stdlib_hashmap_wrappers, only: & -seeded_water_hasher, key_type, set -use iso_fortran_env, only: int8, int32 -implicit none -integer(int8), allocatable :: array1(:) -integer(int32) :: hash -type(key_type) :: key -array1 = [ 5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8 ] -call set( key, array1 ) -hash = seeded_water_hasher (key) -print *, hash + use stdlib_hashmap_wrappers, only: & + seeded_water_hasher, key_type, set + use iso_fortran_env, only: int8, int32 + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = seeded_water_hasher(key) + print *, hash end program demo_seeded_water_hasher diff --git a/test/example/hashmaps/demo_hashmaps_set.f90 b/test/example/hashmaps/demo_hashmaps_set.f90 index d9b87e6c7..cd28ca66b 100644 --- a/test/example/hashmaps/demo_hashmaps_set.f90 +++ b/test/example/hashmaps/demo_hashmaps_set.f90 @@ -1,16 +1,16 @@ program demo_set -use stdlib_hashmap_wrappers, only: & -get, key_type, set -use iso_fortran_env, only: int8 -implicit none -integer(int8), allocatable :: value(:), result(:) -type(key_type) :: key -integer(int8) :: i -allocate( value(1:15) ) -do i=1, 15 -value(i) = i -end do -call set( key, value ) -call get( key, result ) -print *, 'RESULT == VALUE = ', all( value == result ) + use stdlib_hashmap_wrappers, only: & + get, key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8), allocatable :: value(:), result(:) + type(key_type) :: key + integer(int8) :: i + allocate (value(1:15)) + do i = 1, 15 + value(i) = i + end do + call set(key, value) + call get(key, result) + print *, 'RESULT == VALUE = ', all(value == result) end program demo_set diff --git a/test/example/hashmaps/demo_hashmaps_set_other_data.f90 b/test/example/hashmaps/demo_hashmaps_set_other_data.f90 index 4e470a978..5d2a87b2c 100644 --- a/test/example/hashmaps/demo_hashmaps_set_other_data.f90 +++ b/test/example/hashmaps/demo_hashmaps_set_other_data.f90 @@ -1,22 +1,22 @@ program demo_set_other_data -use stdlib_kinds, only: int8 -use stdlib_hashmaps, only: open_hashmap_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher, & -fnv_1a_hasher, key_type, other_type, set -implicit none -logical :: exists -type(open_hashmap_type) :: map -type(key_type) :: key -type(other_type) :: other -class(*), allocatable :: dummy -call map % init( fnv_1_hasher, slots_bits=10 ) -allocate( dummy, source='A value' ) -call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] ) -call set( other, dummy ) -call map % map_entry( key, other ) -deallocate( dummy ) -allocate( dummy, source='Another value' ) -call set( other, dummy ) -call map % set_other_data( key, other, exists ) -print *, 'The entry to have its other data replaced exists = ', exists + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: open_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher, & + fnv_1a_hasher, key_type, other_type, set + implicit none + logical :: exists + type(open_hashmap_type) :: map + type(key_type) :: key + type(other_type) :: other + class(*), allocatable :: dummy + call map%init(fnv_1_hasher, slots_bits=10) + allocate (dummy, source='A value') + call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) + call set(other, dummy) + call map%map_entry(key, other) + deallocate (dummy) + allocate (dummy, source='Another value') + call set(other, dummy) + call map%set_other_data(key, other, exists) + print *, 'The entry to have its other data replaced exists = ', exists end program demo_set_other_data diff --git a/test/example/hashmaps/demo_hashmaps_slots_bits.f90 b/test/example/hashmaps/demo_hashmaps_slots_bits.f90 index 389e8fea7..f12344d81 100644 --- a/test/example/hashmaps/demo_hashmaps_slots_bits.f90 +++ b/test/example/hashmaps/demo_hashmaps_slots_bits.f90 @@ -1,10 +1,10 @@ program demo_slots_bits -use stdlib_hashmaps, only: chaining_hashmap_type -use stdlib_hashmap_wrappers, only: fnv_1_hasher -implicit none -type(chaining_hashmap_type) :: map -integer :: bits -call map % init( fnv_1_hasher ) -bits = map % slots_bits () -print *, "Initial slot bits = ", bits + use stdlib_hashmaps, only: chaining_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + integer :: bits + call map%init(fnv_1_hasher) + bits = map%slots_bits() + print *, "Initial slot bits = ", bits end program demo_slots_bits diff --git a/test/example/hashmaps/demo_hashmaps_total_depth.f90 b/test/example/hashmaps/demo_hashmaps_total_depth.f90 index 6b87d095d..8c3f15e1a 100644 --- a/test/example/hashmaps/demo_hashmaps_total_depth.f90 +++ b/test/example/hashmaps/demo_hashmaps_total_depth.f90 @@ -1,10 +1,10 @@ program demo_total_depth -use stdlib_hashmaps, only: chaining_hashmap_type, int_depth -use stdlib_hashmap_wrappers, only: fnv_1_hasher -implicit none -type(chaining_hashmap_type) :: map -integer(int_depth) :: initial_depth -call map % init( fnv_1_hasher ) -initial_depth = map % total_depth () -print *, "Initial total depth = ", initial_depth + use stdlib_hashmaps, only: chaining_hashmap_type, int_depth + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + integer(int_depth) :: initial_depth + call map%init(fnv_1_hasher) + initial_depth = map%total_depth() + print *, "Initial total depth = ", initial_depth end program demo_total_depth diff --git a/test/example/io/demo_fmt_constants.f90 b/test/example/io/demo_fmt_constants.f90 index 01842def2..bdd94ae70 100644 --- a/test/example/io/demo_fmt_constants.f90 +++ b/test/example/io/demo_fmt_constants.f90 @@ -1,26 +1,26 @@ program demo_fmt_constants -use stdlib_kinds, only : int32, int64, sp, dp -use stdlib_io, only : FMT_INT, FMT_REAL_SP, FMT_REAL_DP, FMT_COMPLEX_SP, FMT_COMPLEX_DP -implicit none + use stdlib_kinds, only: int32, int64, sp, dp + use stdlib_io, only: FMT_INT, FMT_REAL_SP, FMT_REAL_DP, FMT_COMPLEX_SP, FMT_COMPLEX_DP + implicit none -integer(kind=int32) :: i32 -integer(kind=int64) :: i64 -real(kind=sp) :: r32 -real(kind=dp) :: r64 -complex(kind=sp) :: c32 -complex(kind=dp) :: c64 + integer(kind=int32) :: i32 + integer(kind=int64) :: i64 + real(kind=sp) :: r32 + real(kind=dp) :: r64 + complex(kind=sp) :: c32 + complex(kind=dp) :: c64 -i32 = 100_int32 -i64 = 100_int64 -r32 = 100.0_sp -r64 = 100.0_dp -c32 = cmplx(100.0_sp, kind=sp) -c64 = cmplx(100.0_dp, kind=dp) + i32 = 100_int32 + i64 = 100_int64 + r32 = 100.0_sp + r64 = 100.0_dp + c32 = cmplx(100.0_sp, kind=sp) + c64 = cmplx(100.0_dp, kind=dp) -print "(2("//FMT_INT//",1x))", i32, i64 ! outputs: 100 100 -print FMT_REAL_SP, r32 ! outputs: 1.00000000E+02 -print FMT_REAL_DP, r64 ! outputs: 1.0000000000000000E+002 -print FMT_COMPLEX_SP, c32 ! outputs: 1.00000000E+02 0.00000000E+00 -print FMT_COMPLEX_DP, c64 ! outputs: 1.0000000000000000E+002 0.0000000000000000E+000 + print "(2("//FMT_INT//",1x))", i32, i64 ! outputs: 100 100 + print FMT_REAL_SP, r32 ! outputs: 1.00000000E+02 + print FMT_REAL_DP, r64 ! outputs: 1.0000000000000000E+002 + print FMT_COMPLEX_SP, c32 ! outputs: 1.00000000E+02 0.00000000E+00 + print FMT_COMPLEX_DP, c64 ! outputs: 1.0000000000000000E+002 0.0000000000000000E+000 end program demo_fmt_constants diff --git a/test/example/io/demo_getline.f90 b/test/example/io/demo_getline.f90 index c197b2087..ceb800919 100644 --- a/test/example/io/demo_getline.f90 +++ b/test/example/io/demo_getline.f90 @@ -1,13 +1,13 @@ program demo_getline -use, intrinsic :: iso_fortran_env, only : input_unit, output_unit -use stdlib_io, only: getline -implicit none -character(len=:), allocatable :: line -integer :: stat + use, intrinsic :: iso_fortran_env, only: input_unit, output_unit + use stdlib_io, only: getline + implicit none + character(len=:), allocatable :: line + integer :: stat -call getline(input_unit, line, stat) -do while(stat == 0) -write(output_unit, '(a)') line -call getline(input_unit, line, stat) -end do + call getline(input_unit, line, stat) + do while (stat == 0) + write (output_unit, '(a)') line + call getline(input_unit, line, stat) + end do end program demo_getline diff --git a/test/example/io/demo_loadnpy.f90 b/test/example/io/demo_loadnpy.f90 index 5d4cc1b9e..0af352fd4 100644 --- a/test/example/io/demo_loadnpy.f90 +++ b/test/example/io/demo_loadnpy.f90 @@ -1,6 +1,6 @@ program demo_loadnpy -use stdlib_io_npy, only: load_npy -implicit none -real, allocatable :: x(:,:) -call load_npy('example.npy', x) + use stdlib_io_npy, only: load_npy + implicit none + real, allocatable :: x(:, :) + call load_npy('example.npy', x) end program demo_loadnpy diff --git a/test/example/io/demo_loadtxt.f90 b/test/example/io/demo_loadtxt.f90 index 55360f938..ca5f46856 100644 --- a/test/example/io/demo_loadtxt.f90 +++ b/test/example/io/demo_loadtxt.f90 @@ -1,6 +1,6 @@ program demo_loadtxt -use stdlib_io, only: loadtxt -implicit none -real, allocatable :: x(:,:) -call loadtxt('example.dat', x) + use stdlib_io, only: loadtxt + implicit none + real, allocatable :: x(:, :) + call loadtxt('example.dat', x) end program demo_loadtxt diff --git a/test/example/io/demo_open.f90 b/test/example/io/demo_open.f90 index 7792ac425..58592ebb6 100644 --- a/test/example/io/demo_open.f90 +++ b/test/example/io/demo_open.f90 @@ -1,8 +1,8 @@ program demo_open -use stdlib_io, only: open -implicit none -integer :: u -u = open('example.dat', 'wt') -write(u,'(a)')'This is an example for open' -close(u) + use stdlib_io, only: open + implicit none + integer :: u + u = open ('example.dat', 'wt') + write (u, '(a)') 'This is an example for open' + close (u) end program demo_open diff --git a/test/example/io/demo_savenpy.f90 b/test/example/io/demo_savenpy.f90 index 8cac2fe7d..81ef9942e 100644 --- a/test/example/io/demo_savenpy.f90 +++ b/test/example/io/demo_savenpy.f90 @@ -1,6 +1,6 @@ program demo_savenpy -use stdlib_io_npy, only: save_npy -implicit none -real :: x(3,2) = 1 -call save_npy('example.npy', x) + use stdlib_io_npy, only: save_npy + implicit none + real :: x(3, 2) = 1 + call save_npy('example.npy', x) end program demo_savenpy diff --git a/test/example/io/demo_savetxt.f90 b/test/example/io/demo_savetxt.f90 index 507a6b0a5..054871dca 100644 --- a/test/example/io/demo_savetxt.f90 +++ b/test/example/io/demo_savetxt.f90 @@ -1,6 +1,6 @@ program demo_savetxt -use stdlib_io, only: savetxt -implicit none -real :: x(3,2) = 1 -call savetxt('example.dat', x) + use stdlib_io, only: savetxt + implicit none + real :: x(3, 2) = 1 + call savetxt('example.dat', x) end program demo_savetxt diff --git a/test/example/linalg/demo_diag1.f90 b/test/example/linalg/demo_diag1.f90 index 5e1b5c4bf..508a08977 100644 --- a/test/example/linalg/demo_diag1.f90 +++ b/test/example/linalg/demo_diag1.f90 @@ -1,7 +1,7 @@ program demo_diag1 -use stdlib_linalg, only: diag -implicit none -real, allocatable :: A(:,:) -integer :: i -A = diag([(1,i=1,10)]) ! creates a 10 by 10 identity matrix + use stdlib_linalg, only: diag + implicit none + real, allocatable :: A(:, :) + integer :: i + A = diag([(1, i=1, 10)]) ! creates a 10 by 10 identity matrix end program demo_diag1 diff --git a/test/example/linalg/demo_diag2.f90 b/test/example/linalg/demo_diag2.f90 index fbbe0bf65..859a6d3df 100644 --- a/test/example/linalg/demo_diag2.f90 +++ b/test/example/linalg/demo_diag2.f90 @@ -1,9 +1,9 @@ program demo_diag2 -use stdlib_linalg, only: diag -implicit none -real, allocatable :: v(:) -real, allocatable :: A(:,:) -integer :: i -v = [1,2,3,4,5] -A = diag(v) ! creates a 5 by 5 matrix with elements of v on the diagonal + use stdlib_linalg, only: diag + implicit none + real, allocatable :: v(:) + real, allocatable :: A(:, :) + integer :: i + v = [1, 2, 3, 4, 5] + A = diag(v) ! creates a 5 by 5 matrix with elements of v on the diagonal end program demo_diag2 diff --git a/test/example/linalg/demo_diag3.f90 b/test/example/linalg/demo_diag3.f90 index c9d1814f0..47d4e2961 100644 --- a/test/example/linalg/demo_diag3.f90 +++ b/test/example/linalg/demo_diag3.f90 @@ -1,11 +1,11 @@ program demo_diag3 -use stdlib_linalg, only: diag -implicit none -integer, parameter :: n = 10 -real :: c(n), ul(n-1) -real :: A(n,n) -integer :: i -c = 2 -ul = -1 -A = diag(ul,-1) + diag(c) + diag(ul,1) ! Gil Strang's favorite matrix + use stdlib_linalg, only: diag + implicit none + integer, parameter :: n = 10 + real :: c(n), ul(n - 1) + real :: A(n, n) + integer :: i + c = 2 + ul = -1 + A = diag(ul, -1) + diag(c) + diag(ul, 1) ! Gil Strang's favorite matrix end program demo_diag3 diff --git a/test/example/linalg/demo_diag4.f90 b/test/example/linalg/demo_diag4.f90 index 078f1e406..39663cf57 100644 --- a/test/example/linalg/demo_diag4.f90 +++ b/test/example/linalg/demo_diag4.f90 @@ -1,10 +1,10 @@ program demo_diag4 -use stdlib_linalg, only: diag -implicit none -integer, parameter :: n = 12 -real :: A(n,n) -real :: v(n) -integer :: i -call random_number(A) -v = diag(A) ! v contains diagonal elements of A + use stdlib_linalg, only: diag + implicit none + integer, parameter :: n = 12 + real :: A(n, n) + real :: v(n) + integer :: i + call random_number(A) + v = diag(A) ! v contains diagonal elements of A end program demo_diag4 diff --git a/test/example/linalg/demo_diag5.f90 b/test/example/linalg/demo_diag5.f90 index a066f3160..f13ccf3a2 100644 --- a/test/example/linalg/demo_diag5.f90 +++ b/test/example/linalg/demo_diag5.f90 @@ -1,11 +1,11 @@ program demo_diag5 -use stdlib_linalg, only: diag -implicit none -integer, parameter :: n = 3 -real :: A(n,n) -real, allocatable :: v(:) -integer :: i -A = reshape([1,2,3,4,5,6,7,8,9],[n,n]) -v = diag(A,-1) ! v is [2,6] -v = diag(A,1) ! v is [4,8] + use stdlib_linalg, only: diag + implicit none + integer, parameter :: n = 3 + real :: A(n, n) + real, allocatable :: v(:) + integer :: i + A = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [n, n]) + v = diag(A, -1) ! v is [2,6] + v = diag(A, 1) ! v is [4,8] end program demo_diag5 diff --git a/test/example/linalg/demo_eye1.f90 b/test/example/linalg/demo_eye1.f90 index 5cdb828b6..d3f484979 100644 --- a/test/example/linalg/demo_eye1.f90 +++ b/test/example/linalg/demo_eye1.f90 @@ -1,14 +1,14 @@ program demo_eye1 -use stdlib_linalg, only: eye -implicit none -integer :: i(2,2) -real :: a(3,3) -real :: b(2,3) !! Matrix is non-square. -complex :: c(2,2) -I = eye(2) !! [1,0; 0,1] -A = eye(3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] -A = eye(3,3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] -B = eye(2,3) !! [1.0,0.0,0.0; 0.0,1.0,0.0] -C = eye(2,2) !! [(1.0,0.0),(0.0,0.0); (0.0,0.0),(1.0,0.0)] -C = (1.0,1.0)*eye(2,2) !! [(1.0,1.0),(0.0,0.0); (0.0,0.0),(1.0,1.0)] + use stdlib_linalg, only: eye + implicit none + integer :: i(2, 2) + real :: a(3, 3) + real :: b(2, 3) !! Matrix is non-square. + complex :: c(2, 2) + I = eye(2) !! [1,0; 0,1] + A = eye(3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] + A = eye(3, 3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] + B = eye(2, 3) !! [1.0,0.0,0.0; 0.0,1.0,0.0] + C = eye(2, 2) !! [(1.0,0.0),(0.0,0.0); (0.0,0.0),(1.0,0.0)] + C = (1.0, 1.0)*eye(2, 2) !! [(1.0,1.0),(0.0,0.0); (0.0,0.0),(1.0,1.0)] end program demo_eye1 diff --git a/test/example/linalg/demo_eye2.f90 b/test/example/linalg/demo_eye2.f90 index 1f899f264..b125fd67e 100644 --- a/test/example/linalg/demo_eye2.f90 +++ b/test/example/linalg/demo_eye2.f90 @@ -1,5 +1,5 @@ program demo_eye2 -use stdlib_linalg, only: eye, diag -implicit none -print *, all(eye(4) == diag([1,1,1,1])) ! prints .true. + use stdlib_linalg, only: eye, diag + implicit none + print *, all(eye(4) == diag([1, 1, 1, 1])) ! prints .true. end program demo_eye2 diff --git a/test/example/linalg/demo_is_diagonal.f90 b/test/example/linalg/demo_is_diagonal.f90 index b1d56ada0..56b230cdb 100644 --- a/test/example/linalg/demo_is_diagonal.f90 +++ b/test/example/linalg/demo_is_diagonal.f90 @@ -1,10 +1,10 @@ program demo_is_diagonal -use stdlib_linalg, only: is_diagonal -implicit none -real :: A(2,2), B(2,2) -logical :: res -A = reshape([1., 0., 0., 4.], shape(A)) -B = reshape([1., 0., 3., 4.], shape(B)) -res = is_diagonal(A) ! returns .true. -res = is_diagonal(B) ! returns .false. + use stdlib_linalg, only: is_diagonal + implicit none + real :: A(2, 2), B(2, 2) + logical :: res + A = reshape([1., 0., 0., 4.], shape(A)) + B = reshape([1., 0., 3., 4.], shape(B)) + res = is_diagonal(A) ! returns .true. + res = is_diagonal(B) ! returns .false. end program demo_is_diagonal diff --git a/test/example/linalg/demo_is_hermitian.f90 b/test/example/linalg/demo_is_hermitian.f90 index 6b52e8c80..4dbdeea38 100644 --- a/test/example/linalg/demo_is_hermitian.f90 +++ b/test/example/linalg/demo_is_hermitian.f90 @@ -1,10 +1,10 @@ program demo_is_hermitian -use stdlib_linalg, only: is_hermitian -implicit none -complex :: A(2,2), B(2,2) -logical :: res -A = reshape([cmplx(1.,0.), cmplx(3.,-1.), cmplx(3.,1.), cmplx(4.,0.)], shape(A)) -B = reshape([cmplx(1.,0.), cmplx(3.,1.), cmplx(3.,1.), cmplx(4.,0.)], shape(B)) -res = is_hermitian(A) ! returns .true. -res = is_hermitian(B) ! returns .false. + use stdlib_linalg, only: is_hermitian + implicit none + complex :: A(2, 2), B(2, 2) + logical :: res + A = reshape([cmplx(1., 0.), cmplx(3., -1.), cmplx(3., 1.), cmplx(4., 0.)], shape(A)) + B = reshape([cmplx(1., 0.), cmplx(3., 1.), cmplx(3., 1.), cmplx(4., 0.)], shape(B)) + res = is_hermitian(A) ! returns .true. + res = is_hermitian(B) ! returns .false. end program demo_is_hermitian diff --git a/test/example/linalg/demo_is_hessenberg.f90 b/test/example/linalg/demo_is_hessenberg.f90 index e1e84aee1..b4972fecd 100644 --- a/test/example/linalg/demo_is_hessenberg.f90 +++ b/test/example/linalg/demo_is_hessenberg.f90 @@ -1,10 +1,10 @@ program demo_is_hessenberg -use stdlib_linalg, only: is_hessenberg -implicit none -real :: A(3,3), B(3,3) -logical :: res -A = reshape([1., 2., 0., 4., 5., 6., 7., 8., 9.], shape(A)) -B = reshape([1., 2., 3., 4., 5., 6., 7., 8., 9.], shape(B)) -res = is_hessenberg(A,'u') ! returns .true. -res = is_hessenberg(B,'u') ! returns .false. + use stdlib_linalg, only: is_hessenberg + implicit none + real :: A(3, 3), B(3, 3) + logical :: res + A = reshape([1., 2., 0., 4., 5., 6., 7., 8., 9.], shape(A)) + B = reshape([1., 2., 3., 4., 5., 6., 7., 8., 9.], shape(B)) + res = is_hessenberg(A, 'u') ! returns .true. + res = is_hessenberg(B, 'u') ! returns .false. end program demo_is_hessenberg diff --git a/test/example/linalg/demo_is_skew_symmetric.f90 b/test/example/linalg/demo_is_skew_symmetric.f90 index bfcfae4a9..2bd576e86 100644 --- a/test/example/linalg/demo_is_skew_symmetric.f90 +++ b/test/example/linalg/demo_is_skew_symmetric.f90 @@ -1,10 +1,10 @@ program demo_is_skew_symmetric -use stdlib_linalg, only: is_skew_symmetric -implicit none -real :: A(2,2), B(2,2) -logical :: res -A = reshape([0., -3., 3., 0.], shape(A)) -B = reshape([0., 3., 3., 0.], shape(B)) -res = is_skew_symmetric(A) ! returns .true. -res = is_skew_symmetric(B) ! returns .false. + use stdlib_linalg, only: is_skew_symmetric + implicit none + real :: A(2, 2), B(2, 2) + logical :: res + A = reshape([0., -3., 3., 0.], shape(A)) + B = reshape([0., 3., 3., 0.], shape(B)) + res = is_skew_symmetric(A) ! returns .true. + res = is_skew_symmetric(B) ! returns .false. end program demo_is_skew_symmetric diff --git a/test/example/linalg/demo_is_square.f90 b/test/example/linalg/demo_is_square.f90 index fccaf5c01..07ebf4985 100644 --- a/test/example/linalg/demo_is_square.f90 +++ b/test/example/linalg/demo_is_square.f90 @@ -1,10 +1,10 @@ program demo_is_square -use stdlib_linalg, only: is_square -implicit none -real :: A(2,2), B(3,2) -logical :: res -A = reshape([1., 2., 3., 4.], shape(A)) -B = reshape([1., 2., 3., 4., 5., 6.], shape(B)) -res = is_square(A) ! returns .true. -res = is_square(B) ! returns .false. + use stdlib_linalg, only: is_square + implicit none + real :: A(2, 2), B(3, 2) + logical :: res + A = reshape([1., 2., 3., 4.], shape(A)) + B = reshape([1., 2., 3., 4., 5., 6.], shape(B)) + res = is_square(A) ! returns .true. + res = is_square(B) ! returns .false. end program demo_is_square diff --git a/test/example/linalg/demo_is_symmetric.f90 b/test/example/linalg/demo_is_symmetric.f90 index b4c1f8c7b..f3bb4b09e 100644 --- a/test/example/linalg/demo_is_symmetric.f90 +++ b/test/example/linalg/demo_is_symmetric.f90 @@ -1,10 +1,10 @@ program demo_is_symmetric -use stdlib_linalg, only: is_symmetric -implicit none -real :: A(2,2), B(2,2) -logical :: res -A = reshape([1., 3., 3., 4.], shape(A)) -B = reshape([1., 0., 3., 4.], shape(B)) -res = is_symmetric(A) ! returns .true. -res = is_symmetric(B) ! returns .false. + use stdlib_linalg, only: is_symmetric + implicit none + real :: A(2, 2), B(2, 2) + logical :: res + A = reshape([1., 3., 3., 4.], shape(A)) + B = reshape([1., 0., 3., 4.], shape(B)) + res = is_symmetric(A) ! returns .true. + res = is_symmetric(B) ! returns .false. end program demo_is_symmetric diff --git a/test/example/linalg/demo_is_triangular.f90 b/test/example/linalg/demo_is_triangular.f90 index 097bd59f7..286981f57 100644 --- a/test/example/linalg/demo_is_triangular.f90 +++ b/test/example/linalg/demo_is_triangular.f90 @@ -1,10 +1,10 @@ program demo_is_triangular -use stdlib_linalg, only: is_triangular -implicit none -real :: A(3,3), B(3,3) -logical :: res -A = reshape([1., 0., 0., 4., 5., 0., 7., 8., 9.], shape(A)) -B = reshape([1., 0., 3., 4., 5., 0., 7., 8., 9.], shape(B)) -res = is_triangular(A,'u') ! returns .true. -res = is_triangular(B,'u') ! returns .false. + use stdlib_linalg, only: is_triangular + implicit none + real :: A(3, 3), B(3, 3) + logical :: res + A = reshape([1., 0., 0., 4., 5., 0., 7., 8., 9.], shape(A)) + B = reshape([1., 0., 3., 4., 5., 0., 7., 8., 9.], shape(B)) + res = is_triangular(A, 'u') ! returns .true. + res = is_triangular(B, 'u') ! returns .false. end program demo_is_triangular diff --git a/test/example/linalg/demo_outer_product.f90 b/test/example/linalg/demo_outer_product.f90 index 0a461958c..3ecef34b1 100644 --- a/test/example/linalg/demo_outer_product.f90 +++ b/test/example/linalg/demo_outer_product.f90 @@ -1,9 +1,9 @@ program demo_outer_product -use stdlib_linalg, only: outer_product -implicit none -real, allocatable :: A(:,:), u(:), v(:) -u = [1., 2., 3. ] -v = [3., 4.] -A = outer_product(u,v) + use stdlib_linalg, only: outer_product + implicit none + real, allocatable :: A(:, :), u(:), v(:) + u = [1., 2., 3.] + v = [3., 4.] + A = outer_product(u, v) !A = reshape([3., 6., 9., 4., 8., 12.], [3,2]) end program demo_outer_product diff --git a/test/example/linalg/demo_trace.f90 b/test/example/linalg/demo_trace.f90 index 8770f16d0..84a6c569c 100644 --- a/test/example/linalg/demo_trace.f90 +++ b/test/example/linalg/demo_trace.f90 @@ -1,7 +1,7 @@ program demo_trace -use stdlib_linalg, only: trace -implicit none -real :: A(3,3) -A = reshape([1,2,3,4,5,6,7,8,9],[3,3]) -print *, trace(A) ! 1 + 5 + 9 + use stdlib_linalg, only: trace + implicit none + real :: A(3, 3) + A = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [3, 3]) + print *, trace(A) ! 1 + 5 + 9 end program demo_trace diff --git a/test/example/logger/demo_add_log_unit.f90 b/test/example/logger/demo_add_log_unit.f90 index ebeee808b..9985631ee 100644 --- a/test/example/logger/demo_add_log_unit.f90 +++ b/test/example/logger/demo_add_log_unit.f90 @@ -1,21 +1,21 @@ program demo_add_log_unit -use stdlib_logger, only: global_logger, read_only_error + use stdlib_logger, only: global_logger, read_only_error -character(256) :: iomsg -integer :: iostat, unit, stat + character(256) :: iomsg + integer :: iostat, unit, stat -open( newunit=unit, file = 'error_log.txt', & -form='formatted', status='replace', & -position='rewind', err=999, & -action='read', iostat=iostat, iomsg=iomsg ) + open (newunit=unit, file='error_log.txt', & + form='formatted', status='replace', & + position='rewind', err=999, & + action='read', iostat=iostat, iomsg=iomsg) -call global_logger % add_log_unit( unit, stat ) -select case ( stat ) + call global_logger%add_log_unit(unit, stat) + select case (stat) -case ( read_only_error ) -error stop 'Unable to write to "error_log.txt".' + case (read_only_error) + error stop 'Unable to write to "error_log.txt".' -end select + end select 999 error stop 'Unable to open "error_log.txt".' diff --git a/test/example/logger/demo_configure.f90 b/test/example/logger/demo_configure.f90 index 6e1d676a7..ee29e0718 100644 --- a/test/example/logger/demo_configure.f90 +++ b/test/example/logger/demo_configure.f90 @@ -1,6 +1,6 @@ program demo_configure -use stdlib_logger, only: global => global_logger + use stdlib_logger, only: global => global_logger -call global % configure( indent=.false., max_width=72 ) + call global%configure(indent=.false., max_width=72) end program demo_configure diff --git a/test/example/logger/demo_global_logger.f90 b/test/example/logger/demo_global_logger.f90 index 982f350ad..426b27cfc 100644 --- a/test/example/logger/demo_global_logger.f90 +++ b/test/example/logger/demo_global_logger.f90 @@ -1,12 +1,12 @@ program demo_global_logger -use stdlib_logger, global => global_logger + use stdlib_logger, global => global_logger -integer :: unit, stat + integer :: unit, stat -call global % add_log_file( 'error_log.txt', unit, & -position='asis', stat=stat ) -if ( stat /= success ) then -error stop 'Unable to open "error_log.txt".' -end if + call global%add_log_file('error_log.txt', unit, & + position='asis', stat=stat) + if (stat /= success) then + error stop 'Unable to open "error_log.txt".' + end if end program demo_global_logger diff --git a/test/example/logger/demo_log_io_error.f90 b/test/example/logger/demo_log_io_error.f90 index 7ffbc58be..ca2351a48 100644 --- a/test/example/logger/demo_log_io_error.f90 +++ b/test/example/logger/demo_log_io_error.f90 @@ -1,20 +1,20 @@ program demo_log_io_error -use stdlib_logger, global=>global_logger + use stdlib_logger, global => global_logger -character(*), parameter :: filename = 'dummy.txt' -integer :: iostat, lun -character(128) :: iomsg -character(*), parameter :: message = & - 'Failure in opening "dummy.txt".' + character(*), parameter :: filename = 'dummy.txt' + integer :: iostat, lun + character(128) :: iomsg + character(*), parameter :: message = & + 'Failure in opening "dummy.txt".' -open( newunit=lun, file = filename, form='formatted', & -status='old', iostat=iostat, iomsg=iomsg ) -if ( iostat /= 0 ) then -call global % log_io_error( message, & -procedure = 'EXAMPLE', & -iostat=iostat, & -iomsg = iomsg ) -error stop 'Error on opening a file' -end if + open (newunit=lun, file=filename, form='formatted', & + status='old', iostat=iostat, iomsg=iomsg) + if (iostat /= 0) then + call global%log_io_error(message, & + procedure='EXAMPLE', & + iostat=iostat, & + iomsg=iomsg) + error stop 'Error on opening a file' + end if end program demo_log_io_error diff --git a/test/example/logger/demo_log_text_error.f90 b/test/example/logger/demo_log_text_error.f90 index e79795044..3d226a263 100644 --- a/test/example/logger/demo_log_text_error.f90 +++ b/test/example/logger/demo_log_text_error.f90 @@ -1,24 +1,24 @@ program demo_log_text_error -use stdlib_logger + use stdlib_logger -character(*), parameter :: filename = 'dummy.txt' -integer :: col_no, line_no, lun -character(128) :: line -character(*), parameter :: message = 'Bad text found.' + character(*), parameter :: filename = 'dummy.txt' + integer :: col_no, line_no, lun + character(128) :: line + character(*), parameter :: message = 'Bad text found.' -open( newunit=lun, file = filename, status = 'old', & - form='formatted' ) -line_no = 0 -do -read( lun, fmt='(a)', end=900 ) line -line_no = line_no + 1 -call check_line( line, status, col_no ) -if ( status /= 0 ) then -call global_logger % log_text_error( line, & -col_no, message, filename, line_no ) -error stop 'Error in reading ' // filename -end if -end do + open (newunit=lun, file=filename, status='old', & + form='formatted') + line_no = 0 + do + read (lun, fmt='(a)', end=900) line + line_no = line_no + 1 + call check_line(line, status, col_no) + if (status /= 0) then + call global_logger%log_text_error(line, & + col_no, message, filename, line_no) + error stop 'Error in reading '//filename + end if + end do 900 continue end program demo_log_text_error diff --git a/test/example/math/demo_clip_integer.f90 b/test/example/math/demo_clip_integer.f90 index 9c652e26d..f8da03474 100644 --- a/test/example/math/demo_clip_integer.f90 +++ b/test/example/math/demo_clip_integer.f90 @@ -1,16 +1,16 @@ program demo_clip_integer -use stdlib_math, only: clip -use stdlib_kinds, only: int32 -implicit none -integer(int32) :: x -integer(int32) :: xmin -integer(int32) :: xmax -integer(int32) :: clipped_value + use stdlib_math, only: clip + use stdlib_kinds, only: int32 + implicit none + integer(int32) :: x + integer(int32) :: xmin + integer(int32) :: xmax + integer(int32) :: clipped_value -xmin = -5_int32 -xmax = 5_int32 -x = 12_int32 + xmin = -5_int32 + xmax = 5_int32 + x = 12_int32 -clipped_value = clip(x, xmin, xmax) + clipped_value = clip(x, xmin, xmax) ! clipped_value <- 5 end program demo_clip_integer diff --git a/test/example/math/demo_clip_real.f90 b/test/example/math/demo_clip_real.f90 index 0299e3593..a8d70c8d8 100644 --- a/test/example/math/demo_clip_real.f90 +++ b/test/example/math/demo_clip_real.f90 @@ -1,16 +1,16 @@ program demo_clip_real -use stdlib_math, only: clip -use stdlib_kinds, only: sp -implicit none -real(sp) :: x -real(sp) :: xmin -real(sp) :: xmax -real(sp) :: clipped_value + use stdlib_math, only: clip + use stdlib_kinds, only: sp + implicit none + real(sp) :: x + real(sp) :: xmin + real(sp) :: xmax + real(sp) :: clipped_value -xmin = -5.769_sp -xmax = 3.025_sp -x = 3.025_sp + xmin = -5.769_sp + xmax = 3.025_sp + x = 3.025_sp -clipped_value = clip(x, xmin, xmax) + clipped_value = clip(x, xmin, xmax) ! clipped_value <- 3.02500010 end program demo_clip_real diff --git a/test/example/math/demo_diff.f90 b/test/example/math/demo_diff.f90 index 50ebdf502..36c7140bc 100644 --- a/test/example/math/demo_diff.f90 +++ b/test/example/math/demo_diff.f90 @@ -1,22 +1,22 @@ program demo_diff -use stdlib_math, only: diff -implicit none + use stdlib_math, only: diff + implicit none -integer :: i(7) = [1, 1, 2, 3, 5, 8, 13] -real :: x(6) = [0, 5, 15, 30, 50, 75] -integer :: A(3, 3) = reshape([1, 7, 17, 3, 11, 19, 5, 13, 23], [3, 3]) -integer :: Y(3, 2) + integer :: i(7) = [1, 1, 2, 3, 5, 8, 13] + real :: x(6) = [0, 5, 15, 30, 50, 75] + integer :: A(3, 3) = reshape([1, 7, 17, 3, 11, 19, 5, 13, 23], [3, 3]) + integer :: Y(3, 2) -print *, diff(i) ! [0, 1, 1, 2, 3, 5] -print *, diff(x, 2) ! [5.0, 5.0, 5.0, 5.0] + print *, diff(i) ! [0, 1, 1, 2, 3, 5] + print *, diff(x, 2) ! [5.0, 5.0, 5.0, 5.0] -Y = diff(A, n=1, dim=2) -print *, Y(1, :) ! [2, 2] -print *, Y(2, :) ! [4, 2] -print *, Y(3, :) ! [2, 4] + Y = diff(A, n=1, dim=2) + print *, Y(1, :) ! [2, 2] + print *, Y(2, :) ! [4, 2] + print *, Y(3, :) ! [2, 4] -print *, diff(i, prepend=[0]) ! [1, 0, 1, 1, 2, 3, 5] -print *, diff(i, append=[21]) ! [0, 1, 1, 2, 3, 5, 8] + print *, diff(i, prepend=[0]) ! [1, 0, 1, 1, 2, 3, 5] + print *, diff(i, append=[21]) ! [0, 1, 1, 2, 3, 5, 8] end program demo_diff diff --git a/test/example/math/demo_gcd.f90 b/test/example/math/demo_gcd.f90 index bbf4a872e..4ba36005c 100644 --- a/test/example/math/demo_gcd.f90 +++ b/test/example/math/demo_gcd.f90 @@ -1,9 +1,9 @@ program demo_gcd -use stdlib_math, only: gcd -implicit none -integer :: a, b, c + use stdlib_math, only: gcd + implicit none + integer :: a, b, c -a = 48 -b = 18 -c = gcd(a, b) ! returns 6 + a = 48 + b = 18 + c = gcd(a, b) ! returns 6 end program demo_gcd diff --git a/test/example/math/demo_linspace_complex.f90 b/test/example/math/demo_linspace_complex.f90 index d09db00b9..092d9df3d 100644 --- a/test/example/math/demo_linspace_complex.f90 +++ b/test/example/math/demo_linspace_complex.f90 @@ -1,12 +1,12 @@ program demo_linspace_complex -use stdlib_math, only: linspace -use stdlib_kinds, only: dp -implicit none + use stdlib_math, only: linspace + use stdlib_kinds, only: dp + implicit none -complex(dp) :: start = complex(10.0_dp, 5.0_dp) -complex(dp) :: end = complex(-10.0_dp, 15.0_dp) + complex(dp) :: start = complex(10.0_dp, 5.0_dp) + complex(dp) :: end = complex(-10.0_dp, 15.0_dp) -complex(dp) :: z(11) + complex(dp) :: z(11) -z = linspace(start, end, 11) + z = linspace(start, end, 11) end program demo_linspace_complex diff --git a/test/example/math/demo_linspace_int16.f90 b/test/example/math/demo_linspace_int16.f90 index 7f1cad33e..591f462f0 100644 --- a/test/example/math/demo_linspace_int16.f90 +++ b/test/example/math/demo_linspace_int16.f90 @@ -1,12 +1,12 @@ program demo_linspace_int16 -use stdlib_math, only: linspace -use stdlib_kinds, only: int16, dp -implicit none + use stdlib_math, only: linspace + use stdlib_kinds, only: int16, dp + implicit none -integer(int16) :: start = 10_int16 -integer(int16) :: end = 23_int16 + integer(int16) :: start = 10_int16 + integer(int16) :: end = 23_int16 -real(dp) :: r(15) + real(dp) :: r(15) -r = linspace(start, end, 15) + r = linspace(start, end, 15) end program demo_linspace_int16 diff --git a/test/example/math/demo_logspace_complex.f90 b/test/example/math/demo_logspace_complex.f90 index b3095d86b..e9cb3ec0b 100644 --- a/test/example/math/demo_logspace_complex.f90 +++ b/test/example/math/demo_logspace_complex.f90 @@ -1,12 +1,12 @@ program demo_logspace_complex -use stdlib_math, only: logspace -use stdlib_kinds, only: dp -implicit none + use stdlib_math, only: logspace + use stdlib_kinds, only: dp + implicit none -complex(dp) :: start = (10.0_dp, 5.0_dp) -complex(dp) :: end = (-10.0_dp, 15.0_dp) + complex(dp) :: start = (10.0_dp, 5.0_dp) + complex(dp) :: end = (-10.0_dp, 15.0_dp) -complex(dp) :: z(11) ! Complex values raised to complex powers results in complex values + complex(dp) :: z(11) ! Complex values raised to complex powers results in complex values -z = logspace(start, end, 11) + z = logspace(start, end, 11) end program demo_logspace_complex diff --git a/test/example/math/demo_logspace_int.f90 b/test/example/math/demo_logspace_int.f90 index b055e0914..bbfa5ab82 100644 --- a/test/example/math/demo_logspace_int.f90 +++ b/test/example/math/demo_logspace_int.f90 @@ -1,13 +1,13 @@ program demo_logspace_int -use stdlib_math, only: logspace -use stdlib_kinds, only: dp -implicit none + use stdlib_math, only: logspace + use stdlib_kinds, only: dp + implicit none -integer, parameter :: start = 10 -integer, parameter :: end = 23 -integer, parameter :: n = 15 + integer, parameter :: start = 10 + integer, parameter :: end = 23 + integer, parameter :: n = 15 -real(dp) :: r(n) ! Integer values raised to real powers results in real values + real(dp) :: r(n) ! Integer values raised to real powers results in real values -r = logspace(start, end, n) + r = logspace(start, end, n) end program demo_logspace_int diff --git a/test/example/math/demo_logspace_rstart_cbase.f90 b/test/example/math/demo_logspace_rstart_cbase.f90 index 73b8e49e1..9bd527100 100644 --- a/test/example/math/demo_logspace_rstart_cbase.f90 +++ b/test/example/math/demo_logspace_rstart_cbase.f90 @@ -1,15 +1,15 @@ program demo_logspace_rstart_cbase -use stdlib_math, only: logspace -use stdlib_kinds, only: dp -implicit none + use stdlib_math, only: logspace + use stdlib_kinds, only: dp + implicit none -real(dp) :: start = 0.0_dp -real(dp) :: end = 3.0_dp -integer, parameter :: n = 4 -complex(dp) :: base = (0.0_dp, 1.0_dp) + real(dp) :: start = 0.0_dp + real(dp) :: end = 3.0_dp + integer, parameter :: n = 4 + complex(dp) :: base = (0.0_dp, 1.0_dp) -complex(dp) :: z(n) ! complex values raised to real powers result in complex values + complex(dp) :: z(n) ! complex values raised to real powers result in complex values -z = logspace(start, end, n, base) + z = logspace(start, end, n, base) end program demo_logspace_rstart_cbase diff --git a/test/example/math/demo_math_all_close.f90 b/test/example/math/demo_math_all_close.f90 index dd8cf5238..657529168 100644 --- a/test/example/math/demo_math_all_close.f90 +++ b/test/example/math/demo_math_all_close.f90 @@ -1,15 +1,15 @@ program demo_math_all_close -use stdlib_math, only: all_close -real :: x(2) = [1, 2], y, NAN -complex :: z(4, 4) + use stdlib_math, only: all_close + real :: x(2) = [1, 2], y, NAN + complex :: z(4, 4) -y = -3 -NAN = sqrt(y) -z = (1.0, 1.0) + y = -3 + NAN = sqrt(y) + z = (1.0, 1.0) -print *, all_close(z+cmplx(1.0e-11, 1.0e-11), z) ! T -print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.) + print *, all_close(z + cmplx(1.0e-11, 1.0e-11), z) ! T + print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.) ! NAN, F, T end program demo_math_all_close diff --git a/test/example/math/demo_math_arange.f90 b/test/example/math/demo_math_arange.f90 index da35792e4..2ac5f5d20 100644 --- a/test/example/math/demo_math_arange.f90 +++ b/test/example/math/demo_math_arange.f90 @@ -1,19 +1,19 @@ program demo_math_arange -use stdlib_math, only: arange + use stdlib_math, only: arange -print *, arange(3) ! [1,2,3] -print *, arange(-1) ! [1,0,-1] -print *, arange(0,2) ! [0,1,2] -print *, arange(1,-1) ! [1,0,-1] -print *, arange(0, 2, 2) ! [0,2] + print *, arange(3) ! [1,2,3] + print *, arange(-1) ! [1,0,-1] + print *, arange(0, 2) ! [0,1,2] + print *, arange(1, -1) ! [1,0,-1] + print *, arange(0, 2, 2) ! [0,2] -print *, arange(3.0) ! [1.0,2.0,3.0] -print *, arange(0.0,5.0) ! [0.0,1.0,2.0,3.0,4.0,5.0] -print *, arange(0.0,6.0,2.5) ! [0.0,2.5,5.0] + print *, arange(3.0) ! [1.0,2.0,3.0] + print *, arange(0.0, 5.0) ! [0.0,1.0,2.0,3.0,4.0,5.0] + print *, arange(0.0, 6.0, 2.5) ! [0.0,2.5,5.0] -print *, (1.0,1.0)*arange(3) ! [(1.0,1.0),(2.0,2.0),[3.0,3.0]] + print *, (1.0, 1.0)*arange(3) ! [(1.0,1.0),(2.0,2.0),[3.0,3.0]] -print *, arange(0.0,2.0,-2.0) ! [0.0,2.0]. Not recommended: `step` argument is negative! -print *, arange(0.0,2.0,0.0) ! [0.0,1.0,2.0]. Not recommended: `step` argument is zero! + print *, arange(0.0, 2.0, -2.0) ! [0.0,2.0]. Not recommended: `step` argument is negative! + print *, arange(0.0, 2.0, 0.0) ! [0.0,1.0,2.0]. Not recommended: `step` argument is zero! end program demo_math_arange diff --git a/test/example/math/demo_math_arg.f90 b/test/example/math/demo_math_arg.f90 index eaca24141..976826c44 100644 --- a/test/example/math/demo_math_arg.f90 +++ b/test/example/math/demo_math_arg.f90 @@ -1,7 +1,7 @@ program demo_math_arg -use stdlib_math, only: arg -print *, arg((0.0, 0.0)) ! 0.0 -print *, arg((3.0, 4.0)) ! 0.927 -print *, arg(2.0*exp((0.0, 0.5))) ! 0.5 -print *, arg([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [π/2, 0.0, -π/2, π] + use stdlib_math, only: arg + print *, arg((0.0, 0.0)) ! 0.0 + print *, arg((3.0, 4.0)) ! 0.927 + print *, arg(2.0*exp((0.0, 0.5))) ! 0.5 + print *, arg([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [π/2, 0.0, -π/2, π] end program demo_math_arg diff --git a/test/example/math/demo_math_argd.f90 b/test/example/math/demo_math_argd.f90 index 5db939c55..19f43b467 100644 --- a/test/example/math/demo_math_argd.f90 +++ b/test/example/math/demo_math_argd.f90 @@ -1,7 +1,7 @@ program demo_math_argd -use stdlib_math, only: argd -print *, argd((0.0, 0.0)) ! 0.0° -print *, argd((3.0, 4.0)) ! 53.1° -print *, argd(2.0*exp((0.0, 0.5))) ! 28.64° -print *, argd([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [90°, 0°, -90°, 180°] + use stdlib_math, only: argd + print *, argd((0.0, 0.0)) ! 0.0° + print *, argd((3.0, 4.0)) ! 53.1° + print *, argd(2.0*exp((0.0, 0.5))) ! 28.64° + print *, argd([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [90°, 0°, -90°, 180°] end program demo_math_argd diff --git a/test/example/math/demo_math_argpi.f90 b/test/example/math/demo_math_argpi.f90 index 0b9491735..1ffdb8154 100644 --- a/test/example/math/demo_math_argpi.f90 +++ b/test/example/math/demo_math_argpi.f90 @@ -1,7 +1,7 @@ program demo_math_argpi -use stdlib_math, only: argpi -print *, argpi((0.0, 0.0)) ! 0.0 -print *, argpi((3.0, 4.0)) ! 0.295 -print *, argpi(2.0*exp((0.0, 0.5))) ! 0.159 -print *, argpi([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [0.5, 0.0, -0.5, 1.0] + use stdlib_math, only: argpi + print *, argpi((0.0, 0.0)) ! 0.0 + print *, argpi((3.0, 4.0)) ! 0.295 + print *, argpi(2.0*exp((0.0, 0.5))) ! 0.159 + print *, argpi([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [0.5, 0.0, -0.5, 1.0] end program demo_math_argpi diff --git a/test/example/math/demo_math_is_close.f90 b/test/example/math/demo_math_is_close.f90 index f5f956e4d..ce559aa9d 100644 --- a/test/example/math/demo_math_is_close.f90 +++ b/test/example/math/demo_math_is_close.f90 @@ -1,14 +1,14 @@ program demo_math_is_close -use stdlib_math, only: is_close -real :: x(2) = [1, 2], y, NAN + use stdlib_math, only: is_close + real :: x(2) = [1, 2], y, NAN -y = -3 -NAN = sqrt(y) + y = -3 + NAN = sqrt(y) -print *, is_close(x,[real :: 1, 2.1]) ! [T, F] -print *, is_close(2.0, 2.1, abs_tol=0.1) ! T -print *, NAN, is_close(2.0, NAN), is_close(2.0, NAN, equal_nan=.true.) ! NAN, F, F -print *, is_close(NAN, NAN), is_close(NAN, NAN, equal_nan=.true.) ! F, T + print *, is_close(x, [real :: 1, 2.1]) ! [T, F] + print *, is_close(2.0, 2.1, abs_tol=0.1) ! T + print *, NAN, is_close(2.0, NAN), is_close(2.0, NAN, equal_nan=.true.) ! NAN, F, F + print *, is_close(NAN, NAN), is_close(NAN, NAN, equal_nan=.true.) ! F, T end program demo_math_is_close diff --git a/test/example/optval/demo_optval.f90 b/test/example/optval/demo_optval.f90 index 7d0516f75..750aafd25 100644 --- a/test/example/optval/demo_optval.f90 +++ b/test/example/optval/demo_optval.f90 @@ -1,14 +1,14 @@ program demo_optval -use stdlib_optval, only: optval -implicit none -print *, root(64.0) + use stdlib_optval, only: optval + implicit none + print *, root(64.0) ! 8.0 -print *, root(64.0, 3) + print *, root(64.0, 3) ! 4.0 contains -real function root(x, n) - real, intent(in) :: x -integer, intent(in), optional :: n -root = x**(1.0/optval(n, 2)) -end function root + real function root(x, n) + real, intent(in) :: x + integer, intent(in), optional :: n + root = x**(1.0/optval(n, 2)) + end function root end program demo_optval diff --git a/test/example/quadrature/demo_gauss_legendre.f90 b/test/example/quadrature/demo_gauss_legendre.f90 index 1597543e8..b72d319cb 100644 --- a/test/example/quadrature/demo_gauss_legendre.f90 +++ b/test/example/quadrature/demo_gauss_legendre.f90 @@ -1,10 +1,10 @@ program demo_gauss_legendre -use iso_fortran_env, dp => real64 -use stdlib_quadrature, only: gauss_legendre -implicit none + use iso_fortran_env, dp => real64 + use stdlib_quadrature, only: gauss_legendre + implicit none -integer, parameter :: N = 6 -real(dp), dimension(N) :: x,w -call gauss_legendre(x,w) -print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) + integer, parameter :: N = 6 + real(dp), dimension(N) :: x, w + call gauss_legendre(x, w) + print *, "integral of x**2 from -1 to 1 is", sum(x**2*w) end program demo_gauss_legendre diff --git a/test/example/quadrature/demo_gauss_legendre_lobatto.f90 b/test/example/quadrature/demo_gauss_legendre_lobatto.f90 index 8d373d368..8c73f03f0 100644 --- a/test/example/quadrature/demo_gauss_legendre_lobatto.f90 +++ b/test/example/quadrature/demo_gauss_legendre_lobatto.f90 @@ -1,10 +1,10 @@ program demo_gauss_legendre_lobatto -use iso_fortran_env, dp => real64 -use stdlib_quadrature, only: gauss_legendre_lobatto -implicit none + use iso_fortran_env, dp => real64 + use stdlib_quadrature, only: gauss_legendre_lobatto + implicit none -integer, parameter :: N = 6 -real(dp), dimension(N) :: x,w -call gauss_legendre_lobatto(x,w) -print *, "integral of x**2 from -1 to 1 is", sum(x**2 * w) + integer, parameter :: N = 6 + real(dp), dimension(N) :: x, w + call gauss_legendre_lobatto(x, w) + print *, "integral of x**2 from -1 to 1 is", sum(x**2*w) end program demo_gauss_legendre_lobatto diff --git a/test/example/quadrature/demo_simps.f90 b/test/example/quadrature/demo_simps.f90 index f2ee73573..18cd40455 100644 --- a/test/example/quadrature/demo_simps.f90 +++ b/test/example/quadrature/demo_simps.f90 @@ -1,10 +1,10 @@ program demo_simps -use stdlib_quadrature, only: simps -implicit none -real, parameter :: x(5) = [0., 1., 2., 3., 4.] -real :: y(5) = 3.*x**2 -print *, simps(y, x) + use stdlib_quadrature, only: simps + implicit none + real, parameter :: x(5) = [0., 1., 2., 3., 4.] + real :: y(5) = 3.*x**2 + print *, simps(y, x) ! 64.0 -print *, simps(y, 0.5) + print *, simps(y, 0.5) ! 32.0 end program demo_simps diff --git a/test/example/quadrature/demo_simps_weights.f90 b/test/example/quadrature/demo_simps_weights.f90 index 5d94a893b..e92bcaf03 100644 --- a/test/example/quadrature/demo_simps_weights.f90 +++ b/test/example/quadrature/demo_simps_weights.f90 @@ -1,10 +1,10 @@ program demo_simps_weights -use stdlib_quadrature, only: simps_weights -implicit none -real, parameter :: x(5) = [0., 1., 2., 3., 4.] -real :: y(5) = 3.*x**2 -real :: w(5) -w = simps_weights(x) -print *, sum(w*y) + use stdlib_quadrature, only: simps_weights + implicit none + real, parameter :: x(5) = [0., 1., 2., 3., 4.] + real :: y(5) = 3.*x**2 + real :: w(5) + w = simps_weights(x) + print *, sum(w*y) ! 64.0 end program demo_simps_weights diff --git a/test/example/quadrature/demo_trapz.f90 b/test/example/quadrature/demo_trapz.f90 index 3997f696f..46f40f39b 100644 --- a/test/example/quadrature/demo_trapz.f90 +++ b/test/example/quadrature/demo_trapz.f90 @@ -1,10 +1,10 @@ program demo_trapz -use stdlib_quadrature, only: trapz -implicit none -real, parameter :: x(5) = [0., 1., 2., 3., 4.] -real :: y(5) = x**2 -print *, trapz(y, x) + use stdlib_quadrature, only: trapz + implicit none + real, parameter :: x(5) = [0., 1., 2., 3., 4.] + real :: y(5) = x**2 + print *, trapz(y, x) ! 22.0 -print *, trapz(y, 0.5) + print *, trapz(y, 0.5) ! 11.0 end program demo_trapz diff --git a/test/example/quadrature/demo_trapz_weights.f90 b/test/example/quadrature/demo_trapz_weights.f90 index 73a9e993a..9059b33f1 100644 --- a/test/example/quadrature/demo_trapz_weights.f90 +++ b/test/example/quadrature/demo_trapz_weights.f90 @@ -1,11 +1,11 @@ program demo_trapz_weights -use stdlib_quadrature, only: trapz_weights -implicit none -real, parameter :: x(5) = [0., 1., 2., 3., 4.] -real :: y(5) = x**2 -real :: w(5) -w = trapz_weights(x) -print *, sum(w*y) + use stdlib_quadrature, only: trapz_weights + implicit none + real, parameter :: x(5) = [0., 1., 2., 3., 4.] + real :: y(5) = x**2 + real :: w(5) + w = trapz_weights(x) + print *, sum(w*y) ! 22.0 end program demo_trapz_weights diff --git a/test/example/random/demo_dist_rand.f90 b/test/example/random/demo_dist_rand.f90 index 09fab8825..1a6fc3e05 100644 --- a/test/example/random/demo_dist_rand.f90 +++ b/test/example/random/demo_dist_rand.f90 @@ -1,17 +1,17 @@ program demo_dist_rand -use stdlib_kinds, only: int8, int16, int32, int64 -use stdlib_random, only : dist_rand, random_seed -implicit none -integer :: put, get + use stdlib_kinds, only: int8, int16, int32, int64 + use stdlib_random, only: dist_rand, random_seed + implicit none + integer :: put, get -put = 135792468 -call random_seed(put, get) ! set and get current value of seed -print *, dist_rand(1_int8) ! random integer in [-2^7, 2^7 - 1] + put = 135792468 + call random_seed(put, get) ! set and get current value of seed + print *, dist_rand(1_int8) ! random integer in [-2^7, 2^7 - 1] ! -90 -print *, dist_rand(1_int16) ! random integer in [-2^15, 2^15 - 1] + print *, dist_rand(1_int16) ! random integer in [-2^15, 2^15 - 1] ! -32725 -print *, dist_rand(1_int32) ! random integer in [-2^31, 2^31 - 1] + print *, dist_rand(1_int32) ! random integer in [-2^31, 2^31 - 1] ! -1601563881 -print *, dist_rand(1_int64) ! random integer in [-2^63, 2^63 - 1] + print *, dist_rand(1_int64) ! random integer in [-2^63, 2^63 - 1] ! 180977695517992208 end program demo_dist_rand diff --git a/test/example/random/demo_random_seed.f90 b/test/example/random/demo_random_seed.f90 index 28558f7f5..eb6628618 100644 --- a/test/example/random/demo_random_seed.f90 +++ b/test/example/random/demo_random_seed.f90 @@ -1,8 +1,8 @@ program demo_random_seed -use stdlib_random, only : random_seed -implicit none -integer :: seed_put, seed_get + use stdlib_random, only: random_seed + implicit none + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) ! set and get current value of seed + seed_put = 1234567 + call random_seed(seed_put, seed_get) ! set and get current value of seed end program demo_random_seed diff --git a/test/example/selection/demo_arg_select.f90 b/test/example/selection/demo_arg_select.f90 index acb80a73c..246cd43af 100644 --- a/test/example/selection/demo_arg_select.f90 +++ b/test/example/selection/demo_arg_select.f90 @@ -1,29 +1,29 @@ program demo_arg_select -use stdlib_selection, only: arg_select -implicit none + use stdlib_selection, only: arg_select + implicit none -real, allocatable :: array(:) -integer, allocatable :: indx(:) -integer :: kth_smallest -integer :: k, left, right + real, allocatable :: array(:) + integer, allocatable :: indx(:) + integer :: kth_smallest + integer :: k, left, right -array = [3., 2., 7., 4., 5., 1., 4., -1.] -indx = [( k, k = 1, size(array) )] + array = [3., 2., 7., 4., 5., 1., 4., -1.] + indx = [(k, k=1, size(array))] -k = 2 -call arg_select(array, indx, k, kth_smallest) -print*, array(kth_smallest) ! print 1.0 + k = 2 + call arg_select(array, indx, k, kth_smallest) + print *, array(kth_smallest) ! print 1.0 -k = 7 + k = 7 ! Due to the previous call to arg_select, we know for sure this is in an ! index >= 2 -call arg_select(array, indx, k, kth_smallest, left=2) -print*, array(kth_smallest) ! print 5.0 + call arg_select(array, indx, k, kth_smallest, left=2) + print *, array(kth_smallest) ! print 5.0 -k = 6 + k = 6 ! Due to the previous two calls to arg_select, we know for sure this is in ! an index >= 2 and <= 7 -call arg_select(array, indx, k, kth_smallest, left=2, right=7) -print*, array(kth_smallest) ! print 4.0 + call arg_select(array, indx, k, kth_smallest, left=2, right=7) + print *, array(kth_smallest) ! print 4.0 end program demo_arg_select diff --git a/test/example/selection/demo_select.f90 b/test/example/selection/demo_select.f90 index ad903b0f0..1f1eb904f 100644 --- a/test/example/selection/demo_select.f90 +++ b/test/example/selection/demo_select.f90 @@ -1,27 +1,27 @@ program demo_select -use stdlib_selection, only: select -implicit none + use stdlib_selection, only: select + implicit none -real, allocatable :: array(:) -real :: kth_smallest -integer :: k, left, right + real, allocatable :: array(:) + real :: kth_smallest + integer :: k, left, right -array = [3., 2., 7., 4., 5., 1., 4., -1.] + array = [3., 2., 7., 4., 5., 1., 4., -1.] -k = 2 -call select(array, k, kth_smallest) -print*, kth_smallest ! print 1.0 + k = 2 + call select(array, k, kth_smallest) + print *, kth_smallest ! print 1.0 -k = 7 + k = 7 ! Due to the previous call to select, we know for sure this is in an ! index >= 2 -call select(array, k, kth_smallest, left=2) -print*, kth_smallest ! print 5.0 + call select(array, k, kth_smallest, left=2) + print *, kth_smallest ! print 5.0 -k = 6 + k = 6 ! Due to the previous two calls to select, we know for sure this is in ! an index >= 2 and <= 7 -call select(array, k, kth_smallest, left=2, right=7) -print*, kth_smallest ! print 4.0 + call select(array, k, kth_smallest, left=2, right=7) + print *, kth_smallest ! print 4.0 end program demo_select diff --git a/test/example/selection/selection_vs_sort.f90 b/test/example/selection/selection_vs_sort.f90 index 03b92dff3..dbb4315a0 100644 --- a/test/example/selection/selection_vs_sort.f90 +++ b/test/example/selection/selection_vs_sort.f90 @@ -1,77 +1,77 @@ program selection_vs_sort -use stdlib_kinds, only: dp, sp, int64 -use stdlib_selection, only: select, arg_select -use stdlib_sorting, only: sort -implicit none - -call compare_select_sort_for_median(1) -call compare_select_sort_for_median(11) -call compare_select_sort_for_median(101) -call compare_select_sort_for_median(1001) -call compare_select_sort_for_median(10001) -call compare_select_sort_for_median(100001) + use stdlib_kinds, only: dp, sp, int64 + use stdlib_selection, only: select, arg_select + use stdlib_sorting, only: sort + implicit none + + call compare_select_sort_for_median(1) + call compare_select_sort_for_median(11) + call compare_select_sort_for_median(101) + call compare_select_sort_for_median(1001) + call compare_select_sort_for_median(10001) + call compare_select_sort_for_median(100001) contains -subroutine compare_select_sort_for_median(N) -integer, intent(in) :: N + subroutine compare_select_sort_for_median(N) + integer, intent(in) :: N -integer :: i, k, result_arg_select, indx(N), indx_local(N) -real :: random_vals(N), local_random_vals(N) -integer, parameter :: test_reps = 100 -integer(int64) :: t0, t1 -real :: result_sort, result_select -integer(int64) :: time_sort, time_select, time_arg_select -logical :: select_test_passed, arg_select_test_passed + integer :: i, k, result_arg_select, indx(N), indx_local(N) + real :: random_vals(N), local_random_vals(N) + integer, parameter :: test_reps = 100 + integer(int64) :: t0, t1 + real :: result_sort, result_select + integer(int64) :: time_sort, time_select, time_arg_select + logical :: select_test_passed, arg_select_test_passed ! Ensure N is odd -if(mod(N, 2) /= 1) stop + if (mod(N, 2) /= 1) stop -time_sort = 0 -time_select = 0 -time_arg_select = 0 + time_sort = 0 + time_select = 0 + time_arg_select = 0 -select_test_passed = .true. -arg_select_test_passed = .true. + select_test_passed = .true. + arg_select_test_passed = .true. -indx = (/( i, i = 1, N) /) + indx = (/(i, i=1, N)/) -k = (N+1)/2 ! Deliberate integer division + k = (N + 1)/2 ! Deliberate integer division -do i = 1, test_reps -call random_number(random_vals) + do i = 1, test_reps + call random_number(random_vals) ! Compute the median with sorting -local_random_vals = random_vals -call system_clock(t0) -call sort(local_random_vals) -result_sort = local_random_vals(k) -call system_clock(t1) -time_sort = time_sort + (t1 - t0) + local_random_vals = random_vals + call system_clock(t0) + call sort(local_random_vals) + result_sort = local_random_vals(k) + call system_clock(t1) + time_sort = time_sort + (t1 - t0) ! Compute the median with selection, assuming N is odd -local_random_vals = random_vals -call system_clock(t0) -call select(local_random_vals, k, result_select) -call system_clock(t1) -time_select = time_select + (t1 - t0) + local_random_vals = random_vals + call system_clock(t0) + call select(local_random_vals, k, result_select) + call system_clock(t1) + time_select = time_select + (t1 - t0) ! Compute the median with arg_select, assuming N is odd -local_random_vals = random_vals -indx_local = indx -call system_clock(t0) -call arg_select(local_random_vals, indx_local, k, result_arg_select) -call system_clock(t1) -time_arg_select = time_arg_select + (t1 - t0) - -if(result_select /= result_sort) select_test_passed = .FALSE. -if(local_random_vals(result_arg_select) /= result_sort) arg_select_test_passed = .FALSE. -end do - -print*, "select ; N=", N, '; ', merge('PASS', 'FAIL', select_test_passed), & -'; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_select) -print*, "arg_select; N=", N, '; ', merge('PASS', 'FAIL', arg_select_test_passed), & -'; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_arg_select) - -end subroutine + local_random_vals = random_vals + indx_local = indx + call system_clock(t0) + call arg_select(local_random_vals, indx_local, k, result_arg_select) + call system_clock(t1) + time_arg_select = time_arg_select + (t1 - t0) + + if (result_select /= result_sort) select_test_passed = .FALSE. + if (local_random_vals(result_arg_select) /= result_sort) arg_select_test_passed = .FALSE. + end do + + print *, "select ; N=", N, '; ', merge('PASS', 'FAIL', select_test_passed), & + '; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_select) + print *, "arg_select; N=", N, '; ', merge('PASS', 'FAIL', arg_select_test_passed), & + '; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_arg_select) + + end subroutine end program diff --git a/test/example/sorting/demo_ord_sort.f90 b/test/example/sorting/demo_ord_sort.f90 index 1039ee662..8d1420061 100644 --- a/test/example/sorting/demo_ord_sort.f90 +++ b/test/example/sorting/demo_ord_sort.f90 @@ -1,10 +1,10 @@ program demo_ord_sort -use stdlib_sorting, only: ord_sort -implicit none -integer, allocatable :: array1(:), work(:) + use stdlib_sorting, only: ord_sort + implicit none + integer, allocatable :: array1(:), work(:) -array1 = [ 5, 4, 3, 1, 10, 4, 9] -allocate(work, mold = array1) -call ord_sort(array1, work) -print*, array1 !print [1, 3, 4, 4, 5, 9, 10] + array1 = [5, 4, 3, 1, 10, 4, 9] + allocate (work, mold=array1) + call ord_sort(array1, work) + print *, array1 !print [1, 3, 4, 4, 5, 9, 10] end program demo_ord_sort diff --git a/test/example/sorting/demo_sort.f90 b/test/example/sorting/demo_sort.f90 index b89d7ee99..ac2c32e9e 100644 --- a/test/example/sorting/demo_sort.f90 +++ b/test/example/sorting/demo_sort.f90 @@ -1,9 +1,9 @@ program demo_sort -use stdlib_sorting, only: sort -implicit none -integer, allocatable :: array(:) + use stdlib_sorting, only: sort + implicit none + integer, allocatable :: array(:) -array = [ 5, 4, 3, 1, 10, 4, 9] -call sort(array) -print*, array !print [1, 3, 4, 4, 5, 9, 10] + array = [5, 4, 3, 1, 10, 4, 9] + call sort(array) + print *, array !print [1, 3, 4, 4, 5, 9, 10] end program demo_sort diff --git a/test/example/specialfunctions_gamma/demo_gamma.f90 b/test/example/specialfunctions_gamma/demo_gamma.f90 index cab60aee5..4fe421176 100644 --- a/test/example/specialfunctions_gamma/demo_gamma.f90 +++ b/test/example/specialfunctions_gamma/demo_gamma.f90 @@ -1,37 +1,37 @@ program demo_gamma -use stdlib_kinds, only : dp, int64 -use stdlib_specialfunctions_gamma, only : gamma -implicit none - -integer :: i -integer(int64) :: n -real :: x -real(dp) :: y -complex :: z -complex(dp) :: z1 - -i = 10 -n = 15_int64 -x = 2.5 -y = 4.3_dp -z = (2.3, 0.6) -z1 = (-4.2_dp, 3.1_dp) - -print *, gamma(i) !integer gives exact result + use stdlib_kinds, only: dp, int64 + use stdlib_specialfunctions_gamma, only: gamma + implicit none + + integer :: i + integer(int64) :: n + real :: x + real(dp) :: y + complex :: z + complex(dp) :: z1 + + i = 10 + n = 15_int64 + x = 2.5 + y = 4.3_dp + z = (2.3, 0.6) + z1 = (-4.2_dp, 3.1_dp) + + print *, gamma(i) !integer gives exact result ! 362880 -print *, gamma(n) + print *, gamma(n) ! 87178291200 -print *, gamma(x) ! intrinsic function call + print *, gamma(x) ! intrinsic function call ! 1.32934034 -print *, gamma(y) ! intrinsic function call + print *, gamma(y) ! intrinsic function call ! 8.8553433604540341 -print *, gamma(z) + print *, gamma(z) ! (0.988054395, 0.383354813) -print *, gamma(z1) + print *, gamma(z1) ! (-2.78916032990983999E-005, 9.83164600163221218E-006) end program demo_gamma diff --git a/test/example/specialfunctions_gamma/demo_gamma_p.f90 b/test/example/specialfunctions_gamma/demo_gamma_p.f90 index 10578df07..d802e6267 100644 --- a/test/example/specialfunctions_gamma/demo_gamma_p.f90 +++ b/test/example/specialfunctions_gamma/demo_gamma_p.f90 @@ -1,8 +1,8 @@ program demo_gamma_p -use stdlib_specialfunctions_gamma, only : rgp => regularized_gamma_p -implicit none + use stdlib_specialfunctions_gamma, only: rgp => regularized_gamma_p + implicit none -print *, rgp(3.0, 5.0) + print *, rgp(3.0, 5.0) ! 0.875347972 end program demo_gamma_p diff --git a/test/example/specialfunctions_gamma/demo_gamma_q.f90 b/test/example/specialfunctions_gamma/demo_gamma_q.f90 index 49eafa550..407cab723 100644 --- a/test/example/specialfunctions_gamma/demo_gamma_q.f90 +++ b/test/example/specialfunctions_gamma/demo_gamma_q.f90 @@ -1,8 +1,8 @@ program demo_gamma_q -use stdlib_specialfunctions_gamma, only : rgq => regularized_gamma_q -implicit none + use stdlib_specialfunctions_gamma, only: rgq => regularized_gamma_q + implicit none -print *, rgq(3.0, 5.0) + print *, rgq(3.0, 5.0) ! 0.124652028 end program demo_gamma_q diff --git a/test/example/specialfunctions_gamma/demo_ligamma.f90 b/test/example/specialfunctions_gamma/demo_ligamma.f90 index 1ba48c372..0aa27e38a 100644 --- a/test/example/specialfunctions_gamma/demo_ligamma.f90 +++ b/test/example/specialfunctions_gamma/demo_ligamma.f90 @@ -1,16 +1,16 @@ program demo_ligamma -use stdlib_specialfunctions_gamma, only : lig => lower_incomplete_gamma -implicit none -integer :: p -real :: p1, x + use stdlib_specialfunctions_gamma, only: lig => lower_incomplete_gamma + implicit none + integer :: p + real :: p1, x -p = 3 -p1 = 2.3 -print *, lig(p, -5.0) + p = 3 + p1 = 2.3 + print *, lig(p, -5.0) ! -2521.02417 -print *, lig(p1, 5.0) + print *, lig(p1, 5.0) ! 1.09715652 end program demo_ligamma diff --git a/test/example/specialfunctions_gamma/demo_log_factorial.f90 b/test/example/specialfunctions_gamma/demo_log_factorial.f90 index 3fd76f54f..0fc879857 100644 --- a/test/example/specialfunctions_gamma/demo_log_factorial.f90 +++ b/test/example/specialfunctions_gamma/demo_log_factorial.f90 @@ -1,15 +1,15 @@ program demo_log_factorial -use stdlib_kinds, only : int64 -use stdlib_specialfunctions_gamma, only : lf => log_factorial -implicit none -integer :: n + use stdlib_kinds, only: int64 + use stdlib_specialfunctions_gamma, only: lf => log_factorial + implicit none + integer :: n -n = 10 -print *, lf(n) + n = 10 + print *, lf(n) ! 15.1044130 -print *, lf(35_int64) + print *, lf(35_int64) ! 92.1361771 end program demo_log_factorial diff --git a/test/example/specialfunctions_gamma/demo_log_gamma.f90 b/test/example/specialfunctions_gamma/demo_log_gamma.f90 index c6d70910a..c096d6658 100644 --- a/test/example/specialfunctions_gamma/demo_log_gamma.f90 +++ b/test/example/specialfunctions_gamma/demo_log_gamma.f90 @@ -1,35 +1,35 @@ program demo_log_gamma -use stdlib_kinds, only : dp -use stdlib_specialfunctions_gamma, only : log_gamma -implicit none - -integer :: i -real :: x -real(dp) :: y -complex :: z -complex(dp) :: z1 - -i = 10 -x = 8.76 -y = x -z = (5.345, -3.467) -z1 = z -print *, log_gamma(i) !default single precision output + use stdlib_kinds, only: dp + use stdlib_specialfunctions_gamma, only: log_gamma + implicit none + + integer :: i + real :: x + real(dp) :: y + complex :: z + complex(dp) :: z1 + + i = 10 + x = 8.76 + y = x + z = (5.345, -3.467) + z1 = z + print *, log_gamma(i) !default single precision output !12.8018274 -print *, log_gamma(x) !intrinsic function call + print *, log_gamma(x) !intrinsic function call !10.0942659 -print *, log_gamma(y) !intrinsic function call + print *, log_gamma(y) !intrinsic function call !10.094265528673880 -print *, log_gamma(z) !same kind as input + print *, log_gamma(z) !same kind as input !(2.56165648, -5.73382425) -print *, log_gamma(z1) + print *, log_gamma(z1) !(2.5616575105114614, -5.7338247782852498) end program demo_log_gamma diff --git a/test/example/specialfunctions_gamma/demo_uigamma.f90 b/test/example/specialfunctions_gamma/demo_uigamma.f90 index 3ce99bd89..eed52b231 100644 --- a/test/example/specialfunctions_gamma/demo_uigamma.f90 +++ b/test/example/specialfunctions_gamma/demo_uigamma.f90 @@ -1,12 +1,12 @@ program demo_uigamma -use stdlib_specialfunctions_gamma, only : uig => upper_incomplete_gamma -implicit none + use stdlib_specialfunctions_gamma, only: uig => upper_incomplete_gamma + implicit none -print *, uig(3, -5.0) + print *, uig(3, -5.0) !2523.02295 -print *, uig(2.3, 5.0) + print *, uig(2.3, 5.0) !6.95552528E-02 end program demo_uigamma diff --git a/test/example/stats/demo_corr.f90 b/test/example/stats/demo_corr.f90 index 841b6804b..b7fad75e0 100644 --- a/test/example/stats/demo_corr.f90 +++ b/test/example/stats/demo_corr.f90 @@ -1,8 +1,8 @@ program demo_corr -use stdlib_stats, only: corr -implicit none -real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] -real :: y(1:2, 1:3) = reshape([ -1., 40., -3., 4., 10., 6. ], [ 2, 3]) -print *, corr(x, 1) !returns 1. -print *, corr(y, 2) !returns reshape([ 1., -.32480, -.32480, 1. ], [ 2, 3]) + use stdlib_stats, only: corr + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([-1., 40., -3., 4., 10., 6.], [2, 3]) + print *, corr(x, 1) !returns 1. + print *, corr(y, 2) !returns reshape([ 1., -.32480, -.32480, 1. ], [ 2, 3]) end program demo_corr diff --git a/test/example/stats/demo_cov.f90 b/test/example/stats/demo_cov.f90 index 56637e82f..9f4ce609d 100644 --- a/test/example/stats/demo_cov.f90 +++ b/test/example/stats/demo_cov.f90 @@ -1,9 +1,9 @@ program demo_cov -use stdlib_stats, only: cov -implicit none -real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] -real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) -print *, cov(x, 1) !returns 3.5 -print *, cov(x, 1, corrected = .false.) !returns 2.9167 -print *, cov(y, 1) !returns a square matrix of size 3 with all elements equal to 0.5 + use stdlib_stats, only: cov + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, cov(x, 1) !returns 3.5 + print *, cov(x, 1, corrected=.false.) !returns 2.9167 + print *, cov(y, 1) !returns a square matrix of size 3 with all elements equal to 0.5 end program demo_cov diff --git a/test/example/stats/demo_mean.f90 b/test/example/stats/demo_mean.f90 index d5a0cd702..5641cb4f9 100644 --- a/test/example/stats/demo_mean.f90 +++ b/test/example/stats/demo_mean.f90 @@ -1,10 +1,10 @@ program demo_mean -use stdlib_stats, only: mean -implicit none -real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] -real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) -print *, mean(x) !returns 3.5 -print *, mean(y) !returns 3.5 -print *, mean(y, 1) !returns [ 1.5, 3.5, 5.5 ] -print *, mean(y, 1,y > 3.) !returns [ NaN, 4.0, 5.5 ] + use stdlib_stats, only: mean + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, mean(x) !returns 3.5 + print *, mean(y) !returns 3.5 + print *, mean(y, 1) !returns [ 1.5, 3.5, 5.5 ] + print *, mean(y, 1, y > 3.) !returns [ NaN, 4.0, 5.5 ] end program demo_mean diff --git a/test/example/stats/demo_median.f90 b/test/example/stats/demo_median.f90 index 0025f8fd5..1170193d2 100644 --- a/test/example/stats/demo_median.f90 +++ b/test/example/stats/demo_median.f90 @@ -1,10 +1,10 @@ program demo_median -use stdlib_stats, only: median -implicit none -real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] -real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) -print *, median(x) !returns 3.5 -print *, median(y) !returns 3.5 -print *, median(y, 1) !returns [ 1.5, 3.5, 5.5 ] -print *, median(y, 1,y > 3.) !returns [ NaN, 4.0, 5.5 ] + use stdlib_stats, only: median + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, median(x) !returns 3.5 + print *, median(y) !returns 3.5 + print *, median(y, 1) !returns [ 1.5, 3.5, 5.5 ] + print *, median(y, 1, y > 3.) !returns [ NaN, 4.0, 5.5 ] end program demo_median diff --git a/test/example/stats/demo_moment.f90 b/test/example/stats/demo_moment.f90 index 70753108e..986612631 100644 --- a/test/example/stats/demo_moment.f90 +++ b/test/example/stats/demo_moment.f90 @@ -1,12 +1,12 @@ program demo_moment -use stdlib_stats, only: moment -implicit none -real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] -real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) -print *, moment(x, 2) !returns 2.9167 -print *, moment(y, 2) !returns 2.9167 -print *, moment(y, 2, 1) !returns [0.25, 0.25, 0.25] -print *, moment(y, 2, 1, mask = (y > 3.)) !returns [NaN, 0., 0.25] -print *, moment(x, 2, center = 0.) !returns 15.1667 -print *, moment(y, 1, 1, center = 0.) !returns [1.5, 3.5, 5.5] + use stdlib_stats, only: moment + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, moment(x, 2) !returns 2.9167 + print *, moment(y, 2) !returns 2.9167 + print *, moment(y, 2, 1) !returns [0.25, 0.25, 0.25] + print *, moment(y, 2, 1, mask=(y > 3.)) !returns [NaN, 0., 0.25] + print *, moment(x, 2, center=0.) !returns 15.1667 + print *, moment(y, 1, 1, center=0.) !returns [1.5, 3.5, 5.5] end program demo_moment diff --git a/test/example/stats/demo_var.f90 b/test/example/stats/demo_var.f90 index 2357ae9d5..c948d5e06 100644 --- a/test/example/stats/demo_var.f90 +++ b/test/example/stats/demo_var.f90 @@ -1,12 +1,12 @@ program demo_var -use stdlib_stats, only: var -implicit none -real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] -real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3]) -print *, var(x) !returns 3.5 -print *, var(x, corrected = .false.) !returns 2.9167 -print *, var(y) !returns 3.5 -print *, var(y, 1) !returns [0.5, 0.5, 0.5] -print *, var(y, 1, y > 3.) !returns [NaN, NaN, 0.5] -print *, var(y, 1, y > 3., corrected=.false.) !returns [NaN, 0., 0.25] + use stdlib_stats, only: var + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, var(x) !returns 3.5 + print *, var(x, corrected=.false.) !returns 2.9167 + print *, var(y) !returns 3.5 + print *, var(y, 1) !returns [0.5, 0.5, 0.5] + print *, var(y, 1, y > 3.) !returns [NaN, NaN, 0.5] + print *, var(y, 1, y > 3., corrected=.false.) !returns [NaN, 0., 0.25] end program demo_var diff --git a/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 b/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 index e9348c651..f69536dde 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 +++ b/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 @@ -1,28 +1,28 @@ program demo_exponential_cdf -use stdlib_random, only : random_seed -use stdlib_stats_distribution_exponential, only : exp_cdf => cdf_exp, & -rexp => rvs_exp + use stdlib_random, only: random_seed + use stdlib_stats_distribution_exponential, only: exp_cdf => cdf_exp, & + rexp => rvs_exp -implicit none -real :: x(2,3,4),a(2,3,4) -complex :: scale -integer :: seed_put, seed_get + implicit none + real :: x(2, 3, 4), a(2, 3, 4) + complex :: scale + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) -print *, exp_cdf(1.0, 1.0) ! a standard exponential cumulative at 1.0 + print *, exp_cdf(1.0, 1.0) ! a standard exponential cumulative at 1.0 ! 0.632120550 -print *, exp_cdf(2.0, 2.0) ! a cumulative at 2.0 with lambda=2 + print *, exp_cdf(2.0, 2.0) ! a cumulative at 2.0 with lambda=2 ! 0.981684387 -x = reshape(rexp(0.5, 24),[2,3,4]) + x = reshape(rexp(0.5, 24), [2, 3, 4]) ! standard exponential random variates array -a(:,:,:) = 0.5 -print *, exp_cdf(x, a) ! a rank 3 array of standard exponential cumulative + a(:, :, :) = 0.5 + print *, exp_cdf(x, a) ! a rank 3 array of standard exponential cumulative ! 8.57694745E-02 9.70223546E-02 1.52170658E-02 2.95336246E-02 ! 0.107568979 0.196659625 2.97447443E-02 0.366151094 0.163051903 @@ -30,8 +30,8 @@ program demo_exponential_cdf ! 0.192206264 0.330693483 0.179247737 2.92580128E-02 0.332765043 ! 0.472417951 0.500440359 8.56802464E-02 8.72612000E-03 3.55126858E-02 -scale = (0.5,1.0) -print *, exp_cdf((0.5,0.5),scale) + scale = (0.5, 1.0) + print *, exp_cdf((0.5, 0.5), scale) !complex exponential cumulative distribution at (0.5,0.5) with real part of !lambda=0.5 and imaginary part of lambda=1.0 diff --git a/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 b/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 index 86b9c6250..299221b8d 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 +++ b/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 @@ -1,27 +1,27 @@ program demo_exponential_pdf -use stdlib_random, only : random_seed -use stdlib_stats_distribution_exponential, only: exp_pdf => pdf_exp, & -rexp => rvs_exp + use stdlib_random, only: random_seed + use stdlib_stats_distribution_exponential, only: exp_pdf => pdf_exp, & + rexp => rvs_exp -implicit none -real :: x(2,3,4),a(2,3,4) -complex :: scale -integer :: seed_put, seed_get + implicit none + real :: x(2, 3, 4), a(2, 3, 4) + complex :: scale + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) -print *, exp_pdf(1.0,1.0) !a probability density at 1.0 in standard expon + print *, exp_pdf(1.0, 1.0) !a probability density at 1.0 in standard expon ! 0.367879450 -print *, exp_pdf(2.0,2.0) !a probability density at 2.0 with lambda=2.0 + print *, exp_pdf(2.0, 2.0) !a probability density at 2.0 with lambda=2.0 ! 3.66312787E-02 -x = reshape(rexp(0.5, 24),[2,3,4]) ! standard expon random variates array -a(:,:,:) = 0.5 -print *, exp_pdf(x, a) ! a rank 3 standard expon probability density + x = reshape(rexp(0.5, 24), [2, 3, 4]) ! standard expon random variates array + a(:, :, :) = 0.5 + print *, exp_pdf(x, a) ! a rank 3 standard expon probability density ! 0.457115263 0.451488823 0.492391467 0.485233188 0.446215510 ! 0.401670188 0.485127628 0.316924453 0.418474048 0.483173639 @@ -29,8 +29,8 @@ program demo_exponential_pdf ! 0.334653258 0.410376132 0.485370994 0.333617479 0.263791025 ! 0.249779820 0.457159877 0.495636940 0.482243657 -scale = (1.0, 2.) -print *, exp_pdf((1.5,1.0), scale) + scale = (1.0, 2.) + print *, exp_pdf((1.5, 1.0), scale) ! a complex expon probability density function at (1.5,1.0) with real part !of lambda=1.0 and imaginary part of lambda=2.0 diff --git a/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 b/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 index ad59a105b..d0cc37ce3 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 +++ b/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 @@ -1,30 +1,30 @@ program demo_exponential_rvs -use stdlib_random, only : random_seed -use stdlib_stats_distribution_exponential, only: rexp => rvs_exp + use stdlib_random, only: random_seed + use stdlib_stats_distribution_exponential, only: rexp => rvs_exp -implicit none -real :: a(2,3,4) -complex :: scale -integer :: seed_put, seed_get + implicit none + real :: a(2, 3, 4) + complex :: scale + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) -print *, rexp( ) !single standard exponential random variate + print *, rexp() !single standard exponential random variate ! 0.358690143 -print *, rexp(2.0) !exponential random variate with lambda=2.0 + print *, rexp(2.0) !exponential random variate with lambda=2.0 ! 0.816459715 -print *, rexp(0.3, 10) !an array of 10 variates with lambda=0.3 + print *, rexp(0.3, 10) !an array of 10 variates with lambda=0.3 ! 1.84008647E-02 3.59742008E-02 0.136567295 0.262772143 3.62352766E-02 ! 0.547133625 0.213591918 4.10784185E-02 0.583882213 0.671128035 -scale = (2.0, 0.7) -print *, rexp(scale) + scale = (2.0, 0.7) + print *, rexp(scale) !single complex exponential random variate with real part of lambda=2.0; !imagainary part of lambda=0.7 diff --git a/test/example/stats_distribution_normal/demo_norm_cdf.f90 b/test/example/stats_distribution_normal/demo_norm_cdf.f90 index 207e01c7a..ca73e2cf6 100644 --- a/test/example/stats_distribution_normal/demo_norm_cdf.f90 +++ b/test/example/stats_distribution_normal/demo_norm_cdf.f90 @@ -1,31 +1,31 @@ program demo_norm_cdf -use stdlib_random, only : random_seed -use stdlib_stats_distribution_normal, only : norm_cdf => cdf_normal, & -norm => rvs_normal + use stdlib_random, only: random_seed + use stdlib_stats_distribution_normal, only: norm_cdf => cdf_normal, & + norm => rvs_normal -implicit none -real :: x(2,3,4),a(2,3,4),b(2,3,4) -complex :: loc, scale -integer :: seed_put, seed_get + implicit none + real :: x(2, 3, 4), a(2, 3, 4), b(2, 3, 4) + complex :: loc, scale + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) -print *, norm_cdf(1.0, 0.0, 1.0) ! a standard normal cumulative at 1.0 + print *, norm_cdf(1.0, 0.0, 1.0) ! a standard normal cumulative at 1.0 ! 0.841344714 -print *, norm_cdf(2.0, -1.0, 2.0) + print *, norm_cdf(2.0, -1.0, 2.0) ! a cumulative at 2.0 with mu=-1 sigma=2 ! 0.933192849 -x = reshape(norm(0.0, 1.0, 24),[2,3,4]) + x = reshape(norm(0.0, 1.0, 24), [2, 3, 4]) ! standard normal random variates array -a(:,:,:) = 0.0 -b(:,:,:) = 1.0 -print *, norm_cdf(x, a, b) ! standard normal cumulative array + a(:, :, :) = 0.0 + b(:, :, :) = 1.0 + print *, norm_cdf(x, a, b) ! standard normal cumulative array ! 0.713505626 0.207069695 0.486513376 0.424511284 0.587328553 ! 0.335559726 0.401470929 0.806552052 0.866687536 0.371323735 @@ -33,11 +33,11 @@ program demo_norm_cdf ! 0.206268221 0.627057910 0.580759525 0.190364420 7.27325380E-02 ! 7.08068311E-02 0.728241026 0.522919059 0.390097380 -loc = (1.0,0.0) -scale = (0.5,1.0) -print *, norm_cdf((0.5,-0.5),loc,scale) + loc = (1.0, 0.0) + scale = (0.5, 1.0) + print *, norm_cdf((0.5, -0.5), loc, scale) !complex normal cumulative distribution at (0.5,-0.5) with real part of - !mu=1.0, sigma=0.5 and imaginary part of mu=0.0, sigma=1.0 + !mu=1.0, sigma=0.5 and imaginary part of mu=0.0, sigma=1.0 !4.89511043E-02 diff --git a/test/example/stats_distribution_normal/demo_normal_pdf.f90 b/test/example/stats_distribution_normal/demo_normal_pdf.f90 index 942a26e17..b5365efae 100644 --- a/test/example/stats_distribution_normal/demo_normal_pdf.f90 +++ b/test/example/stats_distribution_normal/demo_normal_pdf.f90 @@ -1,31 +1,31 @@ program demo_normal_pdf -use stdlib_random, only : random_seed -use stdlib_stats_distribution_normal, only : norm_pdf=>pdf_normal, & -norm => rvs_normal + use stdlib_random, only: random_seed + use stdlib_stats_distribution_normal, only: norm_pdf => pdf_normal, & + norm => rvs_normal -implicit none -real :: x(3,4,5),a(3,4,5),b(3,4,5) -complex :: loc, scale -integer :: seed_put, seed_get + implicit none + real :: x(3, 4, 5), a(3, 4, 5), b(3, 4, 5) + complex :: loc, scale + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) -print *, norm_pdf(1.0,0.,1.) !a probability density at 1.0 in standard normal + print *, norm_pdf(1.0, 0., 1.) !a probability density at 1.0 in standard normal ! 0.241970733 -print *, norm_pdf(2.0,-1.0, 2.0) + print *, norm_pdf(2.0, -1.0, 2.0) !a probability density at 2.0 with mu=-1.0 sigma=2.0 !6.47588000E-02 -x = reshape(norm(0.0, 1.0, 60),[3,4,5]) + x = reshape(norm(0.0, 1.0, 60), [3, 4, 5]) ! standard normal random variates array -a(:,:,:) = 0.0 -b(:,:,:) = 1.0 -print *, norm_pdf(x, a, b) ! standard normal probability density array + a(:, :, :) = 0.0 + b(:, :, :) = 1.0 + print *, norm_pdf(x, a, b) ! standard normal probability density array ! 0.340346158 0.285823315 0.398714304 0.391778737 0.389345556 ! 0.364551932 0.386712372 0.274370432 0.215250477 0.378006011 @@ -33,11 +33,11 @@ program demo_normal_pdf ! 0.285167664 0.378533930 0.390739858 0.271684974 0.138273031 ! 0.135456234 0.331718773 0.398283750 0.383706540 -loc = (1.0, -0.5) -scale = (1.0, 2.) -print *, norm_pdf((1.5,1.0), loc, scale) + loc = (1.0, -0.5) + scale = (1.0, 2.) + print *, norm_pdf((1.5, 1.0), loc, scale) ! a complex normal probability density function at (1.5,1.0) with real part - ! of mu=1.0, sigma=1.0 and imaginary part of mu=-0.5, sigma=2.0 + ! of mu=1.0, sigma=1.0 and imaginary part of mu=-0.5, sigma=2.0 ! 5.30100204E-02 diff --git a/test/example/stats_distribution_normal/demo_normal_rvs.f90 b/test/example/stats_distribution_normal/demo_normal_rvs.f90 index 685e5adf8..b38161af9 100644 --- a/test/example/stats_distribution_normal/demo_normal_rvs.f90 +++ b/test/example/stats_distribution_normal/demo_normal_rvs.f90 @@ -1,32 +1,32 @@ program demo_normal_rvs -use stdlib_random, only: random_seed -use stdlib_stats_distribution_normal, only: norm => rvs_normal + use stdlib_random, only: random_seed + use stdlib_stats_distribution_normal, only: norm => rvs_normal -implicit none -real :: a(2,3,4), b(2,3,4) -complex :: loc, scale -integer :: seed_put, seed_get + implicit none + real :: a(2, 3, 4), b(2, 3, 4) + complex :: loc, scale + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) -print *, norm( ) !single standard normal random variate + print *, norm() !single standard normal random variate ! 0.563655198 -print *, norm(1.0, 2.0) + print *, norm(1.0, 2.0) !normal random variate mu=1.0, sigma=2.0 ! -0.633261681 -print *, norm(0.0, 1.0, 10) !an array of 10 standard norml random variates + print *, norm(0.0, 1.0, 10) !an array of 10 standard norml random variates ! -3.38123664E-02 -0.190365672 0.220678389 -0.424612164 -0.249541596 ! 0.865260184 1.11086845 -0.328349441 1.10873628 1.27049923 -a(:,:,:) = 1.0 -b(:,:,:) = 1.0 -print *, norm(a,b) ! a rank 3 random variates array + a(:, :, :) = 1.0 + b(:, :, :) = 1.0 + print *, norm(a, b) ! a rank 3 random variates array !0.152776539 -7.51764774E-02 1.47208166 0.180561781 1.32407105 ! 1.20383692 0.123445868 -0.455737948 -0.469808221 1.60750175 @@ -34,11 +34,11 @@ program demo_normal_rvs ! 0.414566994 3.06084275 1.86505437 1.36338580 7.26878643E-02 ! 0.178585172 1.39557445 0.828021586 0.872084975 -loc = (-1.0, 2.0) -scale = (2.0, 1.0) -print *, norm(loc, scale) + loc = (-1.0, 2.0) + scale = (2.0, 1.0) + print *, norm(loc, scale) !single complex normal random variate with real part of mu=-1, sigma=2; - !imagainary part of mu=2.0 and sigma=1.0 + !imagainary part of mu=2.0 and sigma=1.0 ! (1.22566295,2.12518454) diff --git a/test/example/stats_distribution_uniform/demo_shuffle.f90 b/test/example/stats_distribution_uniform/demo_shuffle.f90 index a69ab59e9..3144bf74a 100644 --- a/test/example/stats_distribution_uniform/demo_shuffle.f90 +++ b/test/example/stats_distribution_uniform/demo_shuffle.f90 @@ -1,28 +1,28 @@ program demo_shuffle -use stdlib_random, only : random_seed -use stdlib_stats_distribution_uniform, only : shuffle -implicit none -integer :: seed_put, seed_get, i -real :: x(10) -integer :: n(10) -complex :: z(10) + use stdlib_random, only: random_seed + use stdlib_stats_distribution_uniform, only: shuffle + implicit none + integer :: seed_put, seed_get, i + real :: x(10) + integer :: n(10) + complex :: z(10) -do i=1, 10 -n(i) = i -x(i) = real(i) -z(i) = cmplx(real(i), real(i)) -end do -seed_put = 32165498 -call random_seed(seed_put, seed_get) ! set and get current value of seed -print *, shuffle(n) ! get randomized n + do i = 1, 10 + n(i) = i + x(i) = real(i) + z(i) = cmplx(real(i), real(i)) + end do + seed_put = 32165498 + call random_seed(seed_put, seed_get) ! set and get current value of seed + print *, shuffle(n) ! get randomized n !10 6 9 2 8 1 3 5 7 4 -print *, shuffle(x) ! get randomized x + print *, shuffle(x) ! get randomized x !5.0 10.0 9.0 4.0 3.0 8.0 2.0 1.0 7.0 6.0 -print *, shuffle(z) ! get randomized z + print *, shuffle(z) ! get randomized z !(8.0, 8.0) (7.0, 7.0) (4.0, 4.0) (1.0, 1.0) (5.0, 5.0) !(9.0, 9.0) (6.0, 6.0) (3.0, 3.0) (2.0, 2.0) (10.0, 10.0) diff --git a/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 b/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 index f04a045f0..afc10326c 100644 --- a/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 +++ b/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 @@ -1,32 +1,32 @@ program demo_uniform_cdf -use stdlib_random, only : random_seed -use stdlib_stats_distribution_uniform, only : uni_cdf => cdf_uniform, & -uni => rvs_uniform + use stdlib_random, only: random_seed + use stdlib_stats_distribution_uniform, only: uni_cdf => cdf_uniform, & + uni => rvs_uniform -implicit none -real :: x(3,4,5), a(3,4,5), b(3,4,5) -complex :: loc, scale -integer :: seed_put, seed_get + implicit none + real :: x(3, 4, 5), a(3, 4, 5), b(3, 4, 5) + complex :: loc, scale + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) -print *, uni_cdf(0.5,0.,1.) ! a cumulative at 0.5 in [0., 1.] + print *, uni_cdf(0.5, 0., 1.) ! a cumulative at 0.5 in [0., 1.] !0.500000000 -print *, uni_cdf(0.7,-1.0,2.0) ! a cumulative at 0.7 in [-1.0, 1.0] + print *, uni_cdf(0.7, -1.0, 2.0) ! a cumulative at 0.7 in [-1.0, 1.0] ! 0.850000024 -print *, uni_cdf(6, 2, 10) ! a cumulative at 6 in [2, 10] + print *, uni_cdf(6, 2, 10) ! a cumulative at 6 in [2, 10] ! 0.454545468 -a(:,:,:) = -1.0 -b(:,:,:) = 2.0 -x = reshape(uni(-1.0,2.0,60),[3,4,5]) ! uniform random variates array -print *, uni_cdf(x,a,b) ! cumulative array in [-1.0, 1.0] + a(:, :, :) = -1.0 + b(:, :, :) = 2.0 + x = reshape(uni(-1.0, 2.0, 60), [3, 4, 5]) ! uniform random variates array + print *, uni_cdf(x, a, b) ! cumulative array in [-1.0, 1.0] !0.161520004 0.553248405 0.986900032 0.942091405 0.114239901 0.780188501 ! 0.854656875 0.464386612 0.284466714 0.748768032 0.301834047 0.337008357 @@ -39,9 +39,9 @@ program demo_uniform_cdf !0.855926156 0.250811368 0.300751567 0.110186398 0.502883077 0.738479793 !0.764856219 0.294822574 1.90783739E-02 0.631218433 0.752170086 0.196848959 -loc = (0., 0.) -scale=(2., 1.) -print *, uni_cdf((1.2,0.5), loc, scale) + loc = (0., 0.) + scale = (2., 1.) + print *, uni_cdf((1.2, 0.5), loc, scale) ! joint cumulative distribution at (1.2,0.5) in [(0.,0.), (2.,1.)] ! 0.300000012 diff --git a/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 b/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 index e90bb5d94..9ea14a7a7 100644 --- a/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 +++ b/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 @@ -1,33 +1,32 @@ program demo_uniform_pdf -use stdlib_random, only : random_seed -use stdlib_stats_distribution_uniform, only : uni_pdf => pdf_uniform, & -uni => rvs_uniform + use stdlib_random, only: random_seed + use stdlib_stats_distribution_uniform, only: uni_pdf => pdf_uniform, & + uni => rvs_uniform -implicit none -complex :: loc, scale -real :: a(3,4,5), b(3,4,5), x(3,4,5) -integer :: seed_put, seed_get + implicit none + complex :: loc, scale + real :: a(3, 4, 5), b(3, 4, 5), x(3, 4, 5) + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) -print *, uni_pdf(3, 2, 10) !probability density at 3 in range [2, 10] + print *, uni_pdf(3, 2, 10) !probability density at 3 in range [2, 10] ! 9.09090936E-02 -print *, uni_pdf(0.5,0.0,1.0) !a probability density at 0.5 in [0., 1.] + print *, uni_pdf(0.5, 0.0, 1.0) !a probability density at 0.5 in [0., 1.] ! 1.00000000 - -print *, uni_pdf(0.7,-1.0,2.0) !a probability density at 0.7 in [-1., 1.] + print *, uni_pdf(0.7, -1.0, 2.0) !a probability density at 0.7 in [-1., 1.] ! 0.500000000 -a(:,:,:) = 0.0 -b(:,:,:) = 2.0 -x = reshape(uni(0.,2.,60),[3,4,5])! uniform random variates array in [0., 2.] -print *, uni_pdf(x, a, b) ! probability density array in [0., 2.] + a(:, :, :) = 0.0 + b(:, :, :) = 2.0 + x = reshape(uni(0., 2., 60), [3, 4, 5])! uniform random variates array in [0., 2.] + print *, uni_pdf(x, a, b) ! probability density array in [0., 2.] ! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 ! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 @@ -40,9 +39,9 @@ program demo_uniform_pdf ! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 ! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 -loc = (-0.5,-0.5) -scale = (1.0,1.0) -print *, uni_pdf((-0.1,0.2), loc, scale) + loc = (-0.5, -0.5) + scale = (1.0, 1.0) + print *, uni_pdf((-0.1, 0.2), loc, scale) ! joint probability density at (-0.1,0.2) in [(-0.5, -0.5), (0.5, 0.5)] ! 1.00000000 diff --git a/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 b/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 index 4f36a18f2..1ddc5ab5d 100644 --- a/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 +++ b/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 @@ -1,53 +1,53 @@ program demo_uniform_rvs -use stdlib_random, only:random_seed -use stdlib_stats_distribution_uniform, only:uni=> rvs_uniform + use stdlib_random, only: random_seed + use stdlib_stats_distribution_uniform, only: uni => rvs_uniform -implicit none -complex :: loc, scale -real :: a(3,4,5), b(3,4,5) -integer :: seed_put, seed_get + implicit none + complex :: loc, scale + real :: a(3, 4, 5), b(3, 4, 5) + integer :: seed_put, seed_get -seed_put = 1234567 -call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) -print *, uni( ) !real standard uniform random variate in [0., 1.] + print *, uni() !real standard uniform random variate in [0., 1.] ! 0.161520019 -print *, uni(3.0) !an uniform random variate in [0., 3.] + print *, uni(3.0) !an uniform random variate in [0., 3.] ! 1.65974522 -print *, uni(-0.5, 1.0) !an uniform random variate in [-0.5, 0.5] + print *, uni(-0.5, 1.0) !an uniform random variate in [-0.5, 0.5] ! 0.486900032 -print *, uni(-1.0,2.0,10) + print *, uni(-1.0, 2.0, 10) !an array of 10 uniform random variates in [-1., 1.] !0.884182811 -0.771520197 0.560377002 0.709313750 -7.12267756E-02 !-0.431066573 0.497536063 -0.396331906 -0.325983286 0.137686729 -print *, uni(20) !a random integer variate in [0, 20] + print *, uni(20) !a random integer variate in [0, 20] ! 17 -print *, uni(5,13) !a random integer variate in [5, 18] + print *, uni(5, 13) !a random integer variate in [5, 18] ! 15 -print *, uni(3,19,10) !an array of 10 integer variates in [3,22] + print *, uni(3, 19, 10) !an array of 10 integer variates in [3,22] !7 16 16 12 9 21 19 4 3 19 -loc = (-0.5, -0.5) -scale = (1.0, 1.0) + loc = (-0.5, -0.5) + scale = (1.0, 1.0) -print *, uni(scale) !a complex uniform random variate in unit square + print *, uni(scale) !a complex uniform random variate in unit square !(0.139202669, 0.361759573) -print *, uni(loc,scale) + print *, uni(loc, scale) !a complex uniform random variate in [(-0.5, -0.5), (0.5, 0.5)] !(0.296536088,-0.143987954) -print *, uni(loc, scale, 10) + print *, uni(loc, scale, 10) !an array of 10 complex uniform random variate in [(-0.5, -0.5), (0.5, 0.5)] !(-0.302334785,-0.401923567) (0.281620383,9.534919262E-02) @@ -56,10 +56,10 @@ program demo_uniform_rvs ! (-7.864198089E-02,0.378484428) (-0.423258364,-0.201292425) ! (0.193327367,-0.353985727) (-0.397661150,0.355926156) -a(:,:,:) = -0.5 -b(:,:,:) = 1.0 + a(:, :, :) = -0.5 + b(:, :, :) = 1.0 -print *, uni(a,b) + print *, uni(a, b) !a rank 3 array of random variates in [-0.5,0.5] ! -0.249188632 -0.199248433 -0.389813602 2.88307667E-03 0.238479793, diff --git a/test/example/string_type/demo_adjustl.f90 b/test/example/string_type/demo_adjustl.f90 index 9b97cd355..25d9f79e2 100644 --- a/test/example/string_type/demo_adjustl.f90 +++ b/test/example/string_type/demo_adjustl.f90 @@ -1,9 +1,9 @@ program demo_adjustl -use stdlib_string_type -implicit none -type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string -string = " Whitespace" -string = adjustl(string) + string = " Whitespace" + string = adjustl(string) ! char(string) == "Whitespace " end program demo_adjustl diff --git a/test/example/string_type/demo_adjustr.f90 b/test/example/string_type/demo_adjustr.f90 index df04b5917..83e3d7eb0 100644 --- a/test/example/string_type/demo_adjustr.f90 +++ b/test/example/string_type/demo_adjustr.f90 @@ -1,9 +1,9 @@ program demo_adjustr -use stdlib_string_type -implicit none -type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string -string = "Whitespace " -string = adjustr(string) + string = "Whitespace " + string = adjustr(string) ! char(string) == " Whitespace" end program demo_adjustr diff --git a/test/example/string_type/demo_char.f90 b/test/example/string_type/demo_char.f90 index e186535b6..c4baecb6b 100644 --- a/test/example/string_type/demo_char.f90 +++ b/test/example/string_type/demo_char.f90 @@ -1,10 +1,10 @@ program demo_char -use stdlib_string_type -implicit none -type(string_type) :: string -character(len=:), allocatable :: dlc + use stdlib_string_type + implicit none + type(string_type) :: string + character(len=:), allocatable :: dlc -string = "Character sequence" -dlc = char(string) + string = "Character sequence" + dlc = char(string) ! dlc == "Character sequence" end program demo_char diff --git a/test/example/string_type/demo_char_position.f90 b/test/example/string_type/demo_char_position.f90 index 8524ae56a..15b220e63 100644 --- a/test/example/string_type/demo_char_position.f90 +++ b/test/example/string_type/demo_char_position.f90 @@ -1,13 +1,13 @@ program demo_char_position -use stdlib_string_type -implicit none -type(string_type) :: string -character(len=:), allocatable :: dlc -character(len=1), allocatable :: chars(:) + use stdlib_string_type + implicit none + type(string_type) :: string + character(len=:), allocatable :: dlc + character(len=1), allocatable :: chars(:) -string = "Character sequence" -dlc = char(string, 3) + string = "Character sequence" + dlc = char(string, 3) ! dlc == "a" -chars = char(string, [3, 5, 8, 12, 14, 15, 18]) + chars = char(string, [3, 5, 8, 12, 14, 15, 18]) ! chars == ["a", "a", "e", "e", "u", "e", "e"] end program demo_char_position diff --git a/test/example/string_type/demo_char_range.f90 b/test/example/string_type/demo_char_range.f90 index 978fa87b1..42eccc2e9 100644 --- a/test/example/string_type/demo_char_range.f90 +++ b/test/example/string_type/demo_char_range.f90 @@ -1,10 +1,10 @@ program demo_char_range -use stdlib_string_type -implicit none -type(string_type) :: string -character(len=:), allocatable :: dlc + use stdlib_string_type + implicit none + type(string_type) :: string + character(len=:), allocatable :: dlc -string = "Fortran" -dlc = char(string, 1, 4) + string = "Fortran" + dlc = char(string, 1, 4) ! dlc == "Fort" end program demo_char_range diff --git a/test/example/string_type/demo_constructor_character.f90 b/test/example/string_type/demo_constructor_character.f90 index 4ad005c3a..a0658030d 100644 --- a/test/example/string_type/demo_constructor_character.f90 +++ b/test/example/string_type/demo_constructor_character.f90 @@ -1,8 +1,8 @@ program demo_constructor_character -use stdlib_string_type -implicit none -type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string ! len(string) == 0 -string = "Sequence" + string = "Sequence" ! len(string) == 8 end program demo_constructor_character diff --git a/test/example/string_type/demo_constructor_empty.f90 b/test/example/string_type/demo_constructor_empty.f90 index be22f2ddd..6d02af3fa 100644 --- a/test/example/string_type/demo_constructor_empty.f90 +++ b/test/example/string_type/demo_constructor_empty.f90 @@ -1,7 +1,7 @@ program demo_constructor_empty -use stdlib_string_type -implicit none -type(string_type) :: string -string = string_type() + use stdlib_string_type + implicit none + type(string_type) :: string + string = string_type() ! len(string) == 0 end program demo_constructor_empty diff --git a/test/example/string_type/demo_constructor_integer.f90 b/test/example/string_type/demo_constructor_integer.f90 index bd7f417d8..643d4a0f5 100644 --- a/test/example/string_type/demo_constructor_integer.f90 +++ b/test/example/string_type/demo_constructor_integer.f90 @@ -1,9 +1,9 @@ program demo_constructor_integer -use stdlib_string_type -implicit none -type(string_type) :: string -string = string_type(42) + use stdlib_string_type + implicit none + type(string_type) :: string + string = string_type(42) ! len(string) == 2 -string = string_type(-289) + string = string_type(-289) ! len(string) == 4 end program demo_constructor_integer diff --git a/test/example/string_type/demo_constructor_logical.f90 b/test/example/string_type/demo_constructor_logical.f90 index fc43f343a..c66a22da1 100644 --- a/test/example/string_type/demo_constructor_logical.f90 +++ b/test/example/string_type/demo_constructor_logical.f90 @@ -1,9 +1,9 @@ program demo_constructor_logical -use stdlib_string_type -implicit none -type(string_type) :: string -string = string_type(.true.) + use stdlib_string_type + implicit none + type(string_type) :: string + string = string_type(.true.) ! len(string) == 1 -string = string_type(.false.) + string = string_type(.false.) ! len(string) == 1 end program demo_constructor_logical diff --git a/test/example/string_type/demo_constructor_scalar.f90 b/test/example/string_type/demo_constructor_scalar.f90 index 1799fc9d9..03a3028ac 100644 --- a/test/example/string_type/demo_constructor_scalar.f90 +++ b/test/example/string_type/demo_constructor_scalar.f90 @@ -1,9 +1,9 @@ program demo_constructor_scalar -use stdlib_string_type -implicit none -type(string_type) :: string -string = string_type("Sequence") + use stdlib_string_type + implicit none + type(string_type) :: string + string = string_type("Sequence") ! len(string) == 8 -string = string_type(" S p a c e d ") + string = string_type(" S p a c e d ") ! len(string) == 13 end program demo_constructor_scalar diff --git a/test/example/string_type/demo_cont.f90 b/test/example/string_type/demo_cont.f90 index a535c427a..70e142771 100644 --- a/test/example/string_type/demo_cont.f90 +++ b/test/example/string_type/demo_cont.f90 @@ -1,9 +1,9 @@ program demo_cont -use stdlib_string_type -implicit none -type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string -string = "Hello, " -string = string // "World!" + string = "Hello, " + string = string//"World!" ! len(string) == 13 end program demo_cont diff --git a/test/example/string_type/demo_eq.f90 b/test/example/string_type/demo_eq.f90 index 908bcb391..25ac4cb16 100644 --- a/test/example/string_type/demo_eq.f90 +++ b/test/example/string_type/demo_eq.f90 @@ -1,16 +1,16 @@ program demo_eq -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = string == "abc" + string = "bcd" + res = string == "abc" ! res .eqv. .false. -res = string == "bcd" + res = string == "bcd" ! res .eqv. .true. -res = string == "cde" + res = string == "cde" ! res .eqv. .false. end program demo_eq diff --git a/test/example/string_type/demo_fread.f90 b/test/example/string_type/demo_fread.f90 index fbdac0c1e..431ab1fac 100644 --- a/test/example/string_type/demo_fread.f90 +++ b/test/example/string_type/demo_fread.f90 @@ -1,16 +1,16 @@ program demo_fread -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: io -string = "Important saved value" + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: io + string = "Important saved value" -open(newunit=io, form="formatted", status="scratch") -write(io, *) string -write(io, *) + open (newunit=io, form="formatted", status="scratch") + write (io, *) string + write (io, *) -rewind(io) + rewind (io) -read(io, *) string -close(io) + read (io, *) string + close (io) end program demo_fread diff --git a/test/example/string_type/demo_fwrite.f90 b/test/example/string_type/demo_fwrite.f90 index d86261d55..fa03ab889 100644 --- a/test/example/string_type/demo_fwrite.f90 +++ b/test/example/string_type/demo_fwrite.f90 @@ -1,16 +1,16 @@ program demo_fwrite -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: io -string = "Important saved value" + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: io + string = "Important saved value" -open(newunit=io, form="formatted", status="scratch") -write(io, *) string -write(io, *) + open (newunit=io, form="formatted", status="scratch") + write (io, *) string + write (io, *) -rewind(io) + rewind (io) -read(io, *) string -close(io) + read (io, *) string + close (io) end program demo_fwrite diff --git a/test/example/string_type/demo_ge.f90 b/test/example/string_type/demo_ge.f90 index 4ea9cac29..e28339961 100644 --- a/test/example/string_type/demo_ge.f90 +++ b/test/example/string_type/demo_ge.f90 @@ -1,16 +1,16 @@ program demo_ge -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = string >= "abc" + string = "bcd" + res = string >= "abc" ! res .eqv. .true. -res = string >= "bcd" + res = string >= "bcd" ! res .eqv. .true. -res = string >= "cde" + res = string >= "cde" ! res .eqv. .false. end program demo_ge diff --git a/test/example/string_type/demo_gt.f90 b/test/example/string_type/demo_gt.f90 index c8ffa2bd0..ff608063a 100644 --- a/test/example/string_type/demo_gt.f90 +++ b/test/example/string_type/demo_gt.f90 @@ -1,16 +1,16 @@ program demo_gt -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = string > "abc" + string = "bcd" + res = string > "abc" ! res .eqv. .true. -res = string > "bcd" + res = string > "bcd" ! res .eqv. .false. -res = string > "cde" + res = string > "cde" ! res .eqv. .false. end program demo_gt diff --git a/test/example/string_type/demo_iachar.f90 b/test/example/string_type/demo_iachar.f90 index 1417ed972..2c3deca60 100644 --- a/test/example/string_type/demo_iachar.f90 +++ b/test/example/string_type/demo_iachar.f90 @@ -1,9 +1,9 @@ program demo_iachar -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: code + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: code -string = "Fortran" -code = iachar(string) + string = "Fortran" + code = iachar(string) end program demo_iachar diff --git a/test/example/string_type/demo_ichar.f90 b/test/example/string_type/demo_ichar.f90 index 7eca0f761..dd0aaaaf5 100644 --- a/test/example/string_type/demo_ichar.f90 +++ b/test/example/string_type/demo_ichar.f90 @@ -1,9 +1,9 @@ program demo_ichar -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: code + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: code -string = "Fortran" -code = ichar(string) + string = "Fortran" + code = ichar(string) end program demo_ichar diff --git a/test/example/string_type/demo_index.f90 b/test/example/string_type/demo_index.f90 index b0674bfa9..c14740dc8 100644 --- a/test/example/string_type/demo_index.f90 +++ b/test/example/string_type/demo_index.f90 @@ -1,16 +1,16 @@ program demo_index -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: pos + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: pos -string = "Search this string for this expression" -pos = index(string, "this") + string = "Search this string for this expression" + pos = index(string, "this") ! pos == 8 -pos = index(string, "this", back=.true.) + pos = index(string, "this", back=.true.) ! pos == 24 -pos = index(string, "This") + pos = index(string, "This") ! pos == 0 end program demo_index diff --git a/test/example/string_type/demo_le.f90 b/test/example/string_type/demo_le.f90 index adda4ff21..dba1475e6 100644 --- a/test/example/string_type/demo_le.f90 +++ b/test/example/string_type/demo_le.f90 @@ -1,16 +1,16 @@ program demo_le -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = string <= "abc" + string = "bcd" + res = string <= "abc" ! res .eqv. .false. -res = string <= "bcd" + res = string <= "bcd" ! res .eqv. .true. -res = string <= "cde" + res = string <= "cde" ! res .eqv. .true. end program demo_le diff --git a/test/example/string_type/demo_len.f90 b/test/example/string_type/demo_len.f90 index c4a16b064..f81cc2a85 100644 --- a/test/example/string_type/demo_len.f90 +++ b/test/example/string_type/demo_len.f90 @@ -1,14 +1,14 @@ program demo_len -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: length + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: length -string = "Some longer sentence for this example." -length = len(string) + string = "Some longer sentence for this example." + length = len(string) ! length == 38 -string = "Whitespace " -length = len(string) + string = "Whitespace " + length = len(string) ! length == 38 end program demo_len diff --git a/test/example/string_type/demo_len_trim.f90 b/test/example/string_type/demo_len_trim.f90 index 4e8ec23c0..3aa6ea788 100644 --- a/test/example/string_type/demo_len_trim.f90 +++ b/test/example/string_type/demo_len_trim.f90 @@ -1,14 +1,14 @@ program demo_len_trim -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: length + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: length -string = "Some longer sentence for this example." -length = len_trim(string) + string = "Some longer sentence for this example." + length = len_trim(string) ! length == 38 -string = "Whitespace " -length = len_trim(string) + string = "Whitespace " + length = len_trim(string) ! length == 10 end program demo_len_trim diff --git a/test/example/string_type/demo_lge.f90 b/test/example/string_type/demo_lge.f90 index f51ae1de3..ea7041e52 100644 --- a/test/example/string_type/demo_lge.f90 +++ b/test/example/string_type/demo_lge.f90 @@ -1,16 +1,16 @@ program demo_lge -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = lge(string, "abc") + string = "bcd" + res = lge(string, "abc") ! res .eqv. .true. -res = lge(string, "bcd") + res = lge(string, "bcd") ! res .eqv. .true. -res = lge(string, "cde") + res = lge(string, "cde") ! res .eqv. .false. end program demo_lge diff --git a/test/example/string_type/demo_lgt.f90 b/test/example/string_type/demo_lgt.f90 index 42cb112c5..63a80f946 100644 --- a/test/example/string_type/demo_lgt.f90 +++ b/test/example/string_type/demo_lgt.f90 @@ -1,16 +1,16 @@ program demo_lgt -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = lgt(string, "abc") + string = "bcd" + res = lgt(string, "abc") ! res .eqv. .true. -res = lgt(string, "bcd") + res = lgt(string, "bcd") ! res .eqv. .false. -res = lgt(string, "cde") + res = lgt(string, "cde") ! res .eqv. .false. end program demo_lgt diff --git a/test/example/string_type/demo_lle.f90 b/test/example/string_type/demo_lle.f90 index 3e3b7c3d4..70c5321e7 100644 --- a/test/example/string_type/demo_lle.f90 +++ b/test/example/string_type/demo_lle.f90 @@ -1,16 +1,16 @@ program demo_lle -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = lle(string, "abc") + string = "bcd" + res = lle(string, "abc") ! res .eqv. .false. -res = lle(string, "bcd") + res = lle(string, "bcd") ! res .eqv. .true. -res = lle(string, "cde") + res = lle(string, "cde") ! res .eqv. .true. end program demo_lle diff --git a/test/example/string_type/demo_llt.f90 b/test/example/string_type/demo_llt.f90 index 6443cdca7..ba4838690 100644 --- a/test/example/string_type/demo_llt.f90 +++ b/test/example/string_type/demo_llt.f90 @@ -1,16 +1,16 @@ program demo_llt -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = llt(string, "abc") + string = "bcd" + res = llt(string, "abc") ! res .eqv. .false. -res = llt(string, "bcd") + res = llt(string, "bcd") ! res .eqv. .false. -res = llt(string, "cde") + res = llt(string, "cde") ! res .eqv. .true. end program demo_llt diff --git a/test/example/string_type/demo_lt.f90 b/test/example/string_type/demo_lt.f90 index 31679ccae..3cd87d145 100644 --- a/test/example/string_type/demo_lt.f90 +++ b/test/example/string_type/demo_lt.f90 @@ -1,16 +1,16 @@ program demo_lt -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = string < "abc" + string = "bcd" + res = string < "abc" ! res .eqv. .false. -res = string < "bcd" + res = string < "bcd" ! res .eqv. .false. -res = string < "cde" + res = string < "cde" ! res .eqv. .true. end program demo_lt diff --git a/test/example/string_type/demo_move.f90 b/test/example/string_type/demo_move.f90 index fabe1ce3f..7d07bc1a0 100644 --- a/test/example/string_type/demo_move.f90 +++ b/test/example/string_type/demo_move.f90 @@ -1,20 +1,20 @@ program demo_move -use stdlib_string_type, only : string_type, assignment(=), move -implicit none -type(string_type) :: from_string -character(len=:), allocatable :: from_char, to_char + use stdlib_string_type, only: string_type, assignment(=), move + implicit none + type(string_type) :: from_string + character(len=:), allocatable :: from_char, to_char -from_string = "move this string" -from_char = "move this char" + from_string = "move this string" + from_char = "move this char" ! from_string <-- "move this string" ! from_char <-- "move this char" ! to_char <-- (unallocated) -call move(from_string, to_char) + call move(from_string, to_char) ! from_string <-- "" ! to_char <-- "move this string" -call move(from_char, to_char) + call move(from_char, to_char) ! from_char <-- (unallocated) ! to_string <-- "move this char" diff --git a/test/example/string_type/demo_ne.f90 b/test/example/string_type/demo_ne.f90 index 0f172c838..2964239f1 100644 --- a/test/example/string_type/demo_ne.f90 +++ b/test/example/string_type/demo_ne.f90 @@ -1,16 +1,16 @@ program demo_ne -use stdlib_string_type -implicit none -type(string_type) :: string -logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res -string = "bcd" -res = string /= "abc" + string = "bcd" + res = string /= "abc" ! res .eqv. .true. -res = string /= "bcd" + res = string /= "bcd" ! res .eqv. .false. -res = string /= "cde" + res = string /= "cde" ! res .eqv. .true. end program demo_ne diff --git a/test/example/string_type/demo_repeat.f90 b/test/example/string_type/demo_repeat.f90 index 1f2e26a92..de81cfbbb 100644 --- a/test/example/string_type/demo_repeat.f90 +++ b/test/example/string_type/demo_repeat.f90 @@ -1,9 +1,9 @@ program demo_repeat -use stdlib_string_type -implicit none -type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string -string = "What? " -string = repeat(string, 3) + string = "What? " + string = repeat(string, 3) ! string == "What? What? What? " end program demo_repeat diff --git a/test/example/string_type/demo_reverse.f90 b/test/example/string_type/demo_reverse.f90 index 4f2ab5abb..c0a9a5529 100644 --- a/test/example/string_type/demo_reverse.f90 +++ b/test/example/string_type/demo_reverse.f90 @@ -1,12 +1,12 @@ program demo_reverse -use stdlib_string_type -implicit none -type(string_type) :: string, reverse_string + use stdlib_string_type + implicit none + type(string_type) :: string, reverse_string -string = "Reverse This String" + string = "Reverse This String" ! string <-- "Reverse This String" -reverse_string = reverse(string) + reverse_string = reverse(string) ! string <-- "Reverse This String" ! reverse_string <-- "gnirtS sihT esreveR" end program demo_reverse diff --git a/test/example/string_type/demo_scan.f90 b/test/example/string_type/demo_scan.f90 index 66973e7da..5a0c5adbe 100644 --- a/test/example/string_type/demo_scan.f90 +++ b/test/example/string_type/demo_scan.f90 @@ -1,16 +1,16 @@ program demo_scan -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: pos + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: pos -string = "fortran" -pos = scan(string, "ao") + string = "fortran" + pos = scan(string, "ao") ! pos == 2 -pos = scan(string, "ao", .true.) + pos = scan(string, "ao", .true.) ! pos == 6 -pos = scan(string, "c++") + pos = scan(string, "c++") ! pos == 0 end program demo_scan diff --git a/test/example/string_type/demo_to_lower.f90 b/test/example/string_type/demo_to_lower.f90 index cb3c277b5..b9aaa794c 100644 --- a/test/example/string_type/demo_to_lower.f90 +++ b/test/example/string_type/demo_to_lower.f90 @@ -1,12 +1,12 @@ program demo_to_lower -use stdlib_string_type -implicit none -type(string_type) :: string, lowercase_string + use stdlib_string_type + implicit none + type(string_type) :: string, lowercase_string -string = "Lowercase This String" + string = "Lowercase This String" ! string <-- "Lowercase This String" -lowercase_string = to_lower(string) + lowercase_string = to_lower(string) ! string <-- "Lowercase This String" ! lowercase_string <-- "lowercase this string" end program demo_to_lower diff --git a/test/example/string_type/demo_to_sentence.f90 b/test/example/string_type/demo_to_sentence.f90 index 7450a55bb..bdb1633b0 100644 --- a/test/example/string_type/demo_to_sentence.f90 +++ b/test/example/string_type/demo_to_sentence.f90 @@ -1,12 +1,12 @@ program demo_to_sentence -use stdlib_string_type -implicit none -type(string_type) :: string, sentencecase_string + use stdlib_string_type + implicit none + type(string_type) :: string, sentencecase_string -string = "sentencecase this string." + string = "sentencecase this string." ! string <-- "sentencecase this string." -sentencecase_string = to_sentence(string) + sentencecase_string = to_sentence(string) ! string <-- "sentencecase this string." ! sentencecase_string <-- "Sentencecase this string." end program demo_to_sentence diff --git a/test/example/string_type/demo_to_title.f90 b/test/example/string_type/demo_to_title.f90 index 0f64d655d..5a4064537 100644 --- a/test/example/string_type/demo_to_title.f90 +++ b/test/example/string_type/demo_to_title.f90 @@ -1,12 +1,12 @@ program demo_to_title -use stdlib_string_type -implicit none -type(string_type) :: string, titlecase_string + use stdlib_string_type + implicit none + type(string_type) :: string, titlecase_string -string = "titlecase this string." + string = "titlecase this string." ! string <-- "titlecase this string." -titlecase_string = to_title(string) + titlecase_string = to_title(string) ! string <-- "titlecase this string." ! titlecase_string <-- "Titlecase This String." end program demo_to_title diff --git a/test/example/string_type/demo_to_upper.f90 b/test/example/string_type/demo_to_upper.f90 index 3b8a51ea2..f31b1ca88 100644 --- a/test/example/string_type/demo_to_upper.f90 +++ b/test/example/string_type/demo_to_upper.f90 @@ -1,12 +1,12 @@ program demo_to_upper -use stdlib_string_type -implicit none -type(string_type) :: string, uppercase_string + use stdlib_string_type + implicit none + type(string_type) :: string, uppercase_string -string = "Uppercase This String" + string = "Uppercase This String" ! string <-- "Uppercase This String" -uppercase_string = to_upper(string) + uppercase_string = to_upper(string) ! string <-- "Uppercase This String" ! uppercase_string <-- "UPPERCASE THIS STRING" end program demo_to_upper diff --git a/test/example/string_type/demo_trim.f90 b/test/example/string_type/demo_trim.f90 index 27d0294ec..d56c07a04 100644 --- a/test/example/string_type/demo_trim.f90 +++ b/test/example/string_type/demo_trim.f90 @@ -1,9 +1,9 @@ program demo_trim -use stdlib_string_type -implicit none -type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string -string = "Whitespace " -string = trim(string) + string = "Whitespace " + string = trim(string) ! len(string) == 10 end program demo_trim diff --git a/test/example/string_type/demo_uread.f90 b/test/example/string_type/demo_uread.f90 index 347fb9b9a..1a6dd4eae 100644 --- a/test/example/string_type/demo_uread.f90 +++ b/test/example/string_type/demo_uread.f90 @@ -1,15 +1,15 @@ program demo_uread -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: io -string = "Important saved value" + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: io + string = "Important saved value" -open(newunit=io, form="unformatted", status="scratch") -write(io) string + open (newunit=io, form="unformatted", status="scratch") + write (io) string -rewind(io) + rewind (io) -read(io) string -close(io) + read (io) string + close (io) end program demo_uread diff --git a/test/example/string_type/demo_uwrite.f90 b/test/example/string_type/demo_uwrite.f90 index 79e942494..77edb2eaa 100644 --- a/test/example/string_type/demo_uwrite.f90 +++ b/test/example/string_type/demo_uwrite.f90 @@ -1,15 +1,15 @@ program demo_uwrite -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: io -string = "Important saved value" + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: io + string = "Important saved value" -open(newunit=io, form="unformatted", status="scratch") -write(io) string + open (newunit=io, form="unformatted", status="scratch") + write (io) string -rewind(io) + rewind (io) -read(io) string -close(io) + read (io) string + close (io) end program demo_uwrite diff --git a/test/example/string_type/demo_verify.f90 b/test/example/string_type/demo_verify.f90 index 4eb157c67..22ff054d5 100644 --- a/test/example/string_type/demo_verify.f90 +++ b/test/example/string_type/demo_verify.f90 @@ -1,22 +1,22 @@ program demo_verify -use stdlib_string_type -implicit none -type(string_type) :: string -integer :: pos + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: pos -string = "fortran" -pos = verify(string, "ao") + string = "fortran" + pos = verify(string, "ao") ! pos == 1 -pos = verify(string, "fo") + pos = verify(string, "fo") ! pos == 3 -pos = verify(string, "c++") + pos = verify(string, "c++") ! pos == 1 -pos = verify(string, "c++", back=.true.) + pos = verify(string, "c++", back=.true.) ! pos == 7 -pos = verify(string, string) + pos = verify(string, string) ! pos == 0 end program demo_verify diff --git a/test/example/stringlist_type/demo_stringlist_type_clear.f90 b/test/example/stringlist_type/demo_stringlist_type_clear.f90 index 74b24ccc7..564ddef15 100644 --- a/test/example/stringlist_type/demo_stringlist_type_clear.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_clear.f90 @@ -1,19 +1,19 @@ program demo_clear -use stdlib_stringlist_type, only: stringlist_type, fidx -implicit none + use stdlib_stringlist_type, only: stringlist_type, fidx + implicit none -type(stringlist_type) :: stringlist + type(stringlist_type) :: stringlist !> inserting 2 elements to the stringlist -call stringlist%insert_at( fidx(1), "Element No. one" ) -call stringlist%insert_at( fidx(1), "Element No. two" ) + call stringlist%insert_at(fidx(1), "Element No. one") + call stringlist%insert_at(fidx(1), "Element No. two") ! stringlist <-- {"Element No. two", "Element No. one"} -call stringlist%clear() + call stringlist%clear() ! stringlist <-- { } (empty stringlist) !> inserting 1 element to the stringlist -call stringlist%insert_at( fidx(1), "Element No. one" ) + call stringlist%insert_at(fidx(1), "Element No. one") ! stringlist <-- {"Element No. one"} end program demo_clear diff --git a/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 b/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 index c0422aade..1ef558b21 100644 --- a/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 @@ -1,27 +1,27 @@ program demo_concatenate_operator -use stdlib_stringlist_type, only: stringlist_type, operator(//) -use stdlib_string_type, only: string_type -implicit none + use stdlib_stringlist_type, only: stringlist_type, operator(//) + use stdlib_string_type, only: string_type + implicit none -type(stringlist_type) :: first_stringlist, second_stringlist -type(string_type), allocatable :: stringarray(:) + type(stringlist_type) :: first_stringlist, second_stringlist + type(string_type), allocatable :: stringarray(:) -first_stringlist = first_stringlist // "Element No. one" + first_stringlist = first_stringlist//"Element No. one" ! first_stringlist <-- {"Element No. one"} -second_stringlist = string_type("Element No. two") // first_stringlist + second_stringlist = string_type("Element No. two")//first_stringlist ! second_stringlist <-- {Element No. two, "Element No. one"} !> Creating an array of 2 string_type elements -stringarray = [string_type("Element No. three"), string_type("Element No. four")] + stringarray = [string_type("Element No. three"), string_type("Element No. four")] -second_stringlist = first_stringlist // stringarray + second_stringlist = first_stringlist//stringarray ! second_stringlist <-- {"Element No. one", "Element No. three", "Element No. four"} -second_stringlist = ["#1", "#2"] // second_stringlist + second_stringlist = ["#1", "#2"]//second_stringlist ! second_stringlist <-- {"#1", "#2", "Element No. one", "Element No. three", "Element No. four"} -first_stringlist = first_stringlist // second_stringlist + first_stringlist = first_stringlist//second_stringlist ! first_stringlist <-- {"Element No. one", "#1", "#2", "Element No. one", "Element No. three", "Element No. four"} end program demo_concatenate_operator diff --git a/test/example/stringlist_type/demo_stringlist_type_constructor.f90 b/test/example/stringlist_type/demo_stringlist_type_constructor.f90 index a1b466210..bc6bb67a7 100644 --- a/test/example/stringlist_type/demo_stringlist_type_constructor.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_constructor.f90 @@ -1,17 +1,17 @@ program demo_constructor -use stdlib_stringlist_type, only: stringlist_type -use stdlib_string_type, only: string_type -implicit none + use stdlib_stringlist_type, only: stringlist_type + use stdlib_string_type, only: string_type + implicit none -type(stringlist_type) :: stringlist + type(stringlist_type) :: stringlist -stringlist = stringlist_type() + stringlist = stringlist_type() ! stringlist <-- { } (empty stringlist) -stringlist = stringlist_type(["#1", "#2", "#3"]) + stringlist = stringlist_type(["#1", "#2", "#3"]) ! stringlist <-- {"#1", "#2", "#3"} -stringlist = stringlist_type([string_type("#1"), string_type("#2")]) + stringlist = stringlist_type([string_type("#1"), string_type("#2")]) ! stringlist <-- {"#1", "#2"} end program demo_constructor diff --git a/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 b/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 index 96920a1bf..4b3bcccc4 100644 --- a/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 @@ -1,29 +1,29 @@ program demo_equality_operator -use stdlib_stringlist_type, only: stringlist_type, fidx, list_head, operator(==) -use stdlib_string_type, only: string_type -implicit none + use stdlib_stringlist_type, only: stringlist_type, fidx, list_head, operator(==) + use stdlib_string_type, only: string_type + implicit none -type(stringlist_type) :: stringlist -type(string_type), allocatable :: stringarray(:) -logical :: res + type(stringlist_type) :: stringlist + type(string_type), allocatable :: stringarray(:) + logical :: res !> inserting 4 elements to the stringlist -call stringlist%insert_at( fidx(1), "#1" ) -call stringlist%insert_at( list_head, "#2" ) -call stringlist%insert_at( fidx(1), "#3" ) -call stringlist%insert_at( list_head, "#4" ) + call stringlist%insert_at(fidx(1), "#1") + call stringlist%insert_at(list_head, "#2") + call stringlist%insert_at(fidx(1), "#3") + call stringlist%insert_at(list_head, "#4") ! stringlist <-- {"#4", "#3", "#2", "#1"} !> creating an array of 4 string_type elements -stringarray = [string_type("#4"), string_type("#3"), string_type("#2"), string_type("#1")] + stringarray = [string_type("#4"), string_type("#3"), string_type("#2"), string_type("#1")] -res = ( stringarray == stringlist ) + res = (stringarray == stringlist) ! res <-- .true. -res = ( stringlist == ["#4", "#3", "#2", "#1"] ) + res = (stringlist == ["#4", "#3", "#2", "#1"]) ! res <-- .true. -print'(a)', stringlist == ["#4", "#3", "#1"] + print'(a)', stringlist == ["#4", "#3", "#1"] ! .false. end program demo_equality_operator diff --git a/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 b/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 index 64f94477e..1ae0411c2 100644 --- a/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 @@ -1,13 +1,13 @@ program demo_fidx_bidx -use stdlib_stringlist_type, only: stringlist_index_type, fidx, bidx -implicit none + use stdlib_stringlist_type, only: stringlist_index_type, fidx, bidx + implicit none -type(stringlist_index_type) :: index + type(stringlist_index_type) :: index -index = fidx(1) + index = fidx(1) ! forward index 1 -index = bidx(3) + index = bidx(3) ! backward index 3 end program demo_fidx_bidx diff --git a/test/example/stringlist_type/demo_stringlist_type_get.f90 b/test/example/stringlist_type/demo_stringlist_type_get.f90 index b1d95f23d..adf89a22e 100644 --- a/test/example/stringlist_type/demo_stringlist_type_get.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_get.f90 @@ -1,28 +1,28 @@ program demo_get -use stdlib_stringlist_type, only: stringlist_type, fidx, bidx -use stdlib_string_type, only: string_type -implicit none + use stdlib_stringlist_type, only: stringlist_type, fidx, bidx + use stdlib_string_type, only: string_type + implicit none -type(stringlist_type) :: stringlist -type(string_type) :: output + type(stringlist_type) :: stringlist + type(string_type) :: output !> inserting 4 elements to the stringlist -call stringlist%insert_at( fidx(1), "Element No. one" ) -call stringlist%insert_at( fidx(1), "Element No. two" ) -call stringlist%insert_at( fidx(1), "Element No. three" ) -call stringlist%insert_at( fidx(1), "Element No. four" ) + call stringlist%insert_at(fidx(1), "Element No. one") + call stringlist%insert_at(fidx(1), "Element No. two") + call stringlist%insert_at(fidx(1), "Element No. three") + call stringlist%insert_at(fidx(1), "Element No. four") ! stringlist <-- {"Element No. four", "Element No. three", "Element No. two", "Element No. one"} -output = stringlist%get( fidx(1) ) + output = stringlist%get(fidx(1)) ! output <-- "Element No. four" -output = stringlist%get( bidx(1) ) + output = stringlist%get(bidx(1)) ! output <-- "Element No. one" !> accessing out of bounds index -output = stringlist%get( bidx(5) ) + output = stringlist%get(bidx(5)) ! output <-- "" -output = stringlist%get( fidx(0) ) + output = stringlist%get(fidx(0)) ! output <-- "" end program demo_get diff --git a/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 b/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 index eb6a1286d..edd139e55 100644 --- a/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 @@ -1,29 +1,29 @@ program demo_inequality_operator -use stdlib_stringlist_type, only: stringlist_type, bidx, list_tail, operator(/=) -use stdlib_string_type, only: string_type -implicit none + use stdlib_stringlist_type, only: stringlist_type, bidx, list_tail, operator(/=) + use stdlib_string_type, only: string_type + implicit none -type(stringlist_type) :: stringlist -type(string_type), allocatable :: stringarray(:) -logical :: res + type(stringlist_type) :: stringlist + type(string_type), allocatable :: stringarray(:) + logical :: res !> inserting 4 elements to the stringlist -call stringlist%insert_at( bidx(1), "#1" ) -call stringlist%insert_at( list_tail, "#2" ) -call stringlist%insert_at( bidx(1), "#3" ) -call stringlist%insert_at( list_tail, "#4" ) + call stringlist%insert_at(bidx(1), "#1") + call stringlist%insert_at(list_tail, "#2") + call stringlist%insert_at(bidx(1), "#3") + call stringlist%insert_at(list_tail, "#4") ! stringlist <-- {"#1", "#2", "#3", "#4"} !> creating an array of 4 string_type elements -stringarray = [string_type("#1"), string_type("#2"), string_type("#3"), string_type("#4")] + stringarray = [string_type("#1"), string_type("#2"), string_type("#3"), string_type("#4")] -res = ( stringarray /= stringlist ) + res = (stringarray /= stringlist) ! res <-- .false. -res = ( stringlist /= ["#111", "#222", "#333", "#444"] ) + res = (stringlist /= ["#111", "#222", "#333", "#444"]) ! res <-- .true. -print'(a)', stringlist /= ["#4", "#3", "#1"] + print'(a)', stringlist /= ["#4", "#3", "#1"] ! .true. end program demo_inequality_operator diff --git a/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 b/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 index 60ba59ce1..ee3598c24 100644 --- a/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 @@ -1,23 +1,23 @@ program demo_insert_at -use stdlib_stringlist_type, only: stringlist_type, stringlist_index_type, fidx, bidx -use stdlib_string_type, only: string_type -implicit none + use stdlib_stringlist_type, only: stringlist_type, stringlist_index_type, fidx, bidx + use stdlib_string_type, only: string_type + implicit none -type(stringlist_type) :: stringlist -type(stringlist_index_type) :: index + type(stringlist_type) :: stringlist + type(stringlist_index_type) :: index -index = fidx(1) -call stringlist%insert_at( index, "Element No. one" ) + index = fidx(1) + call stringlist%insert_at(index, "Element No. one") ! stringlist <-- {"Element No. one"} -index = bidx(1) -call stringlist%insert_at( index, string_type( "Element No. two" ) ) + index = bidx(1) + call stringlist%insert_at(index, string_type("Element No. two")) ! stringlist <-- {"Element No. one", "Element No. two"} -call stringlist%insert_at( fidx(2), string_type( "Element No. three" ) ) + call stringlist%insert_at(fidx(2), string_type("Element No. three")) ! stringlist <-- {"Element No. one", "Element No. three", "Element No. two"} -call stringlist%insert_at( bidx(1), "Element No. four" ) + call stringlist%insert_at(bidx(1), "Element No. four") ! stringlist <-- {"Element No. one", "Element No. three", "Element No. two", "Element No. four"} end program demo_insert_at diff --git a/test/example/stringlist_type/demo_stringlist_type_len.f90 b/test/example/stringlist_type/demo_stringlist_type_len.f90 index 0818148b3..0946d04a8 100644 --- a/test/example/stringlist_type/demo_stringlist_type_len.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_len.f90 @@ -1,19 +1,19 @@ program demo_len -use stdlib_stringlist_type, only: stringlist_type, bidx -implicit none + use stdlib_stringlist_type, only: stringlist_type, bidx + implicit none -type(stringlist_type) :: stringlist -integer :: output + type(stringlist_type) :: stringlist + integer :: output -output = stringlist%len() + output = stringlist%len() ! output <-- 0 !> inserting 2 elements to the stringlist -call stringlist%insert_at( bidx(1), "Element No. one" ) -call stringlist%insert_at( bidx(1), "Element No. two" ) + call stringlist%insert_at(bidx(1), "Element No. one") + call stringlist%insert_at(bidx(1), "Element No. two") ! stringlist <-- {"Element No. one", "Element No. two"} -print'(a)', stringlist%len() + print'(a)', stringlist%len() ! 2 end program demo_len diff --git a/test/example/strings/demo_chomp.f90 b/test/example/strings/demo_chomp.f90 index ed97aacab..31188c475 100644 --- a/test/example/strings/demo_chomp.f90 +++ b/test/example/strings/demo_chomp.f90 @@ -1,14 +1,14 @@ program demo_chomp -use stdlib_ascii, only : TAB, VT, NUL, LF, CR, FF -use stdlib_strings, only : chomp -implicit none -print'(a)', chomp(" hello ") ! " hello" -print'(a)', chomp(TAB//"goodbye"//CR//LF) ! "\tgoodbye" -print'(a)', chomp(" "//TAB//LF//VT//FF//CR) ! "" -print'(a)', chomp(" ! ")//"!" ! " !!" -print'(a)', chomp("Hello") ! "Hello" -print'(a)', chomp("hello", ["l", "o"]) ! "he" -print'(a)', chomp("hello", set=["l", "o"]) ! "he" -print'(a)', chomp("hello", "lo") ! "hel" -print'(a)', chomp("hello", substring="lo") ! "hel" + use stdlib_ascii, only: TAB, VT, NUL, LF, CR, FF + use stdlib_strings, only: chomp + implicit none + print'(a)', chomp(" hello ") ! " hello" + print'(a)', chomp(TAB//"goodbye"//CR//LF) ! "\tgoodbye" + print'(a)', chomp(" "//TAB//LF//VT//FF//CR) ! "" + print'(a)', chomp(" ! ")//"!" ! " !!" + print'(a)', chomp("Hello") ! "Hello" + print'(a)', chomp("hello", ["l", "o"]) ! "he" + print'(a)', chomp("hello", set=["l", "o"]) ! "he" + print'(a)', chomp("hello", "lo") ! "hel" + print'(a)', chomp("hello", substring="lo") ! "hel" end program demo_chomp diff --git a/test/example/strings/demo_count.f90 b/test/example/strings/demo_count.f90 index db9a2d8b1..47b58cfd6 100644 --- a/test/example/strings/demo_count.f90 +++ b/test/example/strings/demo_count.f90 @@ -1,13 +1,13 @@ program demo_count -use stdlib_string_type, only: string_type, assignment(=) -use stdlib_strings, only : count -implicit none -type(string_type) :: string + use stdlib_string_type, only: string_type, assignment(=) + use stdlib_strings, only: count + implicit none + type(string_type) :: string -string = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?" + string = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?" -print *, count(string, "wood") ! 4 -print *, count(string, ["would", "chuck", "could"]) ! [1, 4, 1] -print *, count("a long queueueueue", "ueu", [.false., .true.]) ! [2, 4] + print *, count(string, "wood") ! 4 + print *, count(string, ["would", "chuck", "could"]) ! [1, 4, 1] + print *, count("a long queueueueue", "ueu", [.false., .true.]) ! [2, 4] end program demo_count diff --git a/test/example/strings/demo_ends_with.f90 b/test/example/strings/demo_ends_with.f90 index b883cca25..dcd352eed 100644 --- a/test/example/strings/demo_ends_with.f90 +++ b/test/example/strings/demo_ends_with.f90 @@ -1,6 +1,6 @@ program demo_ends_with -use stdlib_strings, only : ends_with -implicit none -print'(a)', ends_with("pattern", "ern") ! T -print'(a)', ends_with("pattern", "pat") ! F + use stdlib_strings, only: ends_with + implicit none + print'(a)', ends_with("pattern", "ern") ! T + print'(a)', ends_with("pattern", "pat") ! F end program demo_ends_with diff --git a/test/example/strings/demo_find.f90 b/test/example/strings/demo_find.f90 index 797743009..fb3bc0ee0 100644 --- a/test/example/strings/demo_find.f90 +++ b/test/example/strings/demo_find.f90 @@ -1,13 +1,13 @@ program demo_find -use stdlib_string_type, only: string_type, assignment(=) -use stdlib_strings, only : find -implicit none -type(string_type) :: string + use stdlib_string_type, only: string_type, assignment(=) + use stdlib_strings, only: find + implicit none + type(string_type) :: string -string = "needle in the character-stack" + string = "needle in the character-stack" -print *, find(string, "needle") ! 1 -print *, find(string, ["a", "c"], [3, 2]) ! [27, 20] -print *, find("qwqwqwq", "qwq", 3, [.false., .true.]) ! [0, 5] + print *, find(string, "needle") ! 1 + print *, find(string, ["a", "c"], [3, 2]) ! [27, 20] + print *, find("qwqwqwq", "qwq", 3, [.false., .true.]) ! [0, 5] end program demo_find diff --git a/test/example/strings/demo_padl.f90 b/test/example/strings/demo_padl.f90 index 54f54026d..41974d891 100644 --- a/test/example/strings/demo_padl.f90 +++ b/test/example/strings/demo_padl.f90 @@ -1,15 +1,15 @@ program demo_padl -use stdlib_string_type, only: string_type, assignment(=) -use stdlib_strings, only : padl -implicit none -string_type :: string + use stdlib_string_type, only: string_type, assignment(=) + use stdlib_strings, only: padl + implicit none + string_type :: string -string = "left pad this string" + string = "left pad this string" ! string <-- "left pad this string" -print *, padl(string, 25, "$") ! "$$$$$left pad this string" + print *, padl(string, 25, "$") ! "$$$$$left pad this string" -string = padl(string, 25) + string = padl(string, 25) ! string <-- " left pad this string" end program demo_padl diff --git a/test/example/strings/demo_padr.f90 b/test/example/strings/demo_padr.f90 index 5ee376e45..0d2a3fdac 100644 --- a/test/example/strings/demo_padr.f90 +++ b/test/example/strings/demo_padr.f90 @@ -1,15 +1,15 @@ program demo_padr -use stdlib_string_type, only: string_type, assignment(=) -use stdlib_strings, only : padr -implicit none -string_type :: string + use stdlib_string_type, only: string_type, assignment(=) + use stdlib_strings, only: padr + implicit none + string_type :: string -string = "right pad this string" + string = "right pad this string" ! string <-- "right pad this string" -print *, padr(string, 25, "$") ! "right pad this string$$$$" + print *, padr(string, 25, "$") ! "right pad this string$$$$" -string = padr(string, 25) + string = padr(string, 25) ! string <-- "right pad this string " end program demo_padr diff --git a/test/example/strings/demo_replace_all.f90 b/test/example/strings/demo_replace_all.f90 index a9b53679c..d29a4393f 100644 --- a/test/example/strings/demo_replace_all.f90 +++ b/test/example/strings/demo_replace_all.f90 @@ -1,16 +1,16 @@ program demo_replace_all -use stdlib_string_type, only: string_type, assignment(=) -use stdlib_strings, only : replace_all -implicit none -type(string_type) :: string + use stdlib_string_type, only: string_type, assignment(=) + use stdlib_strings, only: replace_all + implicit none + type(string_type) :: string -string = "hurdles here, hurdles there, hurdles everywhere" + string = "hurdles here, hurdles there, hurdles everywhere" ! string <-- "hurdles here, hurdles there, hurdles everywhere" -print'(a)', replace_all(string, "hurdles", "learn from") + print'(a)', replace_all(string, "hurdles", "learn from") ! "learn from here, learn from there, learn from everywhere" -string = replace_all(string, "hurdles", "technology") + string = replace_all(string, "hurdles", "technology") ! string <-- "technology here, technology there, technology everywhere" end program demo_replace_all diff --git a/test/example/strings/demo_slice.f90 b/test/example/strings/demo_slice.f90 index faea992f8..568a1388c 100644 --- a/test/example/strings/demo_slice.f90 +++ b/test/example/strings/demo_slice.f90 @@ -1,20 +1,20 @@ program demo_slice -use stdlib_string_type -use stdlib_strings, only : slice -implicit none -type(string_type) :: string -character(len=10) :: chars + use stdlib_string_type + use stdlib_strings, only: slice + implicit none + type(string_type) :: string + character(len=10) :: chars -string = "abcdefghij" + string = "abcdefghij" ! string <-- "abcdefghij" -chars = "abcdefghij" + chars = "abcdefghij" ! chars <-- "abcdefghij" -print'(a)', slice("abcdefghij", 2, 6, 2) ! "bdf" -print'(a)', slice(chars, 2, 6, 2) ! "bdf" + print'(a)', slice("abcdefghij", 2, 6, 2) ! "bdf" + print'(a)', slice(chars, 2, 6, 2) ! "bdf" -string = slice(string, 2, 6, 2) + string = slice(string, 2, 6, 2) ! string <-- "bdf" end program demo_slice diff --git a/test/example/strings/demo_starts_with.f90 b/test/example/strings/demo_starts_with.f90 index 2a8510352..639b47e9f 100644 --- a/test/example/strings/demo_starts_with.f90 +++ b/test/example/strings/demo_starts_with.f90 @@ -1,6 +1,6 @@ program demo_starts_with -use stdlib_strings, only : starts_with -implicit none -print'(a)', starts_with("pattern", "pat") ! T -print'(a)', starts_with("pattern", "ern") ! F + use stdlib_strings, only: starts_with + implicit none + print'(a)', starts_with("pattern", "pat") ! T + print'(a)', starts_with("pattern", "ern") ! F end program demo_starts_with diff --git a/test/example/strings/demo_strip.f90 b/test/example/strings/demo_strip.f90 index f9a26dfef..74e16619b 100644 --- a/test/example/strings/demo_strip.f90 +++ b/test/example/strings/demo_strip.f90 @@ -1,10 +1,10 @@ program demo_strip -use stdlib_ascii, only : TAB, VT, NUL, LF, CR, FF -use stdlib_strings, only : strip -implicit none -print'(a)', strip(" hello ") ! "hello" -print'(a)', strip(TAB//"goodbye"//CR//LF) ! "goodbye" -print'(a)', strip(" "//TAB//LF//VT//FF//CR) ! "" -print'(a)', strip(" ! ")//"!" ! "!!" -print'(a)', strip("Hello") ! "Hello" + use stdlib_ascii, only: TAB, VT, LF, CR, FF + use stdlib_strings, only: strip + implicit none + print'(a)', strip(" hello ") ! "hello" + print'(a)', strip(TAB//"goodbye"//CR//LF) ! "goodbye" + print'(a)', strip(" "//TAB//LF//VT//FF//CR) ! "" + print'(a)', strip(" ! ")//"!" ! "!!" + print'(a)', strip("Hello") ! "Hello" end program demo_strip diff --git a/test/example/strings/demo_to_string.f90 b/test/example/strings/demo_to_string.f90 index 049e09da5..2d8523f38 100644 --- a/test/example/strings/demo_to_string.f90 +++ b/test/example/strings/demo_to_string.f90 @@ -1,31 +1,31 @@ program demo_to_string -use stdlib_strings, only: to_string + use stdlib_strings, only: to_string !> Example for `complex` type -print *, to_string((1, 1)) !! "(1.00000000,1.00000000)" -print *, to_string((1, 1), '(F6.2)') !! "( 1.00, 1.00)" -print *, to_string((1000, 1), '(ES0.2)'), to_string((1000, 1), '(SP,F6.3)') + print *, to_string((1, 1)) !! "(1.00000000,1.00000000)" + print *, to_string((1, 1), '(F6.2)') !! "( 1.00, 1.00)" + print *, to_string((1000, 1), '(ES0.2)'), to_string((1000, 1), '(SP,F6.3)') !! "(1.00E+3,1.00)""(******,+1.000)" !! Too narrow formatter for real number !! Normal demonstration(`******` from Fortran Standard) !> Example for `integer` type -print *, to_string(-3) !! "-3" -print *, to_string(42, '(I4)') !! " 42" -print *, to_string(1, '(I0.4)'), to_string(2, '(B4)') !! "0001"" 10" + print *, to_string(-3) !! "-3" + print *, to_string(42, '(I4)') !! " 42" + print *, to_string(1, '(I0.4)'), to_string(2, '(B4)') !! "0001"" 10" !> Example for `real` type -print *, to_string(1.) !! "1.00000000" -print *, to_string(1., '(F6.2)') !! " 1.00" -print *, to_string(1., 'F6.2') !! " 1.00" -print *, to_string(1., '(SP,ES9.2)'), to_string(1, '(F7.3)') !! "+1.00E+00""[*]" + print *, to_string(1.) !! "1.00000000" + print *, to_string(1., '(F6.2)') !! " 1.00" + print *, to_string(1., 'F6.2') !! " 1.00" + print *, to_string(1., '(SP,ES9.2)'), to_string(1, '(F7.3)') !! "+1.00E+00""[*]" !! 1 wrong demonstration (`[*]` from `to_string`) !> Example for `logical` type -print *, to_string(.true.) !! "T" -print *, to_string(.true., '(L2)') !! " T" -print *, to_string(.true., 'L2') !! " T" -print *, to_string(.false., '(I5)') !! "[*]" + print *, to_string(.true.) !! "T" + print *, to_string(.true., '(L2)') !! " T" + print *, to_string(.true., 'L2') !! " T" + print *, to_string(.false., '(I5)') !! "[*]" !! 1 wrong demonstrations(`[*]` from `to_string`) end program demo_to_string diff --git a/test/example/version/demo_version.f90 b/test/example/version/demo_version.f90 index 9a5ad492e..ad0ce23a8 100644 --- a/test/example/version/demo_version.f90 +++ b/test/example/version/demo_version.f90 @@ -1,7 +1,7 @@ program demo_version -use stdlib_version, only : get_stdlib_version -implicit none -character(len=:), allocatable :: version -call get_stdlib_version(string=version) -print '(a)', version + use stdlib_version, only: get_stdlib_version + implicit none + character(len=:), allocatable :: version + call get_stdlib_version(string=version) + print '(a)', version end program demo_version From 8e2dfc90ba1043664602719b8b5833325a796d0d Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Wed, 22 Jun 2022 16:10:29 +0200 Subject: [PATCH 08/38] fix demo_copy_otehr --- test/example/hashmaps/CMakeLists.txt | 2 +- test/example/hashmaps/demo_hashmaps_copy_other.f90 | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/test/example/hashmaps/CMakeLists.txt b/test/example/hashmaps/CMakeLists.txt index 14b55c326..ec7c68e90 100644 --- a/test/example/hashmaps/CMakeLists.txt +++ b/test/example/hashmaps/CMakeLists.txt @@ -1,6 +1,6 @@ ADD_DEMO(hashmaps_calls) ADD_DEMO(hashmaps_copy_key) -#ADD_DEMO(hashmaps_copy_other) +ADD_DEMO(hashmaps_copy_other) ADD_DEMO(hashmaps_entries) ADD_DEMO(hashmaps_equal_keys) ADD_DEMO(hashmaps_fnv_1a_hasher) diff --git a/test/example/hashmaps/demo_hashmaps_copy_other.f90 b/test/example/hashmaps/demo_hashmaps_copy_other.f90 index e5dcd177b..b0595083a 100644 --- a/test/example/hashmaps/demo_hashmaps_copy_other.f90 +++ b/test/example/hashmaps/demo_hashmaps_copy_other.f90 @@ -1,11 +1,10 @@ program demo_copy_other use stdlib_hashmap_wrappers, only: & - copy_other, get, other_type, set + copy_other, other_type use iso_fortran_env, only: int8 implicit none type(other_type) :: other_in, other_out integer(int8) :: i - class(*), allocatable :: dummy type dummy_type integer(int8) :: value(15) end type @@ -15,9 +14,9 @@ program demo_copy_other end do allocate (other_in%value, source=dummy_val) call copy_other(other_in, other_out) - select type (other_out) - typeis(dummy_type) - print *, "other_in == other_out = ", & - all(other_in%value == other_out%value) + select type (out => other_out%value) + type is (dummy_type) + print *, "other_in == other_out = ", & + all(dummy_val % value == out%value) end select end program demo_copy_other From b003080a522471c623878a032a7e4150b2af9ae1 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Wed, 22 Jun 2022 10:12:27 -0400 Subject: [PATCH 09/38] Update test/example/array/demo_falseloc.f90 Co-authored-by: Ian Giestas Pauli --- test/example/array/demo_falseloc.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/example/array/demo_falseloc.f90 b/test/example/array/demo_falseloc.f90 index c2ed1788a..b12c07fb5 100644 --- a/test/example/array/demo_falseloc.f90 +++ b/test/example/array/demo_falseloc.f90 @@ -4,5 +4,5 @@ program demo_falseloc real, allocatable :: array(:) allocate (array(-200:200)) call random_number(array) - array(falseloc(array < 0.5), lbound(array)) = 0.0 + array(falseloc(array < 0.5, lbound(array,1))) = 0.0 end program demo_falseloc From ec8d47cee4e74da7ce04a086f6f50a37bd81aab8 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Wed, 22 Jun 2022 16:20:43 +0200 Subject: [PATCH 10/38] progress --- test/example/array/CMakeLists.txt | 2 +- test/example/strings/demo_padl.f90 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/example/array/CMakeLists.txt b/test/example/array/CMakeLists.txt index ef739854b..ef3d56051 100644 --- a/test/example/array/CMakeLists.txt +++ b/test/example/array/CMakeLists.txt @@ -1,2 +1,2 @@ -#ADD_DEMO(falseloc) +ADD_DEMO(falseloc) ADD_DEMO(trueloc) diff --git a/test/example/strings/demo_padl.f90 b/test/example/strings/demo_padl.f90 index 41974d891..be7e1bdec 100644 --- a/test/example/strings/demo_padl.f90 +++ b/test/example/strings/demo_padl.f90 @@ -2,12 +2,12 @@ program demo_padl use stdlib_string_type, only: string_type, assignment(=) use stdlib_strings, only: padl implicit none - string_type :: string + type(string_type) :: string string = "left pad this string" ! string <-- "left pad this string" - print *, padl(string, 25, "$") ! "$$$$$left pad this string" + print '(a)', padl(string, 25, "$") ! "$$$$$left pad this string" string = padl(string, 25) ! string <-- " left pad this string" From e8d840ced6b818dbd2e90de9dda9769484b64870 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Mon, 27 Jun 2022 16:46:27 -0400 Subject: [PATCH 11/38] Update test/example/logger/demo_log_text_error.f90 Co-authored-by: Ian Giestas Pauli --- test/example/logger/demo_log_text_error.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/example/logger/demo_log_text_error.f90 b/test/example/logger/demo_log_text_error.f90 index 3d226a263..79fca56b0 100644 --- a/test/example/logger/demo_log_text_error.f90 +++ b/test/example/logger/demo_log_text_error.f90 @@ -2,7 +2,7 @@ program demo_log_text_error use stdlib_logger character(*), parameter :: filename = 'dummy.txt' - integer :: col_no, line_no, lun + integer :: col_no, line_no, lun, status character(128) :: line character(*), parameter :: message = 'Bad text found.' From 0a2f030b53a326f23fe8e520f7bb53279bc78157 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Mon, 27 Jun 2022 16:46:45 -0400 Subject: [PATCH 12/38] Update test/example/strings/demo_padl.f90 Co-authored-by: Ian Giestas Pauli --- test/example/strings/demo_padl.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/example/strings/demo_padl.f90 b/test/example/strings/demo_padl.f90 index be7e1bdec..9aafb5dcd 100644 --- a/test/example/strings/demo_padl.f90 +++ b/test/example/strings/demo_padl.f90 @@ -1,5 +1,5 @@ program demo_padl - use stdlib_string_type, only: string_type, assignment(=) + use stdlib_string_type, only: string_type, assignment(=), write(formatted) use stdlib_strings, only: padl implicit none type(string_type) :: string From c3ca0c8b449e90708a1fcf6b215fa3188527b404 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Mon, 27 Jun 2022 16:46:57 -0400 Subject: [PATCH 13/38] Update test/example/strings/demo_replace_all.f90 Co-authored-by: Ian Giestas Pauli --- test/example/strings/demo_replace_all.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/example/strings/demo_replace_all.f90 b/test/example/strings/demo_replace_all.f90 index d29a4393f..28b833e0e 100644 --- a/test/example/strings/demo_replace_all.f90 +++ b/test/example/strings/demo_replace_all.f90 @@ -1,5 +1,5 @@ program demo_replace_all - use stdlib_string_type, only: string_type, assignment(=) + use stdlib_string_type, only: string_type, assignment(=), write(formatted) use stdlib_strings, only: replace_all implicit none type(string_type) :: string From aec36918d8452ca8e7b971c08814e1a96f771603 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Mon, 27 Jun 2022 16:47:11 -0400 Subject: [PATCH 14/38] Update test/example/strings/demo_padr.f90 Co-authored-by: Ian Giestas Pauli --- test/example/strings/demo_padr.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/example/strings/demo_padr.f90 b/test/example/strings/demo_padr.f90 index 0d2a3fdac..3dc01ac73 100644 --- a/test/example/strings/demo_padr.f90 +++ b/test/example/strings/demo_padr.f90 @@ -2,7 +2,7 @@ program demo_padr use stdlib_string_type, only: string_type, assignment(=) use stdlib_strings, only: padr implicit none - string_type :: string + type(string_type) :: string string = "right pad this string" ! string <-- "right pad this string" From b390dc8607bb8432caab7c09204f4b68fff1e2c4 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Mon, 27 Jun 2022 16:47:23 -0400 Subject: [PATCH 15/38] Update test/example/strings/demo_padr.f90 Co-authored-by: Ian Giestas Pauli --- test/example/strings/demo_padr.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/example/strings/demo_padr.f90 b/test/example/strings/demo_padr.f90 index 3dc01ac73..c8afd6f8d 100644 --- a/test/example/strings/demo_padr.f90 +++ b/test/example/strings/demo_padr.f90 @@ -1,5 +1,5 @@ program demo_padr - use stdlib_string_type, only: string_type, assignment(=) + use stdlib_string_type, only: string_type, assignment(=), write(formatted) use stdlib_strings, only: padr implicit none type(string_type) :: string From faa1bc3b0b19d7d6c5a5515cc43b3879135fbf16 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Mon, 27 Jun 2022 16:47:54 -0400 Subject: [PATCH 16/38] Update test/example/strings/demo_padr.f90 Co-authored-by: Ian Giestas Pauli --- test/example/strings/demo_padr.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/example/strings/demo_padr.f90 b/test/example/strings/demo_padr.f90 index c8afd6f8d..68eb33513 100644 --- a/test/example/strings/demo_padr.f90 +++ b/test/example/strings/demo_padr.f90 @@ -7,7 +7,7 @@ program demo_padr string = "right pad this string" ! string <-- "right pad this string" - print *, padr(string, 25, "$") ! "right pad this string$$$$" + print '(a)', padr(string, 25, "$") ! "right pad this string$$$$" string = padr(string, 25) ! string <-- "right pad this string " From dc42cf57aa56b37864daec54f278ea70adfd5b9c Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Mon, 27 Jun 2022 16:48:44 -0400 Subject: [PATCH 17/38] Update test/example/logger/demo_log_text_error.f90 Co-authored-by: Ian Giestas Pauli --- test/example/logger/demo_log_text_error.f90 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/example/logger/demo_log_text_error.f90 b/test/example/logger/demo_log_text_error.f90 index 79fca56b0..aae9da941 100644 --- a/test/example/logger/demo_log_text_error.f90 +++ b/test/example/logger/demo_log_text_error.f90 @@ -21,4 +21,16 @@ program demo_log_text_error end do 900 continue +contains + + subroutine check_line(line, status, col_no) + character(*), intent(in) :: line + integer, intent(inout) :: status + integer, intent(inout) :: col_no + ! scan the line for forbidden characters + col_no = scan(line,".$/") + ! col_no > 0 means there is a forbidden character + status = int(col_no > 0) + end subroutine + end program demo_log_text_error From 7fd1ac99bb873ed836eabf9b64c2c69621eaf3c2 Mon Sep 17 00:00:00 2001 From: Ian Giestas Pauli Date: Mon, 27 Jun 2022 18:14:31 -0300 Subject: [PATCH 18/38] remove `int()` out of a `logical` expression --- test/example/logger/demo_log_text_error.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/example/logger/demo_log_text_error.f90 b/test/example/logger/demo_log_text_error.f90 index aae9da941..5607c7f98 100644 --- a/test/example/logger/demo_log_text_error.f90 +++ b/test/example/logger/demo_log_text_error.f90 @@ -30,7 +30,7 @@ subroutine check_line(line, status, col_no) ! scan the line for forbidden characters col_no = scan(line,".$/") ! col_no > 0 means there is a forbidden character - status = int(col_no > 0) + status = col_no > 0 end subroutine end program demo_log_text_error From 729b4031932461f83ed42c1ac78e713cc0e23952 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 28 Jun 2022 00:36:18 +0200 Subject: [PATCH 19/38] fix demo to pass all tests --- test/example/CMakeLists.txt | 6 +++--- test/example/error/CMakeLists.txt | 5 +++++ .../hash_procedures/demo_universal_mult_hash_64.f90 | 2 +- test/example/hashmaps/demo_hashmaps_free_other.f90 | 2 +- .../hashmaps/demo_hashmaps_get_other_data.f90 | 2 +- test/example/hashmaps/demo_hashmaps_probes.f90 | 4 ++-- test/example/io/CMakeLists.txt | 2 +- test/example/linalg/demo_diag2.f90 | 1 - test/example/linalg/demo_diag3.f90 | 1 - test/example/linalg/demo_diag4.f90 | 1 - test/example/linalg/demo_diag5.f90 | 1 - test/example/logger/CMakeLists.txt | 1 + test/example/logger/demo_add_log_unit.f90 | 13 +++++-------- test/example/math/demo_linspace_complex.f90 | 4 ++-- test/example/math/demo_math_all_close.f90 | 2 +- test/example/selection/demo_arg_select.f90 | 2 +- test/example/selection/demo_select.f90 | 2 +- .../example/specialfunctions_gamma/demo_ligamma.f90 | 2 +- .../demo_exponential_rvs.f90 | 1 - test/example/strings/CMakeLists.txt | 6 +++--- test/example/strings/demo_chomp.f90 | 2 +- 21 files changed, 30 insertions(+), 32 deletions(-) diff --git a/test/example/CMakeLists.txt b/test/example/CMakeLists.txt index 997397ff8..10c4bc3d2 100644 --- a/test/example/CMakeLists.txt +++ b/test/example/CMakeLists.txt @@ -1,9 +1,9 @@ macro(ADD_DEMO name) add_executable(demo_${name} demo_${name}.f90) target_link_libraries(demo_${name} "${PROJECT_NAME}") -# add_test(NAME ${name} -# COMMAND $ ${CMAKE_CURRENT_BINARY_DIR} -# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + add_test(NAME ${name} + COMMAND $ ${CMAKE_CURRENT_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endmacro(ADD_DEMO) add_subdirectory(array) diff --git a/test/example/error/CMakeLists.txt b/test/example/error/CMakeLists.txt index a9cfa2e96..5d1a00fdc 100644 --- a/test/example/error/CMakeLists.txt +++ b/test/example/error/CMakeLists.txt @@ -1,6 +1,11 @@ ADD_DEMO(check1) +set_tests_properties(check1 PROPERTIES WILL_FAIL true) ADD_DEMO(check2) +set_tests_properties(check2 PROPERTIES WILL_FAIL true) ADD_DEMO(check3) ADD_DEMO(check4) +set_tests_properties(check4 PROPERTIES SKIP_RETURN_CODE 77) ADD_DEMO(error_stop1) +set_tests_properties(error_stop1 PROPERTIES WILL_FAIL true) ADD_DEMO(error_stop2) +set_tests_properties(error_stop2 PROPERTIES WILL_FAIL true) diff --git a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 b/test/example/hash_procedures/demo_universal_mult_hash_64.f90 index 909738497..19236f3d1 100644 --- a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 +++ b/test/example/hash_procedures/demo_universal_mult_hash_64.f90 @@ -4,7 +4,7 @@ program demo_universal_mult_hash_64 use iso_fortran_env, only: int64 implicit none integer, allocatable :: array1(:) - integer(int64) :: hash, i, seed, source + integer(int64) :: hash, seed, source seed = 0 allocate (array1(0:2**6 - 1)) array1 = 0 diff --git a/test/example/hashmaps/demo_hashmaps_free_other.f90 b/test/example/hashmaps/demo_hashmaps_free_other.f90 index 583640ad6..17ab7c1e3 100644 --- a/test/example/hashmaps/demo_hashmaps_free_other.f90 +++ b/test/example/hashmaps/demo_hashmaps_free_other.f90 @@ -7,7 +7,7 @@ program demo_free_other integer(int8) :: value(15) end type dummy_type type(dummy_type) :: dummy_val - type(other_type), allocatable :: other_in, other_out + type(other_type) :: other_in, other_out integer(int8) :: i do i = 1, 15 dummy_val%value(i) = i diff --git a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 index 3fbd7e682..1f9411535 100644 --- a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 +++ b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 @@ -2,7 +2,7 @@ program demo_get_other_data use stdlib_kinds, only: int8 use stdlib_hashmaps, only: chaining_hashmap_type, int_index use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set, get - logical :: conflict, exists + logical :: conflict type(key_type) :: key type(other_type) :: other type(chaining_hashmap_type) :: map diff --git a/test/example/hashmaps/demo_hashmaps_probes.f90 b/test/example/hashmaps/demo_hashmaps_probes.f90 index 43a5d2b5d..a60bc644e 100644 --- a/test/example/hashmaps/demo_hashmaps_probes.f90 +++ b/test/example/hashmaps/demo_hashmaps_probes.f90 @@ -1,9 +1,9 @@ program demo_probes - use stdlib_hashmaps, only: chaining_hashmap_type, int_index + use stdlib_hashmaps, only: chaining_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none type(chaining_hashmap_type) :: map - real :: nprobes + integer :: nprobes call map%init(fnv_1_hasher) nprobes = map%map_probes() print *, "Initial probes = ", nprobes diff --git a/test/example/io/CMakeLists.txt b/test/example/io/CMakeLists.txt index 0e4f22461..d1c4e7003 100644 --- a/test/example/io/CMakeLists.txt +++ b/test/example/io/CMakeLists.txt @@ -1,5 +1,5 @@ ADD_DEMO(fmt_constants) -ADD_DEMO(getline) +#ADD_DEMO(getline) ADD_DEMO(loadnpy) ADD_DEMO(loadtxt) ADD_DEMO(open) diff --git a/test/example/linalg/demo_diag2.f90 b/test/example/linalg/demo_diag2.f90 index 859a6d3df..ee65793d6 100644 --- a/test/example/linalg/demo_diag2.f90 +++ b/test/example/linalg/demo_diag2.f90 @@ -3,7 +3,6 @@ program demo_diag2 implicit none real, allocatable :: v(:) real, allocatable :: A(:, :) - integer :: i v = [1, 2, 3, 4, 5] A = diag(v) ! creates a 5 by 5 matrix with elements of v on the diagonal end program demo_diag2 diff --git a/test/example/linalg/demo_diag3.f90 b/test/example/linalg/demo_diag3.f90 index 47d4e2961..2b6dcd82d 100644 --- a/test/example/linalg/demo_diag3.f90 +++ b/test/example/linalg/demo_diag3.f90 @@ -4,7 +4,6 @@ program demo_diag3 integer, parameter :: n = 10 real :: c(n), ul(n - 1) real :: A(n, n) - integer :: i c = 2 ul = -1 A = diag(ul, -1) + diag(c) + diag(ul, 1) ! Gil Strang's favorite matrix diff --git a/test/example/linalg/demo_diag4.f90 b/test/example/linalg/demo_diag4.f90 index 39663cf57..74024d49a 100644 --- a/test/example/linalg/demo_diag4.f90 +++ b/test/example/linalg/demo_diag4.f90 @@ -4,7 +4,6 @@ program demo_diag4 integer, parameter :: n = 12 real :: A(n, n) real :: v(n) - integer :: i call random_number(A) v = diag(A) ! v contains diagonal elements of A end program demo_diag4 diff --git a/test/example/linalg/demo_diag5.f90 b/test/example/linalg/demo_diag5.f90 index f13ccf3a2..4e182deee 100644 --- a/test/example/linalg/demo_diag5.f90 +++ b/test/example/linalg/demo_diag5.f90 @@ -4,7 +4,6 @@ program demo_diag5 integer, parameter :: n = 3 real :: A(n, n) real, allocatable :: v(:) - integer :: i A = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [n, n]) v = diag(A, -1) ! v is [2,6] v = diag(A, 1) ! v is [4,8] diff --git a/test/example/logger/CMakeLists.txt b/test/example/logger/CMakeLists.txt index 3c8eeec9e..14f9610b9 100644 --- a/test/example/logger/CMakeLists.txt +++ b/test/example/logger/CMakeLists.txt @@ -2,4 +2,5 @@ ADD_DEMO(add_log_unit) ADD_DEMO(configure) ADD_DEMO(global_logger) ADD_DEMO(log_io_error) +set_tests_properties(log_io_error PROPERTIES WILL_FAIL true) #ADD_DEMO(log_text_error) diff --git a/test/example/logger/demo_add_log_unit.f90 b/test/example/logger/demo_add_log_unit.f90 index 9985631ee..e609789f4 100644 --- a/test/example/logger/demo_add_log_unit.f90 +++ b/test/example/logger/demo_add_log_unit.f90 @@ -6,17 +6,14 @@ program demo_add_log_unit open (newunit=unit, file='error_log.txt', & form='formatted', status='replace', & - position='rewind', err=999, & - action='read', iostat=iostat, iomsg=iomsg) + position='rewind', & + action='write', iostat=iostat, iomsg=iomsg) call global_logger%add_log_unit(unit, stat) - select case (stat) - - case (read_only_error) - error stop 'Unable to write to "error_log.txt".' + select case (stat) + case (read_only_error) + error stop 'Unable to write to "error_log.txt".' end select -999 error stop 'Unable to open "error_log.txt".' - end program demo_add_log_unit diff --git a/test/example/math/demo_linspace_complex.f90 b/test/example/math/demo_linspace_complex.f90 index 092d9df3d..43ce59cd1 100644 --- a/test/example/math/demo_linspace_complex.f90 +++ b/test/example/math/demo_linspace_complex.f90 @@ -3,8 +3,8 @@ program demo_linspace_complex use stdlib_kinds, only: dp implicit none - complex(dp) :: start = complex(10.0_dp, 5.0_dp) - complex(dp) :: end = complex(-10.0_dp, 15.0_dp) + complex(dp) :: start = cmplx(10.0_dp, 5.0_dp,kind=dp) + complex(dp) :: end = cmplx(-10.0_dp, 15.0_dp,kind=dp) complex(dp) :: z(11) diff --git a/test/example/math/demo_math_all_close.f90 b/test/example/math/demo_math_all_close.f90 index 657529168..ae52e40af 100644 --- a/test/example/math/demo_math_all_close.f90 +++ b/test/example/math/demo_math_all_close.f90 @@ -1,7 +1,7 @@ program demo_math_all_close use stdlib_math, only: all_close - real :: x(2) = [1, 2], y, NAN + real :: y, NAN complex :: z(4, 4) y = -3 diff --git a/test/example/selection/demo_arg_select.f90 b/test/example/selection/demo_arg_select.f90 index 246cd43af..3b87e9c39 100644 --- a/test/example/selection/demo_arg_select.f90 +++ b/test/example/selection/demo_arg_select.f90 @@ -5,7 +5,7 @@ program demo_arg_select real, allocatable :: array(:) integer, allocatable :: indx(:) integer :: kth_smallest - integer :: k, left, right + integer :: k array = [3., 2., 7., 4., 5., 1., 4., -1.] indx = [(k, k=1, size(array))] diff --git a/test/example/selection/demo_select.f90 b/test/example/selection/demo_select.f90 index 1f1eb904f..fdf5404ef 100644 --- a/test/example/selection/demo_select.f90 +++ b/test/example/selection/demo_select.f90 @@ -4,7 +4,7 @@ program demo_select real, allocatable :: array(:) real :: kth_smallest - integer :: k, left, right + integer :: k array = [3., 2., 7., 4., 5., 1., 4., -1.] diff --git a/test/example/specialfunctions_gamma/demo_ligamma.f90 b/test/example/specialfunctions_gamma/demo_ligamma.f90 index 0aa27e38a..5056703b6 100644 --- a/test/example/specialfunctions_gamma/demo_ligamma.f90 +++ b/test/example/specialfunctions_gamma/demo_ligamma.f90 @@ -2,7 +2,7 @@ program demo_ligamma use stdlib_specialfunctions_gamma, only: lig => lower_incomplete_gamma implicit none integer :: p - real :: p1, x + real :: p1 p = 3 p1 = 2.3 diff --git a/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 b/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 index d0cc37ce3..e20786d5d 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 +++ b/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 @@ -3,7 +3,6 @@ program demo_exponential_rvs use stdlib_stats_distribution_exponential, only: rexp => rvs_exp implicit none - real :: a(2, 3, 4) complex :: scale integer :: seed_put, seed_get diff --git a/test/example/strings/CMakeLists.txt b/test/example/strings/CMakeLists.txt index f3ae32b45..7e36c5c0c 100644 --- a/test/example/strings/CMakeLists.txt +++ b/test/example/strings/CMakeLists.txt @@ -2,9 +2,9 @@ ADD_DEMO(chomp) ADD_DEMO(count) ADD_DEMO(ends_with) ADD_DEMO(find) -#ADD_DEMO(padl) -#ADD_DEMO(padr) -#ADD_DEMO(replace_all) +ADD_DEMO(padl) +ADD_DEMO(padr) +ADD_DEMO(replace_all) ADD_DEMO(slice) ADD_DEMO(starts_with) ADD_DEMO(strip) diff --git a/test/example/strings/demo_chomp.f90 b/test/example/strings/demo_chomp.f90 index 31188c475..1971a11c6 100644 --- a/test/example/strings/demo_chomp.f90 +++ b/test/example/strings/demo_chomp.f90 @@ -1,5 +1,5 @@ program demo_chomp - use stdlib_ascii, only: TAB, VT, NUL, LF, CR, FF + use stdlib_ascii, only: TAB, VT, LF, CR, FF use stdlib_strings, only: chomp implicit none print'(a)', chomp(" hello ") ! " hello" From e9cd24f76cd4a6be16c6d182eb9a99843d35547c Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 28 Jun 2022 00:41:41 +0200 Subject: [PATCH 20/38] add example files in io --- test/example/io/example.dat | 3 +++ test/example/io/example.npy | Bin 0 -> 152 bytes 2 files changed, 3 insertions(+) create mode 100644 test/example/io/example.dat create mode 100644 test/example/io/example.npy diff --git a/test/example/io/example.dat b/test/example/io/example.dat new file mode 100644 index 000000000..43d2cdfe5 --- /dev/null +++ b/test/example/io/example.dat @@ -0,0 +1,3 @@ + 1.00000000E+00 1.00000000E+00 + 1.00000000E+00 1.00000000E+00 + 1.00000000E+00 1.00000000E+00 diff --git a/test/example/io/example.npy b/test/example/io/example.npy new file mode 100644 index 0000000000000000000000000000000000000000..2f182a5ab54a7bbc7748bd05e589c2e752096304 GIT binary patch literal 152 zcmbR27wQ`j$;eQ~P_3SlTAW;@Zl$1ZlV+l>qoAIaUsO_*m=~X4l#&V(4=E~51qv5u eBo?Fsxf;eg3Pw5#nmP)#3giMV28ITEY#0C$f*;2K literal 0 HcmV?d00001 From 5954f51273e11cc0ba0e39292b19cbde2993d206 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 28 Jun 2022 08:36:16 +0200 Subject: [PATCH 21/38] fix issue with Intel compiler --- test/example/hashmaps/demo_hashmaps_get_other_data.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 index 1f9411535..5885bd71e 100644 --- a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 +++ b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 @@ -24,7 +24,7 @@ program demo_get_other_data end if call get(other, data) select type (data) - typeis(dummy_type) + type is (dummy_type) print *, 'Other data % value = ', data%value class default print *, 'Invalid data type in other' From 6d7f88961ccbafdf55c4e72ab95d44a73a9b3a41 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 28 Jun 2022 22:26:45 +0200 Subject: [PATCH 22/38] use 2 spaces for indentation --- test/example/array/demo_falseloc.f90 | 12 +- test/example/array/demo_trueloc.f90 | 12 +- test/example/ascii/demo_ascii_reverse.f90 | 6 +- test/example/ascii/demo_ascii_to_lower.f90 | 6 +- test/example/ascii/demo_ascii_to_sentence.f90 | 10 +- test/example/ascii/demo_ascii_to_title.f90 | 10 +- test/example/ascii/demo_ascii_to_upper.f90 | 6 +- test/example/bitsets/demo_bitsets_all.f90 | 24 ++-- test/example/bitsets/demo_bitsets_and.f90 | 30 ++--- test/example/bitsets/demo_bitsets_and_not.f90 | 32 ++--- test/example/bitsets/demo_bitsets_any.f90 | 26 ++-- .../bitsets/demo_bitsets_assignment.f90 | 48 ++++---- .../bitsets/demo_bitsets_bit_count.f90 | 26 ++-- test/example/bitsets/demo_bitsets_bits.f90 | 18 +-- test/example/bitsets/demo_bitsets_clear.f90 | 18 +-- .../example/bitsets/demo_bitsets_equality.f90 | 28 ++--- test/example/bitsets/demo_bitsets_extract.f90 | 16 +-- test/example/bitsets/demo_bitsets_flip.f90 | 16 +-- .../bitsets/demo_bitsets_from_string.f90 | 30 ++--- test/example/bitsets/demo_bitsets_ge.f90 | 30 ++--- test/example/bitsets/demo_bitsets_gt.f90 | 28 ++--- .../bitsets/demo_bitsets_inequality.f90 | 28 ++--- test/example/bitsets/demo_bitsets_init.f90 | 12 +- test/example/bitsets/demo_bitsets_input.f90 | 60 ++++----- test/example/bitsets/demo_bitsets_le.f90 | 30 ++--- test/example/bitsets/demo_bitsets_lt.f90 | 28 ++--- test/example/bitsets/demo_bitsets_none.f90 | 26 ++-- test/example/bitsets/demo_bitsets_not.f90 | 22 ++-- test/example/bitsets/demo_bitsets_or.f90 | 32 ++--- test/example/bitsets/demo_bitsets_output.f90 | 60 ++++----- .../bitsets/demo_bitsets_read_bitset.f90 | 66 +++++----- test/example/bitsets/demo_bitsets_set.f90 | 16 +-- test/example/bitsets/demo_bitsets_test.f90 | 18 +-- .../bitsets/demo_bitsets_to_string.f90 | 24 ++-- test/example/bitsets/demo_bitsets_value.f90 | 18 +-- .../bitsets/demo_bitsets_write_bitset.f90 | 66 +++++----- test/example/bitsets/demo_bitsets_xor.f90 | 32 ++--- test/example/error/demo_check1.f90 | 8 +- test/example/error/demo_check2.f90 | 8 +- test/example/error/demo_check3.f90 | 8 +- test/example/error/demo_check4.f90 | 8 +- test/example/error/demo_error_stop1.f90 | 6 +- test/example/error/demo_error_stop2.f90 | 6 +- .../hash_procedures/demo_fibonacci_hash.f90 | 22 ++-- .../demo_fibonacci_hash_64.f90 | 22 ++-- .../hash_procedures/demo_fnv_1_hash.f90 | 12 +- .../hash_procedures/demo_fnv_1_hash_64.f90 | 16 +-- .../hash_procedures/demo_fnv_1a_hash.f90 | 12 +- .../hash_procedures/demo_fnv_1a_hash_64.f90 | 16 +-- .../example/hash_procedures/demo_nmhash32.f90 | 18 +-- .../hash_procedures/demo_nmhash32x.f90 | 18 +-- .../hash_procedures/demo_pengy_hash.f90 | 22 ++-- .../hash_procedures/demo_spooky_hash.f90 | 22 ++-- .../demo_universal_mult_hash.f90 | 32 ++--- .../demo_universal_mult_hash_64.f90 | 28 ++--- .../hash_procedures/demo_water_hash.f90 | 18 +-- test/example/hashmaps/demo_hashmaps_calls.f90 | 16 +-- .../hashmaps/demo_hashmaps_copy_key.f90 | 20 +-- .../hashmaps/demo_hashmaps_copy_other.f90 | 40 +++--- .../hashmaps/demo_hashmaps_entries.f90 | 16 +-- .../hashmaps/demo_hashmaps_equal_keys.f90 | 24 ++-- .../hashmaps/demo_hashmaps_fnv_1_hasher.f90 | 20 +-- .../hashmaps/demo_hashmaps_fnv_1a_hasher.f90 | 22 ++-- .../hashmaps/demo_hashmaps_free_key.f90 | 20 +-- .../hashmaps/demo_hashmaps_free_other.f90 | 32 ++--- test/example/hashmaps/demo_hashmaps_get.f90 | 28 ++--- .../hashmaps/demo_hashmaps_get_other_data.f90 | 60 ++++----- .../hashmaps/demo_hashmaps_hasher_fun.f90 | 24 ++-- test/example/hashmaps/demo_hashmaps_init.f90 | 10 +- .../hashmaps/demo_hashmaps_key_test.f90 | 22 ++-- .../hashmaps/demo_hashmaps_loading.f90 | 16 +-- .../hashmaps/demo_hashmaps_map_entry.f90 | 28 ++--- .../hashmaps/demo_hashmaps_num_slots.f90 | 16 +-- .../example/hashmaps/demo_hashmaps_probes.f90 | 16 +-- .../example/hashmaps/demo_hashmaps_rehash.f90 | 30 ++--- .../example/hashmaps/demo_hashmaps_remove.f90 | 32 ++--- .../demo_hashmaps_seeded_nmhash32_hasher.f90 | 22 ++-- .../demo_hashmaps_seeded_nmhash32x_hasher.f90 | 22 ++-- .../demo_hashmaps_seeded_water_hasher.f90 | 22 ++-- test/example/hashmaps/demo_hashmaps_set.f90 | 28 ++--- .../hashmaps/demo_hashmaps_set_other_data.f90 | 40 +++--- .../hashmaps/demo_hashmaps_slots_bits.f90 | 16 +-- .../hashmaps/demo_hashmaps_total_depth.f90 | 16 +-- test/example/io/demo_fmt_constants.f90 | 40 +++--- test/example/io/demo_getline.f90 | 18 +-- test/example/io/demo_loadnpy.f90 | 8 +- test/example/io/demo_loadtxt.f90 | 8 +- test/example/io/demo_open.f90 | 12 +- test/example/io/demo_savenpy.f90 | 8 +- test/example/io/demo_savetxt.f90 | 8 +- test/example/linalg/demo_diag1.f90 | 10 +- test/example/linalg/demo_diag2.f90 | 12 +- test/example/linalg/demo_diag3.f90 | 16 +-- test/example/linalg/demo_diag4.f90 | 14 +-- test/example/linalg/demo_diag5.f90 | 16 +-- test/example/linalg/demo_eye1.f90 | 24 ++-- test/example/linalg/demo_eye2.f90 | 6 +- test/example/linalg/demo_is_diagonal.f90 | 16 +-- test/example/linalg/demo_is_hermitian.f90 | 16 +-- test/example/linalg/demo_is_hessenberg.f90 | 16 +-- .../example/linalg/demo_is_skew_symmetric.f90 | 16 +-- test/example/linalg/demo_is_square.f90 | 16 +-- test/example/linalg/demo_is_symmetric.f90 | 16 +-- test/example/linalg/demo_is_triangular.f90 | 16 +-- test/example/linalg/demo_outer_product.f90 | 12 +- test/example/linalg/demo_trace.f90 | 10 +- test/example/logger/demo_add_log_unit.f90 | 24 ++-- test/example/logger/demo_configure.f90 | 4 +- test/example/logger/demo_global_logger.f90 | 14 +-- test/example/logger/demo_log_io_error.f90 | 30 ++--- test/example/logger/demo_log_text_error.f90 | 54 ++++---- test/example/math/demo_clip_integer.f90 | 22 ++-- test/example/math/demo_clip_real.f90 | 22 ++-- test/example/math/demo_diff.f90 | 28 ++--- test/example/math/demo_gcd.f90 | 12 +- test/example/math/demo_linspace_complex.f90 | 14 +-- test/example/math/demo_linspace_int16.f90 | 14 +-- test/example/math/demo_logspace_complex.f90 | 14 +-- test/example/math/demo_logspace_int.f90 | 16 +-- .../math/demo_logspace_rstart_cbase.f90 | 18 +-- test/example/math/demo_math_all_close.f90 | 16 +-- test/example/math/demo_math_arange.f90 | 24 ++-- test/example/math/demo_math_arg.f90 | 10 +- test/example/math/demo_math_argd.f90 | 10 +- test/example/math/demo_math_argpi.f90 | 10 +- test/example/math/demo_math_is_close.f90 | 16 +-- test/example/optval/demo_optval.f90 | 18 +-- .../quadrature/demo_gauss_legendre.f90 | 14 +-- .../demo_gauss_legendre_lobatto.f90 | 14 +-- test/example/quadrature/demo_simps.f90 | 12 +- .../example/quadrature/demo_simps_weights.f90 | 14 +-- test/example/quadrature/demo_trapz.f90 | 12 +- .../example/quadrature/demo_trapz_weights.f90 | 14 +-- test/example/random/demo_dist_rand.f90 | 20 +-- test/example/random/demo_random_seed.f90 | 10 +- test/example/selection/demo_arg_select.f90 | 34 ++--- test/example/selection/demo_select.f90 | 30 ++--- test/example/selection/selection_vs_sort.f90 | 116 +++++++++--------- test/example/sorting/demo_ord_sort.f90 | 14 +-- test/example/sorting/demo_sort.f90 | 12 +- .../specialfunctions_gamma/demo_gamma.f90 | 48 ++++---- .../specialfunctions_gamma/demo_gamma_p.f90 | 6 +- .../specialfunctions_gamma/demo_gamma_q.f90 | 6 +- .../specialfunctions_gamma/demo_ligamma.f90 | 16 +-- .../demo_log_factorial.f90 | 14 +-- .../specialfunctions_gamma/demo_log_gamma.f90 | 40 +++--- .../specialfunctions_gamma/demo_uigamma.f90 | 8 +- test/example/stats/demo_corr.f90 | 12 +- test/example/stats/demo_cov.f90 | 14 +-- test/example/stats/demo_mean.f90 | 16 +-- test/example/stats/demo_median.f90 | 16 +-- test/example/stats/demo_moment.f90 | 20 +-- test/example/stats/demo_var.f90 | 20 +-- .../demo_exponential_cdf.f90 | 32 ++--- .../demo_exponential_pdf.f90 | 32 ++--- .../demo_exponential_rvs.f90 | 24 ++-- .../demo_norm_cdf.f90 | 38 +++--- .../demo_normal_pdf.f90 | 38 +++--- .../demo_normal_rvs.f90 | 36 +++--- .../demo_shuffle.f90 | 34 ++--- .../demo_uniform_cdf.f90 | 38 +++--- .../demo_uniform_pdf.f90 | 38 +++--- .../demo_uniform_rvs.f90 | 46 +++---- test/example/string_type/demo_adjustl.f90 | 10 +- test/example/string_type/demo_adjustr.f90 | 10 +- test/example/string_type/demo_char.f90 | 12 +- .../string_type/demo_char_position.f90 | 16 +-- test/example/string_type/demo_char_range.f90 | 12 +- .../demo_constructor_character.f90 | 8 +- .../string_type/demo_constructor_empty.f90 | 8 +- .../string_type/demo_constructor_integer.f90 | 10 +- .../string_type/demo_constructor_logical.f90 | 10 +- .../string_type/demo_constructor_scalar.f90 | 10 +- test/example/string_type/demo_cont.f90 | 10 +- test/example/string_type/demo_eq.f90 | 16 +-- test/example/string_type/demo_fread.f90 | 22 ++-- test/example/string_type/demo_fwrite.f90 | 22 ++-- test/example/string_type/demo_ge.f90 | 16 +-- test/example/string_type/demo_gt.f90 | 16 +-- test/example/string_type/demo_iachar.f90 | 12 +- test/example/string_type/demo_ichar.f90 | 12 +- test/example/string_type/demo_index.f90 | 16 +-- test/example/string_type/demo_le.f90 | 16 +-- test/example/string_type/demo_len.f90 | 16 +-- test/example/string_type/demo_len_trim.f90 | 16 +-- test/example/string_type/demo_lge.f90 | 16 +-- test/example/string_type/demo_lgt.f90 | 16 +-- test/example/string_type/demo_lle.f90 | 16 +-- test/example/string_type/demo_llt.f90 | 16 +-- test/example/string_type/demo_lt.f90 | 16 +-- test/example/string_type/demo_move.f90 | 16 +-- test/example/string_type/demo_ne.f90 | 16 +-- test/example/string_type/demo_repeat.f90 | 10 +- test/example/string_type/demo_reverse.f90 | 10 +- test/example/string_type/demo_scan.f90 | 16 +-- test/example/string_type/demo_to_lower.f90 | 10 +- test/example/string_type/demo_to_sentence.f90 | 10 +- test/example/string_type/demo_to_title.f90 | 10 +- test/example/string_type/demo_to_upper.f90 | 10 +- test/example/string_type/demo_trim.f90 | 10 +- test/example/string_type/demo_uread.f90 | 20 +-- test/example/string_type/demo_uwrite.f90 | 20 +-- test/example/string_type/demo_verify.f90 | 20 +-- .../demo_stringlist_type_clear.f90 | 14 +-- ...o_stringlist_type_concatenate_operator.f90 | 22 ++-- .../demo_stringlist_type_constructor.f90 | 14 +-- ...demo_stringlist_type_equality_operator.f90 | 28 ++--- .../demo_stringlist_type_fidx_bidx.f90 | 10 +- .../demo_stringlist_type_get.f90 | 26 ++-- ...mo_stringlist_type_inequality_operator.f90 | 28 ++--- .../demo_stringlist_type_insert_at.f90 | 22 ++-- .../demo_stringlist_type_len.f90 | 16 +-- test/example/strings/demo_chomp.f90 | 24 ++-- test/example/strings/demo_count.f90 | 16 +-- test/example/strings/demo_ends_with.f90 | 8 +- test/example/strings/demo_find.f90 | 16 +-- test/example/strings/demo_padl.f90 | 14 +-- test/example/strings/demo_padr.f90 | 14 +-- test/example/strings/demo_replace_all.f90 | 14 +-- test/example/strings/demo_slice.f90 | 20 +-- test/example/strings/demo_starts_with.f90 | 8 +- test/example/strings/demo_strip.f90 | 16 +-- test/example/strings/demo_to_string.f90 | 30 ++--- test/example/version/demo_version.f90 | 10 +- 224 files changed, 2243 insertions(+), 2243 deletions(-) diff --git a/test/example/array/demo_falseloc.f90 b/test/example/array/demo_falseloc.f90 index b12c07fb5..c8818aa9c 100644 --- a/test/example/array/demo_falseloc.f90 +++ b/test/example/array/demo_falseloc.f90 @@ -1,8 +1,8 @@ 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,1))) = 0.0 + 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, 1))) = 0.0 end program demo_falseloc diff --git a/test/example/array/demo_trueloc.f90 b/test/example/array/demo_trueloc.f90 index 1a57d6415..268d1ea67 100644 --- a/test/example/array/demo_trueloc.f90 +++ b/test/example/array/demo_trueloc.f90 @@ -1,8 +1,8 @@ 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 + 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 diff --git a/test/example/ascii/demo_ascii_reverse.f90 b/test/example/ascii/demo_ascii_reverse.f90 index f9a119a1b..0502b040f 100644 --- a/test/example/ascii/demo_ascii_reverse.f90 +++ b/test/example/ascii/demo_ascii_reverse.f90 @@ -1,5 +1,5 @@ program demo_reverse - use stdlib_ascii, only: reverse - implicit none - print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH" + use stdlib_ascii, only: reverse + implicit none + print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH" end program demo_reverse diff --git a/test/example/ascii/demo_ascii_to_lower.f90 b/test/example/ascii/demo_ascii_to_lower.f90 index 23e21bc9b..ca56df71f 100644 --- a/test/example/ascii/demo_ascii_to_lower.f90 +++ b/test/example/ascii/demo_ascii_to_lower.f90 @@ -1,5 +1,5 @@ program demo_to_lower - use stdlib_ascii, only: to_lower - implicit none - print'(a)', to_lower("HELLo!") ! returns "hello!" + use stdlib_ascii, only: to_lower + implicit none + print'(a)', to_lower("HELLo!") ! returns "hello!" end program demo_to_lower diff --git a/test/example/ascii/demo_ascii_to_sentence.f90 b/test/example/ascii/demo_ascii_to_sentence.f90 index cee15bdd0..869ced5cc 100644 --- a/test/example/ascii/demo_ascii_to_sentence.f90 +++ b/test/example/ascii/demo_ascii_to_sentence.f90 @@ -1,7 +1,7 @@ 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" + 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 diff --git a/test/example/ascii/demo_ascii_to_title.f90 b/test/example/ascii/demo_ascii_to_title.f90 index e93b672f4..6fae4637c 100644 --- a/test/example/ascii/demo_ascii_to_title.f90 +++ b/test/example/ascii/demo_ascii_to_title.f90 @@ -1,7 +1,7 @@ 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" + 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 diff --git a/test/example/ascii/demo_ascii_to_upper.f90 b/test/example/ascii/demo_ascii_to_upper.f90 index 734387fae..8a8baec5c 100644 --- a/test/example/ascii/demo_ascii_to_upper.f90 +++ b/test/example/ascii/demo_ascii_to_upper.f90 @@ -1,5 +1,5 @@ program demo_to_upper - use stdlib_ascii, only: to_upper - implicit none - print'(a)', to_upper("hello!") ! returns "HELLO!" + use stdlib_ascii, only: to_upper + implicit none + print'(a)', to_upper("hello!") ! returns "HELLO!" end program demo_to_upper diff --git a/test/example/bitsets/demo_bitsets_all.f90 b/test/example/bitsets/demo_bitsets_all.f90 index 49769f007..c9440e8cd 100644 --- a/test/example/bitsets/demo_bitsets_all.f90 +++ b/test/example/bitsets/demo_bitsets_all.f90 @@ -1,14 +1,14 @@ program demo_all - use stdlib_bitsets - character(*), parameter :: & - bits_all = '111111111111111111111111111111111' - type(bitset_64) :: set0 - call set0%from_string(bits_all) - if (.not. set0%all()) then - error stop "FROM_STRING failed to interpret"// & - "BITS_ALL's value properly." - else - write (*, *) "FROM_STRING transferred BITS_ALL properly"// & - " into set0." - end if + use stdlib_bitsets + character(*), parameter :: & + bits_all = '111111111111111111111111111111111' + type(bitset_64) :: set0 + call set0%from_string(bits_all) + if (.not. set0%all()) then + error stop "FROM_STRING failed to interpret"// & + "BITS_ALL's value properly." + else + write (*, *) "FROM_STRING transferred BITS_ALL properly"// & + " into set0." + end if end program demo_all diff --git a/test/example/bitsets/demo_bitsets_and.f90 b/test/example/bitsets/demo_bitsets_and.f90 index c848be5f9..278febdc9 100644 --- a/test/example/bitsets/demo_bitsets_and.f90 +++ b/test/example/bitsets/demo_bitsets_and.f90 @@ -1,17 +1,17 @@ program demo_and - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0%init(166) - call set1%init(166) - call and(set0, set1) ! none none - if (set0%none()) write (*, *) 'First test of AND worked.' - call set0%not() - call and(set0, set1) ! all none - if (set0%none()) write (*, *) 'Second test of AND worked.' - call set1%not() - call and(set0, set1) ! none all - if (set0%none()) write (*, *) 'Third test of AND worked.' - call set0%not() - call and(set0, set1) ! all all - if (set0%all()) write (*, *) 'Fourth test of AND worked.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set1%init(166) + call and(set0, set1) ! none none + if (set0%none()) write (*, *) 'First test of AND worked.' + call set0%not() + call and(set0, set1) ! all none + if (set0%none()) write (*, *) 'Second test of AND worked.' + call set1%not() + call and(set0, set1) ! none all + if (set0%none()) write (*, *) 'Third test of AND worked.' + call set0%not() + call and(set0, set1) ! all all + if (set0%all()) write (*, *) 'Fourth test of AND worked.' end program demo_and diff --git a/test/example/bitsets/demo_bitsets_and_not.f90 b/test/example/bitsets/demo_bitsets_and_not.f90 index 042da308c..5795f8912 100644 --- a/test/example/bitsets/demo_bitsets_and_not.f90 +++ b/test/example/bitsets/demo_bitsets_and_not.f90 @@ -1,18 +1,18 @@ program demo_and_not - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0%init(166) - call set1%init(166) - call and_not(set0, set1) ! none none - if (set0%none()) write (*, *) 'First test of AND_NOT worked.' - call set0%not() - call and_not(set0, set1) ! all none - if (set0%all()) write (*, *) 'Second test of AND_NOT worked.' - call set0%not() - call set1%not() - call and_not(set0, set1) ! none all - if (set0%none()) write (*, *) 'Third test of AND_NOT worked.' - call set0%not() - call and_not(set0, set1) ! all all - if (set0%none()) write (*, *) 'Fourth test of AND_NOT worked.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set1%init(166) + call and_not(set0, set1) ! none none + if (set0%none()) write (*, *) 'First test of AND_NOT worked.' + call set0%not() + call and_not(set0, set1) ! all none + if (set0%all()) write (*, *) 'Second test of AND_NOT worked.' + call set0%not() + call set1%not() + call and_not(set0, set1) ! none all + if (set0%none()) write (*, *) 'Third test of AND_NOT worked.' + call set0%not() + call and_not(set0, set1) ! all all + if (set0%none()) write (*, *) 'Fourth test of AND_NOT worked.' end program demo_and_not diff --git a/test/example/bitsets/demo_bitsets_any.f90 b/test/example/bitsets/demo_bitsets_any.f90 index d21eae959..d2bc629ad 100644 --- a/test/example/bitsets/demo_bitsets_any.f90 +++ b/test/example/bitsets/demo_bitsets_any.f90 @@ -1,15 +1,15 @@ program demo_any - use stdlib_bitsets - character(*), parameter :: & - bits_0 = '0000000000000000000' - type(bitset_64) :: set0 - call set0%from_string(bits_0) - if (.not. set0%any()) then - write (*, *) "FROM_STRING interpreted "// & - "BITS_0's value properly." - end if - call set0%set(5) - if (set0%any()) then - write (*, *) "ANY interpreted SET0's value properly." - end if + use stdlib_bitsets + character(*), parameter :: & + bits_0 = '0000000000000000000' + type(bitset_64) :: set0 + call set0%from_string(bits_0) + if (.not. set0%any()) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's value properly." + end if + call set0%set(5) + if (set0%any()) then + write (*, *) "ANY interpreted SET0's value properly." + end if end program demo_any diff --git a/test/example/bitsets/demo_bitsets_assignment.f90 b/test/example/bitsets/demo_bitsets_assignment.f90 index bf337742e..92dc5e2b0 100644 --- a/test/example/bitsets/demo_bitsets_assignment.f90 +++ b/test/example/bitsets/demo_bitsets_assignment.f90 @@ -1,26 +1,26 @@ program demo_assignment - use stdlib_bitsets - use stdlib_kinds, only: int8, int32 - implicit none - logical(int8) :: logical1(64) = .true. - logical(int32), allocatable :: logical2(:) - type(bitset_64) :: set0, set1 - set0 = logical1 - if (set0%bits() /= 64) then - error stop & - ' initialization with logical(int8) failed to set'// & - ' the right size.' - else if (.not. set0%all()) then - error stop ' initialization with'// & - ' logical(int8) failed to set the right values.' - else - write (*, *) 'Initialization with logical(int8) succeeded.' - end if - set1 = set0 - if (set1 == set0) & - write (*, *) 'Initialization by assignment succeeded' - logical2 = set1 - if (all(logical2)) then - write (*, *) 'Initialization of logical(int32) succeeded.' - end if + use stdlib_bitsets + use stdlib_kinds, only: int8, int32 + implicit none + logical(int8) :: logical1(64) = .true. + logical(int32), allocatable :: logical2(:) + type(bitset_64) :: set0, set1 + set0 = logical1 + if (set0%bits() /= 64) then + error stop & + ' initialization with logical(int8) failed to set'// & + ' the right size.' + else if (.not. set0%all()) then + error stop ' initialization with'// & + ' logical(int8) failed to set the right values.' + else + write (*, *) 'Initialization with logical(int8) succeeded.' + end if + set1 = set0 + if (set1 == set0) & + write (*, *) 'Initialization by assignment succeeded' + logical2 = set1 + if (all(logical2)) then + write (*, *) 'Initialization of logical(int32) succeeded.' + end if end program demo_assignment diff --git a/test/example/bitsets/demo_bitsets_bit_count.f90 b/test/example/bitsets/demo_bitsets_bit_count.f90 index ca720d191..17ef992f4 100644 --- a/test/example/bitsets/demo_bitsets_bit_count.f90 +++ b/test/example/bitsets/demo_bitsets_bit_count.f90 @@ -1,15 +1,15 @@ program demo_bit_count - use stdlib_bitsets - character(*), parameter :: & - bits_0 = '0000000000000000000' - type(bitset_64) :: set0 - call set0%from_string(bits_0) - if (set0%bit_count() == 0) then - write (*, *) "FROM_STRING interpreted "// & - "BITS_0's value properly." - end if - call set0%set(5) - if (set0%bit_count() == 1) then - write (*, *) "BIT_COUNT interpreted SET0's value properly." - end if + use stdlib_bitsets + character(*), parameter :: & + bits_0 = '0000000000000000000' + type(bitset_64) :: set0 + call set0%from_string(bits_0) + if (set0%bit_count() == 0) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's value properly." + end if + call set0%set(5) + if (set0%bit_count() == 1) then + write (*, *) "BIT_COUNT interpreted SET0's value properly." + end if end program demo_bit_count diff --git a/test/example/bitsets/demo_bitsets_bits.f90 b/test/example/bitsets/demo_bitsets_bits.f90 index 6c8c02d0f..237ae2f27 100644 --- a/test/example/bitsets/demo_bitsets_bits.f90 +++ b/test/example/bitsets/demo_bitsets_bits.f90 @@ -1,11 +1,11 @@ program demo_bits - use stdlib_bitsets - character(*), parameter :: & - bits_0 = '0000000000000000000' - type(bitset_64) :: set0 - call set0%from_string(bits_0) - if (set0%bits() == 19) then - write (*, *) "FROM_STRING interpreted "// & - "BITS_0's size properly." - end if + use stdlib_bitsets + character(*), parameter :: & + bits_0 = '0000000000000000000' + type(bitset_64) :: set0 + call set0%from_string(bits_0) + if (set0%bits() == 19) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's size properly." + end if end program demo_bits diff --git a/test/example/bitsets/demo_bitsets_clear.f90 b/test/example/bitsets/demo_bitsets_clear.f90 index 4761e30ac..005581f63 100644 --- a/test/example/bitsets/demo_bitsets_clear.f90 +++ b/test/example/bitsets/demo_bitsets_clear.f90 @@ -1,11 +1,11 @@ program demo_clear - use stdlib_bitsets - type(bitset_large) :: set0 - call set0%init(166) - call set0%not() - if (set0%all()) write (*, *) 'SET0 is properly initialized.' - call set0%clear(165) - if (.not. set0%test(165)) write (*, *) 'Bit 165 is cleared.' - call set0%clear(0, 164) - if (set0%none()) write (*, *) 'All bits are cleared.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + call set0%not() + if (set0%all()) write (*, *) 'SET0 is properly initialized.' + call set0%clear(165) + if (.not. set0%test(165)) write (*, *) 'Bit 165 is cleared.' + call set0%clear(0, 164) + if (set0%none()) write (*, *) 'All bits are cleared.' end program demo_clear diff --git a/test/example/bitsets/demo_bitsets_equality.f90 b/test/example/bitsets/demo_bitsets_equality.f90 index 889391068..841a381a2 100644 --- a/test/example/bitsets/demo_bitsets_equality.f90 +++ b/test/example/bitsets/demo_bitsets_equality.f90 @@ -1,16 +1,16 @@ program demo_equality - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0%init(33) - call set1%init(33) - call set2%init(33) - call set1%set(0) - call set2%set(32) - if (set0 == set0 .and. set1 == set1 .and. set2 == set2 .and. & - .not. set0 == set1 .and. .not. set0 == set2 .and. .not. & - set1 == set2) then - write (*, *) 'Passed 64 bit equality tests.' - else - error stop 'Failed 64 bit equality tests.' - end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set0 == set0 .and. set1 == set1 .and. set2 == set2 .and. & + .not. set0 == set1 .and. .not. set0 == set2 .and. .not. & + set1 == set2) then + write (*, *) 'Passed 64 bit equality tests.' + else + error stop 'Failed 64 bit equality tests.' + end if end program demo_equality diff --git a/test/example/bitsets/demo_bitsets_extract.f90 b/test/example/bitsets/demo_bitsets_extract.f90 index 8e2a7aef2..0ae2c61e3 100644 --- a/test/example/bitsets/demo_bitsets_extract.f90 +++ b/test/example/bitsets/demo_bitsets_extract.f90 @@ -1,10 +1,10 @@ program demo_extract - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0%init(166) - call set0%set(100, 150) - call extract(set1, set0, 100, 150) - if (set1%bits() == 51) & - write (*, *) 'SET1 has the proper size.' - if (set1%all()) write (*, *) 'SET1 has the proper values.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set0%set(100, 150) + call extract(set1, set0, 100, 150) + if (set1%bits() == 51) & + write (*, *) 'SET1 has the proper size.' + if (set1%all()) write (*, *) 'SET1 has the proper values.' end program demo_extract diff --git a/test/example/bitsets/demo_bitsets_flip.f90 b/test/example/bitsets/demo_bitsets_flip.f90 index c3969b8cb..9e037b87c 100644 --- a/test/example/bitsets/demo_bitsets_flip.f90 +++ b/test/example/bitsets/demo_bitsets_flip.f90 @@ -1,10 +1,10 @@ program demo_flip - use stdlib_bitsets - type(bitset_large) :: set0 - call set0%init(166) - if (set0%none()) write (*, *) 'SET0 is properly initialized.' - call set0%flip(165) - if (set0%test(165)) write (*, *) 'Bit 165 is flipped.' - call set0%flip(0, 164) - if (set0%all()) write (*, *) 'All bits are flipped.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + if (set0%none()) write (*, *) 'SET0 is properly initialized.' + call set0%flip(165) + if (set0%test(165)) write (*, *) 'Bit 165 is flipped.' + call set0%flip(0, 164) + if (set0%all()) write (*, *) 'All bits are flipped.' end program demo_flip diff --git a/test/example/bitsets/demo_bitsets_from_string.f90 b/test/example/bitsets/demo_bitsets_from_string.f90 index 29408d819..dd9d3f20b 100644 --- a/test/example/bitsets/demo_bitsets_from_string.f90 +++ b/test/example/bitsets/demo_bitsets_from_string.f90 @@ -1,17 +1,17 @@ program demo_from_string - use stdlib_bitsets - character(*), parameter :: & - bits_all = '111111111111111111111111111111111' - type(bitset_64) :: set0 - call set0%from_string(bits_all) - if (bits(set0) /= 33) then - error stop "FROM_STRING failed to interpret "// & - "BITS_ALL's size properly." - else if (.not. set0%all()) then - error stop "FROM_STRING failed to interpret"// & - "BITS_ALL's value properly." - else - write (*, *) "FROM_STRING transferred BITS_ALL properly"// & - " into set0." - end if + use stdlib_bitsets + character(*), parameter :: & + bits_all = '111111111111111111111111111111111' + type(bitset_64) :: set0 + call set0%from_string(bits_all) + if (bits(set0) /= 33) then + error stop "FROM_STRING failed to interpret "// & + "BITS_ALL's size properly." + else if (.not. set0%all()) then + error stop "FROM_STRING failed to interpret"// & + "BITS_ALL's value properly." + else + write (*, *) "FROM_STRING transferred BITS_ALL properly"// & + " into set0." + end if end program demo_from_string diff --git a/test/example/bitsets/demo_bitsets_ge.f90 b/test/example/bitsets/demo_bitsets_ge.f90 index e6fd8fbbc..736fa2db2 100644 --- a/test/example/bitsets/demo_bitsets_ge.f90 +++ b/test/example/bitsets/demo_bitsets_ge.f90 @@ -1,17 +1,17 @@ program demo_ge - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0%init(33) - call set1%init(33) - call set2%init(33) - call set1%set(0) - call set2%set(32) - if (set1 >= set0 .and. set2 >= set1 .and. set2 >= set0 .and. & - set0 >= set0 .and. set1 >= set1 .and. set2 >= set2 .and. & - .not. set0 >= set1 .and. .not. set0 >= set2 .and. .not. & - set1 >= set2) then - write (*, *) 'Passed 64 bit greater than or equals tests.' - else - error stop 'Failed 64 bit greater than or equals tests.' - end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set1 >= set0 .and. set2 >= set1 .and. set2 >= set0 .and. & + set0 >= set0 .and. set1 >= set1 .and. set2 >= set2 .and. & + .not. set0 >= set1 .and. .not. set0 >= set2 .and. .not. & + set1 >= set2) then + write (*, *) 'Passed 64 bit greater than or equals tests.' + else + error stop 'Failed 64 bit greater than or equals tests.' + end if end program demo_ge diff --git a/test/example/bitsets/demo_bitsets_gt.f90 b/test/example/bitsets/demo_bitsets_gt.f90 index c22d12a91..be737468a 100644 --- a/test/example/bitsets/demo_bitsets_gt.f90 +++ b/test/example/bitsets/demo_bitsets_gt.f90 @@ -1,16 +1,16 @@ program demo_gt - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0%init(33) - call set1%init(33) - call set2%init(33) - call set1%set(0) - call set2%set(32) - if (set1 > set0 .and. set2 > set1 .and. set2 > set0 .and. & - .not. set0 > set0 .and. .not. set0 > set1 .and. .not. & - set1 > set2) then - write (*, *) 'Passed 64 bit greater than tests.' - else - error stop 'Failed 64 bit greater than tests.' - end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set1 > set0 .and. set2 > set1 .and. set2 > set0 .and. & + .not. set0 > set0 .and. .not. set0 > set1 .and. .not. & + set1 > set2) then + write (*, *) 'Passed 64 bit greater than tests.' + else + error stop 'Failed 64 bit greater than tests.' + end if end program demo_gt diff --git a/test/example/bitsets/demo_bitsets_inequality.f90 b/test/example/bitsets/demo_bitsets_inequality.f90 index d6e2fa63c..9c76f96e6 100644 --- a/test/example/bitsets/demo_bitsets_inequality.f90 +++ b/test/example/bitsets/demo_bitsets_inequality.f90 @@ -1,16 +1,16 @@ program demo_inequality - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0%init(33) - call set1%init(33) - call set2%init(33) - call set1%set(0) - call set2%set(32) - if (set0 /= set1 .and. set0 /= set2 .and. set1 /= set2 .and. & - .not. set0 /= set0 .and. .not. set1 /= set1 .and. .not. & - set2 /= set2) then - write (*, *) 'Passed 64 bit inequality tests.' - else - error stop 'Failed 64 bit inequality tests.' - end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set0 /= set1 .and. set0 /= set2 .and. set1 /= set2 .and. & + .not. set0 /= set0 .and. .not. set1 /= set1 .and. .not. & + set2 /= set2) then + write (*, *) 'Passed 64 bit inequality tests.' + else + error stop 'Failed 64 bit inequality tests.' + end if end program demo_inequality diff --git a/test/example/bitsets/demo_bitsets_init.f90 b/test/example/bitsets/demo_bitsets_init.f90 index a834a5988..0579cb9da 100644 --- a/test/example/bitsets/demo_bitsets_init.f90 +++ b/test/example/bitsets/demo_bitsets_init.f90 @@ -1,8 +1,8 @@ program demo_init - use stdlib_bitsets - type(bitset_large) :: set0 - call set0%init(166) - if (set0%bits() == 166) & - write (*, *) 'SET0 has the proper size.' - if (set0%none()) write (*, *) 'SET0 is properly initialized.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + if (set0%bits() == 166) & + write (*, *) 'SET0 has the proper size.' + if (set0%none()) write (*, *) 'SET0 is properly initialized.' end program demo_init diff --git a/test/example/bitsets/demo_bitsets_input.f90 b/test/example/bitsets/demo_bitsets_input.f90 index 5fb0660e2..bccfbd332 100644 --- a/test/example/bitsets/demo_bitsets_input.f90 +++ b/test/example/bitsets/demo_bitsets_input.f90 @@ -1,32 +1,32 @@ program demo_input - use stdlib_bitsets - implicit none - character(*), parameter :: & - bits_0 = '000000000000000000000000000000000', & - bits_1 = '000000000000000000000000000000001', & - bits_33 = '100000000000000000000000000000000' - integer :: unit - type(bitset_64) :: set0, set1, set2, set3, set4, set5 - call set0%from_string(bits_0) - call set1%from_string(bits_1) - call set2%from_string(bits_33) - open (newunit=unit, file='test.bin', status='replace', & - form='unformatted', action='write') - call set2%output(unit) - call set1%output(unit) - call set0%output(unit) - close (unit) - open (newunit=unit, file='test.bin', status='old', & - form='unformatted', action='read') - call set5%input(unit) - call set4%input(unit) - call set3%input(unit) - close (unit) - if (set3 /= set0 .or. set4 /= set1 .or. set5 /= set2) then - error stop 'Transfer to and from units using '// & - ' output and input failed.' - else - write (*, *) 'Transfer to and from units using '// & - 'output and input succeeded.' - end if + use stdlib_bitsets + implicit none + character(*), parameter :: & + bits_0 = '000000000000000000000000000000000', & + bits_1 = '000000000000000000000000000000001', & + bits_33 = '100000000000000000000000000000000' + integer :: unit + type(bitset_64) :: set0, set1, set2, set3, set4, set5 + call set0%from_string(bits_0) + call set1%from_string(bits_1) + call set2%from_string(bits_33) + open (newunit=unit, file='test.bin', status='replace', & + form='unformatted', action='write') + call set2%output(unit) + call set1%output(unit) + call set0%output(unit) + close (unit) + open (newunit=unit, file='test.bin', status='old', & + form='unformatted', action='read') + call set5%input(unit) + call set4%input(unit) + call set3%input(unit) + close (unit) + if (set3 /= set0 .or. set4 /= set1 .or. set5 /= set2) then + error stop 'Transfer to and from units using '// & + ' output and input failed.' + else + write (*, *) 'Transfer to and from units using '// & + 'output and input succeeded.' + end if end program demo_input diff --git a/test/example/bitsets/demo_bitsets_le.f90 b/test/example/bitsets/demo_bitsets_le.f90 index f806b7260..f3b30e30e 100644 --- a/test/example/bitsets/demo_bitsets_le.f90 +++ b/test/example/bitsets/demo_bitsets_le.f90 @@ -1,17 +1,17 @@ program demo_le - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0%init(33) - call set1%init(33) - call set2%init(33) - call set1%set(0) - call set2%set(32) - if (set0 <= set1 .and. set1 <= set2 .and. set0 <= set2 .and. & - set0 <= set0 .and. set1 <= set1 .and. set2 <= set2 .and. & - .not. set1 <= set0 .and. .not. set2 <= set0 .and. .not. & - set2 <= set1) then - write (*, *) 'Passed 64 bit less than or equal tests.' - else - error stop 'Failed 64 bit less than or equal tests.' - end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set0 <= set1 .and. set1 <= set2 .and. set0 <= set2 .and. & + set0 <= set0 .and. set1 <= set1 .and. set2 <= set2 .and. & + .not. set1 <= set0 .and. .not. set2 <= set0 .and. .not. & + set2 <= set1) then + write (*, *) 'Passed 64 bit less than or equal tests.' + else + error stop 'Failed 64 bit less than or equal tests.' + end if end program demo_le diff --git a/test/example/bitsets/demo_bitsets_lt.f90 b/test/example/bitsets/demo_bitsets_lt.f90 index 9288dba2e..19e87e9da 100644 --- a/test/example/bitsets/demo_bitsets_lt.f90 +++ b/test/example/bitsets/demo_bitsets_lt.f90 @@ -1,16 +1,16 @@ program demo_lt - use stdlib_bitsets - type(bitset_64) :: set0, set1, set2 - call set0%init(33) - call set1%init(33) - call set2%init(33) - call set1%set(0) - call set2%set(32) - if (set0 < set1 .and. set1 < set2 .and. set0 < set2 .and. & - .not. set0 < set0 .and. .not. set2 < set0 .and. .not. & - set2 < set1) then - write (*, *) 'Passed 64 bit less than tests.' - else - error stop 'Failed 64 bit less than tests.' - end if + use stdlib_bitsets + type(bitset_64) :: set0, set1, set2 + call set0%init(33) + call set1%init(33) + call set2%init(33) + call set1%set(0) + call set2%set(32) + if (set0 < set1 .and. set1 < set2 .and. set0 < set2 .and. & + .not. set0 < set0 .and. .not. set2 < set0 .and. .not. & + set2 < set1) then + write (*, *) 'Passed 64 bit less than tests.' + else + error stop 'Failed 64 bit less than tests.' + end if end program demo_lt diff --git a/test/example/bitsets/demo_bitsets_none.f90 b/test/example/bitsets/demo_bitsets_none.f90 index 8bfff9637..ae321e426 100644 --- a/test/example/bitsets/demo_bitsets_none.f90 +++ b/test/example/bitsets/demo_bitsets_none.f90 @@ -1,15 +1,15 @@ program demo_none - use stdlib_bitsets - character(*), parameter :: & - bits_0 = '0000000000000000000' - type(bitset_large) :: set0 - call set0%from_string(bits_0) - if (set0%none()) then - write (*, *) "FROM_STRING interpreted "// & - "BITS_0's value properly." - end if - call set0%set(5) - if (.not. set0%none()) then - write (*, *) "NONE interpreted SET0's value properly." - end if + use stdlib_bitsets + character(*), parameter :: & + bits_0 = '0000000000000000000' + type(bitset_large) :: set0 + call set0%from_string(bits_0) + if (set0%none()) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's value properly." + end if + call set0%set(5) + if (.not. set0%none()) then + write (*, *) "NONE interpreted SET0's value properly." + end if end program demo_none diff --git a/test/example/bitsets/demo_bitsets_not.f90 b/test/example/bitsets/demo_bitsets_not.f90 index 0f2788993..9f1db0f1e 100644 --- a/test/example/bitsets/demo_bitsets_not.f90 +++ b/test/example/bitsets/demo_bitsets_not.f90 @@ -1,13 +1,13 @@ program demo_not - use stdlib_bitsets - type(bitset_large) :: set0 - call set0%init(155) - if (set0%none()) then - write (*, *) "FROM_STRING interpreted "// & - "BITS_0's value properly." - end if - call set0%not() - if (set0%all()) then - write (*, *) "ALL interpreted SET0's value properly." - end if + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(155) + if (set0%none()) then + write (*, *) "FROM_STRING interpreted "// & + "BITS_0's value properly." + end if + call set0%not() + if (set0%all()) then + write (*, *) "ALL interpreted SET0's value properly." + end if end program demo_not diff --git a/test/example/bitsets/demo_bitsets_or.f90 b/test/example/bitsets/demo_bitsets_or.f90 index 31e04e5ce..631627ed8 100644 --- a/test/example/bitsets/demo_bitsets_or.f90 +++ b/test/example/bitsets/demo_bitsets_or.f90 @@ -1,18 +1,18 @@ program demo_or - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0%init(166) - call set1%init(166) - call or(set0, set1) ! none none - if (set0%none()) write (*, *) 'First test of OR worked.' - call set0%not() - call or(set0, set1) ! all none - if (set0%all()) write (*, *) 'Second test of OR worked.' - call set0%not() - call set1%not() - call or(set0, set1) ! none all - if (set0%all()) write (*, *) 'Third test of OR worked.' - call set0%not() - call or(set0, set1) ! all all - if (set0%all()) write (*, *) 'Fourth test of OR worked.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set1%init(166) + call or(set0, set1) ! none none + if (set0%none()) write (*, *) 'First test of OR worked.' + call set0%not() + call or(set0, set1) ! all none + if (set0%all()) write (*, *) 'Second test of OR worked.' + call set0%not() + call set1%not() + call or(set0, set1) ! none all + if (set0%all()) write (*, *) 'Third test of OR worked.' + call set0%not() + call or(set0, set1) ! all all + if (set0%all()) write (*, *) 'Fourth test of OR worked.' end program demo_or diff --git a/test/example/bitsets/demo_bitsets_output.f90 b/test/example/bitsets/demo_bitsets_output.f90 index 686094927..166ea0b2e 100644 --- a/test/example/bitsets/demo_bitsets_output.f90 +++ b/test/example/bitsets/demo_bitsets_output.f90 @@ -1,32 +1,32 @@ program demo_output - use stdlib_bitsets - implicit none - character(*), parameter :: & - bits_0 = '000000000000000000000000000000000', & - bits_1 = '000000000000000000000000000000001', & - bits_33 = '100000000000000000000000000000000' - integer :: unit - type(bitset_64) :: set0, set1, set2, set3, set4, set5 - call set0%from_string(bits_0) - call set1%from_string(bits_1) - call set2%from_string(bits_33) - open (newunit=unit, file='test.bin', status='replace', & - form='unformatted', action='write') - call set2%output(unit) - call set1%output(unit) - call set0%output(unit) - close (unit) - open (newunit=unit, file='test.bin', status='old', & - form='unformatted', action='read') - call set5%input(unit) - call set4%input(unit) - call set3%input(unit) - close (unit) - if (set3 /= set0 .or. set4 /= set1 .or. set5 /= set2) then - error stop 'Transfer to and from units using '// & - ' output and input failed.' - else - write (*, *) 'Transfer to and from units using '// & - 'output and input succeeded.' - end if + use stdlib_bitsets + implicit none + character(*), parameter :: & + bits_0 = '000000000000000000000000000000000', & + bits_1 = '000000000000000000000000000000001', & + bits_33 = '100000000000000000000000000000000' + integer :: unit + type(bitset_64) :: set0, set1, set2, set3, set4, set5 + call set0%from_string(bits_0) + call set1%from_string(bits_1) + call set2%from_string(bits_33) + open (newunit=unit, file='test.bin', status='replace', & + form='unformatted', action='write') + call set2%output(unit) + call set1%output(unit) + call set0%output(unit) + close (unit) + open (newunit=unit, file='test.bin', status='old', & + form='unformatted', action='read') + call set5%input(unit) + call set4%input(unit) + call set3%input(unit) + close (unit) + if (set3 /= set0 .or. set4 /= set1 .or. set5 /= set2) then + error stop 'Transfer to and from units using '// & + ' output and input failed.' + else + write (*, *) 'Transfer to and from units using '// & + 'output and input succeeded.' + end if end program demo_output diff --git a/test/example/bitsets/demo_bitsets_read_bitset.f90 b/test/example/bitsets/demo_bitsets_read_bitset.f90 index 0ab9186a5..5890b10fd 100644 --- a/test/example/bitsets/demo_bitsets_read_bitset.f90 +++ b/test/example/bitsets/demo_bitsets_read_bitset.f90 @@ -1,35 +1,35 @@ program demo_read_bitset - use stdlib_bitsets - implicit none - character(*), parameter :: & - bits_0 = 'S33B000000000000000000000000000000000', & - bits_1 = 'S33B000000000000000000000000000000001', & - bits_2 = 'S33B100000000000000000000000000000000' - character(:), allocatable :: test_0, test_1, test_2 - integer :: unit, status - type(bitset_64) :: set0, set1, set2, set3, set4, set5 - call set0%read_bitset(bits_0, status) - call set1%read_bitset(bits_1, status) - call set2%read_bitset(bits_2, status) - call set0%write_bitset(test_0, status) - call set1%write_bitset(test_1, status) - call set2%write_bitset(test_2, status) - if (bits_0 == test_0 .and. bits_1 == test_1 .and. & - bits_2 == test_2) then - write (*, *) 'READ_BITSET to WRITE_BITSET strings worked.' - end if - open (newunit=unit, file='test.txt', status='replace', & - form='formatted', action='write') - call set2%write_bitset(unit, advance='no') - call set1%write_bitset(unit, advance='no') - call set0%write_bitset(unit) - close (unit) - open (newunit=unit, file='test.txt', status='old', & - form='formatted', action='read') - call set3%read_bitset(unit, advance='no') - call set4%read_bitset(unit, advance='no') - call set5%read_bitset(unit) - if (set3 == set0 .and. set4 == set1 .and. set5 == set2) then - write (*, *) 'WRITE_BITSET to READ_BITSET through unit worked.' - end if + use stdlib_bitsets + implicit none + character(*), parameter :: & + bits_0 = 'S33B000000000000000000000000000000000', & + bits_1 = 'S33B000000000000000000000000000000001', & + bits_2 = 'S33B100000000000000000000000000000000' + character(:), allocatable :: test_0, test_1, test_2 + integer :: unit, status + type(bitset_64) :: set0, set1, set2, set3, set4, set5 + call set0%read_bitset(bits_0, status) + call set1%read_bitset(bits_1, status) + call set2%read_bitset(bits_2, status) + call set0%write_bitset(test_0, status) + call set1%write_bitset(test_1, status) + call set2%write_bitset(test_2, status) + if (bits_0 == test_0 .and. bits_1 == test_1 .and. & + bits_2 == test_2) then + write (*, *) 'READ_BITSET to WRITE_BITSET strings worked.' + end if + open (newunit=unit, file='test.txt', status='replace', & + form='formatted', action='write') + call set2%write_bitset(unit, advance='no') + call set1%write_bitset(unit, advance='no') + call set0%write_bitset(unit) + close (unit) + open (newunit=unit, file='test.txt', status='old', & + form='formatted', action='read') + call set3%read_bitset(unit, advance='no') + call set4%read_bitset(unit, advance='no') + call set5%read_bitset(unit) + if (set3 == set0 .and. set4 == set1 .and. set5 == set2) then + write (*, *) 'WRITE_BITSET to READ_BITSET through unit worked.' + end if end program demo_read_bitset diff --git a/test/example/bitsets/demo_bitsets_set.f90 b/test/example/bitsets/demo_bitsets_set.f90 index 29d74a30f..7d88f4d20 100644 --- a/test/example/bitsets/demo_bitsets_set.f90 +++ b/test/example/bitsets/demo_bitsets_set.f90 @@ -1,10 +1,10 @@ program demo_set - use stdlib_bitsets - type(bitset_large) :: set0 - call set0%init(166) - if (set0%none()) write (*, *) 'SET0 is properly initialized.' - call set0%set(165) - if (set0%test(165)) write (*, *) 'Bit 165 is set.' - call set0%set(0, 164) - if (set0%all()) write (*, *) 'All bits are set.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + if (set0%none()) write (*, *) 'SET0 is properly initialized.' + call set0%set(165) + if (set0%test(165)) write (*, *) 'Bit 165 is set.' + call set0%set(0, 164) + if (set0%all()) write (*, *) 'All bits are set.' end program demo_set diff --git a/test/example/bitsets/demo_bitsets_test.f90 b/test/example/bitsets/demo_bitsets_test.f90 index d2b402236..7ff66b74f 100644 --- a/test/example/bitsets/demo_bitsets_test.f90 +++ b/test/example/bitsets/demo_bitsets_test.f90 @@ -1,11 +1,11 @@ program demo_test - use stdlib_bitsets - type(bitset_large) :: set0 - call set0%init(166) - call set0%not() - if (set0%all()) write (*, *) 'SET0 is properly initialized.' - call set0%clear(165) - if (.not. set0%test(165)) write (*, *) 'Bit 165 is cleared.' - call set0%set(165) - if (set0%test(165)) write (*, *) 'Bit 165 is set.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + call set0%not() + if (set0%all()) write (*, *) 'SET0 is properly initialized.' + call set0%clear(165) + if (.not. set0%test(165)) write (*, *) 'Bit 165 is cleared.' + call set0%set(165) + if (set0%test(165)) write (*, *) 'Bit 165 is set.' end program demo_test diff --git a/test/example/bitsets/demo_bitsets_to_string.f90 b/test/example/bitsets/demo_bitsets_to_string.f90 index 09768449f..70e8b9831 100644 --- a/test/example/bitsets/demo_bitsets_to_string.f90 +++ b/test/example/bitsets/demo_bitsets_to_string.f90 @@ -1,14 +1,14 @@ program demo_to_string - use stdlib_bitsets - character(*), parameter :: & - bits_all = '111111111111111111111111111111111' - type(bitset_64) :: set0 - character(:), allocatable :: new_string - call set0%init(33) - call set0%not() - call set0%to_string(new_string) - if (new_string == bits_all) then - write (*, *) "TO_STRING transferred BITS0 properly"// & - " into NEW_STRING." - end if + use stdlib_bitsets + character(*), parameter :: & + bits_all = '111111111111111111111111111111111' + type(bitset_64) :: set0 + character(:), allocatable :: new_string + call set0%init(33) + call set0%not() + call set0%to_string(new_string) + if (new_string == bits_all) then + write (*, *) "TO_STRING transferred BITS0 properly"// & + " into NEW_STRING." + end if end program demo_to_string diff --git a/test/example/bitsets/demo_bitsets_value.f90 b/test/example/bitsets/demo_bitsets_value.f90 index 32584075f..f7bded845 100644 --- a/test/example/bitsets/demo_bitsets_value.f90 +++ b/test/example/bitsets/demo_bitsets_value.f90 @@ -1,11 +1,11 @@ program demo_value - use stdlib_bitsets - type(bitset_large) :: set0 - call set0%init(166) - call set0%not() - if (set0%all()) write (*, *) 'SET0 is properly initialized.' - call set0%clear(165) - if (set0%value(165) == 0) write (*, *) 'Bit 165 is cleared.' - call set0%set(165) - if (set0%value(165) == 1) write (*, *) 'Bit 165 is set.' + use stdlib_bitsets + type(bitset_large) :: set0 + call set0%init(166) + call set0%not() + if (set0%all()) write (*, *) 'SET0 is properly initialized.' + call set0%clear(165) + if (set0%value(165) == 0) write (*, *) 'Bit 165 is cleared.' + call set0%set(165) + if (set0%value(165) == 1) write (*, *) 'Bit 165 is set.' end program demo_value diff --git a/test/example/bitsets/demo_bitsets_write_bitset.f90 b/test/example/bitsets/demo_bitsets_write_bitset.f90 index 5027b335a..612faa533 100644 --- a/test/example/bitsets/demo_bitsets_write_bitset.f90 +++ b/test/example/bitsets/demo_bitsets_write_bitset.f90 @@ -1,35 +1,35 @@ program demo_write_bitset - use stdlib_bitsets - implicit none - character(*), parameter :: & - bits_0 = 'S33B000000000000000000000000000000000', & - bits_1 = 'S33B000000000000000000000000000000001', & - bits_2 = 'S33B100000000000000000000000000000000' - character(:), allocatable :: test_0, test_1, test_2 - integer :: unit, status - type(bitset_64) :: set0, set1, set2, set3, set4, set5 - call set0%read_bitset(bits_0, status) - call set1%read_bitset(bits_1, status) - call set2%read_bitset(bits_2, status) - call set0%write_bitset(test_0, status) - call set1%write_bitset(test_1, status) - call set2%write_bitset(test_2, status) - if (bits_0 == test_0 .and. bits_1 == test_1 .and. & - bits_2 == test_2) then - write (*, *) 'READ_BITSET to WRITE_BITSET strings worked.' - end if - open (newunit=unit, file='test.txt', status='replace', & - form='formatted', action='write') - call set2%write_bitset(unit, advance='no') - call set1%write_bitset(unit, advance='no') - call set0%write_bitset(unit) - close (unit) - open (newunit=unit, file='test.txt', status='old', & - form='formatted', action='read') - call set3%read_bitset(unit, advance='no') - call set4%read_bitset(unit, advance='no') - call set5%read_bitset(unit) - if (set3 == set0 .and. set4 == set1 .and. set5 == set2) then - write (*, *) 'WRITE_BITSET to READ_BITSET through unit worked.' - end if + use stdlib_bitsets + implicit none + character(*), parameter :: & + bits_0 = 'S33B000000000000000000000000000000000', & + bits_1 = 'S33B000000000000000000000000000000001', & + bits_2 = 'S33B100000000000000000000000000000000' + character(:), allocatable :: test_0, test_1, test_2 + integer :: unit, status + type(bitset_64) :: set0, set1, set2, set3, set4, set5 + call set0%read_bitset(bits_0, status) + call set1%read_bitset(bits_1, status) + call set2%read_bitset(bits_2, status) + call set0%write_bitset(test_0, status) + call set1%write_bitset(test_1, status) + call set2%write_bitset(test_2, status) + if (bits_0 == test_0 .and. bits_1 == test_1 .and. & + bits_2 == test_2) then + write (*, *) 'READ_BITSET to WRITE_BITSET strings worked.' + end if + open (newunit=unit, file='test.txt', status='replace', & + form='formatted', action='write') + call set2%write_bitset(unit, advance='no') + call set1%write_bitset(unit, advance='no') + call set0%write_bitset(unit) + close (unit) + open (newunit=unit, file='test.txt', status='old', & + form='formatted', action='read') + call set3%read_bitset(unit, advance='no') + call set4%read_bitset(unit, advance='no') + call set5%read_bitset(unit) + if (set3 == set0 .and. set4 == set1 .and. set5 == set2) then + write (*, *) 'WRITE_BITSET to READ_BITSET through unit worked.' + end if end program demo_write_bitset diff --git a/test/example/bitsets/demo_bitsets_xor.f90 b/test/example/bitsets/demo_bitsets_xor.f90 index aa7245dc5..50aebd4c6 100644 --- a/test/example/bitsets/demo_bitsets_xor.f90 +++ b/test/example/bitsets/demo_bitsets_xor.f90 @@ -1,18 +1,18 @@ program demo_xor - use stdlib_bitsets - type(bitset_large) :: set0, set1 - call set0%init(166) - call set1%init(166) - call xor(set0, set1) ! none none - if (set0%none()) write (*, *) 'First test of XOR worked.' - call set0%not() - call xor(set0, set1) ! all none - if (set0%all()) write (*, *) 'Second test of XOR worked.' - call set0%not() - call set1%not() - call xor(set0, set1) ! none all - if (set0%all()) write (*, *) 'Third test of XOR worked.' - call set0%not() - call xor(set0, set1) ! all all - if (set0%none()) write (*, *) 'Fourth test of XOR worked.' + use stdlib_bitsets + type(bitset_large) :: set0, set1 + call set0%init(166) + call set1%init(166) + call xor(set0, set1) ! none none + if (set0%none()) write (*, *) 'First test of XOR worked.' + call set0%not() + call xor(set0, set1) ! all none + if (set0%all()) write (*, *) 'Second test of XOR worked.' + call set0%not() + call set1%not() + call xor(set0, set1) ! none all + if (set0%all()) write (*, *) 'Third test of XOR worked.' + call set0%not() + call xor(set0, set1) ! all all + if (set0%none()) write (*, *) 'Fourth test of XOR worked.' end program demo_xor diff --git a/test/example/error/demo_check1.f90 b/test/example/error/demo_check1.f90 index 3c7c77d0c..db79e0ef6 100644 --- a/test/example/error/demo_check1.f90 +++ b/test/example/error/demo_check1.f90 @@ -1,7 +1,7 @@ program demo_check1 - use stdlib_error, only: check - implicit none - integer :: a = 1 + use stdlib_error, only: check + implicit none + integer :: a = 1 ! If a /= 5, stops the program with exit code 1 and prints 'Check failed.' - call check(a == 5) + call check(a == 5) end program demo_check1 diff --git a/test/example/error/demo_check2.f90 b/test/example/error/demo_check2.f90 index fda527ba2..2b0dd5de1 100644 --- a/test/example/error/demo_check2.f90 +++ b/test/example/error/demo_check2.f90 @@ -1,7 +1,7 @@ program demo_check2 - use stdlib_error, only: check - implicit none - integer :: a = 1 + use stdlib_error, only: check + implicit none + integer :: a = 1 ! If a /= 5, stops the program with exit code 1 and prints 'a == 5 failed.' - call check(a == 5, msg='a == 5 failed.') + call check(a == 5, msg='a == 5 failed.') end program demo_check2 diff --git a/test/example/error/demo_check3.f90 b/test/example/error/demo_check3.f90 index 8c3f2f33e..b64372434 100644 --- a/test/example/error/demo_check3.f90 +++ b/test/example/error/demo_check3.f90 @@ -1,7 +1,7 @@ program demo_check3 - use stdlib_error, only: check - implicit none - integer :: a = 1 + use stdlib_error, only: check + implicit none + integer :: a = 1 ! If a /= 5, prints 'a == 5 failed.', but doesn't stop the program. - call check(a == 5, msg='a == 5 failed.', warn=.true.) + call check(a == 5, msg='a == 5 failed.', warn=.true.) end program demo_check3 diff --git a/test/example/error/demo_check4.f90 b/test/example/error/demo_check4.f90 index 25e5d7726..a23a794d6 100644 --- a/test/example/error/demo_check4.f90 +++ b/test/example/error/demo_check4.f90 @@ -1,7 +1,7 @@ program demo_check4 - use stdlib_error, only: check - implicit none - integer :: a = 1 + use stdlib_error, only: check + implicit none + integer :: a = 1 ! If a /= 5, stops the program with exit code 77 and prints 'a == 5 failed.' - call check(a == 5, msg='a == 5 failed.', code=77) + call check(a == 5, msg='a == 5 failed.', code=77) end program demo_check4 diff --git a/test/example/error/demo_error_stop1.f90 b/test/example/error/demo_error_stop1.f90 index 45f8fb46c..f279bf529 100644 --- a/test/example/error/demo_error_stop1.f90 +++ b/test/example/error/demo_error_stop1.f90 @@ -1,5 +1,5 @@ program demo_error_stop1 - use stdlib_error, only: error_stop - implicit none - call error_stop("Invalid argument") + use stdlib_error, only: error_stop + implicit none + call error_stop("Invalid argument") end program demo_error_stop1 diff --git a/test/example/error/demo_error_stop2.f90 b/test/example/error/demo_error_stop2.f90 index 6502c3225..95ba8f92f 100644 --- a/test/example/error/demo_error_stop2.f90 +++ b/test/example/error/demo_error_stop2.f90 @@ -1,5 +1,5 @@ program demo_error_stop2 - use stdlib_error, only: error_stop - implicit none - call error_stop("Invalid argument", code=123) + use stdlib_error, only: error_stop + implicit none + call error_stop("Invalid argument", code=123) end program demo_error_stop2 diff --git a/test/example/hash_procedures/demo_fibonacci_hash.f90 b/test/example/hash_procedures/demo_fibonacci_hash.f90 index 6f1a213a7..153855d02 100644 --- a/test/example/hash_procedures/demo_fibonacci_hash.f90 +++ b/test/example/hash_procedures/demo_fibonacci_hash.f90 @@ -1,13 +1,13 @@ program demo_fibonacci_hash - use stdlib_hash_32bit, only: fibonacci_hash - use iso_fortran_env, only: int32 - implicit none - integer, allocatable :: array1(:) - integer(int32) :: hash, source - allocate (array1(0:2**6 - 1)) - array1(:) = 0 - source = 42_int32 - hash = fibonacci_hash(source, 6) - array1(hash) = source - print *, hash + use stdlib_hash_32bit, only: fibonacci_hash + use iso_fortran_env, only: int32 + implicit none + integer, allocatable :: array1(:) + integer(int32) :: hash, source + allocate (array1(0:2**6 - 1)) + array1(:) = 0 + source = 42_int32 + hash = fibonacci_hash(source, 6) + array1(hash) = source + print *, hash end program demo_fibonacci_hash diff --git a/test/example/hash_procedures/demo_fibonacci_hash_64.f90 b/test/example/hash_procedures/demo_fibonacci_hash_64.f90 index c1a479580..5e2c113c3 100644 --- a/test/example/hash_procedures/demo_fibonacci_hash_64.f90 +++ b/test/example/hash_procedures/demo_fibonacci_hash_64.f90 @@ -1,13 +1,13 @@ program demo_fibonacci_hash_64 - use stdlib_hash_64bit, only: fibonacci_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: array1(:) - integer(int64) :: hash, source - allocate (array1(0:2**6 - 1)) - array1(:) = 0 - source = int(Z'1FFFFFFFF', int64) - hash = fibonacci_hash(source, 6) - array1(hash) = source - print *, hash + use stdlib_hash_64bit, only: fibonacci_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: array1(:) + integer(int64) :: hash, source + allocate (array1(0:2**6 - 1)) + array1(:) = 0 + source = int(Z'1FFFFFFFF', int64) + hash = fibonacci_hash(source, 6) + array1(hash) = source + print *, hash end program demo_fibonacci_hash_64 diff --git a/test/example/hash_procedures/demo_fnv_1_hash.f90 b/test/example/hash_procedures/demo_fnv_1_hash.f90 index fafb6e701..94993a736 100644 --- a/test/example/hash_procedures/demo_fnv_1_hash.f90 +++ b/test/example/hash_procedures/demo_fnv_1_hash.f90 @@ -1,8 +1,8 @@ program demo_fnv_1_hash - use stdlib_hash_32bit, only: fnv_1_hash - use iso_fortran_env, only: int32 - implicit none - integer(int32) :: hash - hash = fnv_1_hash([5, 4, 3, 1, 10, 4, 9]) - print *, hash + use stdlib_hash_32bit, only: fnv_1_hash + use iso_fortran_env, only: int32 + implicit none + integer(int32) :: hash + hash = fnv_1_hash([5, 4, 3, 1, 10, 4, 9]) + print *, hash end program demo_fnv_1_hash diff --git a/test/example/hash_procedures/demo_fnv_1_hash_64.f90 b/test/example/hash_procedures/demo_fnv_1_hash_64.f90 index b8727477f..4fa9c097d 100644 --- a/test/example/hash_procedures/demo_fnv_1_hash_64.f90 +++ b/test/example/hash_procedures/demo_fnv_1_hash_64.f90 @@ -1,10 +1,10 @@ program demo_fnv_1_hash_64 - use stdlib_hash_64bit, only: fnv_1_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: array1(:) - integer(int64) :: hash - array1 = [5, 4, 3, 1, 10, 4, 9] - hash = fnv_1_hash(array1) - print *, hash + use stdlib_hash_64bit, only: fnv_1_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: array1(:) + integer(int64) :: hash + array1 = [5, 4, 3, 1, 10, 4, 9] + hash = fnv_1_hash(array1) + print *, hash end program demo_fnv_1_hash_64 diff --git a/test/example/hash_procedures/demo_fnv_1a_hash.f90 b/test/example/hash_procedures/demo_fnv_1a_hash.f90 index 524bdacaf..fa7a52548 100644 --- a/test/example/hash_procedures/demo_fnv_1a_hash.f90 +++ b/test/example/hash_procedures/demo_fnv_1a_hash.f90 @@ -1,8 +1,8 @@ program demo_fnv_1a_hash - use stdlib_hash_32bit, only: fnv_1a_hash - use iso_fortran_env, only: int32 - implicit none - integer(int32) :: hash - hash = fnv_1a_hash([5, 4, 3, 1, 10, 4, 9]) - print *, hash + use stdlib_hash_32bit, only: fnv_1a_hash + use iso_fortran_env, only: int32 + implicit none + integer(int32) :: hash + hash = fnv_1a_hash([5, 4, 3, 1, 10, 4, 9]) + print *, hash end program demo_fnv_1a_hash diff --git a/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 b/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 index 16c03d396..d57de195c 100644 --- a/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 +++ b/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 @@ -1,10 +1,10 @@ program demo_fnv_1a_hash_64 - use stdlib_hash_64bit, only: fnv_1a_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: array1(:) - integer(int64) :: hash - array1 = [5, 4, 3, 1, 10, 4, 9] - hash = fnv_1a_hash(array1) - print *, hash + use stdlib_hash_64bit, only: fnv_1a_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: array1(:) + integer(int64) :: hash + array1 = [5, 4, 3, 1, 10, 4, 9] + hash = fnv_1a_hash(array1) + print *, hash end program demo_fnv_1a_hash_64 diff --git a/test/example/hash_procedures/demo_nmhash32.f90 b/test/example/hash_procedures/demo_nmhash32.f90 index 4317c2696..dd5275f73 100644 --- a/test/example/hash_procedures/demo_nmhash32.f90 +++ b/test/example/hash_procedures/demo_nmhash32.f90 @@ -1,11 +1,11 @@ program demo_nmhash32 - use stdlib_hash_32bit, only: nmhash32, & - new_nmhash32_seed - use iso_fortran_env, only: int32 - implicit none - integer(int32) :: hash - integer(int32) :: seed = 42_int32 - call new_nmhash32_seed(seed) - hash = nmhash32([5, 4, 3, 1, 10, 4, 9], seed) - print *, seed, hash + use stdlib_hash_32bit, only: nmhash32, & + new_nmhash32_seed + use iso_fortran_env, only: int32 + implicit none + integer(int32) :: hash + integer(int32) :: seed = 42_int32 + call new_nmhash32_seed(seed) + hash = nmhash32([5, 4, 3, 1, 10, 4, 9], seed) + print *, seed, hash end program demo_nmhash32 diff --git a/test/example/hash_procedures/demo_nmhash32x.f90 b/test/example/hash_procedures/demo_nmhash32x.f90 index da1cc3cc6..a63a07120 100644 --- a/test/example/hash_procedures/demo_nmhash32x.f90 +++ b/test/example/hash_procedures/demo_nmhash32x.f90 @@ -1,11 +1,11 @@ program demo_nmhash32x - use stdlib_hash_32bit, only: nmhash32x, & - new_nmhash32x_seed - use iso_fortran_env, only: int32 - implicit none - integer(int32) :: hash - integer(int32) :: seed = 42_int32 - call new_nmhash32x_seed(seed) - hash = nmhash32x([5, 4, 3, 1, 10, 4, 9], seed) - print *, seed, hash + use stdlib_hash_32bit, only: nmhash32x, & + new_nmhash32x_seed + use iso_fortran_env, only: int32 + implicit none + integer(int32) :: hash + integer(int32) :: seed = 42_int32 + call new_nmhash32x_seed(seed) + hash = nmhash32x([5, 4, 3, 1, 10, 4, 9], seed) + print *, seed, hash end program demo_nmhash32x diff --git a/test/example/hash_procedures/demo_pengy_hash.f90 b/test/example/hash_procedures/demo_pengy_hash.f90 index a33f89b65..a856217d0 100644 --- a/test/example/hash_procedures/demo_pengy_hash.f90 +++ b/test/example/hash_procedures/demo_pengy_hash.f90 @@ -1,13 +1,13 @@ program demo_pengy_hash - use stdlib_hash_64bit, only: new_pengy_hash_seed, pengy_hash - use iso_fortran_env, only: int32, int64 - implicit none - integer, allocatable :: key(:) - integer(int64) :: hash - integer(int32) :: seed - key = [0, 1, 2, 3] - seed = 0_int32 - call new_pengy_hash_seed(seed) - hash = pengy_hash(key, seed) - print *, seed, hash + use stdlib_hash_64bit, only: new_pengy_hash_seed, pengy_hash + use iso_fortran_env, only: int32, int64 + implicit none + integer, allocatable :: key(:) + integer(int64) :: hash + integer(int32) :: seed + key = [0, 1, 2, 3] + seed = 0_int32 + call new_pengy_hash_seed(seed) + hash = pengy_hash(key, seed) + print *, seed, hash end program demo_pengy_hash diff --git a/test/example/hash_procedures/demo_spooky_hash.f90 b/test/example/hash_procedures/demo_spooky_hash.f90 index 18ce61517..99ad9e547 100644 --- a/test/example/hash_procedures/demo_spooky_hash.f90 +++ b/test/example/hash_procedures/demo_spooky_hash.f90 @@ -1,13 +1,13 @@ program demo_spooky_hash - use stdlib_hash_64bit, only: new_spooky_hash_seed, & - spooky_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: key(:) - integer(int64) :: hash(2), seed(2) - key = [0, 1, 2, 3] - seed = [119_int64, 2_int64**41 - 1] - call new_spooky_hash_seed(seed) - hash = spooky_hash(key, seed) - print *, seed, hash + use stdlib_hash_64bit, only: new_spooky_hash_seed, & + spooky_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: key(:) + integer(int64) :: hash(2), seed(2) + key = [0, 1, 2, 3] + seed = [119_int64, 2_int64**41 - 1] + call new_spooky_hash_seed(seed) + hash = spooky_hash(key, seed) + print *, seed, hash end program demo_spooky_hash diff --git a/test/example/hash_procedures/demo_universal_mult_hash.f90 b/test/example/hash_procedures/demo_universal_mult_hash.f90 index 9e606a3cb..89ac974bf 100644 --- a/test/example/hash_procedures/demo_universal_mult_hash.f90 +++ b/test/example/hash_procedures/demo_universal_mult_hash.f90 @@ -1,18 +1,18 @@ program demo_universal_mult_hash - use stdlib_hash_32bit, only: odd_random_integer, & - universal_mult_hash - use iso_fortran_env, only: int32 - implicit none - integer, allocatable :: array1(:) - integer(int32) :: hash, i, seed, source - seed = 0 - allocate (array1(0:2**6 - 1)) - do i = 0, 2**6 - 1 - array1(i) = i - end do - call odd_random_integer(seed) - source = 42_int32 - hash = universal_mult_hash(source, seed, 6) - array1(hash) = source - print *, seed, hash, array1 + use stdlib_hash_32bit, only: odd_random_integer, & + universal_mult_hash + use iso_fortran_env, only: int32 + implicit none + integer, allocatable :: array1(:) + integer(int32) :: hash, i, seed, source + seed = 0 + allocate (array1(0:2**6 - 1)) + do i = 0, 2**6 - 1 + array1(i) = i + end do + call odd_random_integer(seed) + source = 42_int32 + hash = universal_mult_hash(source, seed, 6) + array1(hash) = source + print *, seed, hash, array1 end program demo_universal_mult_hash diff --git a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 b/test/example/hash_procedures/demo_universal_mult_hash_64.f90 index 19236f3d1..93544707c 100644 --- a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 +++ b/test/example/hash_procedures/demo_universal_mult_hash_64.f90 @@ -1,16 +1,16 @@ program demo_universal_mult_hash_64 - use stdlib_hash_64bit, only: odd_random_integer, & - universal_mult_hash - use iso_fortran_env, only: int64 - implicit none - integer, allocatable :: array1(:) - integer(int64) :: hash, seed, source - seed = 0 - allocate (array1(0:2**6 - 1)) - array1 = 0 - call odd_random_integer(seed) - source = 42_int64 - hash = universal_mult_hash(source, seed, 6) - array1(hash) = source - print *, seed, hash, array1 + use stdlib_hash_64bit, only: odd_random_integer, & + universal_mult_hash + use iso_fortran_env, only: int64 + implicit none + integer, allocatable :: array1(:) + integer(int64) :: hash, seed, source + seed = 0 + allocate (array1(0:2**6 - 1)) + array1 = 0 + call odd_random_integer(seed) + source = 42_int64 + hash = universal_mult_hash(source, seed, 6) + array1(hash) = source + print *, seed, hash, array1 end program demo_universal_mult_hash_64 diff --git a/test/example/hash_procedures/demo_water_hash.f90 b/test/example/hash_procedures/demo_water_hash.f90 index 56cecb256..87db9fdc6 100644 --- a/test/example/hash_procedures/demo_water_hash.f90 +++ b/test/example/hash_procedures/demo_water_hash.f90 @@ -1,11 +1,11 @@ program demo_water_hash - use stdlib_hash_32bit, only: water_hash, & - new_water_hash_seed - use iso_fortran_env, only: int32, int64 - implicit none - integer(int32) :: hash - integer(int64) :: seed = 42_int64 - call new_water_hash_seed(seed) - hash = water_hash([5, 4, 3, 1, 10, 4, 9], seed) - print *, hash, seed + use stdlib_hash_32bit, only: water_hash, & + new_water_hash_seed + use iso_fortran_env, only: int32, int64 + implicit none + integer(int32) :: hash + integer(int64) :: seed = 42_int64 + call new_water_hash_seed(seed) + hash = water_hash([5, 4, 3, 1, 10, 4, 9], seed) + print *, hash, seed end program demo_water_hash diff --git a/test/example/hashmaps/demo_hashmaps_calls.f90 b/test/example/hashmaps/demo_hashmaps_calls.f90 index b1919de71..720f16c37 100644 --- a/test/example/hashmaps/demo_hashmaps_calls.f90 +++ b/test/example/hashmaps/demo_hashmaps_calls.f90 @@ -1,10 +1,10 @@ program demo_calls - use stdlib_hashmaps, only: chaining_hashmap_type, int_calls - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - integer(int_calls) :: initial_calls - call map%init(fnv_1_hasher) - initial_calls = map%calls() - print *, "INITIAL_CALLS = ", initial_calls + use stdlib_hashmaps, only: chaining_hashmap_type, int_calls + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + integer(int_calls) :: initial_calls + call map%init(fnv_1_hasher) + initial_calls = map%calls() + print *, "INITIAL_CALLS = ", initial_calls end program demo_calls diff --git a/test/example/hashmaps/demo_hashmaps_copy_key.f90 b/test/example/hashmaps/demo_hashmaps_copy_key.f90 index 09aefd3df..39583a61e 100644 --- a/test/example/hashmaps/demo_hashmaps_copy_key.f90 +++ b/test/example/hashmaps/demo_hashmaps_copy_key.f90 @@ -1,12 +1,12 @@ program demo_copy_key - use stdlib_hashmap_wrappers, only: & - copy_key, operator(==), key_type, set - use iso_fortran_env, only: int8 - implicit none - integer(int8) :: i, value(15) - type(key_type) :: old_key, new_key - value = [(i, i=1, 15)] - call set(old_key, value) - call copy_key(old_key, new_key) - print *, "old_key == new_key = ", old_key == new_key + use stdlib_hashmap_wrappers, only: & + copy_key, operator(==), key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8) :: i, value(15) + type(key_type) :: old_key, new_key + value = [(i, i=1, 15)] + call set(old_key, value) + call copy_key(old_key, new_key) + print *, "old_key == new_key = ", old_key == new_key end program demo_copy_key diff --git a/test/example/hashmaps/demo_hashmaps_copy_other.f90 b/test/example/hashmaps/demo_hashmaps_copy_other.f90 index b0595083a..12c6f72bd 100644 --- a/test/example/hashmaps/demo_hashmaps_copy_other.f90 +++ b/test/example/hashmaps/demo_hashmaps_copy_other.f90 @@ -1,22 +1,22 @@ program demo_copy_other - use stdlib_hashmap_wrappers, only: & - copy_other, other_type - use iso_fortran_env, only: int8 - implicit none - type(other_type) :: other_in, other_out - integer(int8) :: i - type dummy_type - integer(int8) :: value(15) - end type - type(dummy_type) :: dummy_val - do i = 1, 15 - dummy_val%value(i) = i - end do - allocate (other_in%value, source=dummy_val) - call copy_other(other_in, other_out) - select type (out => other_out%value) - type is (dummy_type) - print *, "other_in == other_out = ", & - all(dummy_val % value == out%value) - end select + use stdlib_hashmap_wrappers, only: & + copy_other, other_type + use iso_fortran_env, only: int8 + implicit none + type(other_type) :: other_in, other_out + integer(int8) :: i + type dummy_type + integer(int8) :: value(15) + end type + type(dummy_type) :: dummy_val + do i = 1, 15 + dummy_val%value(i) = i + end do + allocate (other_in%value, source=dummy_val) + call copy_other(other_in, other_out) + select type (out => other_out%value) + type is (dummy_type) + print *, "other_in == other_out = ", & + all(dummy_val%value == out%value) + end select end program demo_copy_other diff --git a/test/example/hashmaps/demo_hashmaps_entries.f90 b/test/example/hashmaps/demo_hashmaps_entries.f90 index 7bb38a877..ff9d9e57a 100644 --- a/test/example/hashmaps/demo_hashmaps_entries.f90 +++ b/test/example/hashmaps/demo_hashmaps_entries.f90 @@ -1,10 +1,10 @@ program demo_entries - use stdlib_hashmaps, only: open_hashmap_type, int_index - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(open_hashmap_type) :: map - integer(int_index) :: initial_entries - call map%init(fnv_1_hasher) - initial_entries = map%entries() - print *, "INITIAL_ENTRIES = ", initial_entries + use stdlib_hashmaps, only: open_hashmap_type, int_index + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(open_hashmap_type) :: map + integer(int_index) :: initial_entries + call map%init(fnv_1_hasher) + initial_entries = map%entries() + print *, "INITIAL_ENTRIES = ", initial_entries end program demo_entries diff --git a/test/example/hashmaps/demo_hashmaps_equal_keys.f90 b/test/example/hashmaps/demo_hashmaps_equal_keys.f90 index 15571f20f..395945141 100644 --- a/test/example/hashmaps/demo_hashmaps_equal_keys.f90 +++ b/test/example/hashmaps/demo_hashmaps_equal_keys.f90 @@ -1,14 +1,14 @@ program demo_equal_keys - use stdlib_hashmap_wrappers, only: & - copy_key, operator(==), key_type, set - use iso_fortran_env, only: int8 - implicit none - integer(int8) :: i, value(15) - type(key_type) :: old_key, new_key - do i = 1, 15 - value(i) = i - end do - call set(old_key, value) - call copy_key(old_key, new_key) - print *, "old_key == new_key = ", old_key == new_key + use stdlib_hashmap_wrappers, only: & + copy_key, operator(==), key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8) :: i, value(15) + type(key_type) :: old_key, new_key + do i = 1, 15 + value(i) = i + end do + call set(old_key, value) + call copy_key(old_key, new_key) + print *, "old_key == new_key = ", old_key == new_key end program demo_equal_keys diff --git a/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 b/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 index c947508f4..d95e9a088 100644 --- a/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 @@ -1,12 +1,12 @@ program demo_fnv_1_hasher - use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set - use iso_fortran_env, only: int8, int32 - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] - call set(key, array1) - hash = fnv_1_hasher(key) - print *, hash + use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set + use iso_fortran_env, only: int8, int32 + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = fnv_1_hasher(key) + print *, hash end program demo_fnv_1_hasher diff --git a/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 b/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 index bf8abadd2..7832615b4 100644 --- a/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 @@ -1,13 +1,13 @@ program demo_fnv_1a_hasher - use stdlib_hashmap_wrappers, only: & - fnv_1a_hasher, key_type, set - use iso_fortran_env, only: int8, int32 - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] - call set(key, array1) - hash = fnv_1a_hasher(key) - print *, hash + use stdlib_hashmap_wrappers, only: & + fnv_1a_hasher, key_type, set + use iso_fortran_env, only: int8, int32 + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = fnv_1a_hasher(key) + print *, hash end program demo_fnv_1a_hasher diff --git a/test/example/hashmaps/demo_hashmaps_free_key.f90 b/test/example/hashmaps/demo_hashmaps_free_key.f90 index 91d3106ef..3ed865b2f 100644 --- a/test/example/hashmaps/demo_hashmaps_free_key.f90 +++ b/test/example/hashmaps/demo_hashmaps_free_key.f90 @@ -1,12 +1,12 @@ program demo_free_key - use stdlib_hashmap_wrappers, only: & - copy_key, free_key, key_type, set - use iso_fortran_env, only: int8 - implicit none - integer(int8) :: i, value(15) - type(key_type) :: old_key, new_key - value = [(i, i=1, 15)] - call set(old_key, value) - call copy_key(old_key, new_key) - call free_key(old_key) + use stdlib_hashmap_wrappers, only: & + copy_key, free_key, key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8) :: i, value(15) + type(key_type) :: old_key, new_key + value = [(i, i=1, 15)] + call set(old_key, value) + call copy_key(old_key, new_key) + call free_key(old_key) end program demo_free_key diff --git a/test/example/hashmaps/demo_hashmaps_free_other.f90 b/test/example/hashmaps/demo_hashmaps_free_other.f90 index 17ab7c1e3..e6fd47c73 100644 --- a/test/example/hashmaps/demo_hashmaps_free_other.f90 +++ b/test/example/hashmaps/demo_hashmaps_free_other.f90 @@ -1,18 +1,18 @@ program demo_free_other - use stdlib_hashmap_wrappers, only: & - copy_other, free_other, other_type - use iso_fortran_env, only: int8 - implicit none - type dummy_type - integer(int8) :: value(15) - end type dummy_type - type(dummy_type) :: dummy_val - type(other_type) :: other_in, other_out - integer(int8) :: i - do i = 1, 15 - dummy_val%value(i) = i - end do - allocate (other_in%value, source=dummy_val) - call copy_other(other_in, other_out) - call free_other(other_out) + use stdlib_hashmap_wrappers, only: & + copy_other, free_other, other_type + use iso_fortran_env, only: int8 + implicit none + type dummy_type + integer(int8) :: value(15) + end type dummy_type + type(dummy_type) :: dummy_val + type(other_type) :: other_in, other_out + integer(int8) :: i + do i = 1, 15 + dummy_val%value(i) = i + end do + allocate (other_in%value, source=dummy_val) + call copy_other(other_in, other_out) + call free_other(other_out) end program demo_free_other diff --git a/test/example/hashmaps/demo_hashmaps_get.f90 b/test/example/hashmaps/demo_hashmaps_get.f90 index 699883ff6..6091234cb 100644 --- a/test/example/hashmaps/demo_hashmaps_get.f90 +++ b/test/example/hashmaps/demo_hashmaps_get.f90 @@ -1,16 +1,16 @@ program demo_get - use stdlib_hashmap_wrappers, only: & - get, key_type, set - use iso_fortran_env, only: int8 - implicit none - integer(int8), allocatable :: value(:), result(:) - type(key_type) :: key - integer(int8) :: i - allocate (value(1:15)) - do i = 1, 15 - value(i) = i - end do - call set(key, value) - call get(key, result) - print *, 'RESULT == VALUE = ', all(value == result) + use stdlib_hashmap_wrappers, only: & + get, key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8), allocatable :: value(:), result(:) + type(key_type) :: key + integer(int8) :: i + allocate (value(1:15)) + do i = 1, 15 + value(i) = i + end do + call set(key, value) + call get(key, result) + print *, 'RESULT == VALUE = ', all(value == result) end program demo_get diff --git a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 index 5885bd71e..e4d629272 100644 --- a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 +++ b/test/example/hashmaps/demo_hashmaps_get_other_data.f90 @@ -1,32 +1,32 @@ program demo_get_other_data - use stdlib_kinds, only: int8 - use stdlib_hashmaps, only: chaining_hashmap_type, int_index - use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set, get - logical :: conflict - type(key_type) :: key - type(other_type) :: other - type(chaining_hashmap_type) :: map - type dummy_type - integer(int8) :: value(4) - end type dummy_type - type(dummy_type) :: dummy - class(*), allocatable :: data - dummy%value = [4_int8, 3_int8, 2_int8, 1_int8] - allocate (data, source=dummy) - call map%init(fnv_1_hasher) - call set(key, [0_int8, 1_int8, 2_int8, 3_int8, 4_int8]) - call set(other, data) - call map%map_entry(key, other, conflict) - if (.not. conflict) then - call map%get_other_data(key, other) - else - error stop 'Key is already present in the map.' - end if - call get(other, data) - select type (data) - type is (dummy_type) - print *, 'Other data % value = ', data%value - class default - print *, 'Invalid data type in other' - end select + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: chaining_hashmap_type, int_index + use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set, get + logical :: conflict + type(key_type) :: key + type(other_type) :: other + type(chaining_hashmap_type) :: map + type dummy_type + integer(int8) :: value(4) + end type dummy_type + type(dummy_type) :: dummy + class(*), allocatable :: data + dummy%value = [4_int8, 3_int8, 2_int8, 1_int8] + allocate (data, source=dummy) + call map%init(fnv_1_hasher) + call set(key, [0_int8, 1_int8, 2_int8, 3_int8, 4_int8]) + call set(other, data) + call map%map_entry(key, other, conflict) + if (.not. conflict) then + call map%get_other_data(key, other) + else + error stop 'Key is already present in the map.' + end if + call get(other, data) + select type (data) + type is (dummy_type) + print *, 'Other data % value = ', data%value + class default + print *, 'Invalid data type in other' + end select end program demo_get_other_data diff --git a/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 b/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 index 328d39c6e..c77d87bb6 100644 --- a/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 +++ b/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 @@ -1,14 +1,14 @@ program demo_hasher_fun - use stdlib_hashmap_wrappers, only: fnv_1a_hasher, hasher_fun, set, key_type - use stdlib_kinds, only: int8, int32 - implicit none - procedure(hasher_fun), pointer :: hasher_pointer - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - hasher_pointer => fnv_1a_hasher - array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] - call set(key, array1) - hash = hasher_pointer(key) - print *, hash + use stdlib_hashmap_wrappers, only: fnv_1a_hasher, hasher_fun, set, key_type + use stdlib_kinds, only: int8, int32 + implicit none + procedure(hasher_fun), pointer :: hasher_pointer + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + hasher_pointer => fnv_1a_hasher + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = hasher_pointer(key) + print *, hash end program demo_hasher_fun diff --git a/test/example/hashmaps/demo_hashmaps_init.f90 b/test/example/hashmaps/demo_hashmaps_init.f90 index 78f213883..c58fe55c9 100644 --- a/test/example/hashmaps/demo_hashmaps_init.f90 +++ b/test/example/hashmaps/demo_hashmaps_init.f90 @@ -1,7 +1,7 @@ program demo_init - use stdlib_hashmaps, only: chaining_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - call map%init(fnv_1_hasher, slots_bits=10) + use stdlib_hashmaps, only: chaining_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + call map%init(fnv_1_hasher, slots_bits=10) end program demo_init diff --git a/test/example/hashmaps/demo_hashmaps_key_test.f90 b/test/example/hashmaps/demo_hashmaps_key_test.f90 index d91a96897..a9b02e805 100644 --- a/test/example/hashmaps/demo_hashmaps_key_test.f90 +++ b/test/example/hashmaps/demo_hashmaps_key_test.f90 @@ -1,13 +1,13 @@ program demo_key_test - use stdlib_kinds, only: int8 - use stdlib_hashmaps, only: chaining_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set - implicit none - type(chaining_hashmap_type) :: map - type(key_type) :: key - logical :: present - call map%init(fnv_1_hasher) - call set(key, [0_int8, 1_int8]) - call map%key_test(key, present) - print *, "Initial key of 10 present for empty map = ", present + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: chaining_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set + implicit none + type(chaining_hashmap_type) :: map + type(key_type) :: key + logical :: present + call map%init(fnv_1_hasher) + call set(key, [0_int8, 1_int8]) + call map%key_test(key, present) + print *, "Initial key of 10 present for empty map = ", present end program demo_key_test diff --git a/test/example/hashmaps/demo_hashmaps_loading.f90 b/test/example/hashmaps/demo_hashmaps_loading.f90 index 75cf80438..805b7cd8e 100644 --- a/test/example/hashmaps/demo_hashmaps_loading.f90 +++ b/test/example/hashmaps/demo_hashmaps_loading.f90 @@ -1,10 +1,10 @@ program demo_loading - use stdlib_hashmaps, only: open_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(open_hashmap_type) :: map - real :: ratio - call map%init(fnv_1_hasher) - ratio = map%loading() - print *, "Initial loading = ", ratio + use stdlib_hashmaps, only: open_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(open_hashmap_type) :: map + real :: ratio + call map%init(fnv_1_hasher) + ratio = map%loading() + print *, "Initial loading = ", ratio end program demo_loading diff --git a/test/example/hashmaps/demo_hashmaps_map_entry.f90 b/test/example/hashmaps/demo_hashmaps_map_entry.f90 index ecebb2c79..311a37da4 100644 --- a/test/example/hashmaps/demo_hashmaps_map_entry.f90 +++ b/test/example/hashmaps/demo_hashmaps_map_entry.f90 @@ -1,16 +1,16 @@ program demo_map_entry - use, intrinsic:: iso_fortran_env, only: int8 - use stdlib_hashmaps, only: chaining_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set - type(chaining_hashmap_type) :: map - type(key_type) :: key - logical :: conflict - type(other_type) :: other - class(*), allocatable :: dummy - allocate (dummy, source=4) - call map%init(fnv_1_hasher, slots_bits=10) - call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) - call set(other, dummy) - call map%map_entry(key, other, conflict) - print *, 'CONFLICT = ', conflict + use, intrinsic:: iso_fortran_env, only: int8 + use stdlib_hashmaps, only: chaining_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set + type(chaining_hashmap_type) :: map + type(key_type) :: key + logical :: conflict + type(other_type) :: other + class(*), allocatable :: dummy + allocate (dummy, source=4) + call map%init(fnv_1_hasher, slots_bits=10) + call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) + call set(other, dummy) + call map%map_entry(key, other, conflict) + print *, 'CONFLICT = ', conflict end program demo_map_entry diff --git a/test/example/hashmaps/demo_hashmaps_num_slots.f90 b/test/example/hashmaps/demo_hashmaps_num_slots.f90 index af99d62d2..b43a153b8 100644 --- a/test/example/hashmaps/demo_hashmaps_num_slots.f90 +++ b/test/example/hashmaps/demo_hashmaps_num_slots.f90 @@ -1,10 +1,10 @@ program demo_num_slots - use stdlib_hashmaps, only: chaining_hashmap_type, int_index - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - integer(int_index) :: initial_slots - call map%init(fnv_1_hasher) - initial_slots = map%num_slots() - print *, "Initial slots = ", initial_slots + use stdlib_hashmaps, only: chaining_hashmap_type, int_index + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + integer(int_index) :: initial_slots + call map%init(fnv_1_hasher) + initial_slots = map%num_slots() + print *, "Initial slots = ", initial_slots end program demo_num_slots diff --git a/test/example/hashmaps/demo_hashmaps_probes.f90 b/test/example/hashmaps/demo_hashmaps_probes.f90 index a60bc644e..0fa7456e9 100644 --- a/test/example/hashmaps/demo_hashmaps_probes.f90 +++ b/test/example/hashmaps/demo_hashmaps_probes.f90 @@ -1,10 +1,10 @@ program demo_probes - use stdlib_hashmaps, only: chaining_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - integer :: nprobes - call map%init(fnv_1_hasher) - nprobes = map%map_probes() - print *, "Initial probes = ", nprobes + use stdlib_hashmaps, only: chaining_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + integer :: nprobes + call map%init(fnv_1_hasher) + nprobes = map%map_probes() + print *, "Initial probes = ", nprobes end program demo_probes diff --git a/test/example/hashmaps/demo_hashmaps_rehash.f90 b/test/example/hashmaps/demo_hashmaps_rehash.f90 index dea398a00..a15dcbabf 100644 --- a/test/example/hashmaps/demo_hashmaps_rehash.f90 +++ b/test/example/hashmaps/demo_hashmaps_rehash.f90 @@ -1,17 +1,17 @@ program demo_rehash - use stdlib_kinds, only: int8 - use stdlib_hashmaps, only: open_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher, & - key_type, other_type, set - implicit none - type(open_hashmap_type) :: map - type(key_type) :: key - type(other_type) :: other - class(*), allocatable :: dummy - allocate (dummy, source='a dummy value') - call map%init(fnv_1_hasher, slots_bits=10) - call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) - call set(other, dummy) - call map%map_entry(key, other) - call map%rehash(fnv_1a_hasher) + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: open_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher, & + key_type, other_type, set + implicit none + type(open_hashmap_type) :: map + type(key_type) :: key + type(other_type) :: other + class(*), allocatable :: dummy + allocate (dummy, source='a dummy value') + call map%init(fnv_1_hasher, slots_bits=10) + call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) + call set(other, dummy) + call map%map_entry(key, other) + call map%rehash(fnv_1a_hasher) end program demo_rehash diff --git a/test/example/hashmaps/demo_hashmaps_remove.f90 b/test/example/hashmaps/demo_hashmaps_remove.f90 index f112596e6..7b39a8440 100644 --- a/test/example/hashmaps/demo_hashmaps_remove.f90 +++ b/test/example/hashmaps/demo_hashmaps_remove.f90 @@ -1,18 +1,18 @@ program demo_remove - use stdlib_kinds, only: int8 - use stdlib_hashmaps, only: open_hashmap_type, int_index - use stdlib_hashmap_wrappers, only: fnv_1_hasher, & - fnv_1a_hasher, key_type, other_type, set - type(open_hashmap_type) :: map - type(key_type) :: key - type(other_type) :: other - logical :: existed - class(*), allocatable :: dummy - allocate (dummy, source=4.0) - call map%init(fnv_1_hasher, slots_bits=10) - call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) - call set(other, dummy) - call map%map_entry(key, other) - call map%remove(key, existed) - print *, "Removed key existed = ", existed + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: open_hashmap_type, int_index + use stdlib_hashmap_wrappers, only: fnv_1_hasher, & + fnv_1a_hasher, key_type, other_type, set + type(open_hashmap_type) :: map + type(key_type) :: key + type(other_type) :: other + logical :: existed + class(*), allocatable :: dummy + allocate (dummy, source=4.0) + call map%init(fnv_1_hasher, slots_bits=10) + call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) + call set(other, dummy) + call map%map_entry(key, other) + call map%remove(key, existed) + print *, "Removed key existed = ", existed end program demo_remove diff --git a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 index 67c23477a..7f817394b 100644 --- a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 @@ -1,13 +1,13 @@ program demo_seeded_nmhash32_hasher - use stdlib_hashmap_wrappers, only: & - seeded_nmhash32_hasher, key_type, set - use iso_fortran_env, only: int8, int32 - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] - call set(key, array1) - hash = seeded_nmhash32_hasher(key) - print *, hash + use stdlib_hashmap_wrappers, only: & + seeded_nmhash32_hasher, key_type, set + use iso_fortran_env, only: int8, int32 + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = seeded_nmhash32_hasher(key) + print *, hash end program demo_seeded_nmhash32_hasher diff --git a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 index 81680b3e5..cfb53a123 100644 --- a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 @@ -1,13 +1,13 @@ program demo_seeded_nmhash32x_hasher - use stdlib_kinds, only: int8, int32 - use stdlib_hashmap_wrappers, only: & - seeded_nmhash32x_hasher, key_type, set - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] - call set(key, array1) - hash = seeded_nmhash32x_hasher(key) - print *, hash + use stdlib_kinds, only: int8, int32 + use stdlib_hashmap_wrappers, only: & + seeded_nmhash32x_hasher, key_type, set + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = seeded_nmhash32x_hasher(key) + print *, hash end program demo_seeded_nmhash32x_hasher diff --git a/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 b/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 index 4234a6726..3b12c6b3e 100644 --- a/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 +++ b/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 @@ -1,13 +1,13 @@ program demo_seeded_water_hasher - use stdlib_hashmap_wrappers, only: & - seeded_water_hasher, key_type, set - use iso_fortran_env, only: int8, int32 - implicit none - integer(int8), allocatable :: array1(:) - integer(int32) :: hash - type(key_type) :: key - array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] - call set(key, array1) - hash = seeded_water_hasher(key) - print *, hash + use stdlib_hashmap_wrappers, only: & + seeded_water_hasher, key_type, set + use iso_fortran_env, only: int8, int32 + implicit none + integer(int8), allocatable :: array1(:) + integer(int32) :: hash + type(key_type) :: key + array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8] + call set(key, array1) + hash = seeded_water_hasher(key) + print *, hash end program demo_seeded_water_hasher diff --git a/test/example/hashmaps/demo_hashmaps_set.f90 b/test/example/hashmaps/demo_hashmaps_set.f90 index cd28ca66b..6b5f69829 100644 --- a/test/example/hashmaps/demo_hashmaps_set.f90 +++ b/test/example/hashmaps/demo_hashmaps_set.f90 @@ -1,16 +1,16 @@ program demo_set - use stdlib_hashmap_wrappers, only: & - get, key_type, set - use iso_fortran_env, only: int8 - implicit none - integer(int8), allocatable :: value(:), result(:) - type(key_type) :: key - integer(int8) :: i - allocate (value(1:15)) - do i = 1, 15 - value(i) = i - end do - call set(key, value) - call get(key, result) - print *, 'RESULT == VALUE = ', all(value == result) + use stdlib_hashmap_wrappers, only: & + get, key_type, set + use iso_fortran_env, only: int8 + implicit none + integer(int8), allocatable :: value(:), result(:) + type(key_type) :: key + integer(int8) :: i + allocate (value(1:15)) + do i = 1, 15 + value(i) = i + end do + call set(key, value) + call get(key, result) + print *, 'RESULT == VALUE = ', all(value == result) end program demo_set diff --git a/test/example/hashmaps/demo_hashmaps_set_other_data.f90 b/test/example/hashmaps/demo_hashmaps_set_other_data.f90 index 5d2a87b2c..39fdcf5c6 100644 --- a/test/example/hashmaps/demo_hashmaps_set_other_data.f90 +++ b/test/example/hashmaps/demo_hashmaps_set_other_data.f90 @@ -1,22 +1,22 @@ program demo_set_other_data - use stdlib_kinds, only: int8 - use stdlib_hashmaps, only: open_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher, & - fnv_1a_hasher, key_type, other_type, set - implicit none - logical :: exists - type(open_hashmap_type) :: map - type(key_type) :: key - type(other_type) :: other - class(*), allocatable :: dummy - call map%init(fnv_1_hasher, slots_bits=10) - allocate (dummy, source='A value') - call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) - call set(other, dummy) - call map%map_entry(key, other) - deallocate (dummy) - allocate (dummy, source='Another value') - call set(other, dummy) - call map%set_other_data(key, other, exists) - print *, 'The entry to have its other data replaced exists = ', exists + use stdlib_kinds, only: int8 + use stdlib_hashmaps, only: open_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher, & + fnv_1a_hasher, key_type, other_type, set + implicit none + logical :: exists + type(open_hashmap_type) :: map + type(key_type) :: key + type(other_type) :: other + class(*), allocatable :: dummy + call map%init(fnv_1_hasher, slots_bits=10) + allocate (dummy, source='A value') + call set(key, [5_int8, 7_int8, 4_int8, 13_int8]) + call set(other, dummy) + call map%map_entry(key, other) + deallocate (dummy) + allocate (dummy, source='Another value') + call set(other, dummy) + call map%set_other_data(key, other, exists) + print *, 'The entry to have its other data replaced exists = ', exists end program demo_set_other_data diff --git a/test/example/hashmaps/demo_hashmaps_slots_bits.f90 b/test/example/hashmaps/demo_hashmaps_slots_bits.f90 index f12344d81..f0e0d7f7c 100644 --- a/test/example/hashmaps/demo_hashmaps_slots_bits.f90 +++ b/test/example/hashmaps/demo_hashmaps_slots_bits.f90 @@ -1,10 +1,10 @@ program demo_slots_bits - use stdlib_hashmaps, only: chaining_hashmap_type - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - integer :: bits - call map%init(fnv_1_hasher) - bits = map%slots_bits() - print *, "Initial slot bits = ", bits + use stdlib_hashmaps, only: chaining_hashmap_type + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + integer :: bits + call map%init(fnv_1_hasher) + bits = map%slots_bits() + print *, "Initial slot bits = ", bits end program demo_slots_bits diff --git a/test/example/hashmaps/demo_hashmaps_total_depth.f90 b/test/example/hashmaps/demo_hashmaps_total_depth.f90 index 8c3f15e1a..935c0a8ca 100644 --- a/test/example/hashmaps/demo_hashmaps_total_depth.f90 +++ b/test/example/hashmaps/demo_hashmaps_total_depth.f90 @@ -1,10 +1,10 @@ program demo_total_depth - use stdlib_hashmaps, only: chaining_hashmap_type, int_depth - use stdlib_hashmap_wrappers, only: fnv_1_hasher - implicit none - type(chaining_hashmap_type) :: map - integer(int_depth) :: initial_depth - call map%init(fnv_1_hasher) - initial_depth = map%total_depth() - print *, "Initial total depth = ", initial_depth + use stdlib_hashmaps, only: chaining_hashmap_type, int_depth + use stdlib_hashmap_wrappers, only: fnv_1_hasher + implicit none + type(chaining_hashmap_type) :: map + integer(int_depth) :: initial_depth + call map%init(fnv_1_hasher) + initial_depth = map%total_depth() + print *, "Initial total depth = ", initial_depth end program demo_total_depth diff --git a/test/example/io/demo_fmt_constants.f90 b/test/example/io/demo_fmt_constants.f90 index bdd94ae70..e1a3a6458 100644 --- a/test/example/io/demo_fmt_constants.f90 +++ b/test/example/io/demo_fmt_constants.f90 @@ -1,26 +1,26 @@ program demo_fmt_constants - use stdlib_kinds, only: int32, int64, sp, dp - use stdlib_io, only: FMT_INT, FMT_REAL_SP, FMT_REAL_DP, FMT_COMPLEX_SP, FMT_COMPLEX_DP - implicit none + use stdlib_kinds, only: int32, int64, sp, dp + use stdlib_io, only: FMT_INT, FMT_REAL_SP, FMT_REAL_DP, FMT_COMPLEX_SP, FMT_COMPLEX_DP + implicit none - integer(kind=int32) :: i32 - integer(kind=int64) :: i64 - real(kind=sp) :: r32 - real(kind=dp) :: r64 - complex(kind=sp) :: c32 - complex(kind=dp) :: c64 + integer(kind=int32) :: i32 + integer(kind=int64) :: i64 + real(kind=sp) :: r32 + real(kind=dp) :: r64 + complex(kind=sp) :: c32 + complex(kind=dp) :: c64 - i32 = 100_int32 - i64 = 100_int64 - r32 = 100.0_sp - r64 = 100.0_dp - c32 = cmplx(100.0_sp, kind=sp) - c64 = cmplx(100.0_dp, kind=dp) + i32 = 100_int32 + i64 = 100_int64 + r32 = 100.0_sp + r64 = 100.0_dp + c32 = cmplx(100.0_sp, kind=sp) + c64 = cmplx(100.0_dp, kind=dp) - print "(2("//FMT_INT//",1x))", i32, i64 ! outputs: 100 100 - print FMT_REAL_SP, r32 ! outputs: 1.00000000E+02 - print FMT_REAL_DP, r64 ! outputs: 1.0000000000000000E+002 - print FMT_COMPLEX_SP, c32 ! outputs: 1.00000000E+02 0.00000000E+00 - print FMT_COMPLEX_DP, c64 ! outputs: 1.0000000000000000E+002 0.0000000000000000E+000 + print "(2("//FMT_INT//",1x))", i32, i64 ! outputs: 100 100 + print FMT_REAL_SP, r32 ! outputs: 1.00000000E+02 + print FMT_REAL_DP, r64 ! outputs: 1.0000000000000000E+002 + print FMT_COMPLEX_SP, c32 ! outputs: 1.00000000E+02 0.00000000E+00 + print FMT_COMPLEX_DP, c64 ! outputs: 1.0000000000000000E+002 0.0000000000000000E+000 end program demo_fmt_constants diff --git a/test/example/io/demo_getline.f90 b/test/example/io/demo_getline.f90 index ceb800919..f8fb61993 100644 --- a/test/example/io/demo_getline.f90 +++ b/test/example/io/demo_getline.f90 @@ -1,13 +1,13 @@ program demo_getline - use, intrinsic :: iso_fortran_env, only: input_unit, output_unit - use stdlib_io, only: getline - implicit none - character(len=:), allocatable :: line - integer :: stat + use, intrinsic :: iso_fortran_env, only: input_unit, output_unit + use stdlib_io, only: getline + implicit none + character(len=:), allocatable :: line + integer :: stat + call getline(input_unit, line, stat) + do while (stat == 0) + write (output_unit, '(a)') line call getline(input_unit, line, stat) - do while (stat == 0) - write (output_unit, '(a)') line - call getline(input_unit, line, stat) - end do + end do end program demo_getline diff --git a/test/example/io/demo_loadnpy.f90 b/test/example/io/demo_loadnpy.f90 index 0af352fd4..aba6bb7ba 100644 --- a/test/example/io/demo_loadnpy.f90 +++ b/test/example/io/demo_loadnpy.f90 @@ -1,6 +1,6 @@ program demo_loadnpy - use stdlib_io_npy, only: load_npy - implicit none - real, allocatable :: x(:, :) - call load_npy('example.npy', x) + use stdlib_io_npy, only: load_npy + implicit none + real, allocatable :: x(:, :) + call load_npy('example.npy', x) end program demo_loadnpy diff --git a/test/example/io/demo_loadtxt.f90 b/test/example/io/demo_loadtxt.f90 index ca5f46856..5c77e8853 100644 --- a/test/example/io/demo_loadtxt.f90 +++ b/test/example/io/demo_loadtxt.f90 @@ -1,6 +1,6 @@ program demo_loadtxt - use stdlib_io, only: loadtxt - implicit none - real, allocatable :: x(:, :) - call loadtxt('example.dat', x) + use stdlib_io, only: loadtxt + implicit none + real, allocatable :: x(:, :) + call loadtxt('example.dat', x) end program demo_loadtxt diff --git a/test/example/io/demo_open.f90 b/test/example/io/demo_open.f90 index 58592ebb6..6820e82b1 100644 --- a/test/example/io/demo_open.f90 +++ b/test/example/io/demo_open.f90 @@ -1,8 +1,8 @@ program demo_open - use stdlib_io, only: open - implicit none - integer :: u - u = open ('example.dat', 'wt') - write (u, '(a)') 'This is an example for open' - close (u) + use stdlib_io, only: open + implicit none + integer :: u + u = open ('example.dat', 'wt') + write (u, '(a)') 'This is an example for open' + close (u) end program demo_open diff --git a/test/example/io/demo_savenpy.f90 b/test/example/io/demo_savenpy.f90 index 81ef9942e..d77a04226 100644 --- a/test/example/io/demo_savenpy.f90 +++ b/test/example/io/demo_savenpy.f90 @@ -1,6 +1,6 @@ program demo_savenpy - use stdlib_io_npy, only: save_npy - implicit none - real :: x(3, 2) = 1 - call save_npy('example.npy', x) + use stdlib_io_npy, only: save_npy + implicit none + real :: x(3, 2) = 1 + call save_npy('example.npy', x) end program demo_savenpy diff --git a/test/example/io/demo_savetxt.f90 b/test/example/io/demo_savetxt.f90 index 054871dca..a19c8dedd 100644 --- a/test/example/io/demo_savetxt.f90 +++ b/test/example/io/demo_savetxt.f90 @@ -1,6 +1,6 @@ program demo_savetxt - use stdlib_io, only: savetxt - implicit none - real :: x(3, 2) = 1 - call savetxt('example.dat', x) + use stdlib_io, only: savetxt + implicit none + real :: x(3, 2) = 1 + call savetxt('example.dat', x) end program demo_savetxt diff --git a/test/example/linalg/demo_diag1.f90 b/test/example/linalg/demo_diag1.f90 index 508a08977..bd4491de7 100644 --- a/test/example/linalg/demo_diag1.f90 +++ b/test/example/linalg/demo_diag1.f90 @@ -1,7 +1,7 @@ program demo_diag1 - use stdlib_linalg, only: diag - implicit none - real, allocatable :: A(:, :) - integer :: i - A = diag([(1, i=1, 10)]) ! creates a 10 by 10 identity matrix + use stdlib_linalg, only: diag + implicit none + real, allocatable :: A(:, :) + integer :: i + A = diag([(1, i=1, 10)]) ! creates a 10 by 10 identity matrix end program demo_diag1 diff --git a/test/example/linalg/demo_diag2.f90 b/test/example/linalg/demo_diag2.f90 index ee65793d6..6e59bb7af 100644 --- a/test/example/linalg/demo_diag2.f90 +++ b/test/example/linalg/demo_diag2.f90 @@ -1,8 +1,8 @@ program demo_diag2 - use stdlib_linalg, only: diag - implicit none - real, allocatable :: v(:) - real, allocatable :: A(:, :) - v = [1, 2, 3, 4, 5] - A = diag(v) ! creates a 5 by 5 matrix with elements of v on the diagonal + use stdlib_linalg, only: diag + implicit none + real, allocatable :: v(:) + real, allocatable :: A(:, :) + v = [1, 2, 3, 4, 5] + A = diag(v) ! creates a 5 by 5 matrix with elements of v on the diagonal end program demo_diag2 diff --git a/test/example/linalg/demo_diag3.f90 b/test/example/linalg/demo_diag3.f90 index 2b6dcd82d..3ff5026d5 100644 --- a/test/example/linalg/demo_diag3.f90 +++ b/test/example/linalg/demo_diag3.f90 @@ -1,10 +1,10 @@ program demo_diag3 - use stdlib_linalg, only: diag - implicit none - integer, parameter :: n = 10 - real :: c(n), ul(n - 1) - real :: A(n, n) - c = 2 - ul = -1 - A = diag(ul, -1) + diag(c) + diag(ul, 1) ! Gil Strang's favorite matrix + use stdlib_linalg, only: diag + implicit none + integer, parameter :: n = 10 + real :: c(n), ul(n - 1) + real :: A(n, n) + c = 2 + ul = -1 + A = diag(ul, -1) + diag(c) + diag(ul, 1) ! Gil Strang's favorite matrix end program demo_diag3 diff --git a/test/example/linalg/demo_diag4.f90 b/test/example/linalg/demo_diag4.f90 index 74024d49a..02beb80f0 100644 --- a/test/example/linalg/demo_diag4.f90 +++ b/test/example/linalg/demo_diag4.f90 @@ -1,9 +1,9 @@ program demo_diag4 - use stdlib_linalg, only: diag - implicit none - integer, parameter :: n = 12 - real :: A(n, n) - real :: v(n) - call random_number(A) - v = diag(A) ! v contains diagonal elements of A + use stdlib_linalg, only: diag + implicit none + integer, parameter :: n = 12 + real :: A(n, n) + real :: v(n) + call random_number(A) + v = diag(A) ! v contains diagonal elements of A end program demo_diag4 diff --git a/test/example/linalg/demo_diag5.f90 b/test/example/linalg/demo_diag5.f90 index 4e182deee..03d7d7109 100644 --- a/test/example/linalg/demo_diag5.f90 +++ b/test/example/linalg/demo_diag5.f90 @@ -1,10 +1,10 @@ program demo_diag5 - use stdlib_linalg, only: diag - implicit none - integer, parameter :: n = 3 - real :: A(n, n) - real, allocatable :: v(:) - A = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [n, n]) - v = diag(A, -1) ! v is [2,6] - v = diag(A, 1) ! v is [4,8] + use stdlib_linalg, only: diag + implicit none + integer, parameter :: n = 3 + real :: A(n, n) + real, allocatable :: v(:) + A = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [n, n]) + v = diag(A, -1) ! v is [2,6] + v = diag(A, 1) ! v is [4,8] end program demo_diag5 diff --git a/test/example/linalg/demo_eye1.f90 b/test/example/linalg/demo_eye1.f90 index d3f484979..3e7723d41 100644 --- a/test/example/linalg/demo_eye1.f90 +++ b/test/example/linalg/demo_eye1.f90 @@ -1,14 +1,14 @@ program demo_eye1 - use stdlib_linalg, only: eye - implicit none - integer :: i(2, 2) - real :: a(3, 3) - real :: b(2, 3) !! Matrix is non-square. - complex :: c(2, 2) - I = eye(2) !! [1,0; 0,1] - A = eye(3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] - A = eye(3, 3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] - B = eye(2, 3) !! [1.0,0.0,0.0; 0.0,1.0,0.0] - C = eye(2, 2) !! [(1.0,0.0),(0.0,0.0); (0.0,0.0),(1.0,0.0)] - C = (1.0, 1.0)*eye(2, 2) !! [(1.0,1.0),(0.0,0.0); (0.0,0.0),(1.0,1.0)] + use stdlib_linalg, only: eye + implicit none + integer :: i(2, 2) + real :: a(3, 3) + real :: b(2, 3) !! Matrix is non-square. + complex :: c(2, 2) + I = eye(2) !! [1,0; 0,1] + A = eye(3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] + A = eye(3, 3) !! [1.0,0.0,0.0; 0.0,1.0,0.0; 0.0,0.0,1.0] + B = eye(2, 3) !! [1.0,0.0,0.0; 0.0,1.0,0.0] + C = eye(2, 2) !! [(1.0,0.0),(0.0,0.0); (0.0,0.0),(1.0,0.0)] + C = (1.0, 1.0)*eye(2, 2) !! [(1.0,1.0),(0.0,0.0); (0.0,0.0),(1.0,1.0)] end program demo_eye1 diff --git a/test/example/linalg/demo_eye2.f90 b/test/example/linalg/demo_eye2.f90 index b125fd67e..ae28c48de 100644 --- a/test/example/linalg/demo_eye2.f90 +++ b/test/example/linalg/demo_eye2.f90 @@ -1,5 +1,5 @@ program demo_eye2 - use stdlib_linalg, only: eye, diag - implicit none - print *, all(eye(4) == diag([1, 1, 1, 1])) ! prints .true. + use stdlib_linalg, only: eye, diag + implicit none + print *, all(eye(4) == diag([1, 1, 1, 1])) ! prints .true. end program demo_eye2 diff --git a/test/example/linalg/demo_is_diagonal.f90 b/test/example/linalg/demo_is_diagonal.f90 index 56b230cdb..0e581340e 100644 --- a/test/example/linalg/demo_is_diagonal.f90 +++ b/test/example/linalg/demo_is_diagonal.f90 @@ -1,10 +1,10 @@ program demo_is_diagonal - use stdlib_linalg, only: is_diagonal - implicit none - real :: A(2, 2), B(2, 2) - logical :: res - A = reshape([1., 0., 0., 4.], shape(A)) - B = reshape([1., 0., 3., 4.], shape(B)) - res = is_diagonal(A) ! returns .true. - res = is_diagonal(B) ! returns .false. + use stdlib_linalg, only: is_diagonal + implicit none + real :: A(2, 2), B(2, 2) + logical :: res + A = reshape([1., 0., 0., 4.], shape(A)) + B = reshape([1., 0., 3., 4.], shape(B)) + res = is_diagonal(A) ! returns .true. + res = is_diagonal(B) ! returns .false. end program demo_is_diagonal diff --git a/test/example/linalg/demo_is_hermitian.f90 b/test/example/linalg/demo_is_hermitian.f90 index 4dbdeea38..5a2529f76 100644 --- a/test/example/linalg/demo_is_hermitian.f90 +++ b/test/example/linalg/demo_is_hermitian.f90 @@ -1,10 +1,10 @@ program demo_is_hermitian - use stdlib_linalg, only: is_hermitian - implicit none - complex :: A(2, 2), B(2, 2) - logical :: res - A = reshape([cmplx(1., 0.), cmplx(3., -1.), cmplx(3., 1.), cmplx(4., 0.)], shape(A)) - B = reshape([cmplx(1., 0.), cmplx(3., 1.), cmplx(3., 1.), cmplx(4., 0.)], shape(B)) - res = is_hermitian(A) ! returns .true. - res = is_hermitian(B) ! returns .false. + use stdlib_linalg, only: is_hermitian + implicit none + complex :: A(2, 2), B(2, 2) + logical :: res + A = reshape([cmplx(1., 0.), cmplx(3., -1.), cmplx(3., 1.), cmplx(4., 0.)], shape(A)) + B = reshape([cmplx(1., 0.), cmplx(3., 1.), cmplx(3., 1.), cmplx(4., 0.)], shape(B)) + res = is_hermitian(A) ! returns .true. + res = is_hermitian(B) ! returns .false. end program demo_is_hermitian diff --git a/test/example/linalg/demo_is_hessenberg.f90 b/test/example/linalg/demo_is_hessenberg.f90 index b4972fecd..20c9ef24d 100644 --- a/test/example/linalg/demo_is_hessenberg.f90 +++ b/test/example/linalg/demo_is_hessenberg.f90 @@ -1,10 +1,10 @@ program demo_is_hessenberg - use stdlib_linalg, only: is_hessenberg - implicit none - real :: A(3, 3), B(3, 3) - logical :: res - A = reshape([1., 2., 0., 4., 5., 6., 7., 8., 9.], shape(A)) - B = reshape([1., 2., 3., 4., 5., 6., 7., 8., 9.], shape(B)) - res = is_hessenberg(A, 'u') ! returns .true. - res = is_hessenberg(B, 'u') ! returns .false. + use stdlib_linalg, only: is_hessenberg + implicit none + real :: A(3, 3), B(3, 3) + logical :: res + A = reshape([1., 2., 0., 4., 5., 6., 7., 8., 9.], shape(A)) + B = reshape([1., 2., 3., 4., 5., 6., 7., 8., 9.], shape(B)) + res = is_hessenberg(A, 'u') ! returns .true. + res = is_hessenberg(B, 'u') ! returns .false. end program demo_is_hessenberg diff --git a/test/example/linalg/demo_is_skew_symmetric.f90 b/test/example/linalg/demo_is_skew_symmetric.f90 index 2bd576e86..4df7a40c9 100644 --- a/test/example/linalg/demo_is_skew_symmetric.f90 +++ b/test/example/linalg/demo_is_skew_symmetric.f90 @@ -1,10 +1,10 @@ program demo_is_skew_symmetric - use stdlib_linalg, only: is_skew_symmetric - implicit none - real :: A(2, 2), B(2, 2) - logical :: res - A = reshape([0., -3., 3., 0.], shape(A)) - B = reshape([0., 3., 3., 0.], shape(B)) - res = is_skew_symmetric(A) ! returns .true. - res = is_skew_symmetric(B) ! returns .false. + use stdlib_linalg, only: is_skew_symmetric + implicit none + real :: A(2, 2), B(2, 2) + logical :: res + A = reshape([0., -3., 3., 0.], shape(A)) + B = reshape([0., 3., 3., 0.], shape(B)) + res = is_skew_symmetric(A) ! returns .true. + res = is_skew_symmetric(B) ! returns .false. end program demo_is_skew_symmetric diff --git a/test/example/linalg/demo_is_square.f90 b/test/example/linalg/demo_is_square.f90 index 07ebf4985..d2588c83c 100644 --- a/test/example/linalg/demo_is_square.f90 +++ b/test/example/linalg/demo_is_square.f90 @@ -1,10 +1,10 @@ program demo_is_square - use stdlib_linalg, only: is_square - implicit none - real :: A(2, 2), B(3, 2) - logical :: res - A = reshape([1., 2., 3., 4.], shape(A)) - B = reshape([1., 2., 3., 4., 5., 6.], shape(B)) - res = is_square(A) ! returns .true. - res = is_square(B) ! returns .false. + use stdlib_linalg, only: is_square + implicit none + real :: A(2, 2), B(3, 2) + logical :: res + A = reshape([1., 2., 3., 4.], shape(A)) + B = reshape([1., 2., 3., 4., 5., 6.], shape(B)) + res = is_square(A) ! returns .true. + res = is_square(B) ! returns .false. end program demo_is_square diff --git a/test/example/linalg/demo_is_symmetric.f90 b/test/example/linalg/demo_is_symmetric.f90 index f3bb4b09e..3279cb45b 100644 --- a/test/example/linalg/demo_is_symmetric.f90 +++ b/test/example/linalg/demo_is_symmetric.f90 @@ -1,10 +1,10 @@ program demo_is_symmetric - use stdlib_linalg, only: is_symmetric - implicit none - real :: A(2, 2), B(2, 2) - logical :: res - A = reshape([1., 3., 3., 4.], shape(A)) - B = reshape([1., 0., 3., 4.], shape(B)) - res = is_symmetric(A) ! returns .true. - res = is_symmetric(B) ! returns .false. + use stdlib_linalg, only: is_symmetric + implicit none + real :: A(2, 2), B(2, 2) + logical :: res + A = reshape([1., 3., 3., 4.], shape(A)) + B = reshape([1., 0., 3., 4.], shape(B)) + res = is_symmetric(A) ! returns .true. + res = is_symmetric(B) ! returns .false. end program demo_is_symmetric diff --git a/test/example/linalg/demo_is_triangular.f90 b/test/example/linalg/demo_is_triangular.f90 index 286981f57..61b8a9ed1 100644 --- a/test/example/linalg/demo_is_triangular.f90 +++ b/test/example/linalg/demo_is_triangular.f90 @@ -1,10 +1,10 @@ program demo_is_triangular - use stdlib_linalg, only: is_triangular - implicit none - real :: A(3, 3), B(3, 3) - logical :: res - A = reshape([1., 0., 0., 4., 5., 0., 7., 8., 9.], shape(A)) - B = reshape([1., 0., 3., 4., 5., 0., 7., 8., 9.], shape(B)) - res = is_triangular(A, 'u') ! returns .true. - res = is_triangular(B, 'u') ! returns .false. + use stdlib_linalg, only: is_triangular + implicit none + real :: A(3, 3), B(3, 3) + logical :: res + A = reshape([1., 0., 0., 4., 5., 0., 7., 8., 9.], shape(A)) + B = reshape([1., 0., 3., 4., 5., 0., 7., 8., 9.], shape(B)) + res = is_triangular(A, 'u') ! returns .true. + res = is_triangular(B, 'u') ! returns .false. end program demo_is_triangular diff --git a/test/example/linalg/demo_outer_product.f90 b/test/example/linalg/demo_outer_product.f90 index 3ecef34b1..a1214512c 100644 --- a/test/example/linalg/demo_outer_product.f90 +++ b/test/example/linalg/demo_outer_product.f90 @@ -1,9 +1,9 @@ program demo_outer_product - use stdlib_linalg, only: outer_product - implicit none - real, allocatable :: A(:, :), u(:), v(:) - u = [1., 2., 3.] - v = [3., 4.] - A = outer_product(u, v) + use stdlib_linalg, only: outer_product + implicit none + real, allocatable :: A(:, :), u(:), v(:) + u = [1., 2., 3.] + v = [3., 4.] + A = outer_product(u, v) !A = reshape([3., 6., 9., 4., 8., 12.], [3,2]) end program demo_outer_product diff --git a/test/example/linalg/demo_trace.f90 b/test/example/linalg/demo_trace.f90 index 84a6c569c..dbb375721 100644 --- a/test/example/linalg/demo_trace.f90 +++ b/test/example/linalg/demo_trace.f90 @@ -1,7 +1,7 @@ program demo_trace - use stdlib_linalg, only: trace - implicit none - real :: A(3, 3) - A = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [3, 3]) - print *, trace(A) ! 1 + 5 + 9 + use stdlib_linalg, only: trace + implicit none + real :: A(3, 3) + A = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [3, 3]) + print *, trace(A) ! 1 + 5 + 9 end program demo_trace diff --git a/test/example/logger/demo_add_log_unit.f90 b/test/example/logger/demo_add_log_unit.f90 index e609789f4..fbdd5b19a 100644 --- a/test/example/logger/demo_add_log_unit.f90 +++ b/test/example/logger/demo_add_log_unit.f90 @@ -1,19 +1,19 @@ program demo_add_log_unit - use stdlib_logger, only: global_logger, read_only_error + use stdlib_logger, only: global_logger, read_only_error - character(256) :: iomsg - integer :: iostat, unit, stat + character(256) :: iomsg + integer :: iostat, unit, stat - open (newunit=unit, file='error_log.txt', & - form='formatted', status='replace', & - position='rewind', & - action='write', iostat=iostat, iomsg=iomsg) + open (newunit=unit, file='error_log.txt', & + form='formatted', status='replace', & + position='rewind', & + action='write', iostat=iostat, iomsg=iomsg) - call global_logger%add_log_unit(unit, stat) + call global_logger%add_log_unit(unit, stat) - select case (stat) - case (read_only_error) - error stop 'Unable to write to "error_log.txt".' - end select + select case (stat) + case (read_only_error) + error stop 'Unable to write to "error_log.txt".' + end select end program demo_add_log_unit diff --git a/test/example/logger/demo_configure.f90 b/test/example/logger/demo_configure.f90 index ee29e0718..680a0af25 100644 --- a/test/example/logger/demo_configure.f90 +++ b/test/example/logger/demo_configure.f90 @@ -1,6 +1,6 @@ program demo_configure - use stdlib_logger, only: global => global_logger + use stdlib_logger, only: global => global_logger - call global%configure(indent=.false., max_width=72) + call global%configure(indent=.false., max_width=72) end program demo_configure diff --git a/test/example/logger/demo_global_logger.f90 b/test/example/logger/demo_global_logger.f90 index 426b27cfc..cc08b1e5d 100644 --- a/test/example/logger/demo_global_logger.f90 +++ b/test/example/logger/demo_global_logger.f90 @@ -1,12 +1,12 @@ program demo_global_logger - use stdlib_logger, global => global_logger + use stdlib_logger, global => global_logger - integer :: unit, stat + integer :: unit, stat - call global%add_log_file('error_log.txt', unit, & - position='asis', stat=stat) - if (stat /= success) then - error stop 'Unable to open "error_log.txt".' - end if + call global%add_log_file('error_log.txt', unit, & + position='asis', stat=stat) + if (stat /= success) then + error stop 'Unable to open "error_log.txt".' + end if end program demo_global_logger diff --git a/test/example/logger/demo_log_io_error.f90 b/test/example/logger/demo_log_io_error.f90 index ca2351a48..fcf254691 100644 --- a/test/example/logger/demo_log_io_error.f90 +++ b/test/example/logger/demo_log_io_error.f90 @@ -1,20 +1,20 @@ program demo_log_io_error - use stdlib_logger, global => global_logger + use stdlib_logger, global => global_logger - character(*), parameter :: filename = 'dummy.txt' - integer :: iostat, lun - character(128) :: iomsg - character(*), parameter :: message = & - 'Failure in opening "dummy.txt".' + character(*), parameter :: filename = 'dummy.txt' + integer :: iostat, lun + character(128) :: iomsg + character(*), parameter :: message = & + 'Failure in opening "dummy.txt".' - open (newunit=lun, file=filename, form='formatted', & - status='old', iostat=iostat, iomsg=iomsg) - if (iostat /= 0) then - call global%log_io_error(message, & - procedure='EXAMPLE', & - iostat=iostat, & - iomsg=iomsg) - error stop 'Error on opening a file' - end if + open (newunit=lun, file=filename, form='formatted', & + status='old', iostat=iostat, iomsg=iomsg) + if (iostat /= 0) then + call global%log_io_error(message, & + procedure='EXAMPLE', & + iostat=iostat, & + iomsg=iomsg) + error stop 'Error on opening a file' + end if end program demo_log_io_error diff --git a/test/example/logger/demo_log_text_error.f90 b/test/example/logger/demo_log_text_error.f90 index 5607c7f98..93a074a10 100644 --- a/test/example/logger/demo_log_text_error.f90 +++ b/test/example/logger/demo_log_text_error.f90 @@ -1,36 +1,36 @@ program demo_log_text_error - use stdlib_logger + use stdlib_logger - character(*), parameter :: filename = 'dummy.txt' - integer :: col_no, line_no, lun, status - character(128) :: line - character(*), parameter :: message = 'Bad text found.' + character(*), parameter :: filename = 'dummy.txt' + integer :: col_no, line_no, lun, status + character(128) :: line + character(*), parameter :: message = 'Bad text found.' - open (newunit=lun, file=filename, status='old', & - form='formatted') - line_no = 0 - do - read (lun, fmt='(a)', end=900) line - line_no = line_no + 1 - call check_line(line, status, col_no) - if (status /= 0) then - call global_logger%log_text_error(line, & - col_no, message, filename, line_no) - error stop 'Error in reading '//filename - end if - end do + open (newunit=lun, file=filename, status='old', & + form='formatted') + line_no = 0 + do + read (lun, fmt='(a)', end=900) line + line_no = line_no + 1 + call check_line(line, status, col_no) + if (status /= 0) then + call global_logger%log_text_error(line, & + col_no, message, filename, line_no) + error stop 'Error in reading '//filename + end if + end do 900 continue contains - subroutine check_line(line, status, col_no) - character(*), intent(in) :: line - integer, intent(inout) :: status - integer, intent(inout) :: col_no - ! scan the line for forbidden characters - col_no = scan(line,".$/") - ! col_no > 0 means there is a forbidden character - status = col_no > 0 - end subroutine + subroutine check_line(line, status, col_no) + character(*), intent(in) :: line + integer, intent(inout) :: status + integer, intent(inout) :: col_no + ! scan the line for forbidden characters + col_no = scan(line, ".$/") + ! col_no > 0 means there is a forbidden character + status = col_no > 0 + end subroutine end program demo_log_text_error diff --git a/test/example/math/demo_clip_integer.f90 b/test/example/math/demo_clip_integer.f90 index f8da03474..736fe3129 100644 --- a/test/example/math/demo_clip_integer.f90 +++ b/test/example/math/demo_clip_integer.f90 @@ -1,16 +1,16 @@ program demo_clip_integer - use stdlib_math, only: clip - use stdlib_kinds, only: int32 - implicit none - integer(int32) :: x - integer(int32) :: xmin - integer(int32) :: xmax - integer(int32) :: clipped_value + use stdlib_math, only: clip + use stdlib_kinds, only: int32 + implicit none + integer(int32) :: x + integer(int32) :: xmin + integer(int32) :: xmax + integer(int32) :: clipped_value - xmin = -5_int32 - xmax = 5_int32 - x = 12_int32 + xmin = -5_int32 + xmax = 5_int32 + x = 12_int32 - clipped_value = clip(x, xmin, xmax) + clipped_value = clip(x, xmin, xmax) ! clipped_value <- 5 end program demo_clip_integer diff --git a/test/example/math/demo_clip_real.f90 b/test/example/math/demo_clip_real.f90 index a8d70c8d8..35f7412b2 100644 --- a/test/example/math/demo_clip_real.f90 +++ b/test/example/math/demo_clip_real.f90 @@ -1,16 +1,16 @@ program demo_clip_real - use stdlib_math, only: clip - use stdlib_kinds, only: sp - implicit none - real(sp) :: x - real(sp) :: xmin - real(sp) :: xmax - real(sp) :: clipped_value + use stdlib_math, only: clip + use stdlib_kinds, only: sp + implicit none + real(sp) :: x + real(sp) :: xmin + real(sp) :: xmax + real(sp) :: clipped_value - xmin = -5.769_sp - xmax = 3.025_sp - x = 3.025_sp + xmin = -5.769_sp + xmax = 3.025_sp + x = 3.025_sp - clipped_value = clip(x, xmin, xmax) + clipped_value = clip(x, xmin, xmax) ! clipped_value <- 3.02500010 end program demo_clip_real diff --git a/test/example/math/demo_diff.f90 b/test/example/math/demo_diff.f90 index 36c7140bc..d2ff8b866 100644 --- a/test/example/math/demo_diff.f90 +++ b/test/example/math/demo_diff.f90 @@ -1,22 +1,22 @@ program demo_diff - use stdlib_math, only: diff - implicit none + use stdlib_math, only: diff + implicit none - integer :: i(7) = [1, 1, 2, 3, 5, 8, 13] - real :: x(6) = [0, 5, 15, 30, 50, 75] - integer :: A(3, 3) = reshape([1, 7, 17, 3, 11, 19, 5, 13, 23], [3, 3]) - integer :: Y(3, 2) + integer :: i(7) = [1, 1, 2, 3, 5, 8, 13] + real :: x(6) = [0, 5, 15, 30, 50, 75] + integer :: A(3, 3) = reshape([1, 7, 17, 3, 11, 19, 5, 13, 23], [3, 3]) + integer :: Y(3, 2) - print *, diff(i) ! [0, 1, 1, 2, 3, 5] - print *, diff(x, 2) ! [5.0, 5.0, 5.0, 5.0] + print *, diff(i) ! [0, 1, 1, 2, 3, 5] + print *, diff(x, 2) ! [5.0, 5.0, 5.0, 5.0] - Y = diff(A, n=1, dim=2) - print *, Y(1, :) ! [2, 2] - print *, Y(2, :) ! [4, 2] - print *, Y(3, :) ! [2, 4] + Y = diff(A, n=1, dim=2) + print *, Y(1, :) ! [2, 2] + print *, Y(2, :) ! [4, 2] + print *, Y(3, :) ! [2, 4] - print *, diff(i, prepend=[0]) ! [1, 0, 1, 1, 2, 3, 5] - print *, diff(i, append=[21]) ! [0, 1, 1, 2, 3, 5, 8] + print *, diff(i, prepend=[0]) ! [1, 0, 1, 1, 2, 3, 5] + print *, diff(i, append=[21]) ! [0, 1, 1, 2, 3, 5, 8] end program demo_diff diff --git a/test/example/math/demo_gcd.f90 b/test/example/math/demo_gcd.f90 index 4ba36005c..4a987cc09 100644 --- a/test/example/math/demo_gcd.f90 +++ b/test/example/math/demo_gcd.f90 @@ -1,9 +1,9 @@ program demo_gcd - use stdlib_math, only: gcd - implicit none - integer :: a, b, c + use stdlib_math, only: gcd + implicit none + integer :: a, b, c - a = 48 - b = 18 - c = gcd(a, b) ! returns 6 + a = 48 + b = 18 + c = gcd(a, b) ! returns 6 end program demo_gcd diff --git a/test/example/math/demo_linspace_complex.f90 b/test/example/math/demo_linspace_complex.f90 index 43ce59cd1..a6b695cd8 100644 --- a/test/example/math/demo_linspace_complex.f90 +++ b/test/example/math/demo_linspace_complex.f90 @@ -1,12 +1,12 @@ program demo_linspace_complex - use stdlib_math, only: linspace - use stdlib_kinds, only: dp - implicit none + use stdlib_math, only: linspace + use stdlib_kinds, only: dp + implicit none - complex(dp) :: start = cmplx(10.0_dp, 5.0_dp,kind=dp) - complex(dp) :: end = cmplx(-10.0_dp, 15.0_dp,kind=dp) + complex(dp) :: start = cmplx(10.0_dp, 5.0_dp, kind=dp) + complex(dp) :: end = cmplx(-10.0_dp, 15.0_dp, kind=dp) - complex(dp) :: z(11) + complex(dp) :: z(11) - z = linspace(start, end, 11) + z = linspace(start, end, 11) end program demo_linspace_complex diff --git a/test/example/math/demo_linspace_int16.f90 b/test/example/math/demo_linspace_int16.f90 index 591f462f0..be9d39c96 100644 --- a/test/example/math/demo_linspace_int16.f90 +++ b/test/example/math/demo_linspace_int16.f90 @@ -1,12 +1,12 @@ program demo_linspace_int16 - use stdlib_math, only: linspace - use stdlib_kinds, only: int16, dp - implicit none + use stdlib_math, only: linspace + use stdlib_kinds, only: int16, dp + implicit none - integer(int16) :: start = 10_int16 - integer(int16) :: end = 23_int16 + integer(int16) :: start = 10_int16 + integer(int16) :: end = 23_int16 - real(dp) :: r(15) + real(dp) :: r(15) - r = linspace(start, end, 15) + r = linspace(start, end, 15) end program demo_linspace_int16 diff --git a/test/example/math/demo_logspace_complex.f90 b/test/example/math/demo_logspace_complex.f90 index e9cb3ec0b..8063666bd 100644 --- a/test/example/math/demo_logspace_complex.f90 +++ b/test/example/math/demo_logspace_complex.f90 @@ -1,12 +1,12 @@ program demo_logspace_complex - use stdlib_math, only: logspace - use stdlib_kinds, only: dp - implicit none + use stdlib_math, only: logspace + use stdlib_kinds, only: dp + implicit none - complex(dp) :: start = (10.0_dp, 5.0_dp) - complex(dp) :: end = (-10.0_dp, 15.0_dp) + complex(dp) :: start = (10.0_dp, 5.0_dp) + complex(dp) :: end = (-10.0_dp, 15.0_dp) - complex(dp) :: z(11) ! Complex values raised to complex powers results in complex values + complex(dp) :: z(11) ! Complex values raised to complex powers results in complex values - z = logspace(start, end, 11) + z = logspace(start, end, 11) end program demo_logspace_complex diff --git a/test/example/math/demo_logspace_int.f90 b/test/example/math/demo_logspace_int.f90 index bbfa5ab82..e61ea9643 100644 --- a/test/example/math/demo_logspace_int.f90 +++ b/test/example/math/demo_logspace_int.f90 @@ -1,13 +1,13 @@ program demo_logspace_int - use stdlib_math, only: logspace - use stdlib_kinds, only: dp - implicit none + use stdlib_math, only: logspace + use stdlib_kinds, only: dp + implicit none - integer, parameter :: start = 10 - integer, parameter :: end = 23 - integer, parameter :: n = 15 + integer, parameter :: start = 10 + integer, parameter :: end = 23 + integer, parameter :: n = 15 - real(dp) :: r(n) ! Integer values raised to real powers results in real values + real(dp) :: r(n) ! Integer values raised to real powers results in real values - r = logspace(start, end, n) + r = logspace(start, end, n) end program demo_logspace_int diff --git a/test/example/math/demo_logspace_rstart_cbase.f90 b/test/example/math/demo_logspace_rstart_cbase.f90 index 9bd527100..74de85d85 100644 --- a/test/example/math/demo_logspace_rstart_cbase.f90 +++ b/test/example/math/demo_logspace_rstart_cbase.f90 @@ -1,15 +1,15 @@ program demo_logspace_rstart_cbase - use stdlib_math, only: logspace - use stdlib_kinds, only: dp - implicit none + use stdlib_math, only: logspace + use stdlib_kinds, only: dp + implicit none - real(dp) :: start = 0.0_dp - real(dp) :: end = 3.0_dp - integer, parameter :: n = 4 - complex(dp) :: base = (0.0_dp, 1.0_dp) + real(dp) :: start = 0.0_dp + real(dp) :: end = 3.0_dp + integer, parameter :: n = 4 + complex(dp) :: base = (0.0_dp, 1.0_dp) - complex(dp) :: z(n) ! complex values raised to real powers result in complex values + complex(dp) :: z(n) ! complex values raised to real powers result in complex values - z = logspace(start, end, n, base) + z = logspace(start, end, n, base) end program demo_logspace_rstart_cbase diff --git a/test/example/math/demo_math_all_close.f90 b/test/example/math/demo_math_all_close.f90 index ae52e40af..02af97805 100644 --- a/test/example/math/demo_math_all_close.f90 +++ b/test/example/math/demo_math_all_close.f90 @@ -1,15 +1,15 @@ program demo_math_all_close - use stdlib_math, only: all_close - real :: y, NAN - complex :: z(4, 4) + use stdlib_math, only: all_close + real :: y, NAN + complex :: z(4, 4) - y = -3 - NAN = sqrt(y) - z = (1.0, 1.0) + y = -3 + NAN = sqrt(y) + z = (1.0, 1.0) - print *, all_close(z + cmplx(1.0e-11, 1.0e-11), z) ! T - print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.) + print *, all_close(z + cmplx(1.0e-11, 1.0e-11), z) ! T + print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.) ! NAN, F, T end program demo_math_all_close diff --git a/test/example/math/demo_math_arange.f90 b/test/example/math/demo_math_arange.f90 index 2ac5f5d20..4ec0964d9 100644 --- a/test/example/math/demo_math_arange.f90 +++ b/test/example/math/demo_math_arange.f90 @@ -1,19 +1,19 @@ program demo_math_arange - use stdlib_math, only: arange + use stdlib_math, only: arange - print *, arange(3) ! [1,2,3] - print *, arange(-1) ! [1,0,-1] - print *, arange(0, 2) ! [0,1,2] - print *, arange(1, -1) ! [1,0,-1] - print *, arange(0, 2, 2) ! [0,2] + print *, arange(3) ! [1,2,3] + print *, arange(-1) ! [1,0,-1] + print *, arange(0, 2) ! [0,1,2] + print *, arange(1, -1) ! [1,0,-1] + print *, arange(0, 2, 2) ! [0,2] - print *, arange(3.0) ! [1.0,2.0,3.0] - print *, arange(0.0, 5.0) ! [0.0,1.0,2.0,3.0,4.0,5.0] - print *, arange(0.0, 6.0, 2.5) ! [0.0,2.5,5.0] + print *, arange(3.0) ! [1.0,2.0,3.0] + print *, arange(0.0, 5.0) ! [0.0,1.0,2.0,3.0,4.0,5.0] + print *, arange(0.0, 6.0, 2.5) ! [0.0,2.5,5.0] - print *, (1.0, 1.0)*arange(3) ! [(1.0,1.0),(2.0,2.0),[3.0,3.0]] + print *, (1.0, 1.0)*arange(3) ! [(1.0,1.0),(2.0,2.0),[3.0,3.0]] - print *, arange(0.0, 2.0, -2.0) ! [0.0,2.0]. Not recommended: `step` argument is negative! - print *, arange(0.0, 2.0, 0.0) ! [0.0,1.0,2.0]. Not recommended: `step` argument is zero! + print *, arange(0.0, 2.0, -2.0) ! [0.0,2.0]. Not recommended: `step` argument is negative! + print *, arange(0.0, 2.0, 0.0) ! [0.0,1.0,2.0]. Not recommended: `step` argument is zero! end program demo_math_arange diff --git a/test/example/math/demo_math_arg.f90 b/test/example/math/demo_math_arg.f90 index 976826c44..11f9b629c 100644 --- a/test/example/math/demo_math_arg.f90 +++ b/test/example/math/demo_math_arg.f90 @@ -1,7 +1,7 @@ program demo_math_arg - use stdlib_math, only: arg - print *, arg((0.0, 0.0)) ! 0.0 - print *, arg((3.0, 4.0)) ! 0.927 - print *, arg(2.0*exp((0.0, 0.5))) ! 0.5 - print *, arg([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [π/2, 0.0, -π/2, π] + use stdlib_math, only: arg + print *, arg((0.0, 0.0)) ! 0.0 + print *, arg((3.0, 4.0)) ! 0.927 + print *, arg(2.0*exp((0.0, 0.5))) ! 0.5 + print *, arg([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [π/2, 0.0, -π/2, π] end program demo_math_arg diff --git a/test/example/math/demo_math_argd.f90 b/test/example/math/demo_math_argd.f90 index 19f43b467..7de2963b7 100644 --- a/test/example/math/demo_math_argd.f90 +++ b/test/example/math/demo_math_argd.f90 @@ -1,7 +1,7 @@ program demo_math_argd - use stdlib_math, only: argd - print *, argd((0.0, 0.0)) ! 0.0° - print *, argd((3.0, 4.0)) ! 53.1° - print *, argd(2.0*exp((0.0, 0.5))) ! 28.64° - print *, argd([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [90°, 0°, -90°, 180°] + use stdlib_math, only: argd + print *, argd((0.0, 0.0)) ! 0.0° + print *, argd((3.0, 4.0)) ! 53.1° + print *, argd(2.0*exp((0.0, 0.5))) ! 28.64° + print *, argd([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [90°, 0°, -90°, 180°] end program demo_math_argd diff --git a/test/example/math/demo_math_argpi.f90 b/test/example/math/demo_math_argpi.f90 index 1ffdb8154..62a0afb78 100644 --- a/test/example/math/demo_math_argpi.f90 +++ b/test/example/math/demo_math_argpi.f90 @@ -1,7 +1,7 @@ program demo_math_argpi - use stdlib_math, only: argpi - print *, argpi((0.0, 0.0)) ! 0.0 - print *, argpi((3.0, 4.0)) ! 0.295 - print *, argpi(2.0*exp((0.0, 0.5))) ! 0.159 - print *, argpi([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [0.5, 0.0, -0.5, 1.0] + use stdlib_math, only: argpi + print *, argpi((0.0, 0.0)) ! 0.0 + print *, argpi((3.0, 4.0)) ! 0.295 + print *, argpi(2.0*exp((0.0, 0.5))) ! 0.159 + print *, argpi([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [0.5, 0.0, -0.5, 1.0] end program demo_math_argpi diff --git a/test/example/math/demo_math_is_close.f90 b/test/example/math/demo_math_is_close.f90 index ce559aa9d..8d019689e 100644 --- a/test/example/math/demo_math_is_close.f90 +++ b/test/example/math/demo_math_is_close.f90 @@ -1,14 +1,14 @@ program demo_math_is_close - use stdlib_math, only: is_close - real :: x(2) = [1, 2], y, NAN + use stdlib_math, only: is_close + real :: x(2) = [1, 2], y, NAN - y = -3 - NAN = sqrt(y) + y = -3 + NAN = sqrt(y) - print *, is_close(x, [real :: 1, 2.1]) ! [T, F] - print *, is_close(2.0, 2.1, abs_tol=0.1) ! T - print *, NAN, is_close(2.0, NAN), is_close(2.0, NAN, equal_nan=.true.) ! NAN, F, F - print *, is_close(NAN, NAN), is_close(NAN, NAN, equal_nan=.true.) ! F, T + print *, is_close(x, [real :: 1, 2.1]) ! [T, F] + print *, is_close(2.0, 2.1, abs_tol=0.1) ! T + print *, NAN, is_close(2.0, NAN), is_close(2.0, NAN, equal_nan=.true.) ! NAN, F, F + print *, is_close(NAN, NAN), is_close(NAN, NAN, equal_nan=.true.) ! F, T end program demo_math_is_close diff --git a/test/example/optval/demo_optval.f90 b/test/example/optval/demo_optval.f90 index 750aafd25..c345db38c 100644 --- a/test/example/optval/demo_optval.f90 +++ b/test/example/optval/demo_optval.f90 @@ -1,14 +1,14 @@ program demo_optval - use stdlib_optval, only: optval - implicit none - print *, root(64.0) + use stdlib_optval, only: optval + implicit none + print *, root(64.0) ! 8.0 - print *, root(64.0, 3) + print *, root(64.0, 3) ! 4.0 contains - real function root(x, n) - real, intent(in) :: x - integer, intent(in), optional :: n - root = x**(1.0/optval(n, 2)) - end function root + real function root(x, n) + real, intent(in) :: x + integer, intent(in), optional :: n + root = x**(1.0/optval(n, 2)) + end function root end program demo_optval diff --git a/test/example/quadrature/demo_gauss_legendre.f90 b/test/example/quadrature/demo_gauss_legendre.f90 index b72d319cb..37271edd9 100644 --- a/test/example/quadrature/demo_gauss_legendre.f90 +++ b/test/example/quadrature/demo_gauss_legendre.f90 @@ -1,10 +1,10 @@ program demo_gauss_legendre - use iso_fortran_env, dp => real64 - use stdlib_quadrature, only: gauss_legendre - implicit none + use iso_fortran_env, dp => real64 + use stdlib_quadrature, only: gauss_legendre + implicit none - integer, parameter :: N = 6 - real(dp), dimension(N) :: x, w - call gauss_legendre(x, w) - print *, "integral of x**2 from -1 to 1 is", sum(x**2*w) + integer, parameter :: N = 6 + real(dp), dimension(N) :: x, w + call gauss_legendre(x, w) + print *, "integral of x**2 from -1 to 1 is", sum(x**2*w) end program demo_gauss_legendre diff --git a/test/example/quadrature/demo_gauss_legendre_lobatto.f90 b/test/example/quadrature/demo_gauss_legendre_lobatto.f90 index 8c73f03f0..9ca632a05 100644 --- a/test/example/quadrature/demo_gauss_legendre_lobatto.f90 +++ b/test/example/quadrature/demo_gauss_legendre_lobatto.f90 @@ -1,10 +1,10 @@ program demo_gauss_legendre_lobatto - use iso_fortran_env, dp => real64 - use stdlib_quadrature, only: gauss_legendre_lobatto - implicit none + use iso_fortran_env, dp => real64 + use stdlib_quadrature, only: gauss_legendre_lobatto + implicit none - integer, parameter :: N = 6 - real(dp), dimension(N) :: x, w - call gauss_legendre_lobatto(x, w) - print *, "integral of x**2 from -1 to 1 is", sum(x**2*w) + integer, parameter :: N = 6 + real(dp), dimension(N) :: x, w + call gauss_legendre_lobatto(x, w) + print *, "integral of x**2 from -1 to 1 is", sum(x**2*w) end program demo_gauss_legendre_lobatto diff --git a/test/example/quadrature/demo_simps.f90 b/test/example/quadrature/demo_simps.f90 index 18cd40455..3d7fd8267 100644 --- a/test/example/quadrature/demo_simps.f90 +++ b/test/example/quadrature/demo_simps.f90 @@ -1,10 +1,10 @@ program demo_simps - use stdlib_quadrature, only: simps - implicit none - real, parameter :: x(5) = [0., 1., 2., 3., 4.] - real :: y(5) = 3.*x**2 - print *, simps(y, x) + use stdlib_quadrature, only: simps + implicit none + real, parameter :: x(5) = [0., 1., 2., 3., 4.] + real :: y(5) = 3.*x**2 + print *, simps(y, x) ! 64.0 - print *, simps(y, 0.5) + print *, simps(y, 0.5) ! 32.0 end program demo_simps diff --git a/test/example/quadrature/demo_simps_weights.f90 b/test/example/quadrature/demo_simps_weights.f90 index e92bcaf03..ce0dde892 100644 --- a/test/example/quadrature/demo_simps_weights.f90 +++ b/test/example/quadrature/demo_simps_weights.f90 @@ -1,10 +1,10 @@ program demo_simps_weights - use stdlib_quadrature, only: simps_weights - implicit none - real, parameter :: x(5) = [0., 1., 2., 3., 4.] - real :: y(5) = 3.*x**2 - real :: w(5) - w = simps_weights(x) - print *, sum(w*y) + use stdlib_quadrature, only: simps_weights + implicit none + real, parameter :: x(5) = [0., 1., 2., 3., 4.] + real :: y(5) = 3.*x**2 + real :: w(5) + w = simps_weights(x) + print *, sum(w*y) ! 64.0 end program demo_simps_weights diff --git a/test/example/quadrature/demo_trapz.f90 b/test/example/quadrature/demo_trapz.f90 index 46f40f39b..95aca38c5 100644 --- a/test/example/quadrature/demo_trapz.f90 +++ b/test/example/quadrature/demo_trapz.f90 @@ -1,10 +1,10 @@ program demo_trapz - use stdlib_quadrature, only: trapz - implicit none - real, parameter :: x(5) = [0., 1., 2., 3., 4.] - real :: y(5) = x**2 - print *, trapz(y, x) + use stdlib_quadrature, only: trapz + implicit none + real, parameter :: x(5) = [0., 1., 2., 3., 4.] + real :: y(5) = x**2 + print *, trapz(y, x) ! 22.0 - print *, trapz(y, 0.5) + print *, trapz(y, 0.5) ! 11.0 end program demo_trapz diff --git a/test/example/quadrature/demo_trapz_weights.f90 b/test/example/quadrature/demo_trapz_weights.f90 index 9059b33f1..9193dfb0a 100644 --- a/test/example/quadrature/demo_trapz_weights.f90 +++ b/test/example/quadrature/demo_trapz_weights.f90 @@ -1,11 +1,11 @@ program demo_trapz_weights - use stdlib_quadrature, only: trapz_weights - implicit none - real, parameter :: x(5) = [0., 1., 2., 3., 4.] - real :: y(5) = x**2 - real :: w(5) - w = trapz_weights(x) - print *, sum(w*y) + use stdlib_quadrature, only: trapz_weights + implicit none + real, parameter :: x(5) = [0., 1., 2., 3., 4.] + real :: y(5) = x**2 + real :: w(5) + w = trapz_weights(x) + print *, sum(w*y) ! 22.0 end program demo_trapz_weights diff --git a/test/example/random/demo_dist_rand.f90 b/test/example/random/demo_dist_rand.f90 index 1a6fc3e05..d9ee88f3f 100644 --- a/test/example/random/demo_dist_rand.f90 +++ b/test/example/random/demo_dist_rand.f90 @@ -1,17 +1,17 @@ program demo_dist_rand - use stdlib_kinds, only: int8, int16, int32, int64 - use stdlib_random, only: dist_rand, random_seed - implicit none - integer :: put, get + use stdlib_kinds, only: int8, int16, int32, int64 + use stdlib_random, only: dist_rand, random_seed + implicit none + integer :: put, get - put = 135792468 - call random_seed(put, get) ! set and get current value of seed - print *, dist_rand(1_int8) ! random integer in [-2^7, 2^7 - 1] + put = 135792468 + call random_seed(put, get) ! set and get current value of seed + print *, dist_rand(1_int8) ! random integer in [-2^7, 2^7 - 1] ! -90 - print *, dist_rand(1_int16) ! random integer in [-2^15, 2^15 - 1] + print *, dist_rand(1_int16) ! random integer in [-2^15, 2^15 - 1] ! -32725 - print *, dist_rand(1_int32) ! random integer in [-2^31, 2^31 - 1] + print *, dist_rand(1_int32) ! random integer in [-2^31, 2^31 - 1] ! -1601563881 - print *, dist_rand(1_int64) ! random integer in [-2^63, 2^63 - 1] + print *, dist_rand(1_int64) ! random integer in [-2^63, 2^63 - 1] ! 180977695517992208 end program demo_dist_rand diff --git a/test/example/random/demo_random_seed.f90 b/test/example/random/demo_random_seed.f90 index eb6628618..9b405ecec 100644 --- a/test/example/random/demo_random_seed.f90 +++ b/test/example/random/demo_random_seed.f90 @@ -1,8 +1,8 @@ program demo_random_seed - use stdlib_random, only: random_seed - implicit none - integer :: seed_put, seed_get + use stdlib_random, only: random_seed + implicit none + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) ! set and get current value of seed + seed_put = 1234567 + call random_seed(seed_put, seed_get) ! set and get current value of seed end program demo_random_seed diff --git a/test/example/selection/demo_arg_select.f90 b/test/example/selection/demo_arg_select.f90 index 3b87e9c39..ea0fb86a4 100644 --- a/test/example/selection/demo_arg_select.f90 +++ b/test/example/selection/demo_arg_select.f90 @@ -1,29 +1,29 @@ program demo_arg_select - use stdlib_selection, only: arg_select - implicit none + use stdlib_selection, only: arg_select + implicit none - real, allocatable :: array(:) - integer, allocatable :: indx(:) - integer :: kth_smallest - integer :: k + real, allocatable :: array(:) + integer, allocatable :: indx(:) + integer :: kth_smallest + integer :: k - array = [3., 2., 7., 4., 5., 1., 4., -1.] - indx = [(k, k=1, size(array))] + array = [3., 2., 7., 4., 5., 1., 4., -1.] + indx = [(k, k=1, size(array))] - k = 2 - call arg_select(array, indx, k, kth_smallest) - print *, array(kth_smallest) ! print 1.0 + k = 2 + call arg_select(array, indx, k, kth_smallest) + print *, array(kth_smallest) ! print 1.0 - k = 7 + k = 7 ! Due to the previous call to arg_select, we know for sure this is in an ! index >= 2 - call arg_select(array, indx, k, kth_smallest, left=2) - print *, array(kth_smallest) ! print 5.0 + call arg_select(array, indx, k, kth_smallest, left=2) + print *, array(kth_smallest) ! print 5.0 - k = 6 + k = 6 ! Due to the previous two calls to arg_select, we know for sure this is in ! an index >= 2 and <= 7 - call arg_select(array, indx, k, kth_smallest, left=2, right=7) - print *, array(kth_smallest) ! print 4.0 + call arg_select(array, indx, k, kth_smallest, left=2, right=7) + print *, array(kth_smallest) ! print 4.0 end program demo_arg_select diff --git a/test/example/selection/demo_select.f90 b/test/example/selection/demo_select.f90 index fdf5404ef..4329b8b58 100644 --- a/test/example/selection/demo_select.f90 +++ b/test/example/selection/demo_select.f90 @@ -1,27 +1,27 @@ program demo_select - use stdlib_selection, only: select - implicit none + use stdlib_selection, only: select + implicit none - real, allocatable :: array(:) - real :: kth_smallest - integer :: k + real, allocatable :: array(:) + real :: kth_smallest + integer :: k - array = [3., 2., 7., 4., 5., 1., 4., -1.] + array = [3., 2., 7., 4., 5., 1., 4., -1.] - k = 2 - call select(array, k, kth_smallest) - print *, kth_smallest ! print 1.0 + k = 2 + call select(array, k, kth_smallest) + print *, kth_smallest ! print 1.0 - k = 7 + k = 7 ! Due to the previous call to select, we know for sure this is in an ! index >= 2 - call select(array, k, kth_smallest, left=2) - print *, kth_smallest ! print 5.0 + call select(array, k, kth_smallest, left=2) + print *, kth_smallest ! print 5.0 - k = 6 + k = 6 ! Due to the previous two calls to select, we know for sure this is in ! an index >= 2 and <= 7 - call select(array, k, kth_smallest, left=2, right=7) - print *, kth_smallest ! print 4.0 + call select(array, k, kth_smallest, left=2, right=7) + print *, kth_smallest ! print 4.0 end program demo_select diff --git a/test/example/selection/selection_vs_sort.f90 b/test/example/selection/selection_vs_sort.f90 index dbb4315a0..a2e43dc11 100644 --- a/test/example/selection/selection_vs_sort.f90 +++ b/test/example/selection/selection_vs_sort.f90 @@ -1,77 +1,77 @@ program selection_vs_sort - use stdlib_kinds, only: dp, sp, int64 - use stdlib_selection, only: select, arg_select - use stdlib_sorting, only: sort - implicit none - - call compare_select_sort_for_median(1) - call compare_select_sort_for_median(11) - call compare_select_sort_for_median(101) - call compare_select_sort_for_median(1001) - call compare_select_sort_for_median(10001) - call compare_select_sort_for_median(100001) + use stdlib_kinds, only: dp, sp, int64 + use stdlib_selection, only: select, arg_select + use stdlib_sorting, only: sort + implicit none + + call compare_select_sort_for_median(1) + call compare_select_sort_for_median(11) + call compare_select_sort_for_median(101) + call compare_select_sort_for_median(1001) + call compare_select_sort_for_median(10001) + call compare_select_sort_for_median(100001) contains - subroutine compare_select_sort_for_median(N) - integer, intent(in) :: N + subroutine compare_select_sort_for_median(N) + integer, intent(in) :: N - integer :: i, k, result_arg_select, indx(N), indx_local(N) - real :: random_vals(N), local_random_vals(N) - integer, parameter :: test_reps = 100 - integer(int64) :: t0, t1 - real :: result_sort, result_select - integer(int64) :: time_sort, time_select, time_arg_select - logical :: select_test_passed, arg_select_test_passed + integer :: i, k, result_arg_select, indx(N), indx_local(N) + real :: random_vals(N), local_random_vals(N) + integer, parameter :: test_reps = 100 + integer(int64) :: t0, t1 + real :: result_sort, result_select + integer(int64) :: time_sort, time_select, time_arg_select + logical :: select_test_passed, arg_select_test_passed ! Ensure N is odd - if (mod(N, 2) /= 1) stop + if (mod(N, 2) /= 1) stop - time_sort = 0 - time_select = 0 - time_arg_select = 0 + time_sort = 0 + time_select = 0 + time_arg_select = 0 - select_test_passed = .true. - arg_select_test_passed = .true. + select_test_passed = .true. + arg_select_test_passed = .true. - indx = (/(i, i=1, N)/) + indx = (/(i, i=1, N)/) - k = (N + 1)/2 ! Deliberate integer division + k = (N + 1)/2 ! Deliberate integer division - do i = 1, test_reps - call random_number(random_vals) + do i = 1, test_reps + call random_number(random_vals) ! Compute the median with sorting - local_random_vals = random_vals - call system_clock(t0) - call sort(local_random_vals) - result_sort = local_random_vals(k) - call system_clock(t1) - time_sort = time_sort + (t1 - t0) + local_random_vals = random_vals + call system_clock(t0) + call sort(local_random_vals) + result_sort = local_random_vals(k) + call system_clock(t1) + time_sort = time_sort + (t1 - t0) ! Compute the median with selection, assuming N is odd - local_random_vals = random_vals - call system_clock(t0) - call select(local_random_vals, k, result_select) - call system_clock(t1) - time_select = time_select + (t1 - t0) + local_random_vals = random_vals + call system_clock(t0) + call select(local_random_vals, k, result_select) + call system_clock(t1) + time_select = time_select + (t1 - t0) ! Compute the median with arg_select, assuming N is odd - local_random_vals = random_vals - indx_local = indx - call system_clock(t0) - call arg_select(local_random_vals, indx_local, k, result_arg_select) - call system_clock(t1) - time_arg_select = time_arg_select + (t1 - t0) - - if (result_select /= result_sort) select_test_passed = .FALSE. - if (local_random_vals(result_arg_select) /= result_sort) arg_select_test_passed = .FALSE. - end do - - print *, "select ; N=", N, '; ', merge('PASS', 'FAIL', select_test_passed), & - '; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_select) - print *, "arg_select; N=", N, '; ', merge('PASS', 'FAIL', arg_select_test_passed), & - '; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_arg_select) - - end subroutine + local_random_vals = random_vals + indx_local = indx + call system_clock(t0) + call arg_select(local_random_vals, indx_local, k, result_arg_select) + call system_clock(t1) + time_arg_select = time_arg_select + (t1 - t0) + + if (result_select /= result_sort) select_test_passed = .FALSE. + if (local_random_vals(result_arg_select) /= result_sort) arg_select_test_passed = .FALSE. + end do + + print *, "select ; N=", N, '; ', merge('PASS', 'FAIL', select_test_passed), & + '; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_select) + print *, "arg_select; N=", N, '; ', merge('PASS', 'FAIL', arg_select_test_passed), & + '; Relative-speedup-vs-sort:', (1.0*time_sort)/(1.0*time_arg_select) + + end subroutine end program diff --git a/test/example/sorting/demo_ord_sort.f90 b/test/example/sorting/demo_ord_sort.f90 index 8d1420061..2b73a0fcb 100644 --- a/test/example/sorting/demo_ord_sort.f90 +++ b/test/example/sorting/demo_ord_sort.f90 @@ -1,10 +1,10 @@ program demo_ord_sort - use stdlib_sorting, only: ord_sort - implicit none - integer, allocatable :: array1(:), work(:) + use stdlib_sorting, only: ord_sort + implicit none + integer, allocatable :: array1(:), work(:) - array1 = [5, 4, 3, 1, 10, 4, 9] - allocate (work, mold=array1) - call ord_sort(array1, work) - print *, array1 !print [1, 3, 4, 4, 5, 9, 10] + array1 = [5, 4, 3, 1, 10, 4, 9] + allocate (work, mold=array1) + call ord_sort(array1, work) + print *, array1 !print [1, 3, 4, 4, 5, 9, 10] end program demo_ord_sort diff --git a/test/example/sorting/demo_sort.f90 b/test/example/sorting/demo_sort.f90 index ac2c32e9e..06a58923c 100644 --- a/test/example/sorting/demo_sort.f90 +++ b/test/example/sorting/demo_sort.f90 @@ -1,9 +1,9 @@ program demo_sort - use stdlib_sorting, only: sort - implicit none - integer, allocatable :: array(:) + use stdlib_sorting, only: sort + implicit none + integer, allocatable :: array(:) - array = [5, 4, 3, 1, 10, 4, 9] - call sort(array) - print *, array !print [1, 3, 4, 4, 5, 9, 10] + array = [5, 4, 3, 1, 10, 4, 9] + call sort(array) + print *, array !print [1, 3, 4, 4, 5, 9, 10] end program demo_sort diff --git a/test/example/specialfunctions_gamma/demo_gamma.f90 b/test/example/specialfunctions_gamma/demo_gamma.f90 index 4fe421176..ee6a15f8d 100644 --- a/test/example/specialfunctions_gamma/demo_gamma.f90 +++ b/test/example/specialfunctions_gamma/demo_gamma.f90 @@ -1,37 +1,37 @@ program demo_gamma - use stdlib_kinds, only: dp, int64 - use stdlib_specialfunctions_gamma, only: gamma - implicit none - - integer :: i - integer(int64) :: n - real :: x - real(dp) :: y - complex :: z - complex(dp) :: z1 - - i = 10 - n = 15_int64 - x = 2.5 - y = 4.3_dp - z = (2.3, 0.6) - z1 = (-4.2_dp, 3.1_dp) - - print *, gamma(i) !integer gives exact result + use stdlib_kinds, only: dp, int64 + use stdlib_specialfunctions_gamma, only: gamma + implicit none + + integer :: i + integer(int64) :: n + real :: x + real(dp) :: y + complex :: z + complex(dp) :: z1 + + i = 10 + n = 15_int64 + x = 2.5 + y = 4.3_dp + z = (2.3, 0.6) + z1 = (-4.2_dp, 3.1_dp) + + print *, gamma(i) !integer gives exact result ! 362880 - print *, gamma(n) + print *, gamma(n) ! 87178291200 - print *, gamma(x) ! intrinsic function call + print *, gamma(x) ! intrinsic function call ! 1.32934034 - print *, gamma(y) ! intrinsic function call + print *, gamma(y) ! intrinsic function call ! 8.8553433604540341 - print *, gamma(z) + print *, gamma(z) ! (0.988054395, 0.383354813) - print *, gamma(z1) + print *, gamma(z1) ! (-2.78916032990983999E-005, 9.83164600163221218E-006) end program demo_gamma diff --git a/test/example/specialfunctions_gamma/demo_gamma_p.f90 b/test/example/specialfunctions_gamma/demo_gamma_p.f90 index d802e6267..b20637ead 100644 --- a/test/example/specialfunctions_gamma/demo_gamma_p.f90 +++ b/test/example/specialfunctions_gamma/demo_gamma_p.f90 @@ -1,8 +1,8 @@ program demo_gamma_p - use stdlib_specialfunctions_gamma, only: rgp => regularized_gamma_p - implicit none + use stdlib_specialfunctions_gamma, only: rgp => regularized_gamma_p + implicit none - print *, rgp(3.0, 5.0) + print *, rgp(3.0, 5.0) ! 0.875347972 end program demo_gamma_p diff --git a/test/example/specialfunctions_gamma/demo_gamma_q.f90 b/test/example/specialfunctions_gamma/demo_gamma_q.f90 index 407cab723..877113baf 100644 --- a/test/example/specialfunctions_gamma/demo_gamma_q.f90 +++ b/test/example/specialfunctions_gamma/demo_gamma_q.f90 @@ -1,8 +1,8 @@ program demo_gamma_q - use stdlib_specialfunctions_gamma, only: rgq => regularized_gamma_q - implicit none + use stdlib_specialfunctions_gamma, only: rgq => regularized_gamma_q + implicit none - print *, rgq(3.0, 5.0) + print *, rgq(3.0, 5.0) ! 0.124652028 end program demo_gamma_q diff --git a/test/example/specialfunctions_gamma/demo_ligamma.f90 b/test/example/specialfunctions_gamma/demo_ligamma.f90 index 5056703b6..e1706fa8a 100644 --- a/test/example/specialfunctions_gamma/demo_ligamma.f90 +++ b/test/example/specialfunctions_gamma/demo_ligamma.f90 @@ -1,16 +1,16 @@ program demo_ligamma - use stdlib_specialfunctions_gamma, only: lig => lower_incomplete_gamma - implicit none - integer :: p - real :: p1 + use stdlib_specialfunctions_gamma, only: lig => lower_incomplete_gamma + implicit none + integer :: p + real :: p1 - p = 3 - p1 = 2.3 - print *, lig(p, -5.0) + p = 3 + p1 = 2.3 + print *, lig(p, -5.0) ! -2521.02417 - print *, lig(p1, 5.0) + print *, lig(p1, 5.0) ! 1.09715652 end program demo_ligamma diff --git a/test/example/specialfunctions_gamma/demo_log_factorial.f90 b/test/example/specialfunctions_gamma/demo_log_factorial.f90 index 0fc879857..d61664f6a 100644 --- a/test/example/specialfunctions_gamma/demo_log_factorial.f90 +++ b/test/example/specialfunctions_gamma/demo_log_factorial.f90 @@ -1,15 +1,15 @@ program demo_log_factorial - use stdlib_kinds, only: int64 - use stdlib_specialfunctions_gamma, only: lf => log_factorial - implicit none - integer :: n + use stdlib_kinds, only: int64 + use stdlib_specialfunctions_gamma, only: lf => log_factorial + implicit none + integer :: n - n = 10 - print *, lf(n) + n = 10 + print *, lf(n) ! 15.1044130 - print *, lf(35_int64) + print *, lf(35_int64) ! 92.1361771 end program demo_log_factorial diff --git a/test/example/specialfunctions_gamma/demo_log_gamma.f90 b/test/example/specialfunctions_gamma/demo_log_gamma.f90 index c096d6658..a6ea2701c 100644 --- a/test/example/specialfunctions_gamma/demo_log_gamma.f90 +++ b/test/example/specialfunctions_gamma/demo_log_gamma.f90 @@ -1,35 +1,35 @@ program demo_log_gamma - use stdlib_kinds, only: dp - use stdlib_specialfunctions_gamma, only: log_gamma - implicit none - - integer :: i - real :: x - real(dp) :: y - complex :: z - complex(dp) :: z1 - - i = 10 - x = 8.76 - y = x - z = (5.345, -3.467) - z1 = z - print *, log_gamma(i) !default single precision output + use stdlib_kinds, only: dp + use stdlib_specialfunctions_gamma, only: log_gamma + implicit none + + integer :: i + real :: x + real(dp) :: y + complex :: z + complex(dp) :: z1 + + i = 10 + x = 8.76 + y = x + z = (5.345, -3.467) + z1 = z + print *, log_gamma(i) !default single precision output !12.8018274 - print *, log_gamma(x) !intrinsic function call + print *, log_gamma(x) !intrinsic function call !10.0942659 - print *, log_gamma(y) !intrinsic function call + print *, log_gamma(y) !intrinsic function call !10.094265528673880 - print *, log_gamma(z) !same kind as input + print *, log_gamma(z) !same kind as input !(2.56165648, -5.73382425) - print *, log_gamma(z1) + print *, log_gamma(z1) !(2.5616575105114614, -5.7338247782852498) end program demo_log_gamma diff --git a/test/example/specialfunctions_gamma/demo_uigamma.f90 b/test/example/specialfunctions_gamma/demo_uigamma.f90 index eed52b231..eabbeb371 100644 --- a/test/example/specialfunctions_gamma/demo_uigamma.f90 +++ b/test/example/specialfunctions_gamma/demo_uigamma.f90 @@ -1,12 +1,12 @@ program demo_uigamma - use stdlib_specialfunctions_gamma, only: uig => upper_incomplete_gamma - implicit none + use stdlib_specialfunctions_gamma, only: uig => upper_incomplete_gamma + implicit none - print *, uig(3, -5.0) + print *, uig(3, -5.0) !2523.02295 - print *, uig(2.3, 5.0) + print *, uig(2.3, 5.0) !6.95552528E-02 end program demo_uigamma diff --git a/test/example/stats/demo_corr.f90 b/test/example/stats/demo_corr.f90 index b7fad75e0..012b837e8 100644 --- a/test/example/stats/demo_corr.f90 +++ b/test/example/stats/demo_corr.f90 @@ -1,8 +1,8 @@ program demo_corr - use stdlib_stats, only: corr - implicit none - real :: x(1:6) = [1., 2., 3., 4., 5., 6.] - real :: y(1:2, 1:3) = reshape([-1., 40., -3., 4., 10., 6.], [2, 3]) - print *, corr(x, 1) !returns 1. - print *, corr(y, 2) !returns reshape([ 1., -.32480, -.32480, 1. ], [ 2, 3]) + use stdlib_stats, only: corr + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([-1., 40., -3., 4., 10., 6.], [2, 3]) + print *, corr(x, 1) !returns 1. + print *, corr(y, 2) !returns reshape([ 1., -.32480, -.32480, 1. ], [ 2, 3]) end program demo_corr diff --git a/test/example/stats/demo_cov.f90 b/test/example/stats/demo_cov.f90 index 9f4ce609d..c9ffb8448 100644 --- a/test/example/stats/demo_cov.f90 +++ b/test/example/stats/demo_cov.f90 @@ -1,9 +1,9 @@ program demo_cov - use stdlib_stats, only: cov - implicit none - real :: x(1:6) = [1., 2., 3., 4., 5., 6.] - real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) - print *, cov(x, 1) !returns 3.5 - print *, cov(x, 1, corrected=.false.) !returns 2.9167 - print *, cov(y, 1) !returns a square matrix of size 3 with all elements equal to 0.5 + use stdlib_stats, only: cov + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, cov(x, 1) !returns 3.5 + print *, cov(x, 1, corrected=.false.) !returns 2.9167 + print *, cov(y, 1) !returns a square matrix of size 3 with all elements equal to 0.5 end program demo_cov diff --git a/test/example/stats/demo_mean.f90 b/test/example/stats/demo_mean.f90 index 5641cb4f9..e4cee4623 100644 --- a/test/example/stats/demo_mean.f90 +++ b/test/example/stats/demo_mean.f90 @@ -1,10 +1,10 @@ program demo_mean - use stdlib_stats, only: mean - implicit none - real :: x(1:6) = [1., 2., 3., 4., 5., 6.] - real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) - print *, mean(x) !returns 3.5 - print *, mean(y) !returns 3.5 - print *, mean(y, 1) !returns [ 1.5, 3.5, 5.5 ] - print *, mean(y, 1, y > 3.) !returns [ NaN, 4.0, 5.5 ] + use stdlib_stats, only: mean + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, mean(x) !returns 3.5 + print *, mean(y) !returns 3.5 + print *, mean(y, 1) !returns [ 1.5, 3.5, 5.5 ] + print *, mean(y, 1, y > 3.) !returns [ NaN, 4.0, 5.5 ] end program demo_mean diff --git a/test/example/stats/demo_median.f90 b/test/example/stats/demo_median.f90 index 1170193d2..36d0ad54f 100644 --- a/test/example/stats/demo_median.f90 +++ b/test/example/stats/demo_median.f90 @@ -1,10 +1,10 @@ program demo_median - use stdlib_stats, only: median - implicit none - real :: x(1:6) = [1., 2., 3., 4., 5., 6.] - real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) - print *, median(x) !returns 3.5 - print *, median(y) !returns 3.5 - print *, median(y, 1) !returns [ 1.5, 3.5, 5.5 ] - print *, median(y, 1, y > 3.) !returns [ NaN, 4.0, 5.5 ] + use stdlib_stats, only: median + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, median(x) !returns 3.5 + print *, median(y) !returns 3.5 + print *, median(y, 1) !returns [ 1.5, 3.5, 5.5 ] + print *, median(y, 1, y > 3.) !returns [ NaN, 4.0, 5.5 ] end program demo_median diff --git a/test/example/stats/demo_moment.f90 b/test/example/stats/demo_moment.f90 index 986612631..3444d8c98 100644 --- a/test/example/stats/demo_moment.f90 +++ b/test/example/stats/demo_moment.f90 @@ -1,12 +1,12 @@ program demo_moment - use stdlib_stats, only: moment - implicit none - real :: x(1:6) = [1., 2., 3., 4., 5., 6.] - real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) - print *, moment(x, 2) !returns 2.9167 - print *, moment(y, 2) !returns 2.9167 - print *, moment(y, 2, 1) !returns [0.25, 0.25, 0.25] - print *, moment(y, 2, 1, mask=(y > 3.)) !returns [NaN, 0., 0.25] - print *, moment(x, 2, center=0.) !returns 15.1667 - print *, moment(y, 1, 1, center=0.) !returns [1.5, 3.5, 5.5] + use stdlib_stats, only: moment + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, moment(x, 2) !returns 2.9167 + print *, moment(y, 2) !returns 2.9167 + print *, moment(y, 2, 1) !returns [0.25, 0.25, 0.25] + print *, moment(y, 2, 1, mask=(y > 3.)) !returns [NaN, 0., 0.25] + print *, moment(x, 2, center=0.) !returns 15.1667 + print *, moment(y, 1, 1, center=0.) !returns [1.5, 3.5, 5.5] end program demo_moment diff --git a/test/example/stats/demo_var.f90 b/test/example/stats/demo_var.f90 index c948d5e06..93423a4f1 100644 --- a/test/example/stats/demo_var.f90 +++ b/test/example/stats/demo_var.f90 @@ -1,12 +1,12 @@ program demo_var - use stdlib_stats, only: var - implicit none - real :: x(1:6) = [1., 2., 3., 4., 5., 6.] - real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) - print *, var(x) !returns 3.5 - print *, var(x, corrected=.false.) !returns 2.9167 - print *, var(y) !returns 3.5 - print *, var(y, 1) !returns [0.5, 0.5, 0.5] - print *, var(y, 1, y > 3.) !returns [NaN, NaN, 0.5] - print *, var(y, 1, y > 3., corrected=.false.) !returns [NaN, 0., 0.25] + use stdlib_stats, only: var + implicit none + real :: x(1:6) = [1., 2., 3., 4., 5., 6.] + real :: y(1:2, 1:3) = reshape([1., 2., 3., 4., 5., 6.], [2, 3]) + print *, var(x) !returns 3.5 + print *, var(x, corrected=.false.) !returns 2.9167 + print *, var(y) !returns 3.5 + print *, var(y, 1) !returns [0.5, 0.5, 0.5] + print *, var(y, 1, y > 3.) !returns [NaN, NaN, 0.5] + print *, var(y, 1, y > 3., corrected=.false.) !returns [NaN, 0., 0.25] end program demo_var diff --git a/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 b/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 index f69536dde..162e0a9ba 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 +++ b/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 @@ -1,28 +1,28 @@ program demo_exponential_cdf - use stdlib_random, only: random_seed - use stdlib_stats_distribution_exponential, only: exp_cdf => cdf_exp, & - rexp => rvs_exp + use stdlib_random, only: random_seed + use stdlib_stats_distribution_exponential, only: exp_cdf => cdf_exp, & + rexp => rvs_exp - implicit none - real :: x(2, 3, 4), a(2, 3, 4) - complex :: scale - integer :: seed_put, seed_get + implicit none + real :: x(2, 3, 4), a(2, 3, 4) + complex :: scale + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) - print *, exp_cdf(1.0, 1.0) ! a standard exponential cumulative at 1.0 + print *, exp_cdf(1.0, 1.0) ! a standard exponential cumulative at 1.0 ! 0.632120550 - print *, exp_cdf(2.0, 2.0) ! a cumulative at 2.0 with lambda=2 + print *, exp_cdf(2.0, 2.0) ! a cumulative at 2.0 with lambda=2 ! 0.981684387 - x = reshape(rexp(0.5, 24), [2, 3, 4]) + x = reshape(rexp(0.5, 24), [2, 3, 4]) ! standard exponential random variates array - a(:, :, :) = 0.5 - print *, exp_cdf(x, a) ! a rank 3 array of standard exponential cumulative + a(:, :, :) = 0.5 + print *, exp_cdf(x, a) ! a rank 3 array of standard exponential cumulative ! 8.57694745E-02 9.70223546E-02 1.52170658E-02 2.95336246E-02 ! 0.107568979 0.196659625 2.97447443E-02 0.366151094 0.163051903 @@ -30,8 +30,8 @@ program demo_exponential_cdf ! 0.192206264 0.330693483 0.179247737 2.92580128E-02 0.332765043 ! 0.472417951 0.500440359 8.56802464E-02 8.72612000E-03 3.55126858E-02 - scale = (0.5, 1.0) - print *, exp_cdf((0.5, 0.5), scale) + scale = (0.5, 1.0) + print *, exp_cdf((0.5, 0.5), scale) !complex exponential cumulative distribution at (0.5,0.5) with real part of !lambda=0.5 and imaginary part of lambda=1.0 diff --git a/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 b/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 index 299221b8d..88e7f9985 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 +++ b/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 @@ -1,27 +1,27 @@ program demo_exponential_pdf - use stdlib_random, only: random_seed - use stdlib_stats_distribution_exponential, only: exp_pdf => pdf_exp, & - rexp => rvs_exp + use stdlib_random, only: random_seed + use stdlib_stats_distribution_exponential, only: exp_pdf => pdf_exp, & + rexp => rvs_exp - implicit none - real :: x(2, 3, 4), a(2, 3, 4) - complex :: scale - integer :: seed_put, seed_get + implicit none + real :: x(2, 3, 4), a(2, 3, 4) + complex :: scale + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) - print *, exp_pdf(1.0, 1.0) !a probability density at 1.0 in standard expon + print *, exp_pdf(1.0, 1.0) !a probability density at 1.0 in standard expon ! 0.367879450 - print *, exp_pdf(2.0, 2.0) !a probability density at 2.0 with lambda=2.0 + print *, exp_pdf(2.0, 2.0) !a probability density at 2.0 with lambda=2.0 ! 3.66312787E-02 - x = reshape(rexp(0.5, 24), [2, 3, 4]) ! standard expon random variates array - a(:, :, :) = 0.5 - print *, exp_pdf(x, a) ! a rank 3 standard expon probability density + x = reshape(rexp(0.5, 24), [2, 3, 4]) ! standard expon random variates array + a(:, :, :) = 0.5 + print *, exp_pdf(x, a) ! a rank 3 standard expon probability density ! 0.457115263 0.451488823 0.492391467 0.485233188 0.446215510 ! 0.401670188 0.485127628 0.316924453 0.418474048 0.483173639 @@ -29,8 +29,8 @@ program demo_exponential_pdf ! 0.334653258 0.410376132 0.485370994 0.333617479 0.263791025 ! 0.249779820 0.457159877 0.495636940 0.482243657 - scale = (1.0, 2.) - print *, exp_pdf((1.5, 1.0), scale) + scale = (1.0, 2.) + print *, exp_pdf((1.5, 1.0), scale) ! a complex expon probability density function at (1.5,1.0) with real part !of lambda=1.0 and imaginary part of lambda=2.0 diff --git a/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 b/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 index e20786d5d..0167c8723 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 +++ b/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 @@ -1,29 +1,29 @@ program demo_exponential_rvs - use stdlib_random, only: random_seed - use stdlib_stats_distribution_exponential, only: rexp => rvs_exp + use stdlib_random, only: random_seed + use stdlib_stats_distribution_exponential, only: rexp => rvs_exp - implicit none - complex :: scale - integer :: seed_put, seed_get + implicit none + complex :: scale + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) - print *, rexp() !single standard exponential random variate + print *, rexp() !single standard exponential random variate ! 0.358690143 - print *, rexp(2.0) !exponential random variate with lambda=2.0 + print *, rexp(2.0) !exponential random variate with lambda=2.0 ! 0.816459715 - print *, rexp(0.3, 10) !an array of 10 variates with lambda=0.3 + print *, rexp(0.3, 10) !an array of 10 variates with lambda=0.3 ! 1.84008647E-02 3.59742008E-02 0.136567295 0.262772143 3.62352766E-02 ! 0.547133625 0.213591918 4.10784185E-02 0.583882213 0.671128035 - scale = (2.0, 0.7) - print *, rexp(scale) + scale = (2.0, 0.7) + print *, rexp(scale) !single complex exponential random variate with real part of lambda=2.0; !imagainary part of lambda=0.7 diff --git a/test/example/stats_distribution_normal/demo_norm_cdf.f90 b/test/example/stats_distribution_normal/demo_norm_cdf.f90 index ca73e2cf6..ecbcc49b7 100644 --- a/test/example/stats_distribution_normal/demo_norm_cdf.f90 +++ b/test/example/stats_distribution_normal/demo_norm_cdf.f90 @@ -1,31 +1,31 @@ program demo_norm_cdf - use stdlib_random, only: random_seed - use stdlib_stats_distribution_normal, only: norm_cdf => cdf_normal, & - norm => rvs_normal + use stdlib_random, only: random_seed + use stdlib_stats_distribution_normal, only: norm_cdf => cdf_normal, & + norm => rvs_normal - implicit none - real :: x(2, 3, 4), a(2, 3, 4), b(2, 3, 4) - complex :: loc, scale - integer :: seed_put, seed_get + implicit none + real :: x(2, 3, 4), a(2, 3, 4), b(2, 3, 4) + complex :: loc, scale + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) - print *, norm_cdf(1.0, 0.0, 1.0) ! a standard normal cumulative at 1.0 + print *, norm_cdf(1.0, 0.0, 1.0) ! a standard normal cumulative at 1.0 ! 0.841344714 - print *, norm_cdf(2.0, -1.0, 2.0) + print *, norm_cdf(2.0, -1.0, 2.0) ! a cumulative at 2.0 with mu=-1 sigma=2 ! 0.933192849 - x = reshape(norm(0.0, 1.0, 24), [2, 3, 4]) + x = reshape(norm(0.0, 1.0, 24), [2, 3, 4]) ! standard normal random variates array - a(:, :, :) = 0.0 - b(:, :, :) = 1.0 - print *, norm_cdf(x, a, b) ! standard normal cumulative array + a(:, :, :) = 0.0 + b(:, :, :) = 1.0 + print *, norm_cdf(x, a, b) ! standard normal cumulative array ! 0.713505626 0.207069695 0.486513376 0.424511284 0.587328553 ! 0.335559726 0.401470929 0.806552052 0.866687536 0.371323735 @@ -33,11 +33,11 @@ program demo_norm_cdf ! 0.206268221 0.627057910 0.580759525 0.190364420 7.27325380E-02 ! 7.08068311E-02 0.728241026 0.522919059 0.390097380 - loc = (1.0, 0.0) - scale = (0.5, 1.0) - print *, norm_cdf((0.5, -0.5), loc, scale) + loc = (1.0, 0.0) + scale = (0.5, 1.0) + print *, norm_cdf((0.5, -0.5), loc, scale) !complex normal cumulative distribution at (0.5,-0.5) with real part of - !mu=1.0, sigma=0.5 and imaginary part of mu=0.0, sigma=1.0 + !mu=1.0, sigma=0.5 and imaginary part of mu=0.0, sigma=1.0 !4.89511043E-02 diff --git a/test/example/stats_distribution_normal/demo_normal_pdf.f90 b/test/example/stats_distribution_normal/demo_normal_pdf.f90 index b5365efae..c0353e656 100644 --- a/test/example/stats_distribution_normal/demo_normal_pdf.f90 +++ b/test/example/stats_distribution_normal/demo_normal_pdf.f90 @@ -1,31 +1,31 @@ program demo_normal_pdf - use stdlib_random, only: random_seed - use stdlib_stats_distribution_normal, only: norm_pdf => pdf_normal, & - norm => rvs_normal + use stdlib_random, only: random_seed + use stdlib_stats_distribution_normal, only: norm_pdf => pdf_normal, & + norm => rvs_normal - implicit none - real :: x(3, 4, 5), a(3, 4, 5), b(3, 4, 5) - complex :: loc, scale - integer :: seed_put, seed_get + implicit none + real :: x(3, 4, 5), a(3, 4, 5), b(3, 4, 5) + complex :: loc, scale + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) - print *, norm_pdf(1.0, 0., 1.) !a probability density at 1.0 in standard normal + print *, norm_pdf(1.0, 0., 1.) !a probability density at 1.0 in standard normal ! 0.241970733 - print *, norm_pdf(2.0, -1.0, 2.0) + print *, norm_pdf(2.0, -1.0, 2.0) !a probability density at 2.0 with mu=-1.0 sigma=2.0 !6.47588000E-02 - x = reshape(norm(0.0, 1.0, 60), [3, 4, 5]) + x = reshape(norm(0.0, 1.0, 60), [3, 4, 5]) ! standard normal random variates array - a(:, :, :) = 0.0 - b(:, :, :) = 1.0 - print *, norm_pdf(x, a, b) ! standard normal probability density array + a(:, :, :) = 0.0 + b(:, :, :) = 1.0 + print *, norm_pdf(x, a, b) ! standard normal probability density array ! 0.340346158 0.285823315 0.398714304 0.391778737 0.389345556 ! 0.364551932 0.386712372 0.274370432 0.215250477 0.378006011 @@ -33,11 +33,11 @@ program demo_normal_pdf ! 0.285167664 0.378533930 0.390739858 0.271684974 0.138273031 ! 0.135456234 0.331718773 0.398283750 0.383706540 - loc = (1.0, -0.5) - scale = (1.0, 2.) - print *, norm_pdf((1.5, 1.0), loc, scale) + loc = (1.0, -0.5) + scale = (1.0, 2.) + print *, norm_pdf((1.5, 1.0), loc, scale) ! a complex normal probability density function at (1.5,1.0) with real part - ! of mu=1.0, sigma=1.0 and imaginary part of mu=-0.5, sigma=2.0 + ! of mu=1.0, sigma=1.0 and imaginary part of mu=-0.5, sigma=2.0 ! 5.30100204E-02 diff --git a/test/example/stats_distribution_normal/demo_normal_rvs.f90 b/test/example/stats_distribution_normal/demo_normal_rvs.f90 index b38161af9..49966d8ec 100644 --- a/test/example/stats_distribution_normal/demo_normal_rvs.f90 +++ b/test/example/stats_distribution_normal/demo_normal_rvs.f90 @@ -1,32 +1,32 @@ program demo_normal_rvs - use stdlib_random, only: random_seed - use stdlib_stats_distribution_normal, only: norm => rvs_normal + use stdlib_random, only: random_seed + use stdlib_stats_distribution_normal, only: norm => rvs_normal - implicit none - real :: a(2, 3, 4), b(2, 3, 4) - complex :: loc, scale - integer :: seed_put, seed_get + implicit none + real :: a(2, 3, 4), b(2, 3, 4) + complex :: loc, scale + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) - print *, norm() !single standard normal random variate + print *, norm() !single standard normal random variate ! 0.563655198 - print *, norm(1.0, 2.0) + print *, norm(1.0, 2.0) !normal random variate mu=1.0, sigma=2.0 ! -0.633261681 - print *, norm(0.0, 1.0, 10) !an array of 10 standard norml random variates + print *, norm(0.0, 1.0, 10) !an array of 10 standard norml random variates ! -3.38123664E-02 -0.190365672 0.220678389 -0.424612164 -0.249541596 ! 0.865260184 1.11086845 -0.328349441 1.10873628 1.27049923 - a(:, :, :) = 1.0 - b(:, :, :) = 1.0 - print *, norm(a, b) ! a rank 3 random variates array + a(:, :, :) = 1.0 + b(:, :, :) = 1.0 + print *, norm(a, b) ! a rank 3 random variates array !0.152776539 -7.51764774E-02 1.47208166 0.180561781 1.32407105 ! 1.20383692 0.123445868 -0.455737948 -0.469808221 1.60750175 @@ -34,11 +34,11 @@ program demo_normal_rvs ! 0.414566994 3.06084275 1.86505437 1.36338580 7.26878643E-02 ! 0.178585172 1.39557445 0.828021586 0.872084975 - loc = (-1.0, 2.0) - scale = (2.0, 1.0) - print *, norm(loc, scale) + loc = (-1.0, 2.0) + scale = (2.0, 1.0) + print *, norm(loc, scale) !single complex normal random variate with real part of mu=-1, sigma=2; - !imagainary part of mu=2.0 and sigma=1.0 + !imagainary part of mu=2.0 and sigma=1.0 ! (1.22566295,2.12518454) diff --git a/test/example/stats_distribution_uniform/demo_shuffle.f90 b/test/example/stats_distribution_uniform/demo_shuffle.f90 index 3144bf74a..fea48ff3d 100644 --- a/test/example/stats_distribution_uniform/demo_shuffle.f90 +++ b/test/example/stats_distribution_uniform/demo_shuffle.f90 @@ -1,28 +1,28 @@ program demo_shuffle - use stdlib_random, only: random_seed - use stdlib_stats_distribution_uniform, only: shuffle - implicit none - integer :: seed_put, seed_get, i - real :: x(10) - integer :: n(10) - complex :: z(10) + use stdlib_random, only: random_seed + use stdlib_stats_distribution_uniform, only: shuffle + implicit none + integer :: seed_put, seed_get, i + real :: x(10) + integer :: n(10) + complex :: z(10) - do i = 1, 10 - n(i) = i - x(i) = real(i) - z(i) = cmplx(real(i), real(i)) - end do - seed_put = 32165498 - call random_seed(seed_put, seed_get) ! set and get current value of seed - print *, shuffle(n) ! get randomized n + do i = 1, 10 + n(i) = i + x(i) = real(i) + z(i) = cmplx(real(i), real(i)) + end do + seed_put = 32165498 + call random_seed(seed_put, seed_get) ! set and get current value of seed + print *, shuffle(n) ! get randomized n !10 6 9 2 8 1 3 5 7 4 - print *, shuffle(x) ! get randomized x + print *, shuffle(x) ! get randomized x !5.0 10.0 9.0 4.0 3.0 8.0 2.0 1.0 7.0 6.0 - print *, shuffle(z) ! get randomized z + print *, shuffle(z) ! get randomized z !(8.0, 8.0) (7.0, 7.0) (4.0, 4.0) (1.0, 1.0) (5.0, 5.0) !(9.0, 9.0) (6.0, 6.0) (3.0, 3.0) (2.0, 2.0) (10.0, 10.0) diff --git a/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 b/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 index afc10326c..91dd125bf 100644 --- a/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 +++ b/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 @@ -1,32 +1,32 @@ program demo_uniform_cdf - use stdlib_random, only: random_seed - use stdlib_stats_distribution_uniform, only: uni_cdf => cdf_uniform, & - uni => rvs_uniform + use stdlib_random, only: random_seed + use stdlib_stats_distribution_uniform, only: uni_cdf => cdf_uniform, & + uni => rvs_uniform - implicit none - real :: x(3, 4, 5), a(3, 4, 5), b(3, 4, 5) - complex :: loc, scale - integer :: seed_put, seed_get + implicit none + real :: x(3, 4, 5), a(3, 4, 5), b(3, 4, 5) + complex :: loc, scale + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) - print *, uni_cdf(0.5, 0., 1.) ! a cumulative at 0.5 in [0., 1.] + print *, uni_cdf(0.5, 0., 1.) ! a cumulative at 0.5 in [0., 1.] !0.500000000 - print *, uni_cdf(0.7, -1.0, 2.0) ! a cumulative at 0.7 in [-1.0, 1.0] + print *, uni_cdf(0.7, -1.0, 2.0) ! a cumulative at 0.7 in [-1.0, 1.0] ! 0.850000024 - print *, uni_cdf(6, 2, 10) ! a cumulative at 6 in [2, 10] + print *, uni_cdf(6, 2, 10) ! a cumulative at 6 in [2, 10] ! 0.454545468 - a(:, :, :) = -1.0 - b(:, :, :) = 2.0 - x = reshape(uni(-1.0, 2.0, 60), [3, 4, 5]) ! uniform random variates array - print *, uni_cdf(x, a, b) ! cumulative array in [-1.0, 1.0] + a(:, :, :) = -1.0 + b(:, :, :) = 2.0 + x = reshape(uni(-1.0, 2.0, 60), [3, 4, 5]) ! uniform random variates array + print *, uni_cdf(x, a, b) ! cumulative array in [-1.0, 1.0] !0.161520004 0.553248405 0.986900032 0.942091405 0.114239901 0.780188501 ! 0.854656875 0.464386612 0.284466714 0.748768032 0.301834047 0.337008357 @@ -39,9 +39,9 @@ program demo_uniform_cdf !0.855926156 0.250811368 0.300751567 0.110186398 0.502883077 0.738479793 !0.764856219 0.294822574 1.90783739E-02 0.631218433 0.752170086 0.196848959 - loc = (0., 0.) - scale = (2., 1.) - print *, uni_cdf((1.2, 0.5), loc, scale) + loc = (0., 0.) + scale = (2., 1.) + print *, uni_cdf((1.2, 0.5), loc, scale) ! joint cumulative distribution at (1.2,0.5) in [(0.,0.), (2.,1.)] ! 0.300000012 diff --git a/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 b/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 index 9ea14a7a7..5fb6c5024 100644 --- a/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 +++ b/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 @@ -1,32 +1,32 @@ program demo_uniform_pdf - use stdlib_random, only: random_seed - use stdlib_stats_distribution_uniform, only: uni_pdf => pdf_uniform, & - uni => rvs_uniform + use stdlib_random, only: random_seed + use stdlib_stats_distribution_uniform, only: uni_pdf => pdf_uniform, & + uni => rvs_uniform - implicit none - complex :: loc, scale - real :: a(3, 4, 5), b(3, 4, 5), x(3, 4, 5) - integer :: seed_put, seed_get + implicit none + complex :: loc, scale + real :: a(3, 4, 5), b(3, 4, 5), x(3, 4, 5) + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) - print *, uni_pdf(3, 2, 10) !probability density at 3 in range [2, 10] + print *, uni_pdf(3, 2, 10) !probability density at 3 in range [2, 10] ! 9.09090936E-02 - print *, uni_pdf(0.5, 0.0, 1.0) !a probability density at 0.5 in [0., 1.] + print *, uni_pdf(0.5, 0.0, 1.0) !a probability density at 0.5 in [0., 1.] ! 1.00000000 - print *, uni_pdf(0.7, -1.0, 2.0) !a probability density at 0.7 in [-1., 1.] + print *, uni_pdf(0.7, -1.0, 2.0) !a probability density at 0.7 in [-1., 1.] ! 0.500000000 - a(:, :, :) = 0.0 - b(:, :, :) = 2.0 - x = reshape(uni(0., 2., 60), [3, 4, 5])! uniform random variates array in [0., 2.] - print *, uni_pdf(x, a, b) ! probability density array in [0., 2.] + a(:, :, :) = 0.0 + b(:, :, :) = 2.0 + x = reshape(uni(0., 2., 60), [3, 4, 5])! uniform random variates array in [0., 2.] + print *, uni_pdf(x, a, b) ! probability density array in [0., 2.] ! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 ! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 @@ -39,9 +39,9 @@ program demo_uniform_pdf ! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 ! 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 0.500000000 - loc = (-0.5, -0.5) - scale = (1.0, 1.0) - print *, uni_pdf((-0.1, 0.2), loc, scale) + loc = (-0.5, -0.5) + scale = (1.0, 1.0) + print *, uni_pdf((-0.1, 0.2), loc, scale) ! joint probability density at (-0.1,0.2) in [(-0.5, -0.5), (0.5, 0.5)] ! 1.00000000 diff --git a/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 b/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 index 1ddc5ab5d..d63652600 100644 --- a/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 +++ b/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 @@ -1,53 +1,53 @@ program demo_uniform_rvs - use stdlib_random, only: random_seed - use stdlib_stats_distribution_uniform, only: uni => rvs_uniform + use stdlib_random, only: random_seed + use stdlib_stats_distribution_uniform, only: uni => rvs_uniform - implicit none - complex :: loc, scale - real :: a(3, 4, 5), b(3, 4, 5) - integer :: seed_put, seed_get + implicit none + complex :: loc, scale + real :: a(3, 4, 5), b(3, 4, 5) + integer :: seed_put, seed_get - seed_put = 1234567 - call random_seed(seed_put, seed_get) + seed_put = 1234567 + call random_seed(seed_put, seed_get) - print *, uni() !real standard uniform random variate in [0., 1.] + print *, uni() !real standard uniform random variate in [0., 1.] ! 0.161520019 - print *, uni(3.0) !an uniform random variate in [0., 3.] + print *, uni(3.0) !an uniform random variate in [0., 3.] ! 1.65974522 - print *, uni(-0.5, 1.0) !an uniform random variate in [-0.5, 0.5] + print *, uni(-0.5, 1.0) !an uniform random variate in [-0.5, 0.5] ! 0.486900032 - print *, uni(-1.0, 2.0, 10) + print *, uni(-1.0, 2.0, 10) !an array of 10 uniform random variates in [-1., 1.] !0.884182811 -0.771520197 0.560377002 0.709313750 -7.12267756E-02 !-0.431066573 0.497536063 -0.396331906 -0.325983286 0.137686729 - print *, uni(20) !a random integer variate in [0, 20] + print *, uni(20) !a random integer variate in [0, 20] ! 17 - print *, uni(5, 13) !a random integer variate in [5, 18] + print *, uni(5, 13) !a random integer variate in [5, 18] ! 15 - print *, uni(3, 19, 10) !an array of 10 integer variates in [3,22] + print *, uni(3, 19, 10) !an array of 10 integer variates in [3,22] !7 16 16 12 9 21 19 4 3 19 - loc = (-0.5, -0.5) - scale = (1.0, 1.0) + loc = (-0.5, -0.5) + scale = (1.0, 1.0) - print *, uni(scale) !a complex uniform random variate in unit square + print *, uni(scale) !a complex uniform random variate in unit square !(0.139202669, 0.361759573) - print *, uni(loc, scale) + print *, uni(loc, scale) !a complex uniform random variate in [(-0.5, -0.5), (0.5, 0.5)] !(0.296536088,-0.143987954) - print *, uni(loc, scale, 10) + print *, uni(loc, scale, 10) !an array of 10 complex uniform random variate in [(-0.5, -0.5), (0.5, 0.5)] !(-0.302334785,-0.401923567) (0.281620383,9.534919262E-02) @@ -56,10 +56,10 @@ program demo_uniform_rvs ! (-7.864198089E-02,0.378484428) (-0.423258364,-0.201292425) ! (0.193327367,-0.353985727) (-0.397661150,0.355926156) - a(:, :, :) = -0.5 - b(:, :, :) = 1.0 + a(:, :, :) = -0.5 + b(:, :, :) = 1.0 - print *, uni(a, b) + print *, uni(a, b) !a rank 3 array of random variates in [-0.5,0.5] ! -0.249188632 -0.199248433 -0.389813602 2.88307667E-03 0.238479793, diff --git a/test/example/string_type/demo_adjustl.f90 b/test/example/string_type/demo_adjustl.f90 index 25d9f79e2..e8fbedb41 100644 --- a/test/example/string_type/demo_adjustl.f90 +++ b/test/example/string_type/demo_adjustl.f90 @@ -1,9 +1,9 @@ program demo_adjustl - use stdlib_string_type - implicit none - type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string - string = " Whitespace" - string = adjustl(string) + string = " Whitespace" + string = adjustl(string) ! char(string) == "Whitespace " end program demo_adjustl diff --git a/test/example/string_type/demo_adjustr.f90 b/test/example/string_type/demo_adjustr.f90 index 83e3d7eb0..0a796b395 100644 --- a/test/example/string_type/demo_adjustr.f90 +++ b/test/example/string_type/demo_adjustr.f90 @@ -1,9 +1,9 @@ program demo_adjustr - use stdlib_string_type - implicit none - type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string - string = "Whitespace " - string = adjustr(string) + string = "Whitespace " + string = adjustr(string) ! char(string) == " Whitespace" end program demo_adjustr diff --git a/test/example/string_type/demo_char.f90 b/test/example/string_type/demo_char.f90 index c4baecb6b..712d1e298 100644 --- a/test/example/string_type/demo_char.f90 +++ b/test/example/string_type/demo_char.f90 @@ -1,10 +1,10 @@ program demo_char - use stdlib_string_type - implicit none - type(string_type) :: string - character(len=:), allocatable :: dlc + use stdlib_string_type + implicit none + type(string_type) :: string + character(len=:), allocatable :: dlc - string = "Character sequence" - dlc = char(string) + string = "Character sequence" + dlc = char(string) ! dlc == "Character sequence" end program demo_char diff --git a/test/example/string_type/demo_char_position.f90 b/test/example/string_type/demo_char_position.f90 index 15b220e63..6183d47e6 100644 --- a/test/example/string_type/demo_char_position.f90 +++ b/test/example/string_type/demo_char_position.f90 @@ -1,13 +1,13 @@ program demo_char_position - use stdlib_string_type - implicit none - type(string_type) :: string - character(len=:), allocatable :: dlc - character(len=1), allocatable :: chars(:) + use stdlib_string_type + implicit none + type(string_type) :: string + character(len=:), allocatable :: dlc + character(len=1), allocatable :: chars(:) - string = "Character sequence" - dlc = char(string, 3) + string = "Character sequence" + dlc = char(string, 3) ! dlc == "a" - chars = char(string, [3, 5, 8, 12, 14, 15, 18]) + chars = char(string, [3, 5, 8, 12, 14, 15, 18]) ! chars == ["a", "a", "e", "e", "u", "e", "e"] end program demo_char_position diff --git a/test/example/string_type/demo_char_range.f90 b/test/example/string_type/demo_char_range.f90 index 42eccc2e9..8c2c60658 100644 --- a/test/example/string_type/demo_char_range.f90 +++ b/test/example/string_type/demo_char_range.f90 @@ -1,10 +1,10 @@ program demo_char_range - use stdlib_string_type - implicit none - type(string_type) :: string - character(len=:), allocatable :: dlc + use stdlib_string_type + implicit none + type(string_type) :: string + character(len=:), allocatable :: dlc - string = "Fortran" - dlc = char(string, 1, 4) + string = "Fortran" + dlc = char(string, 1, 4) ! dlc == "Fort" end program demo_char_range diff --git a/test/example/string_type/demo_constructor_character.f90 b/test/example/string_type/demo_constructor_character.f90 index a0658030d..ebe544547 100644 --- a/test/example/string_type/demo_constructor_character.f90 +++ b/test/example/string_type/demo_constructor_character.f90 @@ -1,8 +1,8 @@ program demo_constructor_character - use stdlib_string_type - implicit none - type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string ! len(string) == 0 - string = "Sequence" + string = "Sequence" ! len(string) == 8 end program demo_constructor_character diff --git a/test/example/string_type/demo_constructor_empty.f90 b/test/example/string_type/demo_constructor_empty.f90 index 6d02af3fa..8dd80badc 100644 --- a/test/example/string_type/demo_constructor_empty.f90 +++ b/test/example/string_type/demo_constructor_empty.f90 @@ -1,7 +1,7 @@ program demo_constructor_empty - use stdlib_string_type - implicit none - type(string_type) :: string - string = string_type() + use stdlib_string_type + implicit none + type(string_type) :: string + string = string_type() ! len(string) == 0 end program demo_constructor_empty diff --git a/test/example/string_type/demo_constructor_integer.f90 b/test/example/string_type/demo_constructor_integer.f90 index 643d4a0f5..a2b33453e 100644 --- a/test/example/string_type/demo_constructor_integer.f90 +++ b/test/example/string_type/demo_constructor_integer.f90 @@ -1,9 +1,9 @@ program demo_constructor_integer - use stdlib_string_type - implicit none - type(string_type) :: string - string = string_type(42) + use stdlib_string_type + implicit none + type(string_type) :: string + string = string_type(42) ! len(string) == 2 - string = string_type(-289) + string = string_type(-289) ! len(string) == 4 end program demo_constructor_integer diff --git a/test/example/string_type/demo_constructor_logical.f90 b/test/example/string_type/demo_constructor_logical.f90 index c66a22da1..1c247c1a2 100644 --- a/test/example/string_type/demo_constructor_logical.f90 +++ b/test/example/string_type/demo_constructor_logical.f90 @@ -1,9 +1,9 @@ program demo_constructor_logical - use stdlib_string_type - implicit none - type(string_type) :: string - string = string_type(.true.) + use stdlib_string_type + implicit none + type(string_type) :: string + string = string_type(.true.) ! len(string) == 1 - string = string_type(.false.) + string = string_type(.false.) ! len(string) == 1 end program demo_constructor_logical diff --git a/test/example/string_type/demo_constructor_scalar.f90 b/test/example/string_type/demo_constructor_scalar.f90 index 03a3028ac..bfad75ff4 100644 --- a/test/example/string_type/demo_constructor_scalar.f90 +++ b/test/example/string_type/demo_constructor_scalar.f90 @@ -1,9 +1,9 @@ program demo_constructor_scalar - use stdlib_string_type - implicit none - type(string_type) :: string - string = string_type("Sequence") + use stdlib_string_type + implicit none + type(string_type) :: string + string = string_type("Sequence") ! len(string) == 8 - string = string_type(" S p a c e d ") + string = string_type(" S p a c e d ") ! len(string) == 13 end program demo_constructor_scalar diff --git a/test/example/string_type/demo_cont.f90 b/test/example/string_type/demo_cont.f90 index 70e142771..36e426a43 100644 --- a/test/example/string_type/demo_cont.f90 +++ b/test/example/string_type/demo_cont.f90 @@ -1,9 +1,9 @@ program demo_cont - use stdlib_string_type - implicit none - type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string - string = "Hello, " - string = string//"World!" + string = "Hello, " + string = string//"World!" ! len(string) == 13 end program demo_cont diff --git a/test/example/string_type/demo_eq.f90 b/test/example/string_type/demo_eq.f90 index 25ac4cb16..2e1516cf0 100644 --- a/test/example/string_type/demo_eq.f90 +++ b/test/example/string_type/demo_eq.f90 @@ -1,16 +1,16 @@ program demo_eq - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = string == "abc" + string = "bcd" + res = string == "abc" ! res .eqv. .false. - res = string == "bcd" + res = string == "bcd" ! res .eqv. .true. - res = string == "cde" + res = string == "cde" ! res .eqv. .false. end program demo_eq diff --git a/test/example/string_type/demo_fread.f90 b/test/example/string_type/demo_fread.f90 index 431ab1fac..faa3482ee 100644 --- a/test/example/string_type/demo_fread.f90 +++ b/test/example/string_type/demo_fread.f90 @@ -1,16 +1,16 @@ program demo_fread - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: io - string = "Important saved value" + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: io + string = "Important saved value" - open (newunit=io, form="formatted", status="scratch") - write (io, *) string - write (io, *) + open (newunit=io, form="formatted", status="scratch") + write (io, *) string + write (io, *) - rewind (io) + rewind (io) - read (io, *) string - close (io) + read (io, *) string + close (io) end program demo_fread diff --git a/test/example/string_type/demo_fwrite.f90 b/test/example/string_type/demo_fwrite.f90 index fa03ab889..b7c3bf3a7 100644 --- a/test/example/string_type/demo_fwrite.f90 +++ b/test/example/string_type/demo_fwrite.f90 @@ -1,16 +1,16 @@ program demo_fwrite - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: io - string = "Important saved value" + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: io + string = "Important saved value" - open (newunit=io, form="formatted", status="scratch") - write (io, *) string - write (io, *) + open (newunit=io, form="formatted", status="scratch") + write (io, *) string + write (io, *) - rewind (io) + rewind (io) - read (io, *) string - close (io) + read (io, *) string + close (io) end program demo_fwrite diff --git a/test/example/string_type/demo_ge.f90 b/test/example/string_type/demo_ge.f90 index e28339961..2413b5bbf 100644 --- a/test/example/string_type/demo_ge.f90 +++ b/test/example/string_type/demo_ge.f90 @@ -1,16 +1,16 @@ program demo_ge - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = string >= "abc" + string = "bcd" + res = string >= "abc" ! res .eqv. .true. - res = string >= "bcd" + res = string >= "bcd" ! res .eqv. .true. - res = string >= "cde" + res = string >= "cde" ! res .eqv. .false. end program demo_ge diff --git a/test/example/string_type/demo_gt.f90 b/test/example/string_type/demo_gt.f90 index ff608063a..6b9882526 100644 --- a/test/example/string_type/demo_gt.f90 +++ b/test/example/string_type/demo_gt.f90 @@ -1,16 +1,16 @@ program demo_gt - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = string > "abc" + string = "bcd" + res = string > "abc" ! res .eqv. .true. - res = string > "bcd" + res = string > "bcd" ! res .eqv. .false. - res = string > "cde" + res = string > "cde" ! res .eqv. .false. end program demo_gt diff --git a/test/example/string_type/demo_iachar.f90 b/test/example/string_type/demo_iachar.f90 index 2c3deca60..1a34d88f6 100644 --- a/test/example/string_type/demo_iachar.f90 +++ b/test/example/string_type/demo_iachar.f90 @@ -1,9 +1,9 @@ program demo_iachar - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: code + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: code - string = "Fortran" - code = iachar(string) + string = "Fortran" + code = iachar(string) end program demo_iachar diff --git a/test/example/string_type/demo_ichar.f90 b/test/example/string_type/demo_ichar.f90 index dd0aaaaf5..3ecff2c8a 100644 --- a/test/example/string_type/demo_ichar.f90 +++ b/test/example/string_type/demo_ichar.f90 @@ -1,9 +1,9 @@ program demo_ichar - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: code + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: code - string = "Fortran" - code = ichar(string) + string = "Fortran" + code = ichar(string) end program demo_ichar diff --git a/test/example/string_type/demo_index.f90 b/test/example/string_type/demo_index.f90 index c14740dc8..f3488ee96 100644 --- a/test/example/string_type/demo_index.f90 +++ b/test/example/string_type/demo_index.f90 @@ -1,16 +1,16 @@ program demo_index - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: pos + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: pos - string = "Search this string for this expression" - pos = index(string, "this") + string = "Search this string for this expression" + pos = index(string, "this") ! pos == 8 - pos = index(string, "this", back=.true.) + pos = index(string, "this", back=.true.) ! pos == 24 - pos = index(string, "This") + pos = index(string, "This") ! pos == 0 end program demo_index diff --git a/test/example/string_type/demo_le.f90 b/test/example/string_type/demo_le.f90 index dba1475e6..a471a52e7 100644 --- a/test/example/string_type/demo_le.f90 +++ b/test/example/string_type/demo_le.f90 @@ -1,16 +1,16 @@ program demo_le - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = string <= "abc" + string = "bcd" + res = string <= "abc" ! res .eqv. .false. - res = string <= "bcd" + res = string <= "bcd" ! res .eqv. .true. - res = string <= "cde" + res = string <= "cde" ! res .eqv. .true. end program demo_le diff --git a/test/example/string_type/demo_len.f90 b/test/example/string_type/demo_len.f90 index f81cc2a85..2e7dee2cb 100644 --- a/test/example/string_type/demo_len.f90 +++ b/test/example/string_type/demo_len.f90 @@ -1,14 +1,14 @@ program demo_len - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: length + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: length - string = "Some longer sentence for this example." - length = len(string) + string = "Some longer sentence for this example." + length = len(string) ! length == 38 - string = "Whitespace " - length = len(string) + string = "Whitespace " + length = len(string) ! length == 38 end program demo_len diff --git a/test/example/string_type/demo_len_trim.f90 b/test/example/string_type/demo_len_trim.f90 index 3aa6ea788..a8343caaf 100644 --- a/test/example/string_type/demo_len_trim.f90 +++ b/test/example/string_type/demo_len_trim.f90 @@ -1,14 +1,14 @@ program demo_len_trim - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: length + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: length - string = "Some longer sentence for this example." - length = len_trim(string) + string = "Some longer sentence for this example." + length = len_trim(string) ! length == 38 - string = "Whitespace " - length = len_trim(string) + string = "Whitespace " + length = len_trim(string) ! length == 10 end program demo_len_trim diff --git a/test/example/string_type/demo_lge.f90 b/test/example/string_type/demo_lge.f90 index ea7041e52..243f6a4c7 100644 --- a/test/example/string_type/demo_lge.f90 +++ b/test/example/string_type/demo_lge.f90 @@ -1,16 +1,16 @@ program demo_lge - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = lge(string, "abc") + string = "bcd" + res = lge(string, "abc") ! res .eqv. .true. - res = lge(string, "bcd") + res = lge(string, "bcd") ! res .eqv. .true. - res = lge(string, "cde") + res = lge(string, "cde") ! res .eqv. .false. end program demo_lge diff --git a/test/example/string_type/demo_lgt.f90 b/test/example/string_type/demo_lgt.f90 index 63a80f946..7ef842baf 100644 --- a/test/example/string_type/demo_lgt.f90 +++ b/test/example/string_type/demo_lgt.f90 @@ -1,16 +1,16 @@ program demo_lgt - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = lgt(string, "abc") + string = "bcd" + res = lgt(string, "abc") ! res .eqv. .true. - res = lgt(string, "bcd") + res = lgt(string, "bcd") ! res .eqv. .false. - res = lgt(string, "cde") + res = lgt(string, "cde") ! res .eqv. .false. end program demo_lgt diff --git a/test/example/string_type/demo_lle.f90 b/test/example/string_type/demo_lle.f90 index 70c5321e7..85ff5f48c 100644 --- a/test/example/string_type/demo_lle.f90 +++ b/test/example/string_type/demo_lle.f90 @@ -1,16 +1,16 @@ program demo_lle - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = lle(string, "abc") + string = "bcd" + res = lle(string, "abc") ! res .eqv. .false. - res = lle(string, "bcd") + res = lle(string, "bcd") ! res .eqv. .true. - res = lle(string, "cde") + res = lle(string, "cde") ! res .eqv. .true. end program demo_lle diff --git a/test/example/string_type/demo_llt.f90 b/test/example/string_type/demo_llt.f90 index ba4838690..8f5b1856e 100644 --- a/test/example/string_type/demo_llt.f90 +++ b/test/example/string_type/demo_llt.f90 @@ -1,16 +1,16 @@ program demo_llt - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = llt(string, "abc") + string = "bcd" + res = llt(string, "abc") ! res .eqv. .false. - res = llt(string, "bcd") + res = llt(string, "bcd") ! res .eqv. .false. - res = llt(string, "cde") + res = llt(string, "cde") ! res .eqv. .true. end program demo_llt diff --git a/test/example/string_type/demo_lt.f90 b/test/example/string_type/demo_lt.f90 index 3cd87d145..ba277dd59 100644 --- a/test/example/string_type/demo_lt.f90 +++ b/test/example/string_type/demo_lt.f90 @@ -1,16 +1,16 @@ program demo_lt - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = string < "abc" + string = "bcd" + res = string < "abc" ! res .eqv. .false. - res = string < "bcd" + res = string < "bcd" ! res .eqv. .false. - res = string < "cde" + res = string < "cde" ! res .eqv. .true. end program demo_lt diff --git a/test/example/string_type/demo_move.f90 b/test/example/string_type/demo_move.f90 index 7d07bc1a0..e357a4d1f 100644 --- a/test/example/string_type/demo_move.f90 +++ b/test/example/string_type/demo_move.f90 @@ -1,20 +1,20 @@ program demo_move - use stdlib_string_type, only: string_type, assignment(=), move - implicit none - type(string_type) :: from_string - character(len=:), allocatable :: from_char, to_char + use stdlib_string_type, only: string_type, assignment(=), move + implicit none + type(string_type) :: from_string + character(len=:), allocatable :: from_char, to_char - from_string = "move this string" - from_char = "move this char" + from_string = "move this string" + from_char = "move this char" ! from_string <-- "move this string" ! from_char <-- "move this char" ! to_char <-- (unallocated) - call move(from_string, to_char) + call move(from_string, to_char) ! from_string <-- "" ! to_char <-- "move this string" - call move(from_char, to_char) + call move(from_char, to_char) ! from_char <-- (unallocated) ! to_string <-- "move this char" diff --git a/test/example/string_type/demo_ne.f90 b/test/example/string_type/demo_ne.f90 index 2964239f1..8c9173156 100644 --- a/test/example/string_type/demo_ne.f90 +++ b/test/example/string_type/demo_ne.f90 @@ -1,16 +1,16 @@ program demo_ne - use stdlib_string_type - implicit none - type(string_type) :: string - logical :: res + use stdlib_string_type + implicit none + type(string_type) :: string + logical :: res - string = "bcd" - res = string /= "abc" + string = "bcd" + res = string /= "abc" ! res .eqv. .true. - res = string /= "bcd" + res = string /= "bcd" ! res .eqv. .false. - res = string /= "cde" + res = string /= "cde" ! res .eqv. .true. end program demo_ne diff --git a/test/example/string_type/demo_repeat.f90 b/test/example/string_type/demo_repeat.f90 index de81cfbbb..46d207340 100644 --- a/test/example/string_type/demo_repeat.f90 +++ b/test/example/string_type/demo_repeat.f90 @@ -1,9 +1,9 @@ program demo_repeat - use stdlib_string_type - implicit none - type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string - string = "What? " - string = repeat(string, 3) + string = "What? " + string = repeat(string, 3) ! string == "What? What? What? " end program demo_repeat diff --git a/test/example/string_type/demo_reverse.f90 b/test/example/string_type/demo_reverse.f90 index c0a9a5529..f794d2b02 100644 --- a/test/example/string_type/demo_reverse.f90 +++ b/test/example/string_type/demo_reverse.f90 @@ -1,12 +1,12 @@ program demo_reverse - use stdlib_string_type - implicit none - type(string_type) :: string, reverse_string + use stdlib_string_type + implicit none + type(string_type) :: string, reverse_string - string = "Reverse This String" + string = "Reverse This String" ! string <-- "Reverse This String" - reverse_string = reverse(string) + reverse_string = reverse(string) ! string <-- "Reverse This String" ! reverse_string <-- "gnirtS sihT esreveR" end program demo_reverse diff --git a/test/example/string_type/demo_scan.f90 b/test/example/string_type/demo_scan.f90 index 5a0c5adbe..36f274a1d 100644 --- a/test/example/string_type/demo_scan.f90 +++ b/test/example/string_type/demo_scan.f90 @@ -1,16 +1,16 @@ program demo_scan - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: pos + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: pos - string = "fortran" - pos = scan(string, "ao") + string = "fortran" + pos = scan(string, "ao") ! pos == 2 - pos = scan(string, "ao", .true.) + pos = scan(string, "ao", .true.) ! pos == 6 - pos = scan(string, "c++") + pos = scan(string, "c++") ! pos == 0 end program demo_scan diff --git a/test/example/string_type/demo_to_lower.f90 b/test/example/string_type/demo_to_lower.f90 index b9aaa794c..f3e3f0a75 100644 --- a/test/example/string_type/demo_to_lower.f90 +++ b/test/example/string_type/demo_to_lower.f90 @@ -1,12 +1,12 @@ program demo_to_lower - use stdlib_string_type - implicit none - type(string_type) :: string, lowercase_string + use stdlib_string_type + implicit none + type(string_type) :: string, lowercase_string - string = "Lowercase This String" + string = "Lowercase This String" ! string <-- "Lowercase This String" - lowercase_string = to_lower(string) + lowercase_string = to_lower(string) ! string <-- "Lowercase This String" ! lowercase_string <-- "lowercase this string" end program demo_to_lower diff --git a/test/example/string_type/demo_to_sentence.f90 b/test/example/string_type/demo_to_sentence.f90 index bdb1633b0..37ddd2c54 100644 --- a/test/example/string_type/demo_to_sentence.f90 +++ b/test/example/string_type/demo_to_sentence.f90 @@ -1,12 +1,12 @@ program demo_to_sentence - use stdlib_string_type - implicit none - type(string_type) :: string, sentencecase_string + use stdlib_string_type + implicit none + type(string_type) :: string, sentencecase_string - string = "sentencecase this string." + string = "sentencecase this string." ! string <-- "sentencecase this string." - sentencecase_string = to_sentence(string) + sentencecase_string = to_sentence(string) ! string <-- "sentencecase this string." ! sentencecase_string <-- "Sentencecase this string." end program demo_to_sentence diff --git a/test/example/string_type/demo_to_title.f90 b/test/example/string_type/demo_to_title.f90 index 5a4064537..2d4787ac3 100644 --- a/test/example/string_type/demo_to_title.f90 +++ b/test/example/string_type/demo_to_title.f90 @@ -1,12 +1,12 @@ program demo_to_title - use stdlib_string_type - implicit none - type(string_type) :: string, titlecase_string + use stdlib_string_type + implicit none + type(string_type) :: string, titlecase_string - string = "titlecase this string." + string = "titlecase this string." ! string <-- "titlecase this string." - titlecase_string = to_title(string) + titlecase_string = to_title(string) ! string <-- "titlecase this string." ! titlecase_string <-- "Titlecase This String." end program demo_to_title diff --git a/test/example/string_type/demo_to_upper.f90 b/test/example/string_type/demo_to_upper.f90 index f31b1ca88..7d287ecd2 100644 --- a/test/example/string_type/demo_to_upper.f90 +++ b/test/example/string_type/demo_to_upper.f90 @@ -1,12 +1,12 @@ program demo_to_upper - use stdlib_string_type - implicit none - type(string_type) :: string, uppercase_string + use stdlib_string_type + implicit none + type(string_type) :: string, uppercase_string - string = "Uppercase This String" + string = "Uppercase This String" ! string <-- "Uppercase This String" - uppercase_string = to_upper(string) + uppercase_string = to_upper(string) ! string <-- "Uppercase This String" ! uppercase_string <-- "UPPERCASE THIS STRING" end program demo_to_upper diff --git a/test/example/string_type/demo_trim.f90 b/test/example/string_type/demo_trim.f90 index d56c07a04..36507e4d5 100644 --- a/test/example/string_type/demo_trim.f90 +++ b/test/example/string_type/demo_trim.f90 @@ -1,9 +1,9 @@ program demo_trim - use stdlib_string_type - implicit none - type(string_type) :: string + use stdlib_string_type + implicit none + type(string_type) :: string - string = "Whitespace " - string = trim(string) + string = "Whitespace " + string = trim(string) ! len(string) == 10 end program demo_trim diff --git a/test/example/string_type/demo_uread.f90 b/test/example/string_type/demo_uread.f90 index 1a6dd4eae..17cd06322 100644 --- a/test/example/string_type/demo_uread.f90 +++ b/test/example/string_type/demo_uread.f90 @@ -1,15 +1,15 @@ program demo_uread - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: io - string = "Important saved value" + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: io + string = "Important saved value" - open (newunit=io, form="unformatted", status="scratch") - write (io) string + open (newunit=io, form="unformatted", status="scratch") + write (io) string - rewind (io) + rewind (io) - read (io) string - close (io) + read (io) string + close (io) end program demo_uread diff --git a/test/example/string_type/demo_uwrite.f90 b/test/example/string_type/demo_uwrite.f90 index 77edb2eaa..1304f487b 100644 --- a/test/example/string_type/demo_uwrite.f90 +++ b/test/example/string_type/demo_uwrite.f90 @@ -1,15 +1,15 @@ program demo_uwrite - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: io - string = "Important saved value" + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: io + string = "Important saved value" - open (newunit=io, form="unformatted", status="scratch") - write (io) string + open (newunit=io, form="unformatted", status="scratch") + write (io) string - rewind (io) + rewind (io) - read (io) string - close (io) + read (io) string + close (io) end program demo_uwrite diff --git a/test/example/string_type/demo_verify.f90 b/test/example/string_type/demo_verify.f90 index 22ff054d5..2aa208588 100644 --- a/test/example/string_type/demo_verify.f90 +++ b/test/example/string_type/demo_verify.f90 @@ -1,22 +1,22 @@ program demo_verify - use stdlib_string_type - implicit none - type(string_type) :: string - integer :: pos + use stdlib_string_type + implicit none + type(string_type) :: string + integer :: pos - string = "fortran" - pos = verify(string, "ao") + string = "fortran" + pos = verify(string, "ao") ! pos == 1 - pos = verify(string, "fo") + pos = verify(string, "fo") ! pos == 3 - pos = verify(string, "c++") + pos = verify(string, "c++") ! pos == 1 - pos = verify(string, "c++", back=.true.) + pos = verify(string, "c++", back=.true.) ! pos == 7 - pos = verify(string, string) + pos = verify(string, string) ! pos == 0 end program demo_verify diff --git a/test/example/stringlist_type/demo_stringlist_type_clear.f90 b/test/example/stringlist_type/demo_stringlist_type_clear.f90 index 564ddef15..17c411a74 100644 --- a/test/example/stringlist_type/demo_stringlist_type_clear.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_clear.f90 @@ -1,19 +1,19 @@ program demo_clear - use stdlib_stringlist_type, only: stringlist_type, fidx - implicit none + use stdlib_stringlist_type, only: stringlist_type, fidx + implicit none - type(stringlist_type) :: stringlist + type(stringlist_type) :: stringlist !> inserting 2 elements to the stringlist - call stringlist%insert_at(fidx(1), "Element No. one") - call stringlist%insert_at(fidx(1), "Element No. two") + call stringlist%insert_at(fidx(1), "Element No. one") + call stringlist%insert_at(fidx(1), "Element No. two") ! stringlist <-- {"Element No. two", "Element No. one"} - call stringlist%clear() + call stringlist%clear() ! stringlist <-- { } (empty stringlist) !> inserting 1 element to the stringlist - call stringlist%insert_at(fidx(1), "Element No. one") + call stringlist%insert_at(fidx(1), "Element No. one") ! stringlist <-- {"Element No. one"} end program demo_clear diff --git a/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 b/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 index 1ef558b21..a85ad4436 100644 --- a/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 @@ -1,27 +1,27 @@ program demo_concatenate_operator - use stdlib_stringlist_type, only: stringlist_type, operator(//) - use stdlib_string_type, only: string_type - implicit none + use stdlib_stringlist_type, only: stringlist_type, operator(//) + use stdlib_string_type, only: string_type + implicit none - type(stringlist_type) :: first_stringlist, second_stringlist - type(string_type), allocatable :: stringarray(:) + type(stringlist_type) :: first_stringlist, second_stringlist + type(string_type), allocatable :: stringarray(:) - first_stringlist = first_stringlist//"Element No. one" + first_stringlist = first_stringlist//"Element No. one" ! first_stringlist <-- {"Element No. one"} - second_stringlist = string_type("Element No. two")//first_stringlist + second_stringlist = string_type("Element No. two")//first_stringlist ! second_stringlist <-- {Element No. two, "Element No. one"} !> Creating an array of 2 string_type elements - stringarray = [string_type("Element No. three"), string_type("Element No. four")] + stringarray = [string_type("Element No. three"), string_type("Element No. four")] - second_stringlist = first_stringlist//stringarray + second_stringlist = first_stringlist//stringarray ! second_stringlist <-- {"Element No. one", "Element No. three", "Element No. four"} - second_stringlist = ["#1", "#2"]//second_stringlist + second_stringlist = ["#1", "#2"]//second_stringlist ! second_stringlist <-- {"#1", "#2", "Element No. one", "Element No. three", "Element No. four"} - first_stringlist = first_stringlist//second_stringlist + first_stringlist = first_stringlist//second_stringlist ! first_stringlist <-- {"Element No. one", "#1", "#2", "Element No. one", "Element No. three", "Element No. four"} end program demo_concatenate_operator diff --git a/test/example/stringlist_type/demo_stringlist_type_constructor.f90 b/test/example/stringlist_type/demo_stringlist_type_constructor.f90 index bc6bb67a7..40c93ea58 100644 --- a/test/example/stringlist_type/demo_stringlist_type_constructor.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_constructor.f90 @@ -1,17 +1,17 @@ program demo_constructor - use stdlib_stringlist_type, only: stringlist_type - use stdlib_string_type, only: string_type - implicit none + use stdlib_stringlist_type, only: stringlist_type + use stdlib_string_type, only: string_type + implicit none - type(stringlist_type) :: stringlist + type(stringlist_type) :: stringlist - stringlist = stringlist_type() + stringlist = stringlist_type() ! stringlist <-- { } (empty stringlist) - stringlist = stringlist_type(["#1", "#2", "#3"]) + stringlist = stringlist_type(["#1", "#2", "#3"]) ! stringlist <-- {"#1", "#2", "#3"} - stringlist = stringlist_type([string_type("#1"), string_type("#2")]) + stringlist = stringlist_type([string_type("#1"), string_type("#2")]) ! stringlist <-- {"#1", "#2"} end program demo_constructor diff --git a/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 b/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 index 4b3bcccc4..10118be30 100644 --- a/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 @@ -1,29 +1,29 @@ program demo_equality_operator - use stdlib_stringlist_type, only: stringlist_type, fidx, list_head, operator(==) - use stdlib_string_type, only: string_type - implicit none + use stdlib_stringlist_type, only: stringlist_type, fidx, list_head, operator(==) + use stdlib_string_type, only: string_type + implicit none - type(stringlist_type) :: stringlist - type(string_type), allocatable :: stringarray(:) - logical :: res + type(stringlist_type) :: stringlist + type(string_type), allocatable :: stringarray(:) + logical :: res !> inserting 4 elements to the stringlist - call stringlist%insert_at(fidx(1), "#1") - call stringlist%insert_at(list_head, "#2") - call stringlist%insert_at(fidx(1), "#3") - call stringlist%insert_at(list_head, "#4") + call stringlist%insert_at(fidx(1), "#1") + call stringlist%insert_at(list_head, "#2") + call stringlist%insert_at(fidx(1), "#3") + call stringlist%insert_at(list_head, "#4") ! stringlist <-- {"#4", "#3", "#2", "#1"} !> creating an array of 4 string_type elements - stringarray = [string_type("#4"), string_type("#3"), string_type("#2"), string_type("#1")] + stringarray = [string_type("#4"), string_type("#3"), string_type("#2"), string_type("#1")] - res = (stringarray == stringlist) + res = (stringarray == stringlist) ! res <-- .true. - res = (stringlist == ["#4", "#3", "#2", "#1"]) + res = (stringlist == ["#4", "#3", "#2", "#1"]) ! res <-- .true. - print'(a)', stringlist == ["#4", "#3", "#1"] + print'(a)', stringlist == ["#4", "#3", "#1"] ! .false. end program demo_equality_operator diff --git a/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 b/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 index 1ae0411c2..952f06639 100644 --- a/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 @@ -1,13 +1,13 @@ program demo_fidx_bidx - use stdlib_stringlist_type, only: stringlist_index_type, fidx, bidx - implicit none + use stdlib_stringlist_type, only: stringlist_index_type, fidx, bidx + implicit none - type(stringlist_index_type) :: index + type(stringlist_index_type) :: index - index = fidx(1) + index = fidx(1) ! forward index 1 - index = bidx(3) + index = bidx(3) ! backward index 3 end program demo_fidx_bidx diff --git a/test/example/stringlist_type/demo_stringlist_type_get.f90 b/test/example/stringlist_type/demo_stringlist_type_get.f90 index adf89a22e..08325952d 100644 --- a/test/example/stringlist_type/demo_stringlist_type_get.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_get.f90 @@ -1,28 +1,28 @@ program demo_get - use stdlib_stringlist_type, only: stringlist_type, fidx, bidx - use stdlib_string_type, only: string_type - implicit none + use stdlib_stringlist_type, only: stringlist_type, fidx, bidx + use stdlib_string_type, only: string_type + implicit none - type(stringlist_type) :: stringlist - type(string_type) :: output + type(stringlist_type) :: stringlist + type(string_type) :: output !> inserting 4 elements to the stringlist - call stringlist%insert_at(fidx(1), "Element No. one") - call stringlist%insert_at(fidx(1), "Element No. two") - call stringlist%insert_at(fidx(1), "Element No. three") - call stringlist%insert_at(fidx(1), "Element No. four") + call stringlist%insert_at(fidx(1), "Element No. one") + call stringlist%insert_at(fidx(1), "Element No. two") + call stringlist%insert_at(fidx(1), "Element No. three") + call stringlist%insert_at(fidx(1), "Element No. four") ! stringlist <-- {"Element No. four", "Element No. three", "Element No. two", "Element No. one"} - output = stringlist%get(fidx(1)) + output = stringlist%get(fidx(1)) ! output <-- "Element No. four" - output = stringlist%get(bidx(1)) + output = stringlist%get(bidx(1)) ! output <-- "Element No. one" !> accessing out of bounds index - output = stringlist%get(bidx(5)) + output = stringlist%get(bidx(5)) ! output <-- "" - output = stringlist%get(fidx(0)) + output = stringlist%get(fidx(0)) ! output <-- "" end program demo_get diff --git a/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 b/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 index edd139e55..d3ac5ffe0 100644 --- a/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 @@ -1,29 +1,29 @@ program demo_inequality_operator - use stdlib_stringlist_type, only: stringlist_type, bidx, list_tail, operator(/=) - use stdlib_string_type, only: string_type - implicit none + use stdlib_stringlist_type, only: stringlist_type, bidx, list_tail, operator(/=) + use stdlib_string_type, only: string_type + implicit none - type(stringlist_type) :: stringlist - type(string_type), allocatable :: stringarray(:) - logical :: res + type(stringlist_type) :: stringlist + type(string_type), allocatable :: stringarray(:) + logical :: res !> inserting 4 elements to the stringlist - call stringlist%insert_at(bidx(1), "#1") - call stringlist%insert_at(list_tail, "#2") - call stringlist%insert_at(bidx(1), "#3") - call stringlist%insert_at(list_tail, "#4") + call stringlist%insert_at(bidx(1), "#1") + call stringlist%insert_at(list_tail, "#2") + call stringlist%insert_at(bidx(1), "#3") + call stringlist%insert_at(list_tail, "#4") ! stringlist <-- {"#1", "#2", "#3", "#4"} !> creating an array of 4 string_type elements - stringarray = [string_type("#1"), string_type("#2"), string_type("#3"), string_type("#4")] + stringarray = [string_type("#1"), string_type("#2"), string_type("#3"), string_type("#4")] - res = (stringarray /= stringlist) + res = (stringarray /= stringlist) ! res <-- .false. - res = (stringlist /= ["#111", "#222", "#333", "#444"]) + res = (stringlist /= ["#111", "#222", "#333", "#444"]) ! res <-- .true. - print'(a)', stringlist /= ["#4", "#3", "#1"] + print'(a)', stringlist /= ["#4", "#3", "#1"] ! .true. end program demo_inequality_operator diff --git a/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 b/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 index ee3598c24..ebb019247 100644 --- a/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 @@ -1,23 +1,23 @@ program demo_insert_at - use stdlib_stringlist_type, only: stringlist_type, stringlist_index_type, fidx, bidx - use stdlib_string_type, only: string_type - implicit none + use stdlib_stringlist_type, only: stringlist_type, stringlist_index_type, fidx, bidx + use stdlib_string_type, only: string_type + implicit none - type(stringlist_type) :: stringlist - type(stringlist_index_type) :: index + type(stringlist_type) :: stringlist + type(stringlist_index_type) :: index - index = fidx(1) - call stringlist%insert_at(index, "Element No. one") + index = fidx(1) + call stringlist%insert_at(index, "Element No. one") ! stringlist <-- {"Element No. one"} - index = bidx(1) - call stringlist%insert_at(index, string_type("Element No. two")) + index = bidx(1) + call stringlist%insert_at(index, string_type("Element No. two")) ! stringlist <-- {"Element No. one", "Element No. two"} - call stringlist%insert_at(fidx(2), string_type("Element No. three")) + call stringlist%insert_at(fidx(2), string_type("Element No. three")) ! stringlist <-- {"Element No. one", "Element No. three", "Element No. two"} - call stringlist%insert_at(bidx(1), "Element No. four") + call stringlist%insert_at(bidx(1), "Element No. four") ! stringlist <-- {"Element No. one", "Element No. three", "Element No. two", "Element No. four"} end program demo_insert_at diff --git a/test/example/stringlist_type/demo_stringlist_type_len.f90 b/test/example/stringlist_type/demo_stringlist_type_len.f90 index 0946d04a8..4e5c6f349 100644 --- a/test/example/stringlist_type/demo_stringlist_type_len.f90 +++ b/test/example/stringlist_type/demo_stringlist_type_len.f90 @@ -1,19 +1,19 @@ program demo_len - use stdlib_stringlist_type, only: stringlist_type, bidx - implicit none + use stdlib_stringlist_type, only: stringlist_type, bidx + implicit none - type(stringlist_type) :: stringlist - integer :: output + type(stringlist_type) :: stringlist + integer :: output - output = stringlist%len() + output = stringlist%len() ! output <-- 0 !> inserting 2 elements to the stringlist - call stringlist%insert_at(bidx(1), "Element No. one") - call stringlist%insert_at(bidx(1), "Element No. two") + call stringlist%insert_at(bidx(1), "Element No. one") + call stringlist%insert_at(bidx(1), "Element No. two") ! stringlist <-- {"Element No. one", "Element No. two"} - print'(a)', stringlist%len() + print'(a)', stringlist%len() ! 2 end program demo_len diff --git a/test/example/strings/demo_chomp.f90 b/test/example/strings/demo_chomp.f90 index 1971a11c6..42c0e75c0 100644 --- a/test/example/strings/demo_chomp.f90 +++ b/test/example/strings/demo_chomp.f90 @@ -1,14 +1,14 @@ program demo_chomp - use stdlib_ascii, only: TAB, VT, LF, CR, FF - use stdlib_strings, only: chomp - implicit none - print'(a)', chomp(" hello ") ! " hello" - print'(a)', chomp(TAB//"goodbye"//CR//LF) ! "\tgoodbye" - print'(a)', chomp(" "//TAB//LF//VT//FF//CR) ! "" - print'(a)', chomp(" ! ")//"!" ! " !!" - print'(a)', chomp("Hello") ! "Hello" - print'(a)', chomp("hello", ["l", "o"]) ! "he" - print'(a)', chomp("hello", set=["l", "o"]) ! "he" - print'(a)', chomp("hello", "lo") ! "hel" - print'(a)', chomp("hello", substring="lo") ! "hel" + use stdlib_ascii, only: TAB, VT, LF, CR, FF + use stdlib_strings, only: chomp + implicit none + print'(a)', chomp(" hello ") ! " hello" + print'(a)', chomp(TAB//"goodbye"//CR//LF) ! "\tgoodbye" + print'(a)', chomp(" "//TAB//LF//VT//FF//CR) ! "" + print'(a)', chomp(" ! ")//"!" ! " !!" + print'(a)', chomp("Hello") ! "Hello" + print'(a)', chomp("hello", ["l", "o"]) ! "he" + print'(a)', chomp("hello", set=["l", "o"]) ! "he" + print'(a)', chomp("hello", "lo") ! "hel" + print'(a)', chomp("hello", substring="lo") ! "hel" end program demo_chomp diff --git a/test/example/strings/demo_count.f90 b/test/example/strings/demo_count.f90 index 47b58cfd6..9574276e6 100644 --- a/test/example/strings/demo_count.f90 +++ b/test/example/strings/demo_count.f90 @@ -1,13 +1,13 @@ program demo_count - use stdlib_string_type, only: string_type, assignment(=) - use stdlib_strings, only: count - implicit none - type(string_type) :: string + use stdlib_string_type, only: string_type, assignment(=) + use stdlib_strings, only: count + implicit none + type(string_type) :: string - string = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?" + string = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?" - print *, count(string, "wood") ! 4 - print *, count(string, ["would", "chuck", "could"]) ! [1, 4, 1] - print *, count("a long queueueueue", "ueu", [.false., .true.]) ! [2, 4] + print *, count(string, "wood") ! 4 + print *, count(string, ["would", "chuck", "could"]) ! [1, 4, 1] + print *, count("a long queueueueue", "ueu", [.false., .true.]) ! [2, 4] end program demo_count diff --git a/test/example/strings/demo_ends_with.f90 b/test/example/strings/demo_ends_with.f90 index dcd352eed..062c1df51 100644 --- a/test/example/strings/demo_ends_with.f90 +++ b/test/example/strings/demo_ends_with.f90 @@ -1,6 +1,6 @@ program demo_ends_with - use stdlib_strings, only: ends_with - implicit none - print'(a)', ends_with("pattern", "ern") ! T - print'(a)', ends_with("pattern", "pat") ! F + use stdlib_strings, only: ends_with + implicit none + print'(a)', ends_with("pattern", "ern") ! T + print'(a)', ends_with("pattern", "pat") ! F end program demo_ends_with diff --git a/test/example/strings/demo_find.f90 b/test/example/strings/demo_find.f90 index fb3bc0ee0..de4498396 100644 --- a/test/example/strings/demo_find.f90 +++ b/test/example/strings/demo_find.f90 @@ -1,13 +1,13 @@ program demo_find - use stdlib_string_type, only: string_type, assignment(=) - use stdlib_strings, only: find - implicit none - type(string_type) :: string + use stdlib_string_type, only: string_type, assignment(=) + use stdlib_strings, only: find + implicit none + type(string_type) :: string - string = "needle in the character-stack" + string = "needle in the character-stack" - print *, find(string, "needle") ! 1 - print *, find(string, ["a", "c"], [3, 2]) ! [27, 20] - print *, find("qwqwqwq", "qwq", 3, [.false., .true.]) ! [0, 5] + print *, find(string, "needle") ! 1 + print *, find(string, ["a", "c"], [3, 2]) ! [27, 20] + print *, find("qwqwqwq", "qwq", 3, [.false., .true.]) ! [0, 5] end program demo_find diff --git a/test/example/strings/demo_padl.f90 b/test/example/strings/demo_padl.f90 index 9aafb5dcd..1509412a8 100644 --- a/test/example/strings/demo_padl.f90 +++ b/test/example/strings/demo_padl.f90 @@ -1,15 +1,15 @@ program demo_padl - use stdlib_string_type, only: string_type, assignment(=), write(formatted) - use stdlib_strings, only: padl - implicit none - type(string_type) :: string + use stdlib_string_type, only: string_type, assignment(=), write (formatted) + use stdlib_strings, only: padl + implicit none + type(string_type) :: string - string = "left pad this string" + string = "left pad this string" ! string <-- "left pad this string" - print '(a)', padl(string, 25, "$") ! "$$$$$left pad this string" + print '(a)', padl(string, 25, "$") ! "$$$$$left pad this string" - string = padl(string, 25) + string = padl(string, 25) ! string <-- " left pad this string" end program demo_padl diff --git a/test/example/strings/demo_padr.f90 b/test/example/strings/demo_padr.f90 index 68eb33513..c552a25ca 100644 --- a/test/example/strings/demo_padr.f90 +++ b/test/example/strings/demo_padr.f90 @@ -1,15 +1,15 @@ program demo_padr - use stdlib_string_type, only: string_type, assignment(=), write(formatted) - use stdlib_strings, only: padr - implicit none - type(string_type) :: string + use stdlib_string_type, only: string_type, assignment(=), write (formatted) + use stdlib_strings, only: padr + implicit none + type(string_type) :: string - string = "right pad this string" + string = "right pad this string" ! string <-- "right pad this string" - print '(a)', padr(string, 25, "$") ! "right pad this string$$$$" + print '(a)', padr(string, 25, "$") ! "right pad this string$$$$" - string = padr(string, 25) + string = padr(string, 25) ! string <-- "right pad this string " end program demo_padr diff --git a/test/example/strings/demo_replace_all.f90 b/test/example/strings/demo_replace_all.f90 index 28b833e0e..848589915 100644 --- a/test/example/strings/demo_replace_all.f90 +++ b/test/example/strings/demo_replace_all.f90 @@ -1,16 +1,16 @@ program demo_replace_all - use stdlib_string_type, only: string_type, assignment(=), write(formatted) - use stdlib_strings, only: replace_all - implicit none - type(string_type) :: string + use stdlib_string_type, only: string_type, assignment(=), write (formatted) + use stdlib_strings, only: replace_all + implicit none + type(string_type) :: string - string = "hurdles here, hurdles there, hurdles everywhere" + string = "hurdles here, hurdles there, hurdles everywhere" ! string <-- "hurdles here, hurdles there, hurdles everywhere" - print'(a)', replace_all(string, "hurdles", "learn from") + print'(a)', replace_all(string, "hurdles", "learn from") ! "learn from here, learn from there, learn from everywhere" - string = replace_all(string, "hurdles", "technology") + string = replace_all(string, "hurdles", "technology") ! string <-- "technology here, technology there, technology everywhere" end program demo_replace_all diff --git a/test/example/strings/demo_slice.f90 b/test/example/strings/demo_slice.f90 index 568a1388c..80082ee3f 100644 --- a/test/example/strings/demo_slice.f90 +++ b/test/example/strings/demo_slice.f90 @@ -1,20 +1,20 @@ program demo_slice - use stdlib_string_type - use stdlib_strings, only: slice - implicit none - type(string_type) :: string - character(len=10) :: chars + use stdlib_string_type + use stdlib_strings, only: slice + implicit none + type(string_type) :: string + character(len=10) :: chars - string = "abcdefghij" + string = "abcdefghij" ! string <-- "abcdefghij" - chars = "abcdefghij" + chars = "abcdefghij" ! chars <-- "abcdefghij" - print'(a)', slice("abcdefghij", 2, 6, 2) ! "bdf" - print'(a)', slice(chars, 2, 6, 2) ! "bdf" + print'(a)', slice("abcdefghij", 2, 6, 2) ! "bdf" + print'(a)', slice(chars, 2, 6, 2) ! "bdf" - string = slice(string, 2, 6, 2) + string = slice(string, 2, 6, 2) ! string <-- "bdf" end program demo_slice diff --git a/test/example/strings/demo_starts_with.f90 b/test/example/strings/demo_starts_with.f90 index 639b47e9f..725074cc8 100644 --- a/test/example/strings/demo_starts_with.f90 +++ b/test/example/strings/demo_starts_with.f90 @@ -1,6 +1,6 @@ program demo_starts_with - use stdlib_strings, only: starts_with - implicit none - print'(a)', starts_with("pattern", "pat") ! T - print'(a)', starts_with("pattern", "ern") ! F + use stdlib_strings, only: starts_with + implicit none + print'(a)', starts_with("pattern", "pat") ! T + print'(a)', starts_with("pattern", "ern") ! F end program demo_starts_with diff --git a/test/example/strings/demo_strip.f90 b/test/example/strings/demo_strip.f90 index 74e16619b..d38f3dc2b 100644 --- a/test/example/strings/demo_strip.f90 +++ b/test/example/strings/demo_strip.f90 @@ -1,10 +1,10 @@ program demo_strip - use stdlib_ascii, only: TAB, VT, LF, CR, FF - use stdlib_strings, only: strip - implicit none - print'(a)', strip(" hello ") ! "hello" - print'(a)', strip(TAB//"goodbye"//CR//LF) ! "goodbye" - print'(a)', strip(" "//TAB//LF//VT//FF//CR) ! "" - print'(a)', strip(" ! ")//"!" ! "!!" - print'(a)', strip("Hello") ! "Hello" + use stdlib_ascii, only: TAB, VT, LF, CR, FF + use stdlib_strings, only: strip + implicit none + print'(a)', strip(" hello ") ! "hello" + print'(a)', strip(TAB//"goodbye"//CR//LF) ! "goodbye" + print'(a)', strip(" "//TAB//LF//VT//FF//CR) ! "" + print'(a)', strip(" ! ")//"!" ! "!!" + print'(a)', strip("Hello") ! "Hello" end program demo_strip diff --git a/test/example/strings/demo_to_string.f90 b/test/example/strings/demo_to_string.f90 index 2d8523f38..6c2e30831 100644 --- a/test/example/strings/demo_to_string.f90 +++ b/test/example/strings/demo_to_string.f90 @@ -1,31 +1,31 @@ program demo_to_string - use stdlib_strings, only: to_string + use stdlib_strings, only: to_string !> Example for `complex` type - print *, to_string((1, 1)) !! "(1.00000000,1.00000000)" - print *, to_string((1, 1), '(F6.2)') !! "( 1.00, 1.00)" - print *, to_string((1000, 1), '(ES0.2)'), to_string((1000, 1), '(SP,F6.3)') + print *, to_string((1, 1)) !! "(1.00000000,1.00000000)" + print *, to_string((1, 1), '(F6.2)') !! "( 1.00, 1.00)" + print *, to_string((1000, 1), '(ES0.2)'), to_string((1000, 1), '(SP,F6.3)') !! "(1.00E+3,1.00)""(******,+1.000)" !! Too narrow formatter for real number !! Normal demonstration(`******` from Fortran Standard) !> Example for `integer` type - print *, to_string(-3) !! "-3" - print *, to_string(42, '(I4)') !! " 42" - print *, to_string(1, '(I0.4)'), to_string(2, '(B4)') !! "0001"" 10" + print *, to_string(-3) !! "-3" + print *, to_string(42, '(I4)') !! " 42" + print *, to_string(1, '(I0.4)'), to_string(2, '(B4)') !! "0001"" 10" !> Example for `real` type - print *, to_string(1.) !! "1.00000000" - print *, to_string(1., '(F6.2)') !! " 1.00" - print *, to_string(1., 'F6.2') !! " 1.00" - print *, to_string(1., '(SP,ES9.2)'), to_string(1, '(F7.3)') !! "+1.00E+00""[*]" + print *, to_string(1.) !! "1.00000000" + print *, to_string(1., '(F6.2)') !! " 1.00" + print *, to_string(1., 'F6.2') !! " 1.00" + print *, to_string(1., '(SP,ES9.2)'), to_string(1, '(F7.3)') !! "+1.00E+00""[*]" !! 1 wrong demonstration (`[*]` from `to_string`) !> Example for `logical` type - print *, to_string(.true.) !! "T" - print *, to_string(.true., '(L2)') !! " T" - print *, to_string(.true., 'L2') !! " T" - print *, to_string(.false., '(I5)') !! "[*]" + print *, to_string(.true.) !! "T" + print *, to_string(.true., '(L2)') !! " T" + print *, to_string(.true., 'L2') !! " T" + print *, to_string(.false., '(I5)') !! "[*]" !! 1 wrong demonstrations(`[*]` from `to_string`) end program demo_to_string diff --git a/test/example/version/demo_version.f90 b/test/example/version/demo_version.f90 index ad0ce23a8..00b803c65 100644 --- a/test/example/version/demo_version.f90 +++ b/test/example/version/demo_version.f90 @@ -1,7 +1,7 @@ program demo_version - use stdlib_version, only: get_stdlib_version - implicit none - character(len=:), allocatable :: version - call get_stdlib_version(string=version) - print '(a)', version + use stdlib_version, only: get_stdlib_version + implicit none + character(len=:), allocatable :: version + call get_stdlib_version(string=version) + print '(a)', version end program demo_version From bf00288098dea430e6c7bb86fc1e2b7ff50a3ac5 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Tue, 28 Jun 2022 23:46:00 +0200 Subject: [PATCH 23/38] replace the prefix demo_ by example_ --- ci/fpm-deployment.sh | 2 +- doc/specs/stdlib_array.md | 4 +- doc/specs/stdlib_ascii.md | 10 +- doc/specs/stdlib_bitsets.md | 60 ++++----- doc/specs/stdlib_error.md | 12 +- doc/specs/stdlib_hash_procedures.md | 26 ++-- doc/specs/stdlib_hashmaps.md | 54 ++++---- doc/specs/stdlib_io.md | 14 +-- doc/specs/stdlib_linalg.md | 32 ++--- doc/specs/stdlib_logger.md | 10 +- doc/specs/stdlib_math.md | 30 ++--- doc/specs/stdlib_optval.md | 2 +- doc/specs/stdlib_quadrature.md | 12 +- doc/specs/stdlib_random.md | 4 +- doc/specs/stdlib_selection.md | 6 +- doc/specs/stdlib_sorting.md | 4 +- doc/specs/stdlib_specialfunctions_gamma.md | 14 +-- doc/specs/stdlib_stats.md | 12 +- .../stdlib_stats_distribution_exponential.md | 6 +- doc/specs/stdlib_stats_distribution_normal.md | 6 +- .../stdlib_stats_distribution_uniform.md | 8 +- doc/specs/stdlib_string_type.md | 80 ++++++------ doc/specs/stdlib_stringlist_type.md | 18 +-- doc/specs/stdlib_strings.md | 22 ++-- doc/specs/stdlib_version.md | 2 +- src/stdlib_bitsets.fypp | 116 +++++++++--------- test/example/CMakeLists.txt | 10 +- test/example/array/CMakeLists.txt | 4 +- ...demo_falseloc.f90 => example_falseloc.f90} | 4 +- .../{demo_trueloc.f90 => example_trueloc.f90} | 4 +- test/example/ascii/CMakeLists.txt | 10 +- ..._reverse.f90 => example_ascii_reverse.f90} | 4 +- ...o_lower.f90 => example_ascii_to_lower.f90} | 4 +- ...ence.f90 => example_ascii_to_sentence.f90} | 4 +- ...o_title.f90 => example_ascii_to_title.f90} | 4 +- ...o_upper.f90 => example_ascii_to_upper.f90} | 4 +- test/example/bitsets/CMakeLists.txt | 60 ++++----- ...itsets_all.f90 => example_bitsets_all.f90} | 4 +- ...itsets_and.f90 => example_bitsets_and.f90} | 4 +- ...nd_not.f90 => example_bitsets_and_not.f90} | 4 +- ...itsets_any.f90 => example_bitsets_any.f90} | 4 +- ...ent.f90 => example_bitsets_assignment.f90} | 4 +- ...ount.f90 => example_bitsets_bit_count.f90} | 4 +- ...sets_bits.f90 => example_bitsets_bits.f90} | 4 +- ...ts_clear.f90 => example_bitsets_clear.f90} | 4 +- ...ality.f90 => example_bitsets_equality.f90} | 4 +- ...xtract.f90 => example_bitsets_extract.f90} | 4 +- ...sets_flip.f90 => example_bitsets_flip.f90} | 4 +- ...ng.f90 => example_bitsets_from_string.f90} | 4 +- ..._bitsets_ge.f90 => example_bitsets_ge.f90} | 4 +- ..._bitsets_gt.f90 => example_bitsets_gt.f90} | 4 +- ...ity.f90 => example_bitsets_inequality.f90} | 4 +- ...sets_init.f90 => example_bitsets_init.f90} | 4 +- ...s_output.f90 => example_bitsets_input.f90} | 4 +- ..._bitsets_le.f90 => example_bitsets_le.f90} | 4 +- ..._bitsets_lt.f90 => example_bitsets_lt.f90} | 4 +- ...sets_none.f90 => example_bitsets_none.f90} | 4 +- ...itsets_not.f90 => example_bitsets_not.f90} | 4 +- ..._bitsets_or.f90 => example_bitsets_or.f90} | 4 +- ...s_input.f90 => example_bitsets_output.f90} | 4 +- ...et.f90 => example_bitsets_read_bitset.f90} | 4 +- ...itsets_set.f90 => example_bitsets_set.f90} | 4 +- ...sets_test.f90 => example_bitsets_test.f90} | 4 +- ...ring.f90 => example_bitsets_to_string.f90} | 4 +- ...ts_value.f90 => example_bitsets_value.f90} | 4 +- ...t.f90 => example_bitsets_write_bitset.f90} | 4 +- ...itsets_xor.f90 => example_bitsets_xor.f90} | 4 +- test/example/error/CMakeLists.txt | 12 +- .../{demo_check1.f90 => example_check1.f90} | 4 +- .../{demo_check2.f90 => example_check2.f90} | 4 +- .../{demo_check3.f90 => example_check3.f90} | 4 +- .../{demo_check4.f90 => example_check4.f90} | 4 +- ...rror_stop1.f90 => example_error_stop1.f90} | 4 +- ...rror_stop2.f90 => example_error_stop2.f90} | 4 +- test/example/hash_procedures/CMakeLists.txt | 26 ++-- ...ci_hash.f90 => example_fibonacci_hash.f90} | 4 +- ...h_64.f90 => example_fibonacci_hash_64.f90} | 4 +- ..._fnv_1_hash.f90 => example_fnv_1_hash.f90} | 4 +- ..._hash_64.f90 => example_fnv_1_hash_64.f90} | 4 +- ...nv_1a_hash.f90 => example_fnv_1a_hash.f90} | 4 +- ...hash_64.f90 => example_fnv_1a_hash_64.f90} | 4 +- ...demo_nmhash32.f90 => example_nmhash32.f90} | 4 +- ...mo_nmhash32x.f90 => example_nmhash32x.f90} | 4 +- ..._pengy_hash.f90 => example_pengy_hash.f90} | 4 +- ...pooky_hash.f90 => example_spooky_hash.f90} | 4 +- ...sh.f90 => example_universal_mult_hash.f90} | 4 +- ...f90 => example_universal_mult_hash_64.f90} | 4 +- ..._water_hash.f90 => example_water_hash.f90} | 4 +- test/example/hashmaps/CMakeLists.txt | 54 ++++---- ...s_calls.f90 => example_hashmaps_calls.f90} | 4 +- ..._key.f90 => example_hashmaps_copy_key.f90} | 4 +- ...er.f90 => example_hashmaps_copy_other.f90} | 4 +- ...tries.f90 => example_hashmaps_entries.f90} | 4 +- ...ys.f90 => example_hashmaps_equal_keys.f90} | 4 +- ....f90 => example_hashmaps_fnv_1_hasher.f90} | 4 +- ...f90 => example_hashmaps_fnv_1a_hasher.f90} | 4 +- ..._key.f90 => example_hashmaps_free_key.f90} | 4 +- ...er.f90 => example_hashmaps_free_other.f90} | 4 +- ...hmaps_get.f90 => example_hashmaps_get.f90} | 4 +- ...90 => example_hashmaps_get_other_data.f90} | 4 +- ...un.f90 => example_hashmaps_hasher_fun.f90} | 4 +- ...aps_init.f90 => example_hashmaps_init.f90} | 4 +- ...test.f90 => example_hashmaps_key_test.f90} | 4 +- ...ading.f90 => example_hashmaps_loading.f90} | 4 +- ...try.f90 => example_hashmaps_map_entry.f90} | 4 +- ...ots.f90 => example_hashmaps_num_slots.f90} | 4 +- ...probes.f90 => example_hashmaps_probes.f90} | 4 +- ...rehash.f90 => example_hashmaps_rehash.f90} | 4 +- ...remove.f90 => example_hashmaps_remove.f90} | 4 +- ...ample_hashmaps_seeded_nmhash32_hasher.f90} | 4 +- ...mple_hashmaps_seeded_nmhash32x_hasher.f90} | 4 +- ... example_hashmaps_seeded_water_hasher.f90} | 4 +- ...hmaps_set.f90 => example_hashmaps_set.f90} | 4 +- ...90 => example_hashmaps_set_other_data.f90} | 4 +- ...ts.f90 => example_hashmaps_slots_bits.f90} | 4 +- ...h.f90 => example_hashmaps_total_depth.f90} | 4 +- test/example/io/CMakeLists.txt | 14 +-- ...onstants.f90 => example_fmt_constants.f90} | 4 +- .../{demo_getline.f90 => example_getline.f90} | 4 +- .../{demo_loadnpy.f90 => example_loadnpy.f90} | 4 +- .../{demo_loadtxt.f90 => example_loadtxt.f90} | 4 +- .../io/{demo_open.f90 => example_open.f90} | 4 +- .../{demo_savenpy.f90 => example_savenpy.f90} | 4 +- .../{demo_savetxt.f90 => example_savetxt.f90} | 4 +- test/example/linalg/CMakeLists.txt | 32 ++--- .../{demo_diag1.f90 => example_diag1.f90} | 4 +- .../{demo_diag2.f90 => example_diag2.f90} | 4 +- .../{demo_diag3.f90 => example_diag3.f90} | 4 +- .../{demo_diag4.f90 => example_diag4.f90} | 4 +- .../{demo_diag5.f90 => example_diag5.f90} | 4 +- .../{demo_eye1.f90 => example_eye1.f90} | 4 +- .../{demo_eye2.f90 => example_eye2.f90} | 4 +- ...s_diagonal.f90 => example_is_diagonal.f90} | 4 +- ...hermitian.f90 => example_is_hermitian.f90} | 4 +- ...ssenberg.f90 => example_is_hessenberg.f90} | 4 +- ...tric.f90 => example_is_skew_symmetric.f90} | 4 +- ...mo_is_square.f90 => example_is_square.f90} | 4 +- ...symmetric.f90 => example_is_symmetric.f90} | 4 +- ...iangular.f90 => example_is_triangular.f90} | 4 +- ..._product.f90 => example_outer_product.f90} | 4 +- .../{demo_trace.f90 => example_trace.f90} | 4 +- test/example/logger/CMakeLists.txt | 10 +- ..._log_unit.f90 => example_add_log_unit.f90} | 4 +- ...mo_configure.f90 => example_configure.f90} | 4 +- ...l_logger.f90 => example_global_logger.f90} | 4 +- ..._io_error.f90 => example_log_io_error.f90} | 4 +- ...t_error.f90 => example_log_text_error.f90} | 4 +- test/example/math/CMakeLists.txt | 30 ++--- ...p_integer.f90 => example_clip_integer.f90} | 4 +- ...mo_clip_real.f90 => example_clip_real.f90} | 4 +- .../math/{demo_diff.f90 => example_diff.f90} | 4 +- .../math/{demo_gcd.f90 => example_gcd.f90} | 4 +- ...mplex.f90 => example_linspace_complex.f90} | 4 +- ...e_int16.f90 => example_linspace_int16.f90} | 4 +- ...mplex.f90 => example_logspace_complex.f90} | 4 +- ...space_int.f90 => example_logspace_int.f90} | 4 +- ....f90 => example_logspace_rstart_cbase.f90} | 4 +- ...l_close.f90 => example_math_all_close.f90} | 4 +- ...ath_arange.f90 => example_math_arange.f90} | 4 +- ...demo_math_arg.f90 => example_math_arg.f90} | 4 +- ...mo_math_argd.f90 => example_math_argd.f90} | 4 +- ..._math_argpi.f90 => example_math_argpi.f90} | 4 +- ...is_close.f90 => example_math_is_close.f90} | 4 +- test/example/optval/CMakeLists.txt | 2 +- .../{demo_optval.f90 => example_optval.f90} | 4 +- test/example/quadrature/CMakeLists.txt | 12 +- ...egendre.f90 => example_gauss_legendre.f90} | 4 +- ...f90 => example_gauss_legendre_lobatto.f90} | 4 +- .../{demo_simps.f90 => example_simps.f90} | 4 +- ..._weights.f90 => example_simps_weights.f90} | 4 +- .../{demo_trapz.f90 => example_trapz.f90} | 4 +- ..._weights.f90 => example_trapz_weights.f90} | 4 +- test/example/random/CMakeLists.txt | 4 +- ...mo_dist_rand.f90 => example_dist_rand.f90} | 4 +- ...andom_seed.f90 => example_random_seed.f90} | 4 +- test/example/selection/CMakeLists.txt | 4 +- ..._arg_select.f90 => example_arg_select.f90} | 4 +- .../{demo_select.f90 => example_select.f90} | 4 +- test/example/sorting/CMakeLists.txt | 4 +- ...demo_ord_sort.f90 => example_ord_sort.f90} | 4 +- .../{demo_sort.f90 => example_sort.f90} | 4 +- .../specialfunctions_gamma/CMakeLists.txt | 14 +-- .../{demo_gamma.f90 => example_gamma.f90} | 4 +- .../{demo_gamma_p.f90 => example_gamma_p.f90} | 4 +- .../{demo_gamma_q.f90 => example_gamma_q.f90} | 4 +- .../{demo_ligamma.f90 => example_ligamma.f90} | 4 +- ...actorial.f90 => example_log_factorial.f90} | 4 +- ...mo_log_gamma.f90 => example_log_gamma.f90} | 4 +- .../{demo_uigamma.f90 => example_uigamma.f90} | 4 +- test/example/stats/CMakeLists.txt | 12 +- .../stats/{demo_corr.f90 => example_corr.f90} | 4 +- .../stats/{demo_cov.f90 => example_cov.f90} | 4 +- .../stats/{demo_mean.f90 => example_mean.f90} | 4 +- .../{demo_median.f90 => example_median.f90} | 4 +- .../{demo_moment.f90 => example_moment.f90} | 4 +- .../stats/{demo_var.f90 => example_var.f90} | 4 +- .../CMakeLists.txt | 6 +- ...al_cdf.f90 => example_exponential_cdf.f90} | 4 +- ...al_pdf.f90 => example_exponential_pdf.f90} | 4 +- ...al_rvs.f90 => example_exponential_rvs.f90} | 4 +- .../stats_distribution_normal/CMakeLists.txt | 6 +- ...demo_norm_cdf.f90 => example_norm_cdf.f90} | 4 +- ..._normal_pdf.f90 => example_normal_pdf.f90} | 4 +- ..._normal_rvs.f90 => example_normal_rvs.f90} | 4 +- .../stats_distribution_uniform/CMakeLists.txt | 8 +- .../{demo_shuffle.f90 => example_shuffle.f90} | 4 +- ...niform_cdf.f90 => example_uniform_cdf.f90} | 4 +- ...niform_pdf.f90 => example_uniform_pdf.f90} | 4 +- ...niform_rvs.f90 => example_uniform_rvs.f90} | 4 +- test/example/string_type/CMakeLists.txt | 80 ++++++------ .../{demo_adjustl.f90 => example_adjustl.f90} | 4 +- .../{demo_adjustr.f90 => example_adjustr.f90} | 4 +- .../{demo_char.f90 => example_char.f90} | 4 +- ...position.f90 => example_char_position.f90} | 4 +- ..._char_range.f90 => example_char_range.f90} | 4 +- ....f90 => example_constructor_character.f90} | 4 +- ...mpty.f90 => example_constructor_empty.f90} | 4 +- ...er.f90 => example_constructor_integer.f90} | 4 +- ...al.f90 => example_constructor_logical.f90} | 4 +- ...lar.f90 => example_constructor_scalar.f90} | 4 +- .../{demo_cont.f90 => example_cont.f90} | 4 +- .../{demo_eq.f90 => example_eq.f90} | 4 +- .../{demo_fread.f90 => example_fread.f90} | 4 +- .../{demo_fwrite.f90 => example_fwrite.f90} | 4 +- .../{demo_ge.f90 => example_ge.f90} | 4 +- .../{demo_gt.f90 => example_gt.f90} | 4 +- .../{demo_iachar.f90 => example_iachar.f90} | 4 +- .../{demo_ichar.f90 => example_ichar.f90} | 4 +- .../{demo_index.f90 => example_index.f90} | 4 +- .../{demo_le.f90 => example_le.f90} | 4 +- .../{demo_len.f90 => example_len.f90} | 4 +- ...demo_len_trim.f90 => example_len_trim.f90} | 4 +- .../{demo_lge.f90 => example_lge.f90} | 4 +- .../{demo_lgt.f90 => example_lgt.f90} | 4 +- .../{demo_lle.f90 => example_lle.f90} | 4 +- .../{demo_llt.f90 => example_llt.f90} | 4 +- .../{demo_lt.f90 => example_lt.f90} | 4 +- .../{demo_move.f90 => example_move.f90} | 4 +- .../{demo_ne.f90 => example_ne.f90} | 4 +- .../{demo_repeat.f90 => example_repeat.f90} | 4 +- .../{demo_reverse.f90 => example_reverse.f90} | 4 +- .../{demo_scan.f90 => example_scan.f90} | 4 +- ...demo_to_lower.f90 => example_to_lower.f90} | 4 +- ...o_sentence.f90 => example_to_sentence.f90} | 4 +- ...demo_to_title.f90 => example_to_title.f90} | 4 +- ...demo_to_upper.f90 => example_to_upper.f90} | 4 +- .../{demo_trim.f90 => example_trim.f90} | 4 +- .../{demo_uread.f90 => example_uread.f90} | 4 +- .../{demo_uwrite.f90 => example_uwrite.f90} | 4 +- .../{demo_verify.f90 => example_verify.f90} | 4 +- test/example/stringlist_type/CMakeLists.txt | 18 +-- ....f90 => example_stringlist_type_clear.f90} | 4 +- ..._stringlist_type_concatenate_operator.f90} | 4 +- ...> example_stringlist_type_constructor.f90} | 4 +- ...ple_stringlist_type_equality_operator.f90} | 4 +- ... => example_stringlist_type_fidx_bidx.f90} | 4 +- ...et.f90 => example_stringlist_type_get.f90} | 4 +- ...e_stringlist_type_inequality_operator.f90} | 4 +- ... => example_stringlist_type_insert_at.f90} | 4 +- ...en.f90 => example_stringlist_type_len.f90} | 4 +- test/example/strings/CMakeLists.txt | 22 ++-- .../{demo_chomp.f90 => example_chomp.f90} | 4 +- .../{demo_count.f90 => example_count.f90} | 4 +- ...mo_ends_with.f90 => example_ends_with.f90} | 4 +- .../{demo_find.f90 => example_find.f90} | 4 +- .../{demo_padl.f90 => example_padl.f90} | 4 +- .../{demo_padr.f90 => example_padr.f90} | 4 +- ...eplace_all.f90 => example_replace_all.f90} | 4 +- .../{demo_slice.f90 => example_slice.f90} | 4 +- ...tarts_with.f90 => example_starts_with.f90} | 4 +- .../{demo_strip.f90 => example_strip.f90} | 4 +- ...mo_to_string.f90 => example_to_string.f90} | 4 +- test/example/version/CMakeLists.txt | 2 +- .../{demo_version.f90 => example_version.f90} | 4 +- 274 files changed, 957 insertions(+), 957 deletions(-) rename test/example/array/{demo_falseloc.f90 => example_falseloc.f90} (78%) rename test/example/array/{demo_trueloc.f90 => example_trueloc.f90} (76%) rename test/example/ascii/{demo_ascii_reverse.f90 => example_ascii_reverse.f90} (68%) rename test/example/ascii/{demo_ascii_to_lower.f90 => example_ascii_to_lower.f90} (65%) rename test/example/ascii/{demo_ascii_to_sentence.f90 => example_ascii_to_sentence.f90} (78%) rename test/example/ascii/{demo_ascii_to_title.f90 => example_ascii_to_title.f90} (79%) rename test/example/ascii/{demo_ascii_to_upper.f90 => example_ascii_to_upper.f90} (65%) rename test/example/bitsets/{demo_bitsets_all.f90 => example_bitsets_all.f90} (89%) rename test/example/bitsets/{demo_bitsets_and.f90 => example_bitsets_and.f90} (92%) rename test/example/bitsets/{demo_bitsets_and_not.f90 => example_bitsets_and_not.f90} (91%) rename test/example/bitsets/{demo_bitsets_any.f90 => example_bitsets_any.f90} (89%) rename test/example/bitsets/{demo_bitsets_assignment.f90 => example_bitsets_assignment.f90} (92%) rename test/example/bitsets/{demo_bitsets_bit_count.f90 => example_bitsets_bit_count.f90} (87%) rename test/example/bitsets/{demo_bitsets_bits.f90 => example_bitsets_bits.f90} (85%) rename test/example/bitsets/{demo_bitsets_clear.f90 => example_bitsets_clear.f90} (86%) rename test/example/bitsets/{demo_bitsets_equality.f90 => example_bitsets_equality.f90} (88%) rename test/example/bitsets/{demo_bitsets_extract.f90 => example_bitsets_extract.f90} (84%) rename test/example/bitsets/{demo_bitsets_flip.f90 => example_bitsets_flip.f90} (86%) rename test/example/bitsets/{demo_bitsets_from_string.f90 => example_bitsets_from_string.f90} (89%) rename test/example/bitsets/{demo_bitsets_ge.f90 => example_bitsets_ge.f90} (92%) rename test/example/bitsets/{demo_bitsets_gt.f90 => example_bitsets_gt.f90} (91%) rename test/example/bitsets/{demo_bitsets_inequality.f90 => example_bitsets_inequality.f90} (88%) rename test/example/bitsets/{demo_bitsets_init.f90 => example_bitsets_init.f90} (81%) rename test/example/bitsets/{demo_bitsets_output.f90 => example_bitsets_input.f90} (95%) rename test/example/bitsets/{demo_bitsets_le.f90 => example_bitsets_le.f90} (92%) rename test/example/bitsets/{demo_bitsets_lt.f90 => example_bitsets_lt.f90} (90%) rename test/example/bitsets/{demo_bitsets_none.f90 => example_bitsets_none.f90} (89%) rename test/example/bitsets/{demo_bitsets_not.f90 => example_bitsets_not.f90} (86%) rename test/example/bitsets/{demo_bitsets_or.f90 => example_bitsets_or.f90} (92%) rename test/example/bitsets/{demo_bitsets_input.f90 => example_bitsets_output.f90} (95%) rename test/example/bitsets/{demo_bitsets_write_bitset.f90 => example_bitsets_read_bitset.f90} (95%) rename test/example/bitsets/{demo_bitsets_set.f90 => example_bitsets_set.f90} (86%) rename test/example/bitsets/{demo_bitsets_test.f90 => example_bitsets_test.f90} (87%) rename test/example/bitsets/{demo_bitsets_to_string.f90 => example_bitsets_to_string.f90} (86%) rename test/example/bitsets/{demo_bitsets_value.f90 => example_bitsets_value.f90} (86%) rename test/example/bitsets/{demo_bitsets_read_bitset.f90 => example_bitsets_write_bitset.f90} (95%) rename test/example/bitsets/{demo_bitsets_xor.f90 => example_bitsets_xor.f90} (92%) rename test/example/error/{demo_check1.f90 => example_check1.f90} (76%) rename test/example/error/{demo_check2.f90 => example_check2.f90} (78%) rename test/example/error/{demo_check3.f90 => example_check3.f90} (79%) rename test/example/error/{demo_check4.f90 => example_check4.f90} (79%) rename test/example/error/{demo_error_stop1.f90 => example_error_stop1.f90} (60%) rename test/example/error/{demo_error_stop2.f90 => example_error_stop2.f90} (62%) rename test/example/hash_procedures/{demo_fibonacci_hash.f90 => example_fibonacci_hash.f90} (82%) rename test/example/hash_procedures/{demo_fibonacci_hash_64.f90 => example_fibonacci_hash_64.f90} (81%) rename test/example/hash_procedures/{demo_fnv_1_hash.f90 => example_fnv_1_hash.f90} (75%) rename test/example/hash_procedures/{demo_fnv_1_hash_64.f90 => example_fnv_1_hash_64.f90} (78%) rename test/example/hash_procedures/{demo_fnv_1a_hash.f90 => example_fnv_1a_hash.f90} (75%) rename test/example/hash_procedures/{demo_fnv_1a_hash_64.f90 => example_fnv_1a_hash_64.f90} (78%) rename test/example/hash_procedures/{demo_nmhash32.f90 => example_nmhash32.f90} (84%) rename test/example/hash_procedures/{demo_nmhash32x.f90 => example_nmhash32x.f90} (84%) rename test/example/hash_procedures/{demo_pengy_hash.f90 => example_pengy_hash.f90} (85%) rename test/example/hash_procedures/{demo_spooky_hash.f90 => example_spooky_hash.f90} (85%) rename test/example/hash_procedures/{demo_universal_mult_hash.f90 => example_universal_mult_hash.f90} (86%) rename test/example/hash_procedures/{demo_universal_mult_hash_64.f90 => example_universal_mult_hash_64.f90} (84%) rename test/example/hash_procedures/{demo_water_hash.f90 => example_water_hash.f90} (84%) rename test/example/hashmaps/{demo_hashmaps_calls.f90 => example_hashmaps_calls.f90} (86%) rename test/example/hashmaps/{demo_hashmaps_copy_key.f90 => example_hashmaps_copy_key.f90} (86%) rename test/example/hashmaps/{demo_hashmaps_copy_other.f90 => example_hashmaps_copy_other.f90} (90%) rename test/example/hashmaps/{demo_hashmaps_entries.f90 => example_hashmaps_entries.f90} (85%) rename test/example/hashmaps/{demo_hashmaps_equal_keys.f90 => example_hashmaps_equal_keys.f90} (86%) rename test/example/hashmaps/{demo_hashmaps_fnv_1_hasher.f90 => example_hashmaps_fnv_1_hasher.f90} (84%) rename test/example/hashmaps/{demo_hashmaps_fnv_1a_hasher.f90 => example_hashmaps_fnv_1a_hasher.f90} (84%) rename test/example/hashmaps/{demo_hashmaps_free_key.f90 => example_hashmaps_free_key.f90} (85%) rename test/example/hashmaps/{demo_hashmaps_free_other.f90 => example_hashmaps_free_other.f90} (88%) rename test/example/hashmaps/{demo_hashmaps_get.f90 => example_hashmaps_get.f90} (89%) rename test/example/hashmaps/{demo_hashmaps_get_other_data.f90 => example_hashmaps_get_other_data.f90} (93%) rename test/example/hashmaps/{demo_hashmaps_hasher_fun.f90 => example_hashmaps_hasher_fun.f90} (88%) rename test/example/hashmaps/{demo_hashmaps_init.f90 => example_hashmaps_init.f90} (81%) rename test/example/hashmaps/{demo_hashmaps_key_test.f90 => example_hashmaps_key_test.f90} (88%) rename test/example/hashmaps/{demo_hashmaps_loading.f90 => example_hashmaps_loading.f90} (83%) rename test/example/hashmaps/{demo_hashmaps_map_entry.f90 => example_hashmaps_map_entry.f90} (91%) rename test/example/hashmaps/{demo_hashmaps_num_slots.f90 => example_hashmaps_num_slots.f90} (84%) rename test/example/hashmaps/{demo_hashmaps_probes.f90 => example_hashmaps_probes.f90} (84%) rename test/example/hashmaps/{demo_hashmaps_rehash.f90 => example_hashmaps_rehash.f90} (92%) rename test/example/hashmaps/{demo_hashmaps_remove.f90 => example_hashmaps_remove.f90} (92%) rename test/example/hashmaps/{demo_hashmaps_seeded_nmhash32_hasher.f90 => example_hashmaps_seeded_nmhash32_hasher.f90} (81%) rename test/example/hashmaps/{demo_hashmaps_seeded_nmhash32x_hasher.f90 => example_hashmaps_seeded_nmhash32x_hasher.f90} (81%) rename test/example/hashmaps/{demo_hashmaps_seeded_water_hasher.f90 => example_hashmaps_seeded_water_hasher.f90} (82%) rename test/example/hashmaps/{demo_hashmaps_set.f90 => example_hashmaps_set.f90} (89%) rename test/example/hashmaps/{demo_hashmaps_set_other_data.f90 => example_hashmaps_set_other_data.f90} (92%) rename test/example/hashmaps/{demo_hashmaps_slots_bits.f90 => example_hashmaps_slots_bits.f90} (82%) rename test/example/hashmaps/{demo_hashmaps_total_depth.f90 => example_hashmaps_total_depth.f90} (84%) rename test/example/io/{demo_fmt_constants.f90 => example_fmt_constants.f90} (93%) rename test/example/io/{demo_getline.f90 => example_getline.f90} (86%) rename test/example/io/{demo_loadnpy.f90 => example_loadnpy.f90} (69%) rename test/example/io/{demo_loadtxt.f90 => example_loadtxt.f90} (68%) rename test/example/io/{demo_open.f90 => example_open.f90} (76%) rename test/example/io/{demo_savenpy.f90 => example_savenpy.f90} (67%) rename test/example/io/{demo_savetxt.f90 => example_savetxt.f90} (66%) rename test/example/linalg/{demo_diag1.f90 => example_diag1.f90} (76%) rename test/example/linalg/{demo_diag2.f90 => example_diag2.f90} (80%) rename test/example/linalg/{demo_diag3.f90 => example_diag3.f90} (81%) rename test/example/linalg/{demo_diag4.f90 => example_diag4.f90} (79%) rename test/example/linalg/{demo_diag5.f90 => example_diag5.f90} (83%) rename test/example/linalg/{demo_eye1.f90 => example_eye1.f90} (92%) rename test/example/linalg/{demo_eye2.f90 => example_eye2.f90} (71%) rename test/example/linalg/{demo_is_diagonal.f90 => example_is_diagonal.f90} (81%) rename test/example/linalg/{demo_is_hermitian.f90 => example_is_hermitian.f90} (85%) rename test/example/linalg/{demo_is_hessenberg.f90 => example_is_hessenberg.f90} (83%) rename test/example/linalg/{demo_is_skew_symmetric.f90 => example_is_skew_symmetric.f90} (79%) rename test/example/linalg/{demo_is_square.f90 => example_is_square.f90} (82%) rename test/example/linalg/{demo_is_symmetric.f90 => example_is_symmetric.f90} (81%) rename test/example/linalg/{demo_is_triangular.f90 => example_is_triangular.f90} (83%) rename test/example/linalg/{demo_outer_product.f90 => example_outer_product.f90} (76%) rename test/example/linalg/{demo_trace.f90 => example_trace.f90} (75%) rename test/example/logger/{demo_add_log_unit.f90 => example_add_log_unit.f90} (87%) rename test/example/logger/{demo_configure.f90 => example_configure.f90} (65%) rename test/example/logger/{demo_global_logger.f90 => example_global_logger.f90} (80%) rename test/example/logger/{demo_log_io_error.f90 => example_log_io_error.f90} (91%) rename test/example/logger/{demo_log_text_error.f90 => example_log_text_error.f90} (93%) rename test/example/math/{demo_clip_integer.f90 => example_clip_integer.f90} (82%) rename test/example/math/{demo_clip_real.f90 => example_clip_real.f90} (83%) rename test/example/math/{demo_diff.f90 => example_diff.f90} (92%) rename test/example/math/{demo_gcd.f90 => example_gcd.f90} (71%) rename test/example/math/{demo_linspace_complex.f90 => example_linspace_complex.f90} (78%) rename test/example/math/{demo_linspace_int16.f90 => example_linspace_int16.f90} (76%) rename test/example/math/{demo_logspace_complex.f90 => example_logspace_complex.f90} (80%) rename test/example/math/{demo_logspace_int.f90 => example_logspace_int.f90} (82%) rename test/example/math/{demo_logspace_rstart_cbase.f90 => example_logspace_rstart_cbase.f90} (80%) rename test/example/math/{demo_math_all_close.f90 => example_math_all_close.f90} (80%) rename test/example/math/{demo_math_arange.f90 => example_math_arange.f90} (92%) rename test/example/math/{demo_math_arg.f90 => example_math_arg.f90} (83%) rename test/example/math/{demo_math_argd.f90 => example_math_argd.f90} (83%) rename test/example/math/{demo_math_argpi.f90 => example_math_argpi.f90} (83%) rename test/example/math/{demo_math_is_close.f90 => example_math_is_close.f90} (85%) rename test/example/optval/{demo_optval.f90 => example_optval.f90} (84%) rename test/example/quadrature/{demo_gauss_legendre.f90 => example_gauss_legendre.f90} (79%) rename test/example/quadrature/{demo_gauss_legendre_lobatto.f90 => example_gauss_legendre_lobatto.f90} (76%) rename test/example/quadrature/{demo_simps.f90 => example_simps.f90} (79%) rename test/example/quadrature/{demo_simps_weights.f90 => example_simps_weights.f90} (75%) rename test/example/quadrature/{demo_trapz.f90 => example_trapz.f90} (79%) rename test/example/quadrature/{demo_trapz_weights.f90 => example_trapz_weights.f90} (75%) rename test/example/random/{demo_dist_rand.f90 => example_dist_rand.f90} (90%) rename test/example/random/{demo_random_seed.f90 => example_random_seed.f90} (75%) rename test/example/selection/{demo_arg_select.f90 => example_arg_select.f90} (92%) rename test/example/selection/{demo_select.f90 => example_select.f90} (92%) rename test/example/sorting/{demo_ord_sort.f90 => example_ord_sort.f90} (81%) rename test/example/sorting/{demo_sort.f90 => example_sort.f90} (80%) rename test/example/specialfunctions_gamma/{demo_gamma.f90 => example_gamma.f90} (93%) rename test/example/specialfunctions_gamma/{demo_gamma_p.f90 => example_gamma_p.f90} (70%) rename test/example/specialfunctions_gamma/{demo_gamma_q.f90 => example_gamma_q.f90} (70%) rename test/example/specialfunctions_gamma/{demo_ligamma.f90 => example_ligamma.f90} (80%) rename test/example/specialfunctions_gamma/{demo_log_factorial.f90 => example_log_factorial.f90} (76%) rename test/example/specialfunctions_gamma/{demo_log_gamma.f90 => example_log_gamma.f90} (91%) rename test/example/specialfunctions_gamma/{demo_uigamma.f90 => example_uigamma.f90} (76%) rename test/example/stats/{demo_corr.f90 => example_corr.f90} (86%) rename test/example/stats/{demo_cov.f90 => example_cov.f90} (89%) rename test/example/stats/{demo_mean.f90 => example_mean.f90} (90%) rename test/example/stats/{demo_median.f90 => example_median.f90} (90%) rename test/example/stats/{demo_moment.f90 => example_moment.f90} (92%) rename test/example/stats/{demo_var.f90 => example_var.f90} (92%) rename test/example/stats_distribution_exponential/{demo_exponential_cdf.f90 => example_exponential_cdf.f90} (94%) rename test/example/stats_distribution_exponential/{demo_exponential_pdf.f90 => example_exponential_pdf.f90} (94%) rename test/example/stats_distribution_exponential/{demo_exponential_rvs.f90 => example_exponential_rvs.f90} (92%) rename test/example/stats_distribution_normal/{demo_norm_cdf.f90 => example_norm_cdf.f90} (96%) rename test/example/stats_distribution_normal/{demo_normal_pdf.f90 => example_normal_pdf.f90} (95%) rename test/example/stats_distribution_normal/{demo_normal_rvs.f90 => example_normal_rvs.f90} (95%) rename test/example/stats_distribution_uniform/{demo_shuffle.f90 => example_shuffle.f90} (94%) rename test/example/stats_distribution_uniform/{demo_uniform_cdf.f90 => example_uniform_cdf.f90} (96%) rename test/example/stats_distribution_uniform/{demo_uniform_pdf.f90 => example_uniform_pdf.f90} (96%) rename test/example/stats_distribution_uniform/{demo_uniform_rvs.f90 => example_uniform_rvs.f90} (97%) rename test/example/string_type/{demo_adjustl.f90 => example_adjustl.f90} (80%) rename test/example/string_type/{demo_adjustr.f90 => example_adjustr.f90} (80%) rename test/example/string_type/{demo_char.f90 => example_char.f90} (80%) rename test/example/string_type/{demo_char_position.f90 => example_char_position.f90} (83%) rename test/example/string_type/{demo_char_range.f90 => example_char_range.f90} (75%) rename test/example/string_type/{demo_constructor_character.f90 => example_constructor_character.f90} (62%) rename test/example/string_type/{demo_constructor_empty.f90 => example_constructor_empty.f90} (61%) rename test/example/string_type/{demo_constructor_integer.f90 => example_constructor_integer.f90} (68%) rename test/example/string_type/{demo_constructor_logical.f90 => example_constructor_logical.f90} (69%) rename test/example/string_type/{demo_constructor_scalar.f90 => example_constructor_scalar.f90} (71%) rename test/example/string_type/{demo_cont.f90 => example_cont.f90} (75%) rename test/example/string_type/{demo_eq.f90 => example_eq.f90} (85%) rename test/example/string_type/{demo_fread.f90 => example_fread.f90} (84%) rename test/example/string_type/{demo_fwrite.f90 => example_fwrite.f90} (84%) rename test/example/string_type/{demo_ge.f90 => example_ge.f90} (85%) rename test/example/string_type/{demo_gt.f90 => example_gt.f90} (84%) rename test/example/string_type/{demo_iachar.f90 => example_iachar.f90} (72%) rename test/example/string_type/{demo_ichar.f90 => example_ichar.f90} (73%) rename test/example/string_type/{demo_index.f90 => example_index.f90} (85%) rename test/example/string_type/{demo_le.f90 => example_le.f90} (85%) rename test/example/string_type/{demo_len.f90 => example_len.f90} (86%) rename test/example/string_type/{demo_len_trim.f90 => example_len_trim.f90} (83%) rename test/example/string_type/{demo_lge.f90 => example_lge.f90} (84%) rename test/example/string_type/{demo_lgt.f90 => example_lgt.f90} (84%) rename test/example/string_type/{demo_lle.f90 => example_lle.f90} (84%) rename test/example/string_type/{demo_llt.f90 => example_llt.f90} (84%) rename test/example/string_type/{demo_lt.f90 => example_lt.f90} (84%) rename test/example/string_type/{demo_move.f90 => example_move.f90} (91%) rename test/example/string_type/{demo_ne.f90 => example_ne.f90} (85%) rename test/example/string_type/{demo_repeat.f90 => example_repeat.f90} (75%) rename test/example/string_type/{demo_reverse.f90 => example_reverse.f90} (83%) rename test/example/string_type/{demo_scan.f90 => example_scan.f90} (83%) rename test/example/string_type/{demo_to_lower.f90 => example_to_lower.f90} (84%) rename test/example/string_type/{demo_to_sentence.f90 => example_to_sentence.f90} (83%) rename test/example/string_type/{demo_to_title.f90 => example_to_title.f90} (84%) rename test/example/string_type/{demo_to_upper.f90 => example_to_upper.f90} (84%) rename test/example/string_type/{demo_trim.f90 => example_trim.f90} (78%) rename test/example/string_type/{demo_uread.f90 => example_uread.f90} (83%) rename test/example/string_type/{demo_uwrite.f90 => example_uwrite.f90} (83%) rename test/example/string_type/{demo_verify.f90 => example_verify.f90} (86%) rename test/example/stringlist_type/{demo_stringlist_type_clear.f90 => example_stringlist_type_clear.f90} (91%) rename test/example/stringlist_type/{demo_stringlist_type_concatenate_operator.f90 => example_stringlist_type_concatenate_operator.f90} (93%) rename test/example/stringlist_type/{demo_stringlist_type_constructor.f90 => example_stringlist_type_constructor.f90} (87%) rename test/example/stringlist_type/{demo_stringlist_type_equality_operator.f90 => example_stringlist_type_equality_operator.f90} (92%) rename test/example/stringlist_type/{demo_stringlist_type_fidx_bidx.f90 => example_stringlist_type_fidx_bidx.f90} (78%) rename test/example/stringlist_type/{demo_stringlist_type_get.f90 => example_stringlist_type_get.f90} (95%) rename test/example/stringlist_type/{demo_stringlist_type_inequality_operator.f90 => example_stringlist_type_inequality_operator.f90} (91%) rename test/example/stringlist_type/{demo_stringlist_type_insert_at.f90 => example_stringlist_type_insert_at.f90} (93%) rename test/example/stringlist_type/{demo_stringlist_type_len.f90 => example_stringlist_type_len.f90} (90%) rename test/example/strings/{demo_chomp.f90 => example_chomp.f90} (92%) rename test/example/strings/{demo_count.f90 => example_count.f90} (90%) rename test/example/strings/{demo_ends_with.f90 => example_ends_with.f90} (72%) rename test/example/strings/{demo_find.f90 => example_find.f90} (89%) rename test/example/strings/{demo_padl.f90 => example_padl.f90} (88%) rename test/example/strings/{demo_padr.f90 => example_padr.f90} (88%) rename test/example/strings/{demo_replace_all.f90 => example_replace_all.f90} (90%) rename test/example/strings/{demo_slice.f90 => example_slice.f90} (89%) rename test/example/strings/{demo_starts_with.f90 => example_starts_with.f90} (71%) rename test/example/strings/{demo_strip.f90 => example_strip.f90} (88%) rename test/example/strings/{demo_to_string.f90 => example_to_string.f90} (95%) rename test/example/version/{demo_version.f90 => example_version.f90} (76%) diff --git a/ci/fpm-deployment.sh b/ci/fpm-deployment.sh index 74ddeedb3..d87944dd6 100644 --- a/ci/fpm-deployment.sh +++ b/ci/fpm-deployment.sh @@ -49,7 +49,7 @@ find src -maxdepth 1 -iname "*.fypp" \ find src -maxdepth 1 -iname "*.f90" -exec cp {} "$destdir/src/" \; find src/tests -name "test_*.f90" -exec cp {} "$destdir/test/" \; find src/tests -name "*.dat" -exec cp {} "$destdir/" \; -find test/example -name "demo_*.f90" -exec cp {} "$destdir/example/" \; +find test/example -name "example_*.f90" -exec cp {} "$destdir/example/" \; # Include additional files cp "${include[@]}" "$destdir/" diff --git a/doc/specs/stdlib_array.md b/doc/specs/stdlib_array.md index cffe1ff73..0730fce16 100644 --- a/doc/specs/stdlib_array.md +++ b/doc/specs/stdlib_array.md @@ -46,7 +46,7 @@ Returns an array of default integer size, with a maximum length of `size(array)` #### Examples ```fortran -{!test/examples/array/demo_trueloc.f90!} +{!test/example/array/example_trueloc.f90!} ``` @@ -83,5 +83,5 @@ Returns an array of default integer size, with a maximum length of `size(array)` #### Examples ```fortran -{!test/examples/array/demo_falseloc.f90!} +{!test/example/array/example_falseloc.f90!} ``` diff --git a/doc/specs/stdlib_ascii.md b/doc/specs/stdlib_ascii.md index e57ef97bb..897843960 100644 --- a/doc/specs/stdlib_ascii.md +++ b/doc/specs/stdlib_ascii.md @@ -51,7 +51,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/examples/ascii/demo_to_lower.f90!} +{!test/example/ascii/example_ascii_to_lower.f90!} ``` ### `to_upper` @@ -83,7 +83,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/examples/ascii/demo_to_upper.f90!} +{!test/example/ascii/example_ascii_to_upper.f90!} ``` ### `to_title` @@ -120,7 +120,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/examples/ascii/demo_to_title.f90!} +{!test/example/ascii/example_ascii_to_title.f90!} ``` ### `to_sentence` @@ -155,7 +155,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/examples/ascii/demo_to_sentence.f90!} +{!test/example/ascii/example_ascii_to_sentence.f90!} ``` ### `reverse` @@ -187,5 +187,5 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/examples/ascii/demo_reverse.f90!} +{!test/example/ascii/example_ascii_reverse.f90!} ``` diff --git a/doc/specs/stdlib_bitsets.md b/doc/specs/stdlib_bitsets.md index 25b0c71c0..9ed11df96 100644 --- a/doc/specs/stdlib_bitsets.md +++ b/doc/specs/stdlib_bitsets.md @@ -205,7 +205,7 @@ is mapped to a set bit, and `.false.` is mapped to an unset bit. #### Example ```fortran -{!test/examples/bitsets/demo_assignment.f90!} +{!test/example/bitsets/example_bitsets_assignment.f90!} ``` ### Table of the non-member comparison operations @@ -259,7 +259,7 @@ otherwise it is `.false.`. #### Example ```fortran -{!test/examples/bitsets/demo_all.f90!} +{!test/example/bitsets/example_bitsets_all.f90!} ``` ### `and` - bitwise `and` of the bits of two bitsets @@ -296,7 +296,7 @@ number of bits as `set1`. #### Example ```fortran -{!test/examples/bitsets/demo_and.f90!} +{!test/example/bitsets/example_bitsets_and.f90!} ``` ### `and_not` - Bitwise `and` of one bitset with the negation of another @@ -334,7 +334,7 @@ number of bits as `set1`, otherwise the result is undefined. #### Example ```fortran -{!test/examples/bitsets/demo_and_not.f90!} +{!test/example/bitsets/example_bitsets_and_not.f90!} ``` ### `any` - determine whether any bits are set @@ -368,7 +368,7 @@ is `.false.`. #### Example ```fortran -{!test/examples/bitsets/demo_any.f90!} +{!test/example/bitsets/example_bitsets_any.f90!} ``` ### `bit_count` - return the number of bits that are set @@ -402,7 +402,7 @@ equal to the number of bits that are set in `self`. #### Example ```fortran -{!test/examples/bitsets/demo_bit_count.f90!} +{!test/example/bitsets/example_bitsets_bit_count.f90!} ``` #### `bits` - returns the number of bits @@ -436,7 +436,7 @@ the number of defined bits in `self`. #### Example ```fortran -{!test/examples/bitsets/demo_bits.f90!} +{!test/example/bitsets/example_bitsets_bits.f90!} ``` ### `clear` - clears a sequence of one or more bits @@ -487,7 +487,7 @@ an `intent(in)` argument. #### Example ```fortran -{!test/examples/bitsets/demo_clear.f90!} +{!test/example/bitsets/example_bitsets_clear.f90!} ``` ### `extract` - create a new bitset from a range in an old bitset @@ -538,7 +538,7 @@ an `intent(out)` argument. If present it shall have one of the values: #### Example ```fortran -{!test/examples/bitsets/demo_extract.f90!} +{!test/example/bitsets/example_bitsets_extract.f90!} ``` ### `flip` - flip the values of a sequence of one or more bits @@ -590,7 +590,7 @@ an `intent(in)` argument. #### Example ```fortran -{!test/examples/bitsets/demo_flip.f90!} +{!test/example/bitsets/example_bitsets_flip.f90!} ``` ### `from_string` - initializes a bitset from a binary literal @@ -640,7 +640,7 @@ codes: #### Example ```fortran -{!test/examples/bitsets/demo_from_string.f90!} +{!test/example/bitsets/example_bitsets_from_string.f90!} ``` ### `init` - `bitset_type` initialization routines @@ -689,7 +689,7 @@ stop code. It can have any of the following error codes: #### Example ```fortran -{!test/examples/bitsets/demo_init.f90!} +{!test/example/bitsets/example_bitsets_init.f90!} ``` ### `input` - reads a bitset from an unformatted file @@ -742,7 +742,7 @@ values for this `status` are: #### Example ```fortran -{!test/examples/bitsets/demo_input.f90!} +{!test/example/bitsets/example_bitsets_input.f90!} ``` ### `none` - determines whether no bits are set @@ -777,7 +777,7 @@ The result is `.true.` if no bits in `self` are set, otherwise it is #### Example ```fortran -{!test/examples/bitsets/demo_none.f90!} +{!test/example/bitsets/example_bitsets_none.f90!} ``` ### `not` - Performs the logical complement on a bitset @@ -807,7 +807,7 @@ complement of their values on input. #### Example ```fortran -{!test/examples/bitsets/demo_not.f90!} +{!test/example/bitsets/example_bitsets_not.f90!} ``` ### `or` - Bitwise OR of the bits of two bitsets @@ -844,7 +844,7 @@ otherwise the results are undefined. #### Example ```fortran -{!test/examples/bitsets/demo_or.f90!} +{!test/example/bitsets/example_bitsets_or.f90!} ``` ### `output` - Writes a binary representation of a bitset to a file @@ -887,7 +887,7 @@ code. The two code values have the meaning: #### Example ```fortran -{!test/examples/bitsets/demo_output.f90!} +{!test/example/bitsets/example_bitsets_output.f90!} ``` ### `read_bitset` - initializes `self` with the value of a *bitset_literal* @@ -968,7 +968,7 @@ as its error code. The possible error codes are: #### Example ```fortran -{!test/examples/bitsets/demo_read_bitset.f90!} +{!test/example/bitsets/example_bitsets_read_bitset.f90!} ``` ### `set` - sets a sequence of one or more bits to 1 @@ -1022,7 +1022,7 @@ Elemental subroutine #### Example ```fortran -{!test/examples/bitsets/demo_set.f90!} +{!test/example/bitsets/example_bitsets_set.f90!} ``` ### `test` - determine whether a bit is set @@ -1062,7 +1062,7 @@ otherwise it is `.false.`. If `pos` is outside the range #### Example ```fortran -{!test/examples/bitsets/demo_test.f90!} +{!test/example/bitsets/example_bitsets_test.f90!} ``` ### `to_string` - represent a bitset as a binary literal @@ -1106,7 +1106,7 @@ the stop code. The values have the following meanings: #### Example ```fortran -{!test/examples/bitsets/demo_to_string.f90!} +{!test/example/bitsets/example_bitsets_to_string.f90!} ``` ### `value` - determine the value of a bit @@ -1145,7 +1145,7 @@ is zero. #### Example ```fortran -{!test/examples/bitsets/demo_value.f90!} +{!test/example/bitsets/example_bitsets_value.f90!} ``` ### `write_bitset` - writes a *bitset-literal* @@ -1212,7 +1212,7 @@ the following error code values: #### Example ```fortran -{!test/examples/bitsets/demo_write_bitset.f90!} +{!test/example/bitsets/example_bitsets_write_bitset.f90!} ``` ### `xor` - bitwise exclusive `or` @@ -1249,7 +1249,7 @@ samee number of bits, otherwise the result is undefined. #### Example ```fortran -{!test/examples/bitsets/demo_xor.f90!} +{!test/example/bitsets/example_bitsets_xor.f90!} ``` ## Specification of the `stdlib_bitsets` operators @@ -1295,7 +1295,7 @@ to the same value, otherwise the result is `.false.`. #### Example ```fortran -{!test/examples/bitsets/demo_equality.f90!} +{!test/example/bitsets/example_bitsets_equality.f90!} ``` ### `/=` - compare two bitsets to determine whether any bits differ in value @@ -1339,7 +1339,7 @@ the result is `.false.`. #### Example ```fortran -{!test/examples/bitsets/demo_inequality.f90!} +{!test/example/bitsets/example_bitsets_inequality.f90!} ``` ### `>=` - compare two bitsets to determine whether the first is greater than or equal to the second @@ -1386,7 +1386,7 @@ or the highest order different bit is set to 1 in `set1` and to 0 in #### Example ```fortran -{!test/examples/bitsets/demo_ge.f90!} +{!test/example/bitsets/example_bitsets_ge.f90!} ``` ### `>` - compare two bitsets to determine whether the first is greater than the other @@ -1433,7 +1433,7 @@ highest order different bit is set to 1 in `set1` and to 0 in `set2`, #### Example ```fortran -{!test/examples/bitsets/demo_gt.f90!} +{!test/example/bitsets/example_bitsets_gt.f90!} ``` ### `<=` - compare two bitsets to determine whether the first is less than or equal to the other @@ -1480,7 +1480,7 @@ or the highest order different bit is set to 0 in `set1` and to 1 in #### Example ```fortran -{!test/examples/bitsets/demo_le.f90!} +{!test/example/bitsets/example_bitsets_le.f90!} ``` ### `<` - compare two bitsets to determine whether the first is less than the other @@ -1527,5 +1527,5 @@ highest order different bit is set to 0 in `set1` and to 1 in `set2`, #### Example ```fortran -{!test/examples/bitsets/demo_lt.f90!} +{!test/example/bitsets/example_bitsets_lt.f90!} ``` diff --git a/doc/specs/stdlib_error.md b/doc/specs/stdlib_error.md index 3900a19a7..179cd39f6 100644 --- a/doc/specs/stdlib_error.md +++ b/doc/specs/stdlib_error.md @@ -53,16 +53,16 @@ If `condition` is `.false.`, and: #### Examples ```fortran -{!test/examples/error/demo_check1.f90!} +{!test/example/error/example_check1.f90!} ``` ```fortran -{!test/examples/error/demo_check2.f90!} +{!test/example/error/example_check2.f90!} ``` ```fortran -{!test/examples/error/demo_check3.f90!} +{!test/example/error/example_check3.f90!} ``` ```fortran -{!test/examples/error/demo_check4.f90!} +{!test/example/error/example_check4.f90!} ``` ### `error_stop` - aborts the program @@ -94,11 +94,11 @@ Aborts the program with printing the message `msg` to `stderr` and a nonzero exi Without error code: ```fortran -{!test/examples/error/demo_error_stop1.f90!} +{!test/example/error/example_error_stop1.f90!} ``` With error code: ```fortran -{!test/examples/error/demo_error_stop2.f90!} +{!test/example/error/example_error_stop2.f90!} ``` diff --git a/doc/specs/stdlib_hash_procedures.md b/doc/specs/stdlib_hash_procedures.md index d40f6601b..052c78d8a 100644 --- a/doc/specs/stdlib_hash_procedures.md +++ b/doc/specs/stdlib_hash_procedures.md @@ -543,7 +543,7 @@ E. Knuth. It multiplies the `key` by the odd valued approximation to ##### Example ```fortran -{!test/examples/hash_procedures/demo_fibonacci_hash.f90!} +{!test/example/hash_procedures/example_fibonacci_hash.f90!} ``` #### `fnv_1_hash`- calculates a hash code from a key @@ -597,7 +597,7 @@ function for character strings. ##### Example ```fortran -{!test/examples/hash_procedures/demo_fnv_1_hash.f90!} +{!test/example/hash_procedures/example_fnv_1_hash.f90!} ``` @@ -651,7 +651,7 @@ function for character strings. ##### Example ```fortran -{!test/examples/hash_procedures/demo_fnv_1a_hash.f90!} +{!test/example/hash_procedures/example_fnv_1a_hash.f90!} ``` @@ -818,7 +818,7 @@ function for character strings. ##### Example ```fortran -{!test/examples/hash_procedures/demo_nmhash32.f90!} +{!test/example/hash_procedures/example_nmhash32.f90!} ``` @@ -870,7 +870,7 @@ function for character strings. ##### Example ```fortran -{!test/examples/hash_procedures/demo_nmhash32x.f90!} +{!test/example/hash_procedures/example_nmhash32x.f90!} ``` #### `odd_random_integer` - returns an odd integer @@ -953,7 +953,7 @@ It multiplies the `key` by `seed`, and returns the ##### Example ```fortran -{!test/examples/hash_procedures/demo_universal_mult_hash.f90!} +{!test/example/hash_procedures/example_universal_mult_hash.f90!} ``` #### `water_hash`- calculates a hash code from a key and a seed @@ -1011,7 +1011,7 @@ function for character strings. ##### Example ```fortran -{!test/examples/hash_procedures/demo_water_hash.f90!} +{!test/example/hash_procedures/example_water_hash.f90!} ``` ## The `stdlib_hash_64bit` module @@ -1102,7 +1102,7 @@ E. Knuth. It multiplies the `key` by the odd valued approximation to ##### Example ```fortran -{!test/examples/hash_procedures/demo_fibonacci_hash_64.f90!} +{!test/example/hash_procedures/example_fibonacci_hash_64.f90!} ``` #### `FNV_1`- calculates a hash code from a key @@ -1156,7 +1156,7 @@ function for character strings. ##### Example ```fortran -{!test/examples/hash_procedures/demo_fnv_1_hash_64.f90!} +{!test/example/hash_procedures/example_fnv_1_hash_64.f90!} ``` @@ -1210,7 +1210,7 @@ function for character strings. ##### Example ```fortran -{!test/examples/hash_procedures/demo_fnv_1a_hash_64.f90!} +{!test/example/hash_procedures/example_fnv_1a_hash_64.f90!} ``` @@ -1370,7 +1370,7 @@ function for character strings. ##### Example ```fortran -{!test/examples/hash_procedures/demo_pengy_hash.f90!} +{!test/example/hash_procedures/example_pengy_hash.f90!} ``` @@ -1420,7 +1420,7 @@ and has no known bad seeds. ##### Example ```fortran -{!test/examples/hash_procedures/demo_spooky_hash.f90!} +{!test/example/hash_procedures/example_spooky_hash.f90!} ``` #### `universal_mult_hash` - maps an integer to a smaller number of bits @@ -1469,7 +1469,7 @@ It multiplies the `key` by `seed`, and returns the ```fortran -{!test/examples/hash_procedures/demo_universal_mult_hash_64.f90!} +{!test/example/hash_procedures/example_universal_mult_hash_64.f90!} ``` diff --git a/doc/specs/stdlib_hashmaps.md b/doc/specs/stdlib_hashmaps.md index ee9ad0291..849f3c244 100644 --- a/doc/specs/stdlib_hashmaps.md +++ b/doc/specs/stdlib_hashmaps.md @@ -227,7 +227,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!test/examples/hashmaps/demo_copy_key.f90!} +{!test/example/hashmaps/example_hashmaps_copy_key.f90!} ``` #### `copy_other` - Returns a copy of the other data @@ -259,7 +259,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!test/examples/hashmaps/demo_copy_other.f90!} +{!test/example/hashmaps/example_hashmaps_copy_other.f90!} ``` @@ -325,7 +325,7 @@ expected to be minor compared to its faster hashing rate. ##### Example ```fortran -{!test/examples/hashmaps/demo_fnv_1_hasher.f90!} +{!test/example/hashmaps/example_hashmaps_fnv_1_hasher.f90!} ``` @@ -377,7 +377,7 @@ expected to be minor compared to its faster hashing rate. ##### Example ```fortran -{!test/examples/hashmaps/demo_fnv_1a_hasher.f90!} +{!test/example/hashmaps/example_hashmaps_fnv_1a_hasher.f90!} ``` #### `free_key` - frees the memory associated with a key @@ -407,7 +407,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!test/examples/hashmaps/demo_free_key.f90!} +{!test/example/hashmaps/example_hashmaps_free_key.f90!} ``` #### `free_other` - frees the memory associated with other data @@ -437,7 +437,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!test/examples/hashmaps/demo_free_other.f90!} +{!test/example/hashmaps/example_hashmaps_free_other.f90!} ``` @@ -481,7 +481,7 @@ an allocatable of `class(*)`. It is an `intent(out)` argument. ##### Example ```fortran -{!test/examples/hashmaps/demo_get.f90!} +{!test/example/hashmaps/example_hashmaps_get.f90!} ``` @@ -525,7 +525,7 @@ pointers intended for use as a hash function for the hash maps. ##### Example ```fortran -{!test/examples/hashmaps/demo_hasher_fun.f90!} +{!test/example/hashmaps/example_hashmaps_hasher_fun.f90!} ``` #### `operator(==)` - Compares two keys for equality @@ -565,7 +565,7 @@ The result is `.true.` if the keys are equal, otherwise `.falss.`. ##### Example ```fortran -{!test/examples/hashmaps/demo_equal_keys.f90!} +{!test/example/hashmaps/example_hashmaps_equal_keys.f90!} ``` #### `seeded_nmhash32_hasher`- calculates a hash code from a key @@ -615,7 +615,7 @@ This code passes the SMHasher tests. ##### Example ```fortran -{!test/examples/hashmaps/demo_seeded_nmhash32_hasher.f90!} +{!test/example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90!} ``` #### `seeded_nmhash32x_hasher`- calculates a hash code from a key @@ -664,7 +664,7 @@ This code passes the SMHasher tests. ##### Example ```fortran -{!test/examples/hashmaps/demo_seeded_nmhash32x_hasher.f90!} +{!test/example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90!} ``` #### `seeded_water_hasher`- calculates a hash code from a key @@ -714,7 +714,7 @@ This code passes the SMHasher tests. ##### Example ```fortran -{!test/examples/hashmaps/demo_seeded_water_hasher.f90!} +{!test/example/hashmaps/example_hashmaps_seeded_water_hasher.f90!} ``` @@ -763,7 +763,7 @@ value to an `int8` vector. ##### Example ```fortran -{!test/examples/hashmaps/demo_set.f90!} +{!test/example/hashmaps/example_hashmaps_set.f90!} ``` @@ -1209,7 +1209,7 @@ The result will be the number of procedure calls on the hash map. ##### Example ```fortran -{!test/examples/hashmaps/demo_calls.f90!} +{!test/example/hashmaps/example_hashmaps_calls.f90!} ``` @@ -1247,7 +1247,7 @@ The result will be the number of entries in the hash map. ##### Example ```fortran -{!test/examples/hashmaps/demo_entries.f90!} +{!test/example/hashmaps/example_hashmaps_entries.f90!} ``` @@ -1295,7 +1295,7 @@ undefined. ```fortran -{!test/examples/hashmaps/demo_get_other_data.f90!} +{!test/example/hashmaps/example_hashmaps_get_other_data.f90!} ``` @@ -1358,7 +1358,7 @@ has the value `alloc_fault`. ##### Example ```fortran -{!test/examples/hashmaps/demo_init.f90!} +{!test/example/hashmaps/example_hashmaps_init.f90!} ``` @@ -1400,7 +1400,7 @@ is being examined. ##### Example ```fortran -{!test/examples/hashmaps/demo_key_test.f90!} +{!test/example/hashmaps/example_hashmaps_key_test.f90!} ``` @@ -1440,7 +1440,7 @@ number of slots in the hash map. ##### Example ```fortran -{!test/examples/hashmaps/demo_loading.f90!} +{!test/example/hashmaps/example_hashmaps_loading.f90!} ``` #### `map_entry` - inserts an entry into the hash map @@ -1490,7 +1490,7 @@ is ignored. ##### Example ```fortran -{!test/examples/hashmaps/demo_map_entry.f90!} +{!test/example/hashmaps/example_hashmaps_map_entry.f90!} ``` #### `map_probes` - returns the number of hash map probes @@ -1529,7 +1529,7 @@ rehashing. ##### Example ```fortran -{!test/examples/hashmaps/demo_probes.f90!} +{!test/example/hashmaps/example_hashmaps_probes.f90!} ``` #### `num_slots` - returns the number of hash map slots. @@ -1567,7 +1567,7 @@ The result is the number of slots in `map`. ##### Example ```fortran -{!test/examples/hashmaps/demo_num_slots.f90!} +{!test/example/hashmaps/example_hashmaps_num_slots.f90!} ``` @@ -1602,7 +1602,7 @@ It is the hash method to be used by `map`. ##### Example ```fortran -{!test/examples/hashmaps/demo_rehash.f90!} +{!test/example/hashmaps/example_hashmaps_rehash.f90!} ``` #### `remove` - removes an entry from the hash map @@ -1643,7 +1643,7 @@ absent, the procedure returns with no entry with the given key. ##### Example ```fortran -{!test/examples/hashmaps/demo_remove.f90!} +{!test/example/hashmaps/example_hashmaps_remove.f90!} ``` #### `set_other_data` - replaces the other data for an entry @@ -1690,7 +1690,7 @@ not exist and nothing was done. ##### Example ```fortran -{!test/examples/hashmaps/demo_set_other_data.f90!} +{!test/example/hashmaps/example_hashmaps_set_other_data.f90!} ``` #### `slots_bits` - returns the number of bits used to address the hash map slots @@ -1728,7 +1728,7 @@ The result is the number of bits used in addressing the slots in `map`. ##### Example ```fortran -{!test/examples/hashmaps/demo_slots_bits.f90!} +{!test/example/hashmaps/example_hashmaps_slots_bits.f90!} ``` @@ -1769,5 +1769,5 @@ from their slot index the map. ##### Example ```fortran -{!test/examples/hashmaps/demo_total_depth.f90!} +{!test/example/hashmaps/example_hashmaps_total_depth.f90!} ``` diff --git a/doc/specs/stdlib_io.md b/doc/specs/stdlib_io.md index 5cc618009..a9c82c94f 100644 --- a/doc/specs/stdlib_io.md +++ b/doc/specs/stdlib_io.md @@ -36,7 +36,7 @@ Returns an allocated rank-2 `array` with the content of `filename`. ### Example ```fortran -{!test/examples/io/demo_loadtxt.f90!} +{!test/example/io/example_loadtxt.f90!} ``` @@ -86,7 +86,7 @@ The result is a scalar of type `integer`. ### Example ```fortran -{!test/examples/io/demo_open.f90!} +{!test/example/io/example_open.f90!} ``` @@ -116,7 +116,7 @@ Provides a text file called `filename` that contains the rank-2 `array`. ### Example ```fortran -{!test/examples/io/demo_savetxt.f90!} +{!test/example/io/example_savetxt.f90!} ``` @@ -157,7 +157,7 @@ Returns an allocated `array` with the content of `filename` in case of success. ### Example ```fortran -{!test/examples/io/demo_loadnpy.f90!} +{!test/example/io/example_loadnpy.f90!} ``` @@ -198,7 +198,7 @@ Provides a npy file called `filename` that contains the rank-2 `array`. ### Example ```fortran -{!test/examples/io/demo_savenpy.f90!} +{!test/example/io/example_savenpy.f90!} ``` ## `getline` @@ -236,7 +236,7 @@ Read a whole line from a formatted unit into a string variable ### Example ```fortran -{!test/examples/io/demo_getline.f90!} +{!test/example/io/example_getline.f90!} ``` ## Formatting constants @@ -253,5 +253,5 @@ Provides formats for all kinds as defined in the `stdlib_kinds` module. ### Example ```fortran -{!test/examples/io/demo_fmt_constants.f90!} +{!test/example/io/example_fmt_constants.f90!} ``` diff --git a/doc/specs/stdlib_linalg.md b/doc/specs/stdlib_linalg.md index 1db29b651..2edd38a2d 100644 --- a/doc/specs/stdlib_linalg.md +++ b/doc/specs/stdlib_linalg.md @@ -33,23 +33,23 @@ Returns a diagonal array or a vector with the extracted diagonal elements. ### Example ```fortran -{!test/examples/linalg/demo_diag1.f90!} +{!test/example/linalg/example_diag1.f90!} ``` ```fortran -{!test/examples/linalg/demo_diag2.f90!} +{!test/example/linalg/example_diag2.f90!} ``` ```fortran -{!test/examples/linalg/demo_diag3.f90!} +{!test/example/linalg/example_diag3.f90!} ``` ```fortran -{!test/examples/linalg/demo_diag4.f90!} +{!test/example/linalg/example_diag4.f90!} ``` ```fortran -{!test/examples/linalg/demo_diag5.f90!} +{!test/example/linalg/example_diag5.f90!} ``` ## `eye` - Construct the identity matrix @@ -96,11 +96,11 @@ A = eye(2,2)/2.0 !! A == diag([0.5, 0.5]) ### Example ```fortran -{!test/examples/linalg/demo_eye1.f90!} +{!test/example/linalg/example_eye1.f90!} ``` ```fortran -{!test/examples/linalg/demo_eye2.f90!} +{!test/example/linalg/example_eye2.f90!} ``` ## `trace` - Trace of a matrix @@ -127,7 +127,7 @@ Returns the trace of the matrix, i.e. the sum of diagonal elements. ### Example ```fortran -{!test/examples/linalg/demo_trace.f90!} +{!test/example/linalg/example_trace.f90!} ``` ## `outer_product` - Computes the outer product of two vectors @@ -157,7 +157,7 @@ Returns a rank-2 array equal to `u v^T` (where `u, v` are considered column vect ### Example ```fortran -{!test/examples/linalg/demo_outer_product.f90!} +{!test/example/linalg/example_outer_product.f90!} ``` ## `is_square` - Checks if a matrix is square @@ -185,7 +185,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is square, and ` ### Example ```fortran -{!test/examples/linalg/demo_is_square.f90!} +{!test/example/linalg/example_is_square.f90!} ``` ## `is_diagonal` - Checks if a matrix is diagonal @@ -214,7 +214,7 @@ Note that nonsquare matrices may be diagonal, so long as `a_ij = 0` when `i /= j ### Example ```fortran -{!test/examples/linalg/demo_is_diagonal.f90!} +{!test/example/linalg/example_is_diagonal.f90!} ``` ## `is_symmetric` - Checks if a matrix is symmetric @@ -242,7 +242,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is symmetric, an ### Example ```fortran -{!test/examples/linalg/demo_is_symmetric.f90!} +{!test/example/linalg/example_is_symmetric.f90!} ``` ## `is_skew_symmetric` - Checks if a matrix is skew-symmetric @@ -270,7 +270,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is skew-symmetri ### Example ```fortran -{!test/examples/linalg/demo_is_skew_symmetric.f90!} +{!test/example/linalg/example_is_skew_symmetric.f90!} ``` ## `is_hermitian` - Checks if a matrix is Hermitian @@ -298,7 +298,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is Hermitian, an ### Example ```fortran -{!test/examples/linalg/demo_is_hermitian.f90!} +{!test/example/linalg/example_is_hermitian.f90!} ``` ## `is_triangular` - Checks if a matrix is triangular @@ -330,7 +330,7 @@ Specifically, upper triangular matrices satisfy `a_ij = 0` when `j < i`, and low ### Example ```fortran -{!test/examples/linalg/demo_is_triangular.f90!} +{!test/example/linalg/example_is_triangular.f90!} ``` ## `is_hessenberg` - Checks if a matrix is hessenberg @@ -362,5 +362,5 @@ Specifically, upper Hessenberg matrices satisfy `a_ij = 0` when `j < i-1`, and l ### Example ```fortran -{!test/examples/linalg/demo_is_hessenberg.f90!} +{!test/example/linalg/example_is_hessenberg.f90!} ``` diff --git a/doc/specs/stdlib_logger.md b/doc/specs/stdlib_logger.md index 695fc98ed..f9ca089aa 100644 --- a/doc/specs/stdlib_logger.md +++ b/doc/specs/stdlib_logger.md @@ -195,7 +195,7 @@ an `intent(in)` argument. It shall be the name of the file to be opened. #### Example ```fortran -{!test/examples/logger/demo_global_logger.f90!} +{!test/example/logger/example_global_logger.f90!} ``` ### `add_log_unit` - add a unit to the array `self % log_units` @@ -251,7 +251,7 @@ to `unit`. #### Example ```fortran -{!test/examples/logger/demo_add_log_unit.f90!} +{!test/example/logger/example_add_log_unit.f90!} ``` ### `configuration` - report a logger's configuration @@ -378,7 +378,7 @@ Pure subroutine #### Example ```fortran -{!test/examples/logger/demo_configure.f90!} +{!test/example/logger/example_configure.f90!} ``` ### `log_debug` - Writes the string `message` to `self % log_units` @@ -668,7 +668,7 @@ Subroutine #### Example ```fortran -{!test/examples/logger/demo_log_io_error.f90!} +{!test/example/logger/example_log_io_error.f90!} ``` ### `log_message` - write the string `message` to `self % log_units` @@ -817,7 +817,7 @@ Subroutine #### Example ```fortran -{!test/examples/logger/demo_log_text_error.f90!} +{!test/example/logger/example_log_text_error.f90!} ``` ### `log_units_assigned` - returns the number of active I/O units diff --git a/doc/specs/stdlib_math.md b/doc/specs/stdlib_math.md index 8429d7d45..89d5356fe 100644 --- a/doc/specs/stdlib_math.md +++ b/doc/specs/stdlib_math.md @@ -51,14 +51,14 @@ The output is a scalar of `type` and `kind` same as to that of the arguments. Here inputs are of type `integer` and kind `int32` ```fortran -{!test/examples/math/demo_clip_integer.f90!} +{!test/example/math/example_clip_integer.f90!} ``` ##### Example 2: Here inputs are of type `real` and kind `sp` ```fortran -{!test/examples/math/demo_clip_real.f90!} +{!test/example/math/example_clip_real.f90!} ``` ### `gcd` function @@ -95,7 +95,7 @@ Returns an integer of the same `kind` as that of the arguments. ##### Example 1: ```fortran -{!test/examples/math/demo_gcd.f90!} +{!test/example/math/example_gcd.f90!} ``` ### `linspace` - Create a linearly spaced rank one array @@ -138,14 +138,14 @@ If `start`/`end` are `integer` types, the `result` will default to a `real(dp)` Here inputs are of type `complex` and kind `dp` ```fortran -{!test/examples/math/demo_linspace_complex.f90!} +{!test/example/math/example_linspace_complex.f90!} ``` ##### Example 2: Here inputs are of type `integer` and kind `int16`, with the result defaulting to `real(dp)`. ```fortran -{!test/examples/math/demo_linspace_int16.f90!} +{!test/example/math/example_linspace_int16.f90!} ``` ### `logspace` - Create a logarithmically spaced rank one array @@ -207,21 +207,21 @@ For function calls where the `base` is specified, the `type` and `kind` of the r Here inputs are of type `complex` and kind `dp`. `n` and `base` is not specified and thus default to 50 and 10, respectively. ```fortran -{!test/examples/math/demo_logspace_complex.f90!} +{!test/example/math/example_logspace_complex.f90!} ``` ##### Example 2: Here inputs are of type `integer` and default kind. `base` is not specified and thus defaults to 10. ```fortran -{!test/examples/math/demo_logspace_int.f90!} +{!test/example/math/example_logspace_int.f90!} ``` ##### Example 3: Here `start`/`end` are of type `real` and double precision. `base` is type `complex` and also double precision. ```fortran -{!test/examples/math/demo_logspace_rstart_cbase.f90!} +{!test/example/math/example_logspace_rstart_cbase.f90!} ``` ### `arange` function @@ -271,7 +271,7 @@ For `real` type arguments, the length of the result vector is `floor((end - star #### Example ```fortran -{!test/examples/math/demo_math_arange.f90!} +{!test/example/math/example_math_arange.f90!} ``` ### `arg` function @@ -307,7 +307,7 @@ Notes: Although the angle of the complex number `0` is undefined, `arg((0,0))` r #### Example ```fortran -{!test/examples/math/demo_math_arg.f90!} +{!test/example/math/example_math_arg.f90!} ``` ### `argd` function @@ -343,7 +343,7 @@ Notes: Although the angle of the complex number `0` is undefined, `argd((0,0))` #### Example ```fortran -{!test/examples/math/demo_math_argd.f90!} +{!test/example/math/example_math_argd.f90!} ``` ### `argpi` function @@ -379,7 +379,7 @@ Notes: Although the angle of the complex number `0` is undefined, `argpi((0,0))` #### Example ```fortran -{!test/examples/math/demo_math_argpi.f90!} +{!test/example/math/example_math_argpi.f90!} ``` ### `is_close` function @@ -439,7 +439,7 @@ Returns a `logical` scalar/array. #### Example ```fortran -{!test/examples/math/demo_math_is_close.f90!} +{!test/example/math/example_math_is_close.f90!} ``` ### `all_close` function @@ -490,7 +490,7 @@ Returns a `logical` scalar. #### Example ```fortran -{!test/examples/math/demo_math_all_close.f90!} +{!test/example/math/example_math_all_close.f90!} ``` ### `diff` function @@ -552,5 +552,5 @@ When both `prepend` and `append` are not present, the result `y` has one fewer e #### Example ```fortran -{!test/examples/math/demo_diff.f90!} +{!test/example/math/example_diff.f90!} ``` diff --git a/doc/specs/stdlib_optval.md b/doc/specs/stdlib_optval.md index 627f285c7..6abd8ff91 100644 --- a/doc/specs/stdlib_optval.md +++ b/doc/specs/stdlib_optval.md @@ -35,5 +35,5 @@ If `x` is present, the result is `x`, otherwise the result is `default`. ### Example ```fortran -{!test/examples/optval/demo_optval.f90!} +{!test/example/optval/example_optval.f90!} ``` diff --git a/doc/specs/stdlib_quadrature.md b/doc/specs/stdlib_quadrature.md index fa4247bdb..4566d4d9a 100644 --- a/doc/specs/stdlib_quadrature.md +++ b/doc/specs/stdlib_quadrature.md @@ -39,7 +39,7 @@ If the size of `y` is zero or one, the result is zero. ### Example ```fortran -{!test/examples/quadrature/demo_trapz.f90!} +{!test/example/quadrature/example_trapz.f90!} ``` ## `trapz_weights` - trapezoidal rule weights for given abscissas @@ -69,7 +69,7 @@ If the size of `x` is one, then the sole element of the result is zero. ### Example ```fortran -{!test/examples/quadrature/demo_trapz_weights.f90!} +{!test/example/quadrature/example_trapz_weights.f90!} ``` ## `simps` - integrate sampled values using Simpson's rule @@ -111,7 +111,7 @@ If the size of `y` is two, the result is the same as if `trapz` had been called ### Example ```fortran -{!test/examples/quadrature/demo_simps.f90!} +{!test/example/quadrature/example_simps.f90!} ``` ## `simps_weights` - Simpson's rule weights for given abscissas @@ -147,7 +147,7 @@ If the size of `x` is two, then the result is the same as if `trapz_weights` had ### Example ```fortran -{!test/examples/quadrature/demo_simps_weights.f90!} +{!test/example/quadrature/example_simps_weights.f90!} ``` ## `gauss_legendre` - Gauss-Legendre quadrature (a.k.a. Gaussian quadrature) nodes and weights @@ -185,7 +185,7 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -{!test/examples/quadrature/demo_gauss_legendre.f90!} +{!test/example/quadrature/example_gauss_legendre.f90!} ``` ## `gauss_legendre_lobatto` - Gauss-Legendre-Lobatto quadrature nodes and weights @@ -223,5 +223,5 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -{!test/examples/quadrature/demo_gauss_legendre_lobatto.f90!} +{!test/example/quadrature/example_gauss_legendre_lobatto.f90!} ``` diff --git a/doc/specs/stdlib_random.md b/doc/specs/stdlib_random.md index 3fd70cbf4..14c14f210 100644 --- a/doc/specs/stdlib_random.md +++ b/doc/specs/stdlib_random.md @@ -33,7 +33,7 @@ Return a scalar of type `integer`. ### Example ```fortran -{!test/examples/random/demo_random_seed.f90!} +{!test/example/random/example_random_seed.f90!} ``` ## `dist_rand` - Get a random integer with specified kind @@ -61,5 +61,5 @@ Return a scalar of type `integer`. ### Example ```fortran -{!test/examples/random/demo_dist_rand.f90!} +{!test/example/random/example_dist_rand.f90!} ``` diff --git a/doc/specs/stdlib_selection.md b/doc/specs/stdlib_selection.md index 64a7dcfd4..f2e7a3b79 100644 --- a/doc/specs/stdlib_selection.md +++ b/doc/specs/stdlib_selection.md @@ -107,7 +107,7 @@ code here to be released under stdlib's MIT license. ### Example ```fortran -{!test/examples/selection/demo_select.f90!} +{!test/example/selection/example_select.f90!} ``` ## `arg_select` - find the index of the k-th smallest value in an input array @@ -190,7 +190,7 @@ code here to be released under stdlib's MIT license. ```fortran -{!test/examples/selection/demo_arg_select.f90!} +{!test/example/selection/example_arg_select.f90!} ``` ## Comparison with using `sort` @@ -201,7 +201,7 @@ should see a speed improvement with the selection routines which grows like LOG(size(`array`)). ```fortran -{!test/examples/selection/selection_vs_sort.f90!} +{!test/example/selection/selection_vs_sort.f90!} ``` The results seem consistent with expectations when the `array` is large; the program prints: diff --git a/doc/specs/stdlib_sorting.md b/doc/specs/stdlib_sorting.md index b0b5b13e0..5d90e1bd3 100644 --- a/doc/specs/stdlib_sorting.md +++ b/doc/specs/stdlib_sorting.md @@ -261,7 +261,7 @@ function `LGT`. ##### Example ```fortran -{!test/examples/sorting/demo_ord_sort.f90!} +{!test/example/sorting/example_ord_sort.f90!} ``` #### `sort` - sorts an input array @@ -315,7 +315,7 @@ element of `array` is a `NaN`. Sorting of `CHARACTER(*)` and ```fortran -{!test/examples/sorting/demo_sort.f90!} +{!test/example/sorting/example_sort.f90!} ``` #### `sort_index` - creates an array of sorting indices for an input array, while also sorting the array. diff --git a/doc/specs/stdlib_specialfunctions_gamma.md b/doc/specs/stdlib_specialfunctions_gamma.md index 06b40f489..f95103bb3 100644 --- a/doc/specs/stdlib_specialfunctions_gamma.md +++ b/doc/specs/stdlib_specialfunctions_gamma.md @@ -38,7 +38,7 @@ The function returns a value with the same type and kind as input argument. ### Example ```fortran -{!test/examples/specialfunctions_gamma/demo_gamma.f90!} +{!test/example/specialfunctions_gamma/example_gamma.f90!} ``` ## `log_gamma` - Calculate the natural logarithm of the gamma function @@ -72,7 +72,7 @@ The function returns real single precision values for integer input arguments, w ### Example ```fortran -{!test/examples/specialfunctions_gamma/demo_log_gamma.f90!} +{!test/example/specialfunctions_gamma/example_log_gamma.f90!} ``` ## `log_factorial` - calculate the logarithm of a factorial @@ -103,7 +103,7 @@ The function returns real type values with single precision. ### Example ```fortran -{!test/examples/specialfunctions_gamma/demo_log_factorial.f90!} +{!test/example/specialfunctions_gamma/example_log_factorial.f90!} ``` ## `lower_incomplete_gamma` - calculate lower incomplete gamma integral @@ -140,7 +140,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!test/examples/specialfunctions_gamma/demo_ligamma.f90!} +{!test/example/specialfunctions_gamma/example_ligamma.f90!} ``` ## `upper_incomplete_gamma` - calculate the upper incomplete gamma integral @@ -177,7 +177,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!test/examples/specialfunctions_gamma/demo_uigamma.f90!} +{!test/example/specialfunctions_gamma/example_uigamma.f90!} ``` ## `log_lower_incomplete_gamma` - calculate the natural logarithm of the lower incomplete gamma integral @@ -272,7 +272,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!test/examples/specialfunctions_gamma/demo_gamma_p.f90!} +{!test/example/specialfunctions_gamma/example_gamma_p.f90!} ``` ## `regularized_gamma_q` - calculate the gamma quotient Q @@ -309,5 +309,5 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!test/examples/specialfunctions_gamma/demo_gamma_q.f90!} +{!test/example/specialfunctions_gamma/example_gamma_q.f90!} ``` diff --git a/doc/specs/stdlib_stats.md b/doc/specs/stdlib_stats.md index 7b42f31fb..cb4d54a77 100644 --- a/doc/specs/stdlib_stats.md +++ b/doc/specs/stdlib_stats.md @@ -52,7 +52,7 @@ If `mask` is specified, the result is the Pearson correlation of all elements of ### Example ```fortran -{!test/examples/stats/demo_corr.f90!} +{!test/example/stats/example_corr.f90!} ``` ## `cov` - covariance of array elements @@ -108,7 +108,7 @@ If `mask` is specified, the result is the covariance of all elements of `array` ### Example ```fortran -{!test/examples/stats/demo_cov.f90!} +{!test/example/stats/example_cov.f90!} ``` ## `mean` - mean of array elements @@ -151,7 +151,7 @@ If `mask` is specified, the result is the mean of all elements of `array` corres ### Example ```fortran -{!test/examples/stats/demo_mean.f90!} +{!test/example/stats/example_mean.f90!} ``` ## `median` - median of array elements @@ -216,7 +216,7 @@ If `mask` is specified, the result is the median of all elements of `array` corr ### Example ```fortran -{!test/examples/stats/demo_median.f90!} +{!test/example/stats/example_median.f90!} ``` ## `moment` - central moments of array elements @@ -280,7 +280,7 @@ If `mask` is specified, the result is the _k_-th (central) moment of all elemen ### Example ```fortran -{!test/examples/stats/demo_moment.f90!} +{!test/example/stats/example_moment.f90!} ``` ## `var` - variance of array elements @@ -338,5 +338,5 @@ If the variance is computed with only one single element, then the result is IEE ### Example ```fortran -{!test/examples/stats/demo_var.f90!} +{!test/example/stats/example_var.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_exponential.md b/doc/specs/stdlib_stats_distribution_exponential.md index d755a7135..8fad691f9 100644 --- a/doc/specs/stdlib_stats_distribution_exponential.md +++ b/doc/specs/stdlib_stats_distribution_exponential.md @@ -46,7 +46,7 @@ The result is a scalar or rank one array with a size of `array_size`, and has th ### Example ```fortran -{!test/examples/stats_distribution_exponential/demo_exponential_rvs.f90!} +{!test/example/stats_distribution_exponential/example_exponential_rvs.f90!} ``` ## `pdf_exp` - exponential distribution probability density function @@ -90,7 +90,7 @@ The result is a scalar or an array, with a shape conformable to arguments, and h ### Example ```fortran -{!test/examples/stats_distribution_exponential/demo_exponential_pdf.f90!} +{!test/example/stats_distribution_exponential/example_exponential_pdf.f90!} ``` ## `cdf_exp` - exponential cumulative distribution function @@ -134,5 +134,5 @@ The result is a scalar or an array, with a shape conformable to arguments, and h ### Example ```fortran -{!test/examples/stats_distribution_exponential/demo_exponential_cdf.f90!} +{!test/example/stats_distribution_exponential/example_exponential_cdf.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_normal.md b/doc/specs/stdlib_stats_distribution_normal.md index bab21f822..ef1add080 100644 --- a/doc/specs/stdlib_stats_distribution_normal.md +++ b/doc/specs/stdlib_stats_distribution_normal.md @@ -49,7 +49,7 @@ The result is a scalar or rank one array, with a size of `array_size`, and as th ### Example ```fortran -{!test/examples/stats_distribution_normal/demo_normal_rvs.f90!} +{!test/example/stats_distribution_normal/example_normal_rvs.f90!} ``` ## `pdf_normal` - normal distribution probability density function @@ -93,7 +93,7 @@ The result is a scalar or an array, with a shape conformable to arguments, and a ### Example ```fortran -{!test/examples/stats_distribution_normal/demo_normal_pdf.f90!} +{!test/example/stats_distribution_normal/example_normal_pdf.f90!} ``` ## `cdf_normal` - normal distribution cumulative distribution function @@ -137,5 +137,5 @@ The result is a scalar or an array, with a shape conformable to arguments, as th ### Example ```fortran -{!test/examples/stats_distribution_normal/demo_norm_cdf.f90!} +{!test/example/stats_distribution_normal/example_norm_cdf.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_uniform.md b/doc/specs/stdlib_stats_distribution_uniform.md index ead740a9a..f2adc9b5f 100644 --- a/doc/specs/stdlib_stats_distribution_uniform.md +++ b/doc/specs/stdlib_stats_distribution_uniform.md @@ -35,7 +35,7 @@ Return a randomized rank one array of the input type. ### Example ```fortran -{!test/examples/stats_distribution_uniform/demo_shuffle.f90!} +{!test/example/stats_distribution_uniform/example_shuffle.f90!} ``` ## `rvs_uniform` - uniform distribution random variates @@ -85,7 +85,7 @@ The result is a scalar or a rank one array with size of `array_size`, of type `i ### Example ```fortran -{!test/examples/stats_distribution_uniform/demo_uniform_rvs.f90!} +{!test/example/stats_distribution_uniform/example_uniform_rvs.f90!} ``` ## `pdf_uniform` - Uniform distribution probability density function @@ -133,7 +133,7 @@ The result is a scalar or an array, with a shape conformable to arguments, of ty ### Example ```fortran -{!test/examples/stats_distribution_uniform/demo_uniform_pdf.f90!} +{!test/example/stats_distribution_uniform/example_uniform_pdf.f90!} ``` ## `cdf_uniform` - Uniform distribution cumulative distribution function @@ -183,5 +183,5 @@ The result is a scalar or an array, with a shape conformable to arguments, of ty ### Example ```fortran -{!test/examples/stats_distribution_uniform/demo_uniform_cdf.f90!} +{!test/example/stats_distribution_uniform/example_uniform_cdf.f90!} ``` diff --git a/doc/specs/stdlib_string_type.md b/doc/specs/stdlib_string_type.md index edba8639c..f77ab2bcb 100644 --- a/doc/specs/stdlib_string_type.md +++ b/doc/specs/stdlib_string_type.md @@ -67,7 +67,7 @@ The result is an instance of `string_type` with zero length. #### Example ```fortran -{!test/examples/string_type/demo_constructor_empty.f90!} +{!test/example/string_type/example_constructor_empty.f90!} ``` @@ -105,7 +105,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!test/examples/string_type/demo_constructor_scalar.f90!} +{!test/example/string_type/example_constructor_scalar.f90!} ``` @@ -139,7 +139,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!test/examples/string_type/demo_constructor_integer.f90!} +{!test/example/string_type/example_constructor_integer.f90!} ``` @@ -173,7 +173,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!test/examples/string_type/demo_constructor_logical.f90!} +{!test/example/string_type/example_constructor_logical.f90!} ``` @@ -202,7 +202,7 @@ Elemental subroutine, `assignment(=)`. #### Example ```fortran -{!test/examples/string_type/demo_constructor_character.f90!} +{!test/example/string_type/example_constructor_character.f90!} ``` @@ -236,7 +236,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/examples/string_type/demo_len.f90!} +{!test/example/string_type/example_len.f90!} ``` @@ -271,7 +271,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/examples/string_type/demo_len_trim.f90!} +{!test/example/string_type/example_len_trim.f90!} ``` @@ -306,7 +306,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/examples/string_type/demo_trim.f90!} +{!test/example/string_type/example_trim.f90!} ``` @@ -341,7 +341,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/examples/string_type/demo_adjustl.f90!} +{!test/example/string_type/example_adjustl.f90!} ``` @@ -376,7 +376,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/examples/string_type/demo_adjustr.f90!} +{!test/example/string_type/example_adjustr.f90!} ``` @@ -412,7 +412,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/examples/string_type/demo_repeat.f90!} +{!test/example/string_type/example_repeat.f90!} ``` @@ -446,7 +446,7 @@ The result is a scalar character value. #### Example ```fortran -{!test/examples/string_type/demo_char.f90!} +{!test/example/string_type/example_char.f90!} ``` @@ -481,7 +481,7 @@ The result is a scalar character value. #### Example ```fortran -{!test/examples/string_type/demo_char_position.f90!} +{!test/example/string_type/example_char_position.f90!} ``` @@ -517,7 +517,7 @@ The result is a scalar character value. #### Example ```fortran -{!test/examples/string_type/demo_char_range.f90!} +{!test/example/string_type/example_char_range.f90!} ``` @@ -554,7 +554,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/examples/string_type/demo_ichar.f90!} +{!test/example/string_type/example_ichar.f90!} ``` @@ -591,7 +591,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/examples/string_type/demo_iachar.f90!} +{!test/example/string_type/example_iachar.f90!} ``` @@ -631,7 +631,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/examples/string_type/demo_index.f90!} +{!test/example/string_type/example_index.f90!} ``` @@ -671,7 +671,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/examples/string_type/demo_scan.f90!} +{!test/example/string_type/example_scan.f90!} ``` @@ -711,7 +711,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/examples/string_type/demo_verify.f90!} +{!test/example/string_type/example_verify.f90!} ``` @@ -750,7 +750,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_lgt.f90!} +{!test/example/string_type/example_lgt.f90!} ``` @@ -789,7 +789,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_llt.f90!} +{!test/example/string_type/example_llt.f90!} ``` @@ -829,7 +829,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_lge.f90!} +{!test/example/string_type/example_lge.f90!} ``` @@ -869,7 +869,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_lle.f90!} +{!test/example/string_type/example_lle.f90!} ``` @@ -904,7 +904,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/examples/string_type/demo_to_lower.f90!} +{!test/example/string_type/example_to_lower.f90!} ``` @@ -939,7 +939,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/examples/string_type/demo_to_upper.f90!} +{!test/example/string_type/example_to_upper.f90!} ``` @@ -979,7 +979,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/examples/string_type/demo_to_title.f90!} +{!test/example/string_type/example_to_title.f90!} ``` @@ -1016,7 +1016,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/examples/string_type/demo_to_sentence.f90!} +{!test/example/string_type/example_to_sentence.f90!} ``` @@ -1050,7 +1050,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/examples/string_type/demo_reverse.f90!} +{!test/example/string_type/example_reverse.f90!} ``` @@ -1092,7 +1092,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_gt.f90!} +{!test/example/string_type/example_gt.f90!} ``` @@ -1134,7 +1134,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_lt.f90!} +{!test/example/string_type/example_lt.f90!} ``` @@ -1176,7 +1176,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_ge.f90!} +{!test/example/string_type/example_ge.f90!} ``` @@ -1218,7 +1218,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_le.f90!} +{!test/example/string_type/example_le.f90!} ``` @@ -1260,7 +1260,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_eq.f90!} +{!test/example/string_type/example_eq.f90!} ``` @@ -1302,7 +1302,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/examples/string_type/demo_ne.f90!} +{!test/example/string_type/example_ne.f90!} ``` @@ -1341,7 +1341,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!test/examples/string_type/demo_cont.f90!} +{!test/example/string_type/example_cont.f90!} ``` @@ -1378,7 +1378,7 @@ Unformatted user defined derived type output. #### Example ```fortran -{!test/examples/string_type/demo_uwrite.f90!} +{!test/example/string_type/example_uwrite.f90!} ``` @@ -1421,7 +1421,7 @@ Formatted user defined derived type output. #### Example ```fortran -{!test/examples/string_type/demo_fwrite.f90!} +{!test/example/string_type/example_fwrite.f90!} ``` @@ -1460,7 +1460,7 @@ Unformatted derived type input. #### Example ```fortran -{!test/examples/string_type/demo_uread.f90!} +{!test/example/string_type/example_uread.f90!} ``` @@ -1507,7 +1507,7 @@ Formatted derived type input. #### Example ```fortran -{!test/examples/string_type/demo_fread.f90!} +{!test/example/string_type/example_fread.f90!} ``` @@ -1542,5 +1542,5 @@ Pure subroutine (Elemental subroutine, only when both `from` and `to` are `type( #### Example ```fortran -{!test/examples/string_type/demo_move.f90!} +{!test/example/string_type/example_move.f90!} ``` diff --git a/doc/specs/stdlib_stringlist_type.md b/doc/specs/stdlib_stringlist_type.md index 43fb0ca4d..304ad9060 100644 --- a/doc/specs/stdlib_stringlist_type.md +++ b/doc/specs/stdlib_stringlist_type.md @@ -72,7 +72,7 @@ The result is of type `stringlist_index_type`. #### Example ```fortran -{!test/examples/stringlist_type/demo_fidx_bidx.f90!} +{!test/example/stringlist_type/example_stringlist_type_fidx_bidx.f90!} ``` @@ -108,7 +108,7 @@ The result is an instance of type `stringlist_type`. #### Example ```fortran -{!test/examples/stringlist_type/demo_constructor.f90!} +{!test/example/stringlist_type/example_stringlist_type_constructor.f90!} ``` @@ -142,7 +142,7 @@ Pure subroutine. #### Example ```fortran -{!test/examples/stringlist_type/demo_insert_at.f90!} +{!test/example/stringlist_type/example_stringlist_type_insert_at.f90!} ``` @@ -177,7 +177,7 @@ The result is a string of type `string_type`. #### Example ```fortran -{!test/examples/stringlist_type/demo_get.f90!} +{!test/example/stringlist_type/example_stringlist_type_get.f90!} ``` @@ -211,7 +211,7 @@ The result is of type `integer`. #### Example ```fortran -{!test/examples/stringlist_type/demo_len.f90!} +{!test/example/stringlist_type/example_stringlist_type_len.f90!} ``` @@ -241,7 +241,7 @@ No arguments. #### Example ```fortran -{!test/examples/stringlist_type/demo_clear.f90!} +{!test/example/stringlist_type/example_stringlist_type_clear.f90!} ``` @@ -283,7 +283,7 @@ The result is a default `logical` scalar value. #### Example ```fortran -{!test/examples/stringlist_type/demo_equality_operator.f90!} +{!test/example/stringlist_type/example_stringlist_type_equality_operator.f90!} ``` @@ -325,7 +325,7 @@ The result is a default `logical` scalar value. #### Example ```fortran -{!test/examples/stringlist_type/demo_inequality_operator.f90!} +{!test/example/stringlist_type/example_stringlist_type_inequality_operator.f90!} ``` @@ -365,5 +365,5 @@ The result is an instance of `[[stdlib_stringlist_type(module):stringlist_type(t #### Example ```fortran -{!test/examples/stringlist_type/demo_concatenate_operator.f90!} +{!test/example/stringlist_type/example_stringlist_type_concatenate_operator.f90!} ``` diff --git a/doc/specs/stdlib_strings.md b/doc/specs/stdlib_strings.md index bba57b4b8..16e135850 100644 --- a/doc/specs/stdlib_strings.md +++ b/doc/specs/stdlib_strings.md @@ -45,7 +45,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/examples/strings/demo_strip.f90!} +{!test/example/strings/example_strip.f90!} ``` @@ -84,7 +84,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/examples/strings/demo_chomp.f90!} +{!test/example/strings/example_chomp.f90!} ``` @@ -121,7 +121,7 @@ The result is of scalar logical type. #### Example ```fortran -{!test/examples/strings/demo_starts_with.f90!} +{!test/example/strings/example_starts_with.f90!} ``` @@ -158,7 +158,7 @@ The result is of scalar logical type. #### Example ```fortran -{!test/examples/strings/demo_ends_with.f90!} +{!test/example/strings/example_ends_with.f90!} ``` @@ -213,7 +213,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/examples/strings/demo_slice.f90!} +{!test/example/strings/example_slice.f90!} ``` @@ -258,7 +258,7 @@ The result is a scalar of integer type or an integer array of rank equal to the #### Example ```fortran -{!test/examples/strings/demo_find.f90!} +{!test/example/strings/example_find.f90!} ``` @@ -298,7 +298,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/examples/strings/demo_replace_all.f90!} +{!test/example/strings/example_replace_all.f90!} ``` @@ -338,7 +338,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/examples/strings/demo_padl.f90!} +{!test/example/strings/example_padl.f90!} ``` @@ -378,7 +378,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/examples/strings/demo_padr.f90!} +{!test/example/strings/example_padr.f90!} ``` @@ -418,7 +418,7 @@ The result is a scalar of integer type or an integer array of rank equal to the #### Example ```fortran -{!test/examples/strings/demo_count.f90!} +{!test/example/strings/example_count.f90!} ``` @@ -457,5 +457,5 @@ The result is an `allocatable` length `character` scalar with up to `128` cached #### Example ```fortran -{!test/examples/strings/demo_to_string.f90!} +{!test/example/strings/example_to_string.f90!} ``` diff --git a/doc/specs/stdlib_version.md b/doc/specs/stdlib_version.md index d8fe031b0..1cbf3d3df 100644 --- a/doc/specs/stdlib_version.md +++ b/doc/specs/stdlib_version.md @@ -54,5 +54,5 @@ Pure subroutine. #### Example ```fortran -{!test/examples/version/demo_version.f90!} +{!test/example/version/example_version.f90!} ``` diff --git a/src/stdlib_bitsets.fypp b/src/stdlib_bitsets.fypp index f4cd7013e..0605f2792 100644 --- a/src/stdlib_bitsets.fypp +++ b/src/stdlib_bitsets.fypp @@ -151,7 +151,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_all +!! program example_all !! use stdlib_bitsets !! character(*), parameter :: & !! bits_all = '111111111111111111111111111111111' @@ -167,7 +167,7 @@ module stdlib_bitsets !! write(*,*) "FROM_STRING transferred BITS_ALL properly" // & !! " into set0." !! end if -!! end program demo_all +!! end program example_all !!``` import :: bitset_type logical :: all @@ -182,7 +182,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_any +!! program example_any !! use stdlib_bitsets !! character(*), parameter :: & !! bits_0 = '0000000000000000000' @@ -196,7 +196,7 @@ module stdlib_bitsets !! if ( set0 % any() ) then !! write(*,*) "ANY interpreted SET0's value properly." !! end if -!! end program demo_any +!! end program example_any !!``` import :: bitset_type logical :: any @@ -211,7 +211,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_bit_count +!! program example_bit_count !! use stdlib_bitsets !! character(*), parameter :: & !! bits_0 = '0000000000000000000' @@ -225,7 +225,7 @@ module stdlib_bitsets !! if ( set0 % bit_count() == 1 ) then !! write(*,*) "BIT_COUNT interpreted SET0's value properly." !! end if -!! end program demo_bit_count +!! end program example_bit_count !!``` import :: bitset_type, bits_kind integer(bits_kind) :: bit_count @@ -241,7 +241,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_clear +!! program example_clear !! use stdlib_bitsets !! type(bitset_large) :: set0 !! call set0 % init(166) @@ -251,7 +251,7 @@ module stdlib_bitsets !! if ( .not. set0 % test(165) ) write(*,*) 'Bit 165 is cleared.' !! call set0 % clear(0,164) !! if ( set0 % none() ) write(*,*) 'All bits are cleared.' -!! end program demo_clear +!! end program example_clear !!``` import :: bitset_type, bits_kind class(bitset_type), intent(inout) :: self @@ -279,7 +279,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_flip +!! program example_flip !! use stdlib_bitsets !! type(bitset_large) :: set0 !! call set0 % init(166) @@ -288,7 +288,7 @@ module stdlib_bitsets !! if ( set0 % test(165) ) write(*,*) 'Bit 165 is flipped.' !! call set0 % flip(0,164) !! if ( set0 % all() ) write(*,*) 'All bits are flipped.' -!! end program demo_flip +!! end program example_flip !!``` import :: bitset_type, bits_kind class(bitset_type), intent(inout) :: self @@ -319,7 +319,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_from_string +!! program example_from_string !! use stdlib_bitsets !! character(*), parameter :: & !! bits_all = '111111111111111111111111111111111' @@ -335,7 +335,7 @@ module stdlib_bitsets !! write(*,*) "FROM_STRING transferred BITS_ALL properly" // & !! " into set0." !! end if -!! end program demo_from_string +!! end program example_from_string !!``` import :: bitset_type class(bitset_type), intent(out) :: self @@ -356,14 +356,14 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_init +!! program example_init !! use stdlib_bitsets !! type(bitset_large) :: set0 !! call set0 % init(166) !! if ( set0 % bits() == 166 ) & !! write(*,*) `SET0 has the proper size.' !! if ( set0 % none() ) write(*,*) 'SET0 is properly initialized.' -!! end program demo_init +!! end program example_init !!``` import :: bitset_type, bits_kind class(bitset_type), intent(out) :: self @@ -387,7 +387,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_input +!! program example_input !! character(*), parameter :: & !! bits_0 = '000000000000000000000000000000000', & !! bits_1 = '000000000000000000000000000000001', & @@ -416,7 +416,7 @@ module stdlib_bitsets !! write(*,*) 'Transfer to and from units using ' // & !! 'output and input succeeded.' !! end if -!! end program demo_input +!! end program example_input !!``` import :: bitset_type class(bitset_type), intent(out) :: self @@ -432,7 +432,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_none +!! program example_none !! use stdlib_bitsets !! character(*), parameter :: & !! bits_0 = '0000000000000000000' @@ -446,7 +446,7 @@ module stdlib_bitsets !! if ( .not. set0 % none() ) then !! write(*,*) "NONE interpreted SET0's value properly." !! end if -!! end program demo_none +!! end program example_none !!``` import :: bitset_type logical :: none @@ -461,7 +461,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_not +!! program example_not !! use stdlib_bitsets !! type(bitset_large) :: set0 !! call set0 % init( 155 ) @@ -473,7 +473,7 @@ module stdlib_bitsets !! if ( set0 % all() ) then !! write(*,*) "ALL interpreted SET0's value properly." !! end if -!! end program demo_not +!! end program example_not !!``` import :: bitset_type class(bitset_type), intent(inout) :: self @@ -491,7 +491,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_output +!! program example_output !! character(*), parameter :: & !! bits_0 = '000000000000000000000000000000000', & !! bits_1 = '000000000000000000000000000000001', & @@ -520,7 +520,7 @@ module stdlib_bitsets !! write(*,*) 'Transfer to and from units using ' // & !! 'output and input succeeded.' !! end if -!! end program demo_output +!! end program example_output !!``` import :: bitset_type class(bitset_type), intent(in) :: self @@ -550,7 +550,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_read_bitset +!! program example_read_bitset !! character(*), parameter :: & !! bits_0 = 'S33B000000000000000000000000000000000', & !! bits_1 = 'S33B000000000000000000000000000000001', & @@ -582,7 +582,7 @@ module stdlib_bitsets !! if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then !! write(*,*) WRITE_BITSET to READ_BITSET through unit worked.' !! end if -!! end program demo_read_bitset +!! end program example_read_bitset !!``` import :: bitset_type class(bitset_type), intent(out) :: self @@ -630,7 +630,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_set +!! program example_set !! use stdlib_bitsets !! type(bitset_large) :: set0 !! call set0 % init(166) @@ -639,7 +639,7 @@ module stdlib_bitsets !! if ( set0 % test(165) ) write(*,*) 'Bit 165 is set.' !! call set0 % set(0,164) !! if ( set0 % all() ) write(*,*) 'All bits are set.' -!! end program demo_set +!! end program example_set !!``` import :: bitset_type, bits_kind class(bitset_type), intent(inout) :: self @@ -666,7 +666,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_test +!! program example_test !! use stdlib_bitsets !! type(bitset_large) :: set0 !! call set0 % init(166) @@ -676,7 +676,7 @@ module stdlib_bitsets !! if ( .not. set0 % test(165) ) write(*,*) 'Bit 165 is cleared.' !! call set0 % set(165) !! if ( set0 % test(165) ) write(*,*) 'Bit 165 is set.' -!! end program demo_test +!! end program example_test !!``` import :: bitset_type, bits_kind logical :: test @@ -693,7 +693,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_to_string +!! program example_to_string !! use stdlib_bitsets !! character(*), parameter :: & !! bits_all = '111111111111111111111111111111111' @@ -706,7 +706,7 @@ module stdlib_bitsets !! write(*,*) "TO_STRING transferred BITS0 properly" // & !! " into NEW_STRING." !! end if -!! end program demo_to_string +!! end program example_to_string !!``` import :: bitset_type class(bitset_type), intent(in) :: self @@ -723,7 +723,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_value +!! program example_value !! use stdlib_bitsets !! type(bitset_large) :: set0 !! call set0 % init(166) @@ -733,7 +733,7 @@ module stdlib_bitsets !! if ( set0 % value(165) == 0 ) write(*,*) 'Bit 165 is cleared.' !! call set0 % set(165) !! if ( set0 % value(165) == 1 ) write(*,*) 'Bit 165 is set.' -!! end program demo_value +!! end program example_value !!``` import :: bitset_type, bits_kind integer :: value @@ -754,7 +754,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_write_bitset +!! program example_write_bitset !! character(*), parameter :: & !! bits_0 = 'S33B000000000000000000000000000000000', & !! bits_1 = 'S33B000000000000000000000000000000001', & @@ -786,7 +786,7 @@ module stdlib_bitsets !! if ( set3 == set0 .and. set4 == set1 .and. set5 == set2 ) then !! write(*,*) WRITE_BITSET to READ_BITSET through unit worked.' !! end if -!! end program demo_write_bitset +!! end program example_write_bitset !!``` import :: bitset_type class(bitset_type), intent(in) :: self @@ -1140,7 +1140,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_assignment +!! program example_assignment !! use stdlib_bitsets !! logical(int8) :: logical1(64) = .true. !! logical(int32), allocatable :: logical2(:) @@ -1163,7 +1163,7 @@ module stdlib_bitsets !! if ( all( logical2 ) ) then !! write(*,*) 'Initialization of logical(int32) succeeded.' !! end if -!! end program demo_assignment +!! end program example_assignment !!``` pure module subroutine assign_large( set1, set2 ) @@ -1552,7 +1552,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_and +!! program example_and !! use stdlib_bitsets !! type(bitset_large) :: set0, set1 !! call set0 % init(166) @@ -1568,7 +1568,7 @@ module stdlib_bitsets !! call set0 % not() !! call and( set0, set1 ) ! all all !! if ( all(set0) ) write(*,*) 'Fourth test of AND worked.' -!! end program demo_and +!! end program example_and !!``` elemental module subroutine and_large(set1, set2) type(bitset_large), intent(inout) :: set1 @@ -1595,7 +1595,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_and_not +!! program example_and_not !! use stdlib_bitsets !! type(bitset_large) :: set0, set1 !! call set0 % init(166) @@ -1612,7 +1612,7 @@ module stdlib_bitsets !! call set0 % not() !! call and_not( set0, set1 ) ! all all !! if ( none(set0) ) write(*,*) 'Fourth test of AND_NOT worked.' -!! end program demo_and_not +!! end program example_and_not !!``` elemental module subroutine and_not_large(set1, set2) @@ -1641,7 +1641,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_extract +!! program example_extract !! use stdlib_bitsets !! type(bitset_large) :: set0, set1 !! call set0 % init(166) @@ -1650,7 +1650,7 @@ module stdlib_bitsets !! if ( set1 % bits() == 51 ) & !! write(*,*) 'SET1 has the proper size.' !! if ( set1 % all() ) write(*,*) 'SET1 has the proper values.' -!! end program demo_extract +!! end program example_extract !!``` module subroutine extract_large(new, old, start_pos, stop_pos, status) @@ -1681,7 +1681,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_or +!! program example_or !! use stdlib_bitsets !! type(bitset_large) :: set0, set1 !! call set0 % init(166) @@ -1698,7 +1698,7 @@ module stdlib_bitsets !! call set0 % not() !! call or( set0, set1 ) ! all all !! if ( all(set0) ) write(*,*) 'Fourth test of OR worked.' -!! end program demo_or +!! end program example_or !!``` elemental module subroutine or_large(set1, set2) type(bitset_large), intent(inout) :: set1 @@ -1724,7 +1724,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_xor +!! program example_xor !! use stdlib_bitsets !! type(bitset_large) :: set0, set1 !! call set0 % init(166) @@ -1741,7 +1741,7 @@ module stdlib_bitsets !! call set0 % not() !! call xor( set0, set1 ) ! all all !! if ( none(set0) ) write(*,*) 'Fourth test of XOR worked.' -!! end program demo_xor +!! end program example_xor !!``` elemental module subroutine xor_large(set1, set2) type(bitset_large), intent(inout) :: set1 @@ -1767,7 +1767,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_equality +!! program example_equality !! use stdlib_bitsets !! type(bitset_64) :: set0, set1, set2 !! call set0 % init( 33 ) @@ -1782,7 +1782,7 @@ module stdlib_bitsets !! else !! error stop 'Failed 64 bit equality tests.' !! end if -!! end program demo_equality +!! end program example_equality !!``` elemental module function eqv_large(set1, set2) result(eqv) logical :: eqv @@ -1808,7 +1808,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_inequality +!! program example_inequality !! use stdlib_bitsets !! type(bitset_64) :: set0, set1, set2 !! call set0 % init( 33 ) @@ -1823,7 +1823,7 @@ module stdlib_bitsets !! else !! error stop 'Failed 64 bit inequality tests.' !! end if -!! end program demo_inequality +!! end program example_inequality !!``` elemental module function neqv_large(set1, set2) result(neqv) logical :: neqv @@ -1850,7 +1850,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_gt +!! program example_gt !! use stdlib_bitsets !! type(bitset_64) :: set0, set1, set2 !! call set0 % init( 33 ) @@ -1865,7 +1865,7 @@ module stdlib_bitsets !! else !! error stop 'Failed 64 bit greater than tests.' !! end if -!! end program demo_gt +!! end program example_gt !!``` elemental module function gt_large(set1, set2) result(gt) logical :: gt @@ -1892,7 +1892,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_ge +!! program example_ge !! use stdlib_bitsets !! type(bitset_64) :: set0, set1, set2 !! call set0 % init( 33 ) @@ -1908,7 +1908,7 @@ module stdlib_bitsets !! else !! error stop 'Failed 64 bit greater than or equals tests.' !! end if -!! end program demo_ge +!! end program example_ge !!``` elemental module function ge_large(set1, set2) result(ge) logical :: ge @@ -1935,7 +1935,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_lt +!! program example_lt !! use stdlib_bitsets !! type(bitset_64) :: set0, set1, set2 !! call set0 % init( 33 ) @@ -1950,7 +1950,7 @@ module stdlib_bitsets !! else !! error stop 'Failed 64 bit less than tests.' !! end if -!! end program demo_lt +!! end program example_lt !!``` elemental module function lt_large(set1, set2) result(lt) logical :: lt @@ -1977,7 +1977,7 @@ module stdlib_bitsets !!#### Example !! !!```fortran -!! program demo_le +!! program example_le !! use stdlib_bitsets !! type(bitset_64) :: set0, set1, set2 !! call set0 % init( 33 ) @@ -1993,7 +1993,7 @@ module stdlib_bitsets !! else !! error stop 'Failed 64 bit less than or equal tests.' !! end if -!! end program demo_le +!! end program example_le !!``` elemental module function le_large(set1, set2) result(le) logical :: le diff --git a/test/example/CMakeLists.txt b/test/example/CMakeLists.txt index 10c4bc3d2..3dd43694f 100644 --- a/test/example/CMakeLists.txt +++ b/test/example/CMakeLists.txt @@ -1,10 +1,10 @@ -macro(ADD_DEMO name) - add_executable(demo_${name} demo_${name}.f90) - target_link_libraries(demo_${name} "${PROJECT_NAME}") +macro(ADD_EXAMPLE name) + add_executable(example_${name} example_${name}.f90) + target_link_libraries(example_${name} "${PROJECT_NAME}") add_test(NAME ${name} - COMMAND $ ${CMAKE_CURRENT_BINARY_DIR} + COMMAND $ ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -endmacro(ADD_DEMO) +endmacro(ADD_EXAMPLE) add_subdirectory(array) add_subdirectory(ascii) diff --git a/test/example/array/CMakeLists.txt b/test/example/array/CMakeLists.txt index ef3d56051..9af8de306 100644 --- a/test/example/array/CMakeLists.txt +++ b/test/example/array/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_DEMO(falseloc) -ADD_DEMO(trueloc) +ADD_EXAMPLE(falseloc) +ADD_EXAMPLE(trueloc) diff --git a/test/example/array/demo_falseloc.f90 b/test/example/array/example_falseloc.f90 similarity index 78% rename from test/example/array/demo_falseloc.f90 rename to test/example/array/example_falseloc.f90 index c8818aa9c..dd06721a6 100644 --- a/test/example/array/demo_falseloc.f90 +++ b/test/example/array/example_falseloc.f90 @@ -1,8 +1,8 @@ -program demo_falseloc +program example_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, 1))) = 0.0 -end program demo_falseloc +end program example_falseloc diff --git a/test/example/array/demo_trueloc.f90 b/test/example/array/example_trueloc.f90 similarity index 76% rename from test/example/array/demo_trueloc.f90 rename to test/example/array/example_trueloc.f90 index 268d1ea67..a6e6fffb4 100644 --- a/test/example/array/demo_trueloc.f90 +++ b/test/example/array/example_trueloc.f90 @@ -1,8 +1,8 @@ -program demo_trueloc +program example_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 +end program example_trueloc diff --git a/test/example/ascii/CMakeLists.txt b/test/example/ascii/CMakeLists.txt index c599d4127..e346ac61d 100644 --- a/test/example/ascii/CMakeLists.txt +++ b/test/example/ascii/CMakeLists.txt @@ -1,5 +1,5 @@ -ADD_DEMO(ascii_reverse) -ADD_DEMO(ascii_to_lower) -ADD_DEMO(ascii_to_sentence) -ADD_DEMO(ascii_to_title) -ADD_DEMO(ascii_to_upper) +ADD_EXAMPLE(ascii_reverse) +ADD_EXAMPLE(ascii_to_lower) +ADD_EXAMPLE(ascii_to_sentence) +ADD_EXAMPLE(ascii_to_title) +ADD_EXAMPLE(ascii_to_upper) diff --git a/test/example/ascii/demo_ascii_reverse.f90 b/test/example/ascii/example_ascii_reverse.f90 similarity index 68% rename from test/example/ascii/demo_ascii_reverse.f90 rename to test/example/ascii/example_ascii_reverse.f90 index 0502b040f..ef5901851 100644 --- a/test/example/ascii/demo_ascii_reverse.f90 +++ b/test/example/ascii/example_ascii_reverse.f90 @@ -1,5 +1,5 @@ -program demo_reverse +program example_reverse use stdlib_ascii, only: reverse implicit none print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH" -end program demo_reverse +end program example_reverse diff --git a/test/example/ascii/demo_ascii_to_lower.f90 b/test/example/ascii/example_ascii_to_lower.f90 similarity index 65% rename from test/example/ascii/demo_ascii_to_lower.f90 rename to test/example/ascii/example_ascii_to_lower.f90 index ca56df71f..dca955010 100644 --- a/test/example/ascii/demo_ascii_to_lower.f90 +++ b/test/example/ascii/example_ascii_to_lower.f90 @@ -1,5 +1,5 @@ -program demo_to_lower +program example_to_lower use stdlib_ascii, only: to_lower implicit none print'(a)', to_lower("HELLo!") ! returns "hello!" -end program demo_to_lower +end program example_to_lower diff --git a/test/example/ascii/demo_ascii_to_sentence.f90 b/test/example/ascii/example_ascii_to_sentence.f90 similarity index 78% rename from test/example/ascii/demo_ascii_to_sentence.f90 rename to test/example/ascii/example_ascii_to_sentence.f90 index 869ced5cc..34f7ea872 100644 --- a/test/example/ascii/demo_ascii_to_sentence.f90 +++ b/test/example/ascii/example_ascii_to_sentence.f90 @@ -1,7 +1,7 @@ -program demo_to_sentence +program example_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 +end program example_to_sentence diff --git a/test/example/ascii/demo_ascii_to_title.f90 b/test/example/ascii/example_ascii_to_title.f90 similarity index 79% rename from test/example/ascii/demo_ascii_to_title.f90 rename to test/example/ascii/example_ascii_to_title.f90 index 6fae4637c..50931ca07 100644 --- a/test/example/ascii/demo_ascii_to_title.f90 +++ b/test/example/ascii/example_ascii_to_title.f90 @@ -1,7 +1,7 @@ -program demo_to_title +program example_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 +end program example_to_title diff --git a/test/example/ascii/demo_ascii_to_upper.f90 b/test/example/ascii/example_ascii_to_upper.f90 similarity index 65% rename from test/example/ascii/demo_ascii_to_upper.f90 rename to test/example/ascii/example_ascii_to_upper.f90 index 8a8baec5c..93c12a18f 100644 --- a/test/example/ascii/demo_ascii_to_upper.f90 +++ b/test/example/ascii/example_ascii_to_upper.f90 @@ -1,5 +1,5 @@ -program demo_to_upper +program example_to_upper use stdlib_ascii, only: to_upper implicit none print'(a)', to_upper("hello!") ! returns "HELLO!" -end program demo_to_upper +end program example_to_upper diff --git a/test/example/bitsets/CMakeLists.txt b/test/example/bitsets/CMakeLists.txt index f009bfea2..6e380ebf2 100644 --- a/test/example/bitsets/CMakeLists.txt +++ b/test/example/bitsets/CMakeLists.txt @@ -1,30 +1,30 @@ -ADD_DEMO(bitsets_all) -ADD_DEMO(bitsets_and) -ADD_DEMO(bitsets_and_not) -ADD_DEMO(bitsets_any) -ADD_DEMO(bitsets_assignment) -ADD_DEMO(bitsets_bit_count) -ADD_DEMO(bitsets_bits) -ADD_DEMO(bitsets_clear) -ADD_DEMO(bitsets_equality) -ADD_DEMO(bitsets_extract) -ADD_DEMO(bitsets_flip) -ADD_DEMO(bitsets_from_string) -ADD_DEMO(bitsets_ge) -ADD_DEMO(bitsets_gt) -ADD_DEMO(bitsets_inequality) -ADD_DEMO(bitsets_init) -ADD_DEMO(bitsets_input) -ADD_DEMO(bitsets_le) -ADD_DEMO(bitsets_lt) -ADD_DEMO(bitsets_none) -ADD_DEMO(bitsets_not) -ADD_DEMO(bitsets_or) -ADD_DEMO(bitsets_output) -ADD_DEMO(bitsets_read_bitset) -ADD_DEMO(bitsets_set) -ADD_DEMO(bitsets_test) -ADD_DEMO(bitsets_to_string) -ADD_DEMO(bitsets_value) -ADD_DEMO(bitsets_write_bitset) -ADD_DEMO(bitsets_xor) +ADD_EXAMPLE(bitsets_all) +ADD_EXAMPLE(bitsets_and) +ADD_EXAMPLE(bitsets_and_not) +ADD_EXAMPLE(bitsets_any) +ADD_EXAMPLE(bitsets_assignment) +ADD_EXAMPLE(bitsets_bit_count) +ADD_EXAMPLE(bitsets_bits) +ADD_EXAMPLE(bitsets_clear) +ADD_EXAMPLE(bitsets_equality) +ADD_EXAMPLE(bitsets_extract) +ADD_EXAMPLE(bitsets_flip) +ADD_EXAMPLE(bitsets_from_string) +ADD_EXAMPLE(bitsets_ge) +ADD_EXAMPLE(bitsets_gt) +ADD_EXAMPLE(bitsets_inequality) +ADD_EXAMPLE(bitsets_init) +ADD_EXAMPLE(bitsets_input) +ADD_EXAMPLE(bitsets_le) +ADD_EXAMPLE(bitsets_lt) +ADD_EXAMPLE(bitsets_none) +ADD_EXAMPLE(bitsets_not) +ADD_EXAMPLE(bitsets_or) +ADD_EXAMPLE(bitsets_output) +ADD_EXAMPLE(bitsets_read_bitset) +ADD_EXAMPLE(bitsets_set) +ADD_EXAMPLE(bitsets_test) +ADD_EXAMPLE(bitsets_to_string) +ADD_EXAMPLE(bitsets_value) +ADD_EXAMPLE(bitsets_write_bitset) +ADD_EXAMPLE(bitsets_xor) diff --git a/test/example/bitsets/demo_bitsets_all.f90 b/test/example/bitsets/example_bitsets_all.f90 similarity index 89% rename from test/example/bitsets/demo_bitsets_all.f90 rename to test/example/bitsets/example_bitsets_all.f90 index c9440e8cd..39fc18632 100644 --- a/test/example/bitsets/demo_bitsets_all.f90 +++ b/test/example/bitsets/example_bitsets_all.f90 @@ -1,4 +1,4 @@ -program demo_all +program example_all use stdlib_bitsets character(*), parameter :: & bits_all = '111111111111111111111111111111111' @@ -11,4 +11,4 @@ program demo_all write (*, *) "FROM_STRING transferred BITS_ALL properly"// & " into set0." end if -end program demo_all +end program example_all diff --git a/test/example/bitsets/demo_bitsets_and.f90 b/test/example/bitsets/example_bitsets_and.f90 similarity index 92% rename from test/example/bitsets/demo_bitsets_and.f90 rename to test/example/bitsets/example_bitsets_and.f90 index 278febdc9..d70e54359 100644 --- a/test/example/bitsets/demo_bitsets_and.f90 +++ b/test/example/bitsets/example_bitsets_and.f90 @@ -1,4 +1,4 @@ -program demo_and +program example_and use stdlib_bitsets type(bitset_large) :: set0, set1 call set0%init(166) @@ -14,4 +14,4 @@ program demo_and call set0%not() call and(set0, set1) ! all all if (set0%all()) write (*, *) 'Fourth test of AND worked.' -end program demo_and +end program example_and diff --git a/test/example/bitsets/demo_bitsets_and_not.f90 b/test/example/bitsets/example_bitsets_and_not.f90 similarity index 91% rename from test/example/bitsets/demo_bitsets_and_not.f90 rename to test/example/bitsets/example_bitsets_and_not.f90 index 5795f8912..8e3677c8a 100644 --- a/test/example/bitsets/demo_bitsets_and_not.f90 +++ b/test/example/bitsets/example_bitsets_and_not.f90 @@ -1,4 +1,4 @@ -program demo_and_not +program example_and_not use stdlib_bitsets type(bitset_large) :: set0, set1 call set0%init(166) @@ -15,4 +15,4 @@ program demo_and_not call set0%not() call and_not(set0, set1) ! all all if (set0%none()) write (*, *) 'Fourth test of AND_NOT worked.' -end program demo_and_not +end program example_and_not diff --git a/test/example/bitsets/demo_bitsets_any.f90 b/test/example/bitsets/example_bitsets_any.f90 similarity index 89% rename from test/example/bitsets/demo_bitsets_any.f90 rename to test/example/bitsets/example_bitsets_any.f90 index d2bc629ad..3224fc074 100644 --- a/test/example/bitsets/demo_bitsets_any.f90 +++ b/test/example/bitsets/example_bitsets_any.f90 @@ -1,4 +1,4 @@ -program demo_any +program example_any use stdlib_bitsets character(*), parameter :: & bits_0 = '0000000000000000000' @@ -12,4 +12,4 @@ program demo_any if (set0%any()) then write (*, *) "ANY interpreted SET0's value properly." end if -end program demo_any +end program example_any diff --git a/test/example/bitsets/demo_bitsets_assignment.f90 b/test/example/bitsets/example_bitsets_assignment.f90 similarity index 92% rename from test/example/bitsets/demo_bitsets_assignment.f90 rename to test/example/bitsets/example_bitsets_assignment.f90 index 92dc5e2b0..3493c1b6a 100644 --- a/test/example/bitsets/demo_bitsets_assignment.f90 +++ b/test/example/bitsets/example_bitsets_assignment.f90 @@ -1,4 +1,4 @@ -program demo_assignment +program example_assignment use stdlib_bitsets use stdlib_kinds, only: int8, int32 implicit none @@ -23,4 +23,4 @@ program demo_assignment if (all(logical2)) then write (*, *) 'Initialization of logical(int32) succeeded.' end if -end program demo_assignment +end program example_assignment diff --git a/test/example/bitsets/demo_bitsets_bit_count.f90 b/test/example/bitsets/example_bitsets_bit_count.f90 similarity index 87% rename from test/example/bitsets/demo_bitsets_bit_count.f90 rename to test/example/bitsets/example_bitsets_bit_count.f90 index 17ef992f4..1cbd15f1e 100644 --- a/test/example/bitsets/demo_bitsets_bit_count.f90 +++ b/test/example/bitsets/example_bitsets_bit_count.f90 @@ -1,4 +1,4 @@ -program demo_bit_count +program example_bit_count use stdlib_bitsets character(*), parameter :: & bits_0 = '0000000000000000000' @@ -12,4 +12,4 @@ program demo_bit_count if (set0%bit_count() == 1) then write (*, *) "BIT_COUNT interpreted SET0's value properly." end if -end program demo_bit_count +end program example_bit_count diff --git a/test/example/bitsets/demo_bitsets_bits.f90 b/test/example/bitsets/example_bitsets_bits.f90 similarity index 85% rename from test/example/bitsets/demo_bitsets_bits.f90 rename to test/example/bitsets/example_bitsets_bits.f90 index 237ae2f27..b177da1e9 100644 --- a/test/example/bitsets/demo_bitsets_bits.f90 +++ b/test/example/bitsets/example_bitsets_bits.f90 @@ -1,4 +1,4 @@ -program demo_bits +program example_bits use stdlib_bitsets character(*), parameter :: & bits_0 = '0000000000000000000' @@ -8,4 +8,4 @@ program demo_bits write (*, *) "FROM_STRING interpreted "// & "BITS_0's size properly." end if -end program demo_bits +end program example_bits diff --git a/test/example/bitsets/demo_bitsets_clear.f90 b/test/example/bitsets/example_bitsets_clear.f90 similarity index 86% rename from test/example/bitsets/demo_bitsets_clear.f90 rename to test/example/bitsets/example_bitsets_clear.f90 index 005581f63..d184d147d 100644 --- a/test/example/bitsets/demo_bitsets_clear.f90 +++ b/test/example/bitsets/example_bitsets_clear.f90 @@ -1,4 +1,4 @@ -program demo_clear +program example_clear use stdlib_bitsets type(bitset_large) :: set0 call set0%init(166) @@ -8,4 +8,4 @@ program demo_clear if (.not. set0%test(165)) write (*, *) 'Bit 165 is cleared.' call set0%clear(0, 164) if (set0%none()) write (*, *) 'All bits are cleared.' -end program demo_clear +end program example_clear diff --git a/test/example/bitsets/demo_bitsets_equality.f90 b/test/example/bitsets/example_bitsets_equality.f90 similarity index 88% rename from test/example/bitsets/demo_bitsets_equality.f90 rename to test/example/bitsets/example_bitsets_equality.f90 index 841a381a2..59bc8d3f6 100644 --- a/test/example/bitsets/demo_bitsets_equality.f90 +++ b/test/example/bitsets/example_bitsets_equality.f90 @@ -1,4 +1,4 @@ -program demo_equality +program example_equality use stdlib_bitsets type(bitset_64) :: set0, set1, set2 call set0%init(33) @@ -13,4 +13,4 @@ program demo_equality else error stop 'Failed 64 bit equality tests.' end if -end program demo_equality +end program example_equality diff --git a/test/example/bitsets/demo_bitsets_extract.f90 b/test/example/bitsets/example_bitsets_extract.f90 similarity index 84% rename from test/example/bitsets/demo_bitsets_extract.f90 rename to test/example/bitsets/example_bitsets_extract.f90 index 0ae2c61e3..c4795422c 100644 --- a/test/example/bitsets/demo_bitsets_extract.f90 +++ b/test/example/bitsets/example_bitsets_extract.f90 @@ -1,4 +1,4 @@ -program demo_extract +program example_extract use stdlib_bitsets type(bitset_large) :: set0, set1 call set0%init(166) @@ -7,4 +7,4 @@ program demo_extract if (set1%bits() == 51) & write (*, *) 'SET1 has the proper size.' if (set1%all()) write (*, *) 'SET1 has the proper values.' -end program demo_extract +end program example_extract diff --git a/test/example/bitsets/demo_bitsets_flip.f90 b/test/example/bitsets/example_bitsets_flip.f90 similarity index 86% rename from test/example/bitsets/demo_bitsets_flip.f90 rename to test/example/bitsets/example_bitsets_flip.f90 index 9e037b87c..449f758c4 100644 --- a/test/example/bitsets/demo_bitsets_flip.f90 +++ b/test/example/bitsets/example_bitsets_flip.f90 @@ -1,4 +1,4 @@ -program demo_flip +program example_flip use stdlib_bitsets type(bitset_large) :: set0 call set0%init(166) @@ -7,4 +7,4 @@ program demo_flip if (set0%test(165)) write (*, *) 'Bit 165 is flipped.' call set0%flip(0, 164) if (set0%all()) write (*, *) 'All bits are flipped.' -end program demo_flip +end program example_flip diff --git a/test/example/bitsets/demo_bitsets_from_string.f90 b/test/example/bitsets/example_bitsets_from_string.f90 similarity index 89% rename from test/example/bitsets/demo_bitsets_from_string.f90 rename to test/example/bitsets/example_bitsets_from_string.f90 index dd9d3f20b..ab85d853a 100644 --- a/test/example/bitsets/demo_bitsets_from_string.f90 +++ b/test/example/bitsets/example_bitsets_from_string.f90 @@ -1,4 +1,4 @@ -program demo_from_string +program example_from_string use stdlib_bitsets character(*), parameter :: & bits_all = '111111111111111111111111111111111' @@ -14,4 +14,4 @@ program demo_from_string write (*, *) "FROM_STRING transferred BITS_ALL properly"// & " into set0." end if -end program demo_from_string +end program example_from_string diff --git a/test/example/bitsets/demo_bitsets_ge.f90 b/test/example/bitsets/example_bitsets_ge.f90 similarity index 92% rename from test/example/bitsets/demo_bitsets_ge.f90 rename to test/example/bitsets/example_bitsets_ge.f90 index 736fa2db2..0a905714d 100644 --- a/test/example/bitsets/demo_bitsets_ge.f90 +++ b/test/example/bitsets/example_bitsets_ge.f90 @@ -1,4 +1,4 @@ -program demo_ge +program example_ge use stdlib_bitsets type(bitset_64) :: set0, set1, set2 call set0%init(33) @@ -14,4 +14,4 @@ program demo_ge else error stop 'Failed 64 bit greater than or equals tests.' end if -end program demo_ge +end program example_ge diff --git a/test/example/bitsets/demo_bitsets_gt.f90 b/test/example/bitsets/example_bitsets_gt.f90 similarity index 91% rename from test/example/bitsets/demo_bitsets_gt.f90 rename to test/example/bitsets/example_bitsets_gt.f90 index be737468a..bc45228f7 100644 --- a/test/example/bitsets/demo_bitsets_gt.f90 +++ b/test/example/bitsets/example_bitsets_gt.f90 @@ -1,4 +1,4 @@ -program demo_gt +program example_gt use stdlib_bitsets type(bitset_64) :: set0, set1, set2 call set0%init(33) @@ -13,4 +13,4 @@ program demo_gt else error stop 'Failed 64 bit greater than tests.' end if -end program demo_gt +end program example_gt diff --git a/test/example/bitsets/demo_bitsets_inequality.f90 b/test/example/bitsets/example_bitsets_inequality.f90 similarity index 88% rename from test/example/bitsets/demo_bitsets_inequality.f90 rename to test/example/bitsets/example_bitsets_inequality.f90 index 9c76f96e6..cd8815071 100644 --- a/test/example/bitsets/demo_bitsets_inequality.f90 +++ b/test/example/bitsets/example_bitsets_inequality.f90 @@ -1,4 +1,4 @@ -program demo_inequality +program example_inequality use stdlib_bitsets type(bitset_64) :: set0, set1, set2 call set0%init(33) @@ -13,4 +13,4 @@ program demo_inequality else error stop 'Failed 64 bit inequality tests.' end if -end program demo_inequality +end program example_inequality diff --git a/test/example/bitsets/demo_bitsets_init.f90 b/test/example/bitsets/example_bitsets_init.f90 similarity index 81% rename from test/example/bitsets/demo_bitsets_init.f90 rename to test/example/bitsets/example_bitsets_init.f90 index 0579cb9da..b900b9bec 100644 --- a/test/example/bitsets/demo_bitsets_init.f90 +++ b/test/example/bitsets/example_bitsets_init.f90 @@ -1,8 +1,8 @@ -program demo_init +program example_init use stdlib_bitsets type(bitset_large) :: set0 call set0%init(166) if (set0%bits() == 166) & write (*, *) 'SET0 has the proper size.' if (set0%none()) write (*, *) 'SET0 is properly initialized.' -end program demo_init +end program example_init diff --git a/test/example/bitsets/demo_bitsets_output.f90 b/test/example/bitsets/example_bitsets_input.f90 similarity index 95% rename from test/example/bitsets/demo_bitsets_output.f90 rename to test/example/bitsets/example_bitsets_input.f90 index 166ea0b2e..12600956d 100644 --- a/test/example/bitsets/demo_bitsets_output.f90 +++ b/test/example/bitsets/example_bitsets_input.f90 @@ -1,4 +1,4 @@ -program demo_output +program example_input use stdlib_bitsets implicit none character(*), parameter :: & @@ -29,4 +29,4 @@ program demo_output write (*, *) 'Transfer to and from units using '// & 'output and input succeeded.' end if -end program demo_output +end program example_input diff --git a/test/example/bitsets/demo_bitsets_le.f90 b/test/example/bitsets/example_bitsets_le.f90 similarity index 92% rename from test/example/bitsets/demo_bitsets_le.f90 rename to test/example/bitsets/example_bitsets_le.f90 index f3b30e30e..e17f0d95e 100644 --- a/test/example/bitsets/demo_bitsets_le.f90 +++ b/test/example/bitsets/example_bitsets_le.f90 @@ -1,4 +1,4 @@ -program demo_le +program example_le use stdlib_bitsets type(bitset_64) :: set0, set1, set2 call set0%init(33) @@ -14,4 +14,4 @@ program demo_le else error stop 'Failed 64 bit less than or equal tests.' end if -end program demo_le +end program example_le diff --git a/test/example/bitsets/demo_bitsets_lt.f90 b/test/example/bitsets/example_bitsets_lt.f90 similarity index 90% rename from test/example/bitsets/demo_bitsets_lt.f90 rename to test/example/bitsets/example_bitsets_lt.f90 index 19e87e9da..5c2b44740 100644 --- a/test/example/bitsets/demo_bitsets_lt.f90 +++ b/test/example/bitsets/example_bitsets_lt.f90 @@ -1,4 +1,4 @@ -program demo_lt +program example_lt use stdlib_bitsets type(bitset_64) :: set0, set1, set2 call set0%init(33) @@ -13,4 +13,4 @@ program demo_lt else error stop 'Failed 64 bit less than tests.' end if -end program demo_lt +end program example_lt diff --git a/test/example/bitsets/demo_bitsets_none.f90 b/test/example/bitsets/example_bitsets_none.f90 similarity index 89% rename from test/example/bitsets/demo_bitsets_none.f90 rename to test/example/bitsets/example_bitsets_none.f90 index ae321e426..f00ea8a49 100644 --- a/test/example/bitsets/demo_bitsets_none.f90 +++ b/test/example/bitsets/example_bitsets_none.f90 @@ -1,4 +1,4 @@ -program demo_none +program example_none use stdlib_bitsets character(*), parameter :: & bits_0 = '0000000000000000000' @@ -12,4 +12,4 @@ program demo_none if (.not. set0%none()) then write (*, *) "NONE interpreted SET0's value properly." end if -end program demo_none +end program example_none diff --git a/test/example/bitsets/demo_bitsets_not.f90 b/test/example/bitsets/example_bitsets_not.f90 similarity index 86% rename from test/example/bitsets/demo_bitsets_not.f90 rename to test/example/bitsets/example_bitsets_not.f90 index 9f1db0f1e..78ebc33b6 100644 --- a/test/example/bitsets/demo_bitsets_not.f90 +++ b/test/example/bitsets/example_bitsets_not.f90 @@ -1,4 +1,4 @@ -program demo_not +program example_not use stdlib_bitsets type(bitset_large) :: set0 call set0%init(155) @@ -10,4 +10,4 @@ program demo_not if (set0%all()) then write (*, *) "ALL interpreted SET0's value properly." end if -end program demo_not +end program example_not diff --git a/test/example/bitsets/demo_bitsets_or.f90 b/test/example/bitsets/example_bitsets_or.f90 similarity index 92% rename from test/example/bitsets/demo_bitsets_or.f90 rename to test/example/bitsets/example_bitsets_or.f90 index 631627ed8..ddaface21 100644 --- a/test/example/bitsets/demo_bitsets_or.f90 +++ b/test/example/bitsets/example_bitsets_or.f90 @@ -1,4 +1,4 @@ -program demo_or +program example_or use stdlib_bitsets type(bitset_large) :: set0, set1 call set0%init(166) @@ -15,4 +15,4 @@ program demo_or call set0%not() call or(set0, set1) ! all all if (set0%all()) write (*, *) 'Fourth test of OR worked.' -end program demo_or +end program example_or diff --git a/test/example/bitsets/demo_bitsets_input.f90 b/test/example/bitsets/example_bitsets_output.f90 similarity index 95% rename from test/example/bitsets/demo_bitsets_input.f90 rename to test/example/bitsets/example_bitsets_output.f90 index bccfbd332..b10dba27b 100644 --- a/test/example/bitsets/demo_bitsets_input.f90 +++ b/test/example/bitsets/example_bitsets_output.f90 @@ -1,4 +1,4 @@ -program demo_input +program example_output use stdlib_bitsets implicit none character(*), parameter :: & @@ -29,4 +29,4 @@ program demo_input write (*, *) 'Transfer to and from units using '// & 'output and input succeeded.' end if -end program demo_input +end program example_output diff --git a/test/example/bitsets/demo_bitsets_write_bitset.f90 b/test/example/bitsets/example_bitsets_read_bitset.f90 similarity index 95% rename from test/example/bitsets/demo_bitsets_write_bitset.f90 rename to test/example/bitsets/example_bitsets_read_bitset.f90 index 612faa533..54a3e09d3 100644 --- a/test/example/bitsets/demo_bitsets_write_bitset.f90 +++ b/test/example/bitsets/example_bitsets_read_bitset.f90 @@ -1,4 +1,4 @@ -program demo_write_bitset +program example_read_bitset use stdlib_bitsets implicit none character(*), parameter :: & @@ -32,4 +32,4 @@ program demo_write_bitset if (set3 == set0 .and. set4 == set1 .and. set5 == set2) then write (*, *) 'WRITE_BITSET to READ_BITSET through unit worked.' end if -end program demo_write_bitset +end program example_read_bitset diff --git a/test/example/bitsets/demo_bitsets_set.f90 b/test/example/bitsets/example_bitsets_set.f90 similarity index 86% rename from test/example/bitsets/demo_bitsets_set.f90 rename to test/example/bitsets/example_bitsets_set.f90 index 7d88f4d20..5409e5c17 100644 --- a/test/example/bitsets/demo_bitsets_set.f90 +++ b/test/example/bitsets/example_bitsets_set.f90 @@ -1,4 +1,4 @@ -program demo_set +program example_set use stdlib_bitsets type(bitset_large) :: set0 call set0%init(166) @@ -7,4 +7,4 @@ program demo_set if (set0%test(165)) write (*, *) 'Bit 165 is set.' call set0%set(0, 164) if (set0%all()) write (*, *) 'All bits are set.' -end program demo_set +end program example_set diff --git a/test/example/bitsets/demo_bitsets_test.f90 b/test/example/bitsets/example_bitsets_test.f90 similarity index 87% rename from test/example/bitsets/demo_bitsets_test.f90 rename to test/example/bitsets/example_bitsets_test.f90 index 7ff66b74f..2f5faa41c 100644 --- a/test/example/bitsets/demo_bitsets_test.f90 +++ b/test/example/bitsets/example_bitsets_test.f90 @@ -1,4 +1,4 @@ -program demo_test +program example_test use stdlib_bitsets type(bitset_large) :: set0 call set0%init(166) @@ -8,4 +8,4 @@ program demo_test if (.not. set0%test(165)) write (*, *) 'Bit 165 is cleared.' call set0%set(165) if (set0%test(165)) write (*, *) 'Bit 165 is set.' -end program demo_test +end program example_test diff --git a/test/example/bitsets/demo_bitsets_to_string.f90 b/test/example/bitsets/example_bitsets_to_string.f90 similarity index 86% rename from test/example/bitsets/demo_bitsets_to_string.f90 rename to test/example/bitsets/example_bitsets_to_string.f90 index 70e8b9831..2bf151f83 100644 --- a/test/example/bitsets/demo_bitsets_to_string.f90 +++ b/test/example/bitsets/example_bitsets_to_string.f90 @@ -1,4 +1,4 @@ -program demo_to_string +program example_to_string use stdlib_bitsets character(*), parameter :: & bits_all = '111111111111111111111111111111111' @@ -11,4 +11,4 @@ program demo_to_string write (*, *) "TO_STRING transferred BITS0 properly"// & " into NEW_STRING." end if -end program demo_to_string +end program example_to_string diff --git a/test/example/bitsets/demo_bitsets_value.f90 b/test/example/bitsets/example_bitsets_value.f90 similarity index 86% rename from test/example/bitsets/demo_bitsets_value.f90 rename to test/example/bitsets/example_bitsets_value.f90 index f7bded845..9c8f84f6e 100644 --- a/test/example/bitsets/demo_bitsets_value.f90 +++ b/test/example/bitsets/example_bitsets_value.f90 @@ -1,4 +1,4 @@ -program demo_value +program example_value use stdlib_bitsets type(bitset_large) :: set0 call set0%init(166) @@ -8,4 +8,4 @@ program demo_value if (set0%value(165) == 0) write (*, *) 'Bit 165 is cleared.' call set0%set(165) if (set0%value(165) == 1) write (*, *) 'Bit 165 is set.' -end program demo_value +end program example_value diff --git a/test/example/bitsets/demo_bitsets_read_bitset.f90 b/test/example/bitsets/example_bitsets_write_bitset.f90 similarity index 95% rename from test/example/bitsets/demo_bitsets_read_bitset.f90 rename to test/example/bitsets/example_bitsets_write_bitset.f90 index 5890b10fd..e56b4c58a 100644 --- a/test/example/bitsets/demo_bitsets_read_bitset.f90 +++ b/test/example/bitsets/example_bitsets_write_bitset.f90 @@ -1,4 +1,4 @@ -program demo_read_bitset +program example_write_bitset use stdlib_bitsets implicit none character(*), parameter :: & @@ -32,4 +32,4 @@ program demo_read_bitset if (set3 == set0 .and. set4 == set1 .and. set5 == set2) then write (*, *) 'WRITE_BITSET to READ_BITSET through unit worked.' end if -end program demo_read_bitset +end program example_write_bitset diff --git a/test/example/bitsets/demo_bitsets_xor.f90 b/test/example/bitsets/example_bitsets_xor.f90 similarity index 92% rename from test/example/bitsets/demo_bitsets_xor.f90 rename to test/example/bitsets/example_bitsets_xor.f90 index 50aebd4c6..886b16e48 100644 --- a/test/example/bitsets/demo_bitsets_xor.f90 +++ b/test/example/bitsets/example_bitsets_xor.f90 @@ -1,4 +1,4 @@ -program demo_xor +program example_xor use stdlib_bitsets type(bitset_large) :: set0, set1 call set0%init(166) @@ -15,4 +15,4 @@ program demo_xor call set0%not() call xor(set0, set1) ! all all if (set0%none()) write (*, *) 'Fourth test of XOR worked.' -end program demo_xor +end program example_xor diff --git a/test/example/error/CMakeLists.txt b/test/example/error/CMakeLists.txt index 5d1a00fdc..c4830efb9 100644 --- a/test/example/error/CMakeLists.txt +++ b/test/example/error/CMakeLists.txt @@ -1,11 +1,11 @@ -ADD_DEMO(check1) +ADD_EXAMPLE(check1) set_tests_properties(check1 PROPERTIES WILL_FAIL true) -ADD_DEMO(check2) +ADD_EXAMPLE(check2) set_tests_properties(check2 PROPERTIES WILL_FAIL true) -ADD_DEMO(check3) -ADD_DEMO(check4) +ADD_EXAMPLE(check3) +ADD_EXAMPLE(check4) set_tests_properties(check4 PROPERTIES SKIP_RETURN_CODE 77) -ADD_DEMO(error_stop1) +ADD_EXAMPLE(error_stop1) set_tests_properties(error_stop1 PROPERTIES WILL_FAIL true) -ADD_DEMO(error_stop2) +ADD_EXAMPLE(error_stop2) set_tests_properties(error_stop2 PROPERTIES WILL_FAIL true) diff --git a/test/example/error/demo_check1.f90 b/test/example/error/example_check1.f90 similarity index 76% rename from test/example/error/demo_check1.f90 rename to test/example/error/example_check1.f90 index db79e0ef6..4c5c3d0a0 100644 --- a/test/example/error/demo_check1.f90 +++ b/test/example/error/example_check1.f90 @@ -1,7 +1,7 @@ -program demo_check1 +program example_check1 use stdlib_error, only: check implicit none integer :: a = 1 ! If a /= 5, stops the program with exit code 1 and prints 'Check failed.' call check(a == 5) -end program demo_check1 +end program example_check1 diff --git a/test/example/error/demo_check2.f90 b/test/example/error/example_check2.f90 similarity index 78% rename from test/example/error/demo_check2.f90 rename to test/example/error/example_check2.f90 index 2b0dd5de1..c505e4450 100644 --- a/test/example/error/demo_check2.f90 +++ b/test/example/error/example_check2.f90 @@ -1,7 +1,7 @@ -program demo_check2 +program example_check2 use stdlib_error, only: check implicit none integer :: a = 1 ! If a /= 5, stops the program with exit code 1 and prints 'a == 5 failed.' call check(a == 5, msg='a == 5 failed.') -end program demo_check2 +end program example_check2 diff --git a/test/example/error/demo_check3.f90 b/test/example/error/example_check3.f90 similarity index 79% rename from test/example/error/demo_check3.f90 rename to test/example/error/example_check3.f90 index b64372434..97e9b5b91 100644 --- a/test/example/error/demo_check3.f90 +++ b/test/example/error/example_check3.f90 @@ -1,7 +1,7 @@ -program demo_check3 +program example_check3 use stdlib_error, only: check implicit none integer :: a = 1 ! If a /= 5, prints 'a == 5 failed.', but doesn't stop the program. call check(a == 5, msg='a == 5 failed.', warn=.true.) -end program demo_check3 +end program example_check3 diff --git a/test/example/error/demo_check4.f90 b/test/example/error/example_check4.f90 similarity index 79% rename from test/example/error/demo_check4.f90 rename to test/example/error/example_check4.f90 index a23a794d6..da1c15531 100644 --- a/test/example/error/demo_check4.f90 +++ b/test/example/error/example_check4.f90 @@ -1,7 +1,7 @@ -program demo_check4 +program example_check4 use stdlib_error, only: check implicit none integer :: a = 1 ! If a /= 5, stops the program with exit code 77 and prints 'a == 5 failed.' call check(a == 5, msg='a == 5 failed.', code=77) -end program demo_check4 +end program example_check4 diff --git a/test/example/error/demo_error_stop1.f90 b/test/example/error/example_error_stop1.f90 similarity index 60% rename from test/example/error/demo_error_stop1.f90 rename to test/example/error/example_error_stop1.f90 index f279bf529..29ee87a52 100644 --- a/test/example/error/demo_error_stop1.f90 +++ b/test/example/error/example_error_stop1.f90 @@ -1,5 +1,5 @@ -program demo_error_stop1 +program example_error_stop1 use stdlib_error, only: error_stop implicit none call error_stop("Invalid argument") -end program demo_error_stop1 +end program example_error_stop1 diff --git a/test/example/error/demo_error_stop2.f90 b/test/example/error/example_error_stop2.f90 similarity index 62% rename from test/example/error/demo_error_stop2.f90 rename to test/example/error/example_error_stop2.f90 index 95ba8f92f..09107c512 100644 --- a/test/example/error/demo_error_stop2.f90 +++ b/test/example/error/example_error_stop2.f90 @@ -1,5 +1,5 @@ -program demo_error_stop2 +program example_error_stop2 use stdlib_error, only: error_stop implicit none call error_stop("Invalid argument", code=123) -end program demo_error_stop2 +end program example_error_stop2 diff --git a/test/example/hash_procedures/CMakeLists.txt b/test/example/hash_procedures/CMakeLists.txt index 236d46deb..7258747dd 100644 --- a/test/example/hash_procedures/CMakeLists.txt +++ b/test/example/hash_procedures/CMakeLists.txt @@ -1,13 +1,13 @@ -ADD_DEMO(fibonacci_hash_64) -ADD_DEMO(fibonacci_hash) -ADD_DEMO(fnv_1a_hash_64) -ADD_DEMO(fnv_1a_hash) -ADD_DEMO(fnv_1_hash_64) -ADD_DEMO(fnv_1_hash) -ADD_DEMO(nmhash32) -ADD_DEMO(nmhash32x) -ADD_DEMO(pengy_hash) -ADD_DEMO(spooky_hash) -ADD_DEMO(universal_mult_hash_64) -ADD_DEMO(universal_mult_hash) -ADD_DEMO(water_hash) +ADD_EXAMPLE(fibonacci_hash_64) +ADD_EXAMPLE(fibonacci_hash) +ADD_EXAMPLE(fnv_1a_hash_64) +ADD_EXAMPLE(fnv_1a_hash) +ADD_EXAMPLE(fnv_1_hash_64) +ADD_EXAMPLE(fnv_1_hash) +ADD_EXAMPLE(nmhash32) +ADD_EXAMPLE(nmhash32x) +ADD_EXAMPLE(pengy_hash) +ADD_EXAMPLE(spooky_hash) +ADD_EXAMPLE(universal_mult_hash_64) +ADD_EXAMPLE(universal_mult_hash) +ADD_EXAMPLE(water_hash) diff --git a/test/example/hash_procedures/demo_fibonacci_hash.f90 b/test/example/hash_procedures/example_fibonacci_hash.f90 similarity index 82% rename from test/example/hash_procedures/demo_fibonacci_hash.f90 rename to test/example/hash_procedures/example_fibonacci_hash.f90 index 153855d02..35fe47caf 100644 --- a/test/example/hash_procedures/demo_fibonacci_hash.f90 +++ b/test/example/hash_procedures/example_fibonacci_hash.f90 @@ -1,4 +1,4 @@ -program demo_fibonacci_hash +program example_fibonacci_hash use stdlib_hash_32bit, only: fibonacci_hash use iso_fortran_env, only: int32 implicit none @@ -10,4 +10,4 @@ program demo_fibonacci_hash hash = fibonacci_hash(source, 6) array1(hash) = source print *, hash -end program demo_fibonacci_hash +end program example_fibonacci_hash diff --git a/test/example/hash_procedures/demo_fibonacci_hash_64.f90 b/test/example/hash_procedures/example_fibonacci_hash_64.f90 similarity index 81% rename from test/example/hash_procedures/demo_fibonacci_hash_64.f90 rename to test/example/hash_procedures/example_fibonacci_hash_64.f90 index 5e2c113c3..45b6e1031 100644 --- a/test/example/hash_procedures/demo_fibonacci_hash_64.f90 +++ b/test/example/hash_procedures/example_fibonacci_hash_64.f90 @@ -1,4 +1,4 @@ -program demo_fibonacci_hash_64 +program example_fibonacci_hash_64 use stdlib_hash_64bit, only: fibonacci_hash use iso_fortran_env, only: int64 implicit none @@ -10,4 +10,4 @@ program demo_fibonacci_hash_64 hash = fibonacci_hash(source, 6) array1(hash) = source print *, hash -end program demo_fibonacci_hash_64 +end program example_fibonacci_hash_64 diff --git a/test/example/hash_procedures/demo_fnv_1_hash.f90 b/test/example/hash_procedures/example_fnv_1_hash.f90 similarity index 75% rename from test/example/hash_procedures/demo_fnv_1_hash.f90 rename to test/example/hash_procedures/example_fnv_1_hash.f90 index 94993a736..adf97c011 100644 --- a/test/example/hash_procedures/demo_fnv_1_hash.f90 +++ b/test/example/hash_procedures/example_fnv_1_hash.f90 @@ -1,8 +1,8 @@ -program demo_fnv_1_hash +program example_fnv_1_hash use stdlib_hash_32bit, only: fnv_1_hash use iso_fortran_env, only: int32 implicit none integer(int32) :: hash hash = fnv_1_hash([5, 4, 3, 1, 10, 4, 9]) print *, hash -end program demo_fnv_1_hash +end program example_fnv_1_hash diff --git a/test/example/hash_procedures/demo_fnv_1_hash_64.f90 b/test/example/hash_procedures/example_fnv_1_hash_64.f90 similarity index 78% rename from test/example/hash_procedures/demo_fnv_1_hash_64.f90 rename to test/example/hash_procedures/example_fnv_1_hash_64.f90 index 4fa9c097d..e3e30eea3 100644 --- a/test/example/hash_procedures/demo_fnv_1_hash_64.f90 +++ b/test/example/hash_procedures/example_fnv_1_hash_64.f90 @@ -1,4 +1,4 @@ -program demo_fnv_1_hash_64 +program example_fnv_1_hash_64 use stdlib_hash_64bit, only: fnv_1_hash use iso_fortran_env, only: int64 implicit none @@ -7,4 +7,4 @@ program demo_fnv_1_hash_64 array1 = [5, 4, 3, 1, 10, 4, 9] hash = fnv_1_hash(array1) print *, hash -end program demo_fnv_1_hash_64 +end program example_fnv_1_hash_64 diff --git a/test/example/hash_procedures/demo_fnv_1a_hash.f90 b/test/example/hash_procedures/example_fnv_1a_hash.f90 similarity index 75% rename from test/example/hash_procedures/demo_fnv_1a_hash.f90 rename to test/example/hash_procedures/example_fnv_1a_hash.f90 index fa7a52548..2dbff6ea0 100644 --- a/test/example/hash_procedures/demo_fnv_1a_hash.f90 +++ b/test/example/hash_procedures/example_fnv_1a_hash.f90 @@ -1,8 +1,8 @@ -program demo_fnv_1a_hash +program example_fnv_1a_hash use stdlib_hash_32bit, only: fnv_1a_hash use iso_fortran_env, only: int32 implicit none integer(int32) :: hash hash = fnv_1a_hash([5, 4, 3, 1, 10, 4, 9]) print *, hash -end program demo_fnv_1a_hash +end program example_fnv_1a_hash diff --git a/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 b/test/example/hash_procedures/example_fnv_1a_hash_64.f90 similarity index 78% rename from test/example/hash_procedures/demo_fnv_1a_hash_64.f90 rename to test/example/hash_procedures/example_fnv_1a_hash_64.f90 index d57de195c..d14ed807c 100644 --- a/test/example/hash_procedures/demo_fnv_1a_hash_64.f90 +++ b/test/example/hash_procedures/example_fnv_1a_hash_64.f90 @@ -1,4 +1,4 @@ -program demo_fnv_1a_hash_64 +program example_fnv_1a_hash_64 use stdlib_hash_64bit, only: fnv_1a_hash use iso_fortran_env, only: int64 implicit none @@ -7,4 +7,4 @@ program demo_fnv_1a_hash_64 array1 = [5, 4, 3, 1, 10, 4, 9] hash = fnv_1a_hash(array1) print *, hash -end program demo_fnv_1a_hash_64 +end program example_fnv_1a_hash_64 diff --git a/test/example/hash_procedures/demo_nmhash32.f90 b/test/example/hash_procedures/example_nmhash32.f90 similarity index 84% rename from test/example/hash_procedures/demo_nmhash32.f90 rename to test/example/hash_procedures/example_nmhash32.f90 index dd5275f73..a0654d2ac 100644 --- a/test/example/hash_procedures/demo_nmhash32.f90 +++ b/test/example/hash_procedures/example_nmhash32.f90 @@ -1,4 +1,4 @@ -program demo_nmhash32 +program example_nmhash32 use stdlib_hash_32bit, only: nmhash32, & new_nmhash32_seed use iso_fortran_env, only: int32 @@ -8,4 +8,4 @@ program demo_nmhash32 call new_nmhash32_seed(seed) hash = nmhash32([5, 4, 3, 1, 10, 4, 9], seed) print *, seed, hash -end program demo_nmhash32 +end program example_nmhash32 diff --git a/test/example/hash_procedures/demo_nmhash32x.f90 b/test/example/hash_procedures/example_nmhash32x.f90 similarity index 84% rename from test/example/hash_procedures/demo_nmhash32x.f90 rename to test/example/hash_procedures/example_nmhash32x.f90 index a63a07120..34339ef16 100644 --- a/test/example/hash_procedures/demo_nmhash32x.f90 +++ b/test/example/hash_procedures/example_nmhash32x.f90 @@ -1,4 +1,4 @@ -program demo_nmhash32x +program example_nmhash32x use stdlib_hash_32bit, only: nmhash32x, & new_nmhash32x_seed use iso_fortran_env, only: int32 @@ -8,4 +8,4 @@ program demo_nmhash32x call new_nmhash32x_seed(seed) hash = nmhash32x([5, 4, 3, 1, 10, 4, 9], seed) print *, seed, hash -end program demo_nmhash32x +end program example_nmhash32x diff --git a/test/example/hash_procedures/demo_pengy_hash.f90 b/test/example/hash_procedures/example_pengy_hash.f90 similarity index 85% rename from test/example/hash_procedures/demo_pengy_hash.f90 rename to test/example/hash_procedures/example_pengy_hash.f90 index a856217d0..4b8bcf145 100644 --- a/test/example/hash_procedures/demo_pengy_hash.f90 +++ b/test/example/hash_procedures/example_pengy_hash.f90 @@ -1,4 +1,4 @@ -program demo_pengy_hash +program example_pengy_hash use stdlib_hash_64bit, only: new_pengy_hash_seed, pengy_hash use iso_fortran_env, only: int32, int64 implicit none @@ -10,4 +10,4 @@ program demo_pengy_hash call new_pengy_hash_seed(seed) hash = pengy_hash(key, seed) print *, seed, hash -end program demo_pengy_hash +end program example_pengy_hash diff --git a/test/example/hash_procedures/demo_spooky_hash.f90 b/test/example/hash_procedures/example_spooky_hash.f90 similarity index 85% rename from test/example/hash_procedures/demo_spooky_hash.f90 rename to test/example/hash_procedures/example_spooky_hash.f90 index 99ad9e547..0c80d618f 100644 --- a/test/example/hash_procedures/demo_spooky_hash.f90 +++ b/test/example/hash_procedures/example_spooky_hash.f90 @@ -1,4 +1,4 @@ -program demo_spooky_hash +program example_spooky_hash use stdlib_hash_64bit, only: new_spooky_hash_seed, & spooky_hash use iso_fortran_env, only: int64 @@ -10,4 +10,4 @@ program demo_spooky_hash call new_spooky_hash_seed(seed) hash = spooky_hash(key, seed) print *, seed, hash -end program demo_spooky_hash +end program example_spooky_hash diff --git a/test/example/hash_procedures/demo_universal_mult_hash.f90 b/test/example/hash_procedures/example_universal_mult_hash.f90 similarity index 86% rename from test/example/hash_procedures/demo_universal_mult_hash.f90 rename to test/example/hash_procedures/example_universal_mult_hash.f90 index 89ac974bf..70071937c 100644 --- a/test/example/hash_procedures/demo_universal_mult_hash.f90 +++ b/test/example/hash_procedures/example_universal_mult_hash.f90 @@ -1,4 +1,4 @@ -program demo_universal_mult_hash +program example_universal_mult_hash use stdlib_hash_32bit, only: odd_random_integer, & universal_mult_hash use iso_fortran_env, only: int32 @@ -15,4 +15,4 @@ program demo_universal_mult_hash hash = universal_mult_hash(source, seed, 6) array1(hash) = source print *, seed, hash, array1 -end program demo_universal_mult_hash +end program example_universal_mult_hash diff --git a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 b/test/example/hash_procedures/example_universal_mult_hash_64.f90 similarity index 84% rename from test/example/hash_procedures/demo_universal_mult_hash_64.f90 rename to test/example/hash_procedures/example_universal_mult_hash_64.f90 index 93544707c..ab4644170 100644 --- a/test/example/hash_procedures/demo_universal_mult_hash_64.f90 +++ b/test/example/hash_procedures/example_universal_mult_hash_64.f90 @@ -1,4 +1,4 @@ -program demo_universal_mult_hash_64 +program example_universal_mult_hash_64 use stdlib_hash_64bit, only: odd_random_integer, & universal_mult_hash use iso_fortran_env, only: int64 @@ -13,4 +13,4 @@ program demo_universal_mult_hash_64 hash = universal_mult_hash(source, seed, 6) array1(hash) = source print *, seed, hash, array1 -end program demo_universal_mult_hash_64 +end program example_universal_mult_hash_64 diff --git a/test/example/hash_procedures/demo_water_hash.f90 b/test/example/hash_procedures/example_water_hash.f90 similarity index 84% rename from test/example/hash_procedures/demo_water_hash.f90 rename to test/example/hash_procedures/example_water_hash.f90 index 87db9fdc6..6b4464c9c 100644 --- a/test/example/hash_procedures/demo_water_hash.f90 +++ b/test/example/hash_procedures/example_water_hash.f90 @@ -1,4 +1,4 @@ -program demo_water_hash +program example_water_hash use stdlib_hash_32bit, only: water_hash, & new_water_hash_seed use iso_fortran_env, only: int32, int64 @@ -8,4 +8,4 @@ program demo_water_hash call new_water_hash_seed(seed) hash = water_hash([5, 4, 3, 1, 10, 4, 9], seed) print *, hash, seed -end program demo_water_hash +end program example_water_hash diff --git a/test/example/hashmaps/CMakeLists.txt b/test/example/hashmaps/CMakeLists.txt index ec7c68e90..c3962fcfb 100644 --- a/test/example/hashmaps/CMakeLists.txt +++ b/test/example/hashmaps/CMakeLists.txt @@ -1,27 +1,27 @@ -ADD_DEMO(hashmaps_calls) -ADD_DEMO(hashmaps_copy_key) -ADD_DEMO(hashmaps_copy_other) -ADD_DEMO(hashmaps_entries) -ADD_DEMO(hashmaps_equal_keys) -ADD_DEMO(hashmaps_fnv_1a_hasher) -ADD_DEMO(hashmaps_fnv_1_hasher) -ADD_DEMO(hashmaps_free_key) -ADD_DEMO(hashmaps_free_other) -ADD_DEMO(hashmaps_get) -ADD_DEMO(hashmaps_get_other_data) -ADD_DEMO(hashmaps_hasher_fun) -ADD_DEMO(hashmaps_init) -ADD_DEMO(hashmaps_key_test) -ADD_DEMO(hashmaps_loading) -ADD_DEMO(hashmaps_map_entry) -ADD_DEMO(hashmaps_num_slots) -ADD_DEMO(hashmaps_probes) -ADD_DEMO(hashmaps_rehash) -ADD_DEMO(hashmaps_remove) -ADD_DEMO(hashmaps_seeded_nmhash32_hasher) -ADD_DEMO(hashmaps_seeded_nmhash32x_hasher) -ADD_DEMO(hashmaps_seeded_water_hasher) -ADD_DEMO(hashmaps_set) -ADD_DEMO(hashmaps_set_other_data) -ADD_DEMO(hashmaps_slots_bits) -ADD_DEMO(hashmaps_total_depth) +ADD_EXAMPLE(hashmaps_calls) +ADD_EXAMPLE(hashmaps_copy_key) +ADD_EXAMPLE(hashmaps_copy_other) +ADD_EXAMPLE(hashmaps_entries) +ADD_EXAMPLE(hashmaps_equal_keys) +ADD_EXAMPLE(hashmaps_fnv_1a_hasher) +ADD_EXAMPLE(hashmaps_fnv_1_hasher) +ADD_EXAMPLE(hashmaps_free_key) +ADD_EXAMPLE(hashmaps_free_other) +ADD_EXAMPLE(hashmaps_get) +ADD_EXAMPLE(hashmaps_get_other_data) +ADD_EXAMPLE(hashmaps_hasher_fun) +ADD_EXAMPLE(hashmaps_init) +ADD_EXAMPLE(hashmaps_key_test) +ADD_EXAMPLE(hashmaps_loading) +ADD_EXAMPLE(hashmaps_map_entry) +ADD_EXAMPLE(hashmaps_num_slots) +ADD_EXAMPLE(hashmaps_probes) +ADD_EXAMPLE(hashmaps_rehash) +ADD_EXAMPLE(hashmaps_remove) +ADD_EXAMPLE(hashmaps_seeded_nmhash32_hasher) +ADD_EXAMPLE(hashmaps_seeded_nmhash32x_hasher) +ADD_EXAMPLE(hashmaps_seeded_water_hasher) +ADD_EXAMPLE(hashmaps_set) +ADD_EXAMPLE(hashmaps_set_other_data) +ADD_EXAMPLE(hashmaps_slots_bits) +ADD_EXAMPLE(hashmaps_total_depth) diff --git a/test/example/hashmaps/demo_hashmaps_calls.f90 b/test/example/hashmaps/example_hashmaps_calls.f90 similarity index 86% rename from test/example/hashmaps/demo_hashmaps_calls.f90 rename to test/example/hashmaps/example_hashmaps_calls.f90 index 720f16c37..2e8306675 100644 --- a/test/example/hashmaps/demo_hashmaps_calls.f90 +++ b/test/example/hashmaps/example_hashmaps_calls.f90 @@ -1,4 +1,4 @@ -program demo_calls +program example_calls use stdlib_hashmaps, only: chaining_hashmap_type, int_calls use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none @@ -7,4 +7,4 @@ program demo_calls call map%init(fnv_1_hasher) initial_calls = map%calls() print *, "INITIAL_CALLS = ", initial_calls -end program demo_calls +end program example_calls diff --git a/test/example/hashmaps/demo_hashmaps_copy_key.f90 b/test/example/hashmaps/example_hashmaps_copy_key.f90 similarity index 86% rename from test/example/hashmaps/demo_hashmaps_copy_key.f90 rename to test/example/hashmaps/example_hashmaps_copy_key.f90 index 39583a61e..615796ec1 100644 --- a/test/example/hashmaps/demo_hashmaps_copy_key.f90 +++ b/test/example/hashmaps/example_hashmaps_copy_key.f90 @@ -1,4 +1,4 @@ -program demo_copy_key +program example_copy_key use stdlib_hashmap_wrappers, only: & copy_key, operator(==), key_type, set use iso_fortran_env, only: int8 @@ -9,4 +9,4 @@ program demo_copy_key call set(old_key, value) call copy_key(old_key, new_key) print *, "old_key == new_key = ", old_key == new_key -end program demo_copy_key +end program example_copy_key diff --git a/test/example/hashmaps/demo_hashmaps_copy_other.f90 b/test/example/hashmaps/example_hashmaps_copy_other.f90 similarity index 90% rename from test/example/hashmaps/demo_hashmaps_copy_other.f90 rename to test/example/hashmaps/example_hashmaps_copy_other.f90 index 12c6f72bd..a9d9c03e1 100644 --- a/test/example/hashmaps/demo_hashmaps_copy_other.f90 +++ b/test/example/hashmaps/example_hashmaps_copy_other.f90 @@ -1,4 +1,4 @@ -program demo_copy_other +program example_copy_other use stdlib_hashmap_wrappers, only: & copy_other, other_type use iso_fortran_env, only: int8 @@ -19,4 +19,4 @@ program demo_copy_other print *, "other_in == other_out = ", & all(dummy_val%value == out%value) end select -end program demo_copy_other +end program example_copy_other diff --git a/test/example/hashmaps/demo_hashmaps_entries.f90 b/test/example/hashmaps/example_hashmaps_entries.f90 similarity index 85% rename from test/example/hashmaps/demo_hashmaps_entries.f90 rename to test/example/hashmaps/example_hashmaps_entries.f90 index ff9d9e57a..2e5e5ea4e 100644 --- a/test/example/hashmaps/demo_hashmaps_entries.f90 +++ b/test/example/hashmaps/example_hashmaps_entries.f90 @@ -1,4 +1,4 @@ -program demo_entries +program example_entries use stdlib_hashmaps, only: open_hashmap_type, int_index use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none @@ -7,4 +7,4 @@ program demo_entries call map%init(fnv_1_hasher) initial_entries = map%entries() print *, "INITIAL_ENTRIES = ", initial_entries -end program demo_entries +end program example_entries diff --git a/test/example/hashmaps/demo_hashmaps_equal_keys.f90 b/test/example/hashmaps/example_hashmaps_equal_keys.f90 similarity index 86% rename from test/example/hashmaps/demo_hashmaps_equal_keys.f90 rename to test/example/hashmaps/example_hashmaps_equal_keys.f90 index 395945141..dbf66334d 100644 --- a/test/example/hashmaps/demo_hashmaps_equal_keys.f90 +++ b/test/example/hashmaps/example_hashmaps_equal_keys.f90 @@ -1,4 +1,4 @@ -program demo_equal_keys +program example_equal_keys use stdlib_hashmap_wrappers, only: & copy_key, operator(==), key_type, set use iso_fortran_env, only: int8 @@ -11,4 +11,4 @@ program demo_equal_keys call set(old_key, value) call copy_key(old_key, new_key) print *, "old_key == new_key = ", old_key == new_key -end program demo_equal_keys +end program example_equal_keys diff --git a/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 b/test/example/hashmaps/example_hashmaps_fnv_1_hasher.f90 similarity index 84% rename from test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 rename to test/example/hashmaps/example_hashmaps_fnv_1_hasher.f90 index d95e9a088..f8b052125 100644 --- a/test/example/hashmaps/demo_hashmaps_fnv_1_hasher.f90 +++ b/test/example/hashmaps/example_hashmaps_fnv_1_hasher.f90 @@ -1,4 +1,4 @@ -program demo_fnv_1_hasher +program example_fnv_1_hasher use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set use iso_fortran_env, only: int8, int32 implicit none @@ -9,4 +9,4 @@ program demo_fnv_1_hasher call set(key, array1) hash = fnv_1_hasher(key) print *, hash -end program demo_fnv_1_hasher +end program example_fnv_1_hasher diff --git a/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 b/test/example/hashmaps/example_hashmaps_fnv_1a_hasher.f90 similarity index 84% rename from test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 rename to test/example/hashmaps/example_hashmaps_fnv_1a_hasher.f90 index 7832615b4..b843f89fe 100644 --- a/test/example/hashmaps/demo_hashmaps_fnv_1a_hasher.f90 +++ b/test/example/hashmaps/example_hashmaps_fnv_1a_hasher.f90 @@ -1,4 +1,4 @@ -program demo_fnv_1a_hasher +program example_fnv_1a_hasher use stdlib_hashmap_wrappers, only: & fnv_1a_hasher, key_type, set use iso_fortran_env, only: int8, int32 @@ -10,4 +10,4 @@ program demo_fnv_1a_hasher call set(key, array1) hash = fnv_1a_hasher(key) print *, hash -end program demo_fnv_1a_hasher +end program example_fnv_1a_hasher diff --git a/test/example/hashmaps/demo_hashmaps_free_key.f90 b/test/example/hashmaps/example_hashmaps_free_key.f90 similarity index 85% rename from test/example/hashmaps/demo_hashmaps_free_key.f90 rename to test/example/hashmaps/example_hashmaps_free_key.f90 index 3ed865b2f..70039a425 100644 --- a/test/example/hashmaps/demo_hashmaps_free_key.f90 +++ b/test/example/hashmaps/example_hashmaps_free_key.f90 @@ -1,4 +1,4 @@ -program demo_free_key +program example_free_key use stdlib_hashmap_wrappers, only: & copy_key, free_key, key_type, set use iso_fortran_env, only: int8 @@ -9,4 +9,4 @@ program demo_free_key call set(old_key, value) call copy_key(old_key, new_key) call free_key(old_key) -end program demo_free_key +end program example_free_key diff --git a/test/example/hashmaps/demo_hashmaps_free_other.f90 b/test/example/hashmaps/example_hashmaps_free_other.f90 similarity index 88% rename from test/example/hashmaps/demo_hashmaps_free_other.f90 rename to test/example/hashmaps/example_hashmaps_free_other.f90 index e6fd47c73..6f4a0f292 100644 --- a/test/example/hashmaps/demo_hashmaps_free_other.f90 +++ b/test/example/hashmaps/example_hashmaps_free_other.f90 @@ -1,4 +1,4 @@ -program demo_free_other +program example_free_other use stdlib_hashmap_wrappers, only: & copy_other, free_other, other_type use iso_fortran_env, only: int8 @@ -15,4 +15,4 @@ program demo_free_other allocate (other_in%value, source=dummy_val) call copy_other(other_in, other_out) call free_other(other_out) -end program demo_free_other +end program example_free_other diff --git a/test/example/hashmaps/demo_hashmaps_get.f90 b/test/example/hashmaps/example_hashmaps_get.f90 similarity index 89% rename from test/example/hashmaps/demo_hashmaps_get.f90 rename to test/example/hashmaps/example_hashmaps_get.f90 index 6091234cb..ed78e1a03 100644 --- a/test/example/hashmaps/demo_hashmaps_get.f90 +++ b/test/example/hashmaps/example_hashmaps_get.f90 @@ -1,4 +1,4 @@ -program demo_get +program example_get use stdlib_hashmap_wrappers, only: & get, key_type, set use iso_fortran_env, only: int8 @@ -13,4 +13,4 @@ program demo_get call set(key, value) call get(key, result) print *, 'RESULT == VALUE = ', all(value == result) -end program demo_get +end program example_get diff --git a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 b/test/example/hashmaps/example_hashmaps_get_other_data.f90 similarity index 93% rename from test/example/hashmaps/demo_hashmaps_get_other_data.f90 rename to test/example/hashmaps/example_hashmaps_get_other_data.f90 index e4d629272..cedf5e1fe 100644 --- a/test/example/hashmaps/demo_hashmaps_get_other_data.f90 +++ b/test/example/hashmaps/example_hashmaps_get_other_data.f90 @@ -1,4 +1,4 @@ -program demo_get_other_data +program example_get_other_data use stdlib_kinds, only: int8 use stdlib_hashmaps, only: chaining_hashmap_type, int_index use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set, get @@ -29,4 +29,4 @@ program demo_get_other_data class default print *, 'Invalid data type in other' end select -end program demo_get_other_data +end program example_get_other_data diff --git a/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 b/test/example/hashmaps/example_hashmaps_hasher_fun.f90 similarity index 88% rename from test/example/hashmaps/demo_hashmaps_hasher_fun.f90 rename to test/example/hashmaps/example_hashmaps_hasher_fun.f90 index c77d87bb6..0e4c0145e 100644 --- a/test/example/hashmaps/demo_hashmaps_hasher_fun.f90 +++ b/test/example/hashmaps/example_hashmaps_hasher_fun.f90 @@ -1,4 +1,4 @@ -program demo_hasher_fun +program example_hasher_fun use stdlib_hashmap_wrappers, only: fnv_1a_hasher, hasher_fun, set, key_type use stdlib_kinds, only: int8, int32 implicit none @@ -11,4 +11,4 @@ program demo_hasher_fun call set(key, array1) hash = hasher_pointer(key) print *, hash -end program demo_hasher_fun +end program example_hasher_fun diff --git a/test/example/hashmaps/demo_hashmaps_init.f90 b/test/example/hashmaps/example_hashmaps_init.f90 similarity index 81% rename from test/example/hashmaps/demo_hashmaps_init.f90 rename to test/example/hashmaps/example_hashmaps_init.f90 index c58fe55c9..ef2d85b54 100644 --- a/test/example/hashmaps/demo_hashmaps_init.f90 +++ b/test/example/hashmaps/example_hashmaps_init.f90 @@ -1,7 +1,7 @@ -program demo_init +program example_init use stdlib_hashmaps, only: chaining_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none type(chaining_hashmap_type) :: map call map%init(fnv_1_hasher, slots_bits=10) -end program demo_init +end program example_init diff --git a/test/example/hashmaps/demo_hashmaps_key_test.f90 b/test/example/hashmaps/example_hashmaps_key_test.f90 similarity index 88% rename from test/example/hashmaps/demo_hashmaps_key_test.f90 rename to test/example/hashmaps/example_hashmaps_key_test.f90 index a9b02e805..c3248b5c8 100644 --- a/test/example/hashmaps/demo_hashmaps_key_test.f90 +++ b/test/example/hashmaps/example_hashmaps_key_test.f90 @@ -1,4 +1,4 @@ -program demo_key_test +program example_key_test use stdlib_kinds, only: int8 use stdlib_hashmaps, only: chaining_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, set @@ -10,4 +10,4 @@ program demo_key_test call set(key, [0_int8, 1_int8]) call map%key_test(key, present) print *, "Initial key of 10 present for empty map = ", present -end program demo_key_test +end program example_key_test diff --git a/test/example/hashmaps/demo_hashmaps_loading.f90 b/test/example/hashmaps/example_hashmaps_loading.f90 similarity index 83% rename from test/example/hashmaps/demo_hashmaps_loading.f90 rename to test/example/hashmaps/example_hashmaps_loading.f90 index 805b7cd8e..33e1e43ec 100644 --- a/test/example/hashmaps/demo_hashmaps_loading.f90 +++ b/test/example/hashmaps/example_hashmaps_loading.f90 @@ -1,4 +1,4 @@ -program demo_loading +program example_loading use stdlib_hashmaps, only: open_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none @@ -7,4 +7,4 @@ program demo_loading call map%init(fnv_1_hasher) ratio = map%loading() print *, "Initial loading = ", ratio -end program demo_loading +end program example_loading diff --git a/test/example/hashmaps/demo_hashmaps_map_entry.f90 b/test/example/hashmaps/example_hashmaps_map_entry.f90 similarity index 91% rename from test/example/hashmaps/demo_hashmaps_map_entry.f90 rename to test/example/hashmaps/example_hashmaps_map_entry.f90 index 311a37da4..c28a4c28b 100644 --- a/test/example/hashmaps/demo_hashmaps_map_entry.f90 +++ b/test/example/hashmaps/example_hashmaps_map_entry.f90 @@ -1,4 +1,4 @@ -program demo_map_entry +program example_map_entry use, intrinsic:: iso_fortran_env, only: int8 use stdlib_hashmaps, only: chaining_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set @@ -13,4 +13,4 @@ program demo_map_entry call set(other, dummy) call map%map_entry(key, other, conflict) print *, 'CONFLICT = ', conflict -end program demo_map_entry +end program example_map_entry diff --git a/test/example/hashmaps/demo_hashmaps_num_slots.f90 b/test/example/hashmaps/example_hashmaps_num_slots.f90 similarity index 84% rename from test/example/hashmaps/demo_hashmaps_num_slots.f90 rename to test/example/hashmaps/example_hashmaps_num_slots.f90 index b43a153b8..64fc900b4 100644 --- a/test/example/hashmaps/demo_hashmaps_num_slots.f90 +++ b/test/example/hashmaps/example_hashmaps_num_slots.f90 @@ -1,4 +1,4 @@ -program demo_num_slots +program example_num_slots use stdlib_hashmaps, only: chaining_hashmap_type, int_index use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none @@ -7,4 +7,4 @@ program demo_num_slots call map%init(fnv_1_hasher) initial_slots = map%num_slots() print *, "Initial slots = ", initial_slots -end program demo_num_slots +end program example_num_slots diff --git a/test/example/hashmaps/demo_hashmaps_probes.f90 b/test/example/hashmaps/example_hashmaps_probes.f90 similarity index 84% rename from test/example/hashmaps/demo_hashmaps_probes.f90 rename to test/example/hashmaps/example_hashmaps_probes.f90 index 0fa7456e9..b279a7983 100644 --- a/test/example/hashmaps/demo_hashmaps_probes.f90 +++ b/test/example/hashmaps/example_hashmaps_probes.f90 @@ -1,4 +1,4 @@ -program demo_probes +program example_probes use stdlib_hashmaps, only: chaining_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none @@ -7,4 +7,4 @@ program demo_probes call map%init(fnv_1_hasher) nprobes = map%map_probes() print *, "Initial probes = ", nprobes -end program demo_probes +end program example_probes diff --git a/test/example/hashmaps/demo_hashmaps_rehash.f90 b/test/example/hashmaps/example_hashmaps_rehash.f90 similarity index 92% rename from test/example/hashmaps/demo_hashmaps_rehash.f90 rename to test/example/hashmaps/example_hashmaps_rehash.f90 index a15dcbabf..2205ca370 100644 --- a/test/example/hashmaps/demo_hashmaps_rehash.f90 +++ b/test/example/hashmaps/example_hashmaps_rehash.f90 @@ -1,4 +1,4 @@ -program demo_rehash +program example_rehash use stdlib_kinds, only: int8 use stdlib_hashmaps, only: open_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher, & @@ -14,4 +14,4 @@ program demo_rehash call set(other, dummy) call map%map_entry(key, other) call map%rehash(fnv_1a_hasher) -end program demo_rehash +end program example_rehash diff --git a/test/example/hashmaps/demo_hashmaps_remove.f90 b/test/example/hashmaps/example_hashmaps_remove.f90 similarity index 92% rename from test/example/hashmaps/demo_hashmaps_remove.f90 rename to test/example/hashmaps/example_hashmaps_remove.f90 index 7b39a8440..53e1e9b1d 100644 --- a/test/example/hashmaps/demo_hashmaps_remove.f90 +++ b/test/example/hashmaps/example_hashmaps_remove.f90 @@ -1,4 +1,4 @@ -program demo_remove +program example_remove use stdlib_kinds, only: int8 use stdlib_hashmaps, only: open_hashmap_type, int_index use stdlib_hashmap_wrappers, only: fnv_1_hasher, & @@ -15,4 +15,4 @@ program demo_remove call map%map_entry(key, other) call map%remove(key, existed) print *, "Removed key existed = ", existed -end program demo_remove +end program example_remove diff --git a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 b/test/example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 similarity index 81% rename from test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 rename to test/example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 index 7f817394b..1ffe8b151 100644 --- a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32_hasher.f90 +++ b/test/example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 @@ -1,4 +1,4 @@ -program demo_seeded_nmhash32_hasher +program example_seeded_nmhash32_hasher use stdlib_hashmap_wrappers, only: & seeded_nmhash32_hasher, key_type, set use iso_fortran_env, only: int8, int32 @@ -10,4 +10,4 @@ program demo_seeded_nmhash32_hasher call set(key, array1) hash = seeded_nmhash32_hasher(key) print *, hash -end program demo_seeded_nmhash32_hasher +end program example_seeded_nmhash32_hasher diff --git a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 b/test/example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 similarity index 81% rename from test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 rename to test/example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 index cfb53a123..4394f0939 100644 --- a/test/example/hashmaps/demo_hashmaps_seeded_nmhash32x_hasher.f90 +++ b/test/example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 @@ -1,4 +1,4 @@ -program demo_seeded_nmhash32x_hasher +program example_seeded_nmhash32x_hasher use stdlib_kinds, only: int8, int32 use stdlib_hashmap_wrappers, only: & seeded_nmhash32x_hasher, key_type, set @@ -10,4 +10,4 @@ program demo_seeded_nmhash32x_hasher call set(key, array1) hash = seeded_nmhash32x_hasher(key) print *, hash -end program demo_seeded_nmhash32x_hasher +end program example_seeded_nmhash32x_hasher diff --git a/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 b/test/example/hashmaps/example_hashmaps_seeded_water_hasher.f90 similarity index 82% rename from test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 rename to test/example/hashmaps/example_hashmaps_seeded_water_hasher.f90 index 3b12c6b3e..cbcf9324e 100644 --- a/test/example/hashmaps/demo_hashmaps_seeded_water_hasher.f90 +++ b/test/example/hashmaps/example_hashmaps_seeded_water_hasher.f90 @@ -1,4 +1,4 @@ -program demo_seeded_water_hasher +program example_seeded_water_hasher use stdlib_hashmap_wrappers, only: & seeded_water_hasher, key_type, set use iso_fortran_env, only: int8, int32 @@ -10,4 +10,4 @@ program demo_seeded_water_hasher call set(key, array1) hash = seeded_water_hasher(key) print *, hash -end program demo_seeded_water_hasher +end program example_seeded_water_hasher diff --git a/test/example/hashmaps/demo_hashmaps_set.f90 b/test/example/hashmaps/example_hashmaps_set.f90 similarity index 89% rename from test/example/hashmaps/demo_hashmaps_set.f90 rename to test/example/hashmaps/example_hashmaps_set.f90 index 6b5f69829..3bfed35ee 100644 --- a/test/example/hashmaps/demo_hashmaps_set.f90 +++ b/test/example/hashmaps/example_hashmaps_set.f90 @@ -1,4 +1,4 @@ -program demo_set +program example_set use stdlib_hashmap_wrappers, only: & get, key_type, set use iso_fortran_env, only: int8 @@ -13,4 +13,4 @@ program demo_set call set(key, value) call get(key, result) print *, 'RESULT == VALUE = ', all(value == result) -end program demo_set +end program example_set diff --git a/test/example/hashmaps/demo_hashmaps_set_other_data.f90 b/test/example/hashmaps/example_hashmaps_set_other_data.f90 similarity index 92% rename from test/example/hashmaps/demo_hashmaps_set_other_data.f90 rename to test/example/hashmaps/example_hashmaps_set_other_data.f90 index 39fdcf5c6..fbc3863f7 100644 --- a/test/example/hashmaps/demo_hashmaps_set_other_data.f90 +++ b/test/example/hashmaps/example_hashmaps_set_other_data.f90 @@ -1,4 +1,4 @@ -program demo_set_other_data +program example_set_other_data use stdlib_kinds, only: int8 use stdlib_hashmaps, only: open_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher, & @@ -19,4 +19,4 @@ program demo_set_other_data call set(other, dummy) call map%set_other_data(key, other, exists) print *, 'The entry to have its other data replaced exists = ', exists -end program demo_set_other_data +end program example_set_other_data diff --git a/test/example/hashmaps/demo_hashmaps_slots_bits.f90 b/test/example/hashmaps/example_hashmaps_slots_bits.f90 similarity index 82% rename from test/example/hashmaps/demo_hashmaps_slots_bits.f90 rename to test/example/hashmaps/example_hashmaps_slots_bits.f90 index f0e0d7f7c..141eb62fe 100644 --- a/test/example/hashmaps/demo_hashmaps_slots_bits.f90 +++ b/test/example/hashmaps/example_hashmaps_slots_bits.f90 @@ -1,4 +1,4 @@ -program demo_slots_bits +program example_slots_bits use stdlib_hashmaps, only: chaining_hashmap_type use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none @@ -7,4 +7,4 @@ program demo_slots_bits call map%init(fnv_1_hasher) bits = map%slots_bits() print *, "Initial slot bits = ", bits -end program demo_slots_bits +end program example_slots_bits diff --git a/test/example/hashmaps/demo_hashmaps_total_depth.f90 b/test/example/hashmaps/example_hashmaps_total_depth.f90 similarity index 84% rename from test/example/hashmaps/demo_hashmaps_total_depth.f90 rename to test/example/hashmaps/example_hashmaps_total_depth.f90 index 935c0a8ca..51a15929e 100644 --- a/test/example/hashmaps/demo_hashmaps_total_depth.f90 +++ b/test/example/hashmaps/example_hashmaps_total_depth.f90 @@ -1,4 +1,4 @@ -program demo_total_depth +program example_total_depth use stdlib_hashmaps, only: chaining_hashmap_type, int_depth use stdlib_hashmap_wrappers, only: fnv_1_hasher implicit none @@ -7,4 +7,4 @@ program demo_total_depth call map%init(fnv_1_hasher) initial_depth = map%total_depth() print *, "Initial total depth = ", initial_depth -end program demo_total_depth +end program example_total_depth diff --git a/test/example/io/CMakeLists.txt b/test/example/io/CMakeLists.txt index d1c4e7003..2e606d2d1 100644 --- a/test/example/io/CMakeLists.txt +++ b/test/example/io/CMakeLists.txt @@ -1,7 +1,7 @@ -ADD_DEMO(fmt_constants) -#ADD_DEMO(getline) -ADD_DEMO(loadnpy) -ADD_DEMO(loadtxt) -ADD_DEMO(open) -ADD_DEMO(savenpy) -ADD_DEMO(savetxt) +ADD_EXAMPLE(fmt_constants) +#ADD_EXAMPLE(getline) +ADD_EXAMPLE(loadnpy) +ADD_EXAMPLE(loadtxt) +ADD_EXAMPLE(open) +ADD_EXAMPLE(savenpy) +ADD_EXAMPLE(savetxt) diff --git a/test/example/io/demo_fmt_constants.f90 b/test/example/io/example_fmt_constants.f90 similarity index 93% rename from test/example/io/demo_fmt_constants.f90 rename to test/example/io/example_fmt_constants.f90 index e1a3a6458..03a4f20bb 100644 --- a/test/example/io/demo_fmt_constants.f90 +++ b/test/example/io/example_fmt_constants.f90 @@ -1,4 +1,4 @@ -program demo_fmt_constants +program example_fmt_constants use stdlib_kinds, only: int32, int64, sp, dp use stdlib_io, only: FMT_INT, FMT_REAL_SP, FMT_REAL_DP, FMT_COMPLEX_SP, FMT_COMPLEX_DP implicit none @@ -23,4 +23,4 @@ program demo_fmt_constants print FMT_COMPLEX_SP, c32 ! outputs: 1.00000000E+02 0.00000000E+00 print FMT_COMPLEX_DP, c64 ! outputs: 1.0000000000000000E+002 0.0000000000000000E+000 -end program demo_fmt_constants +end program example_fmt_constants diff --git a/test/example/io/demo_getline.f90 b/test/example/io/example_getline.f90 similarity index 86% rename from test/example/io/demo_getline.f90 rename to test/example/io/example_getline.f90 index f8fb61993..f61265099 100644 --- a/test/example/io/demo_getline.f90 +++ b/test/example/io/example_getline.f90 @@ -1,4 +1,4 @@ -program demo_getline +program example_getline use, intrinsic :: iso_fortran_env, only: input_unit, output_unit use stdlib_io, only: getline implicit none @@ -10,4 +10,4 @@ program demo_getline write (output_unit, '(a)') line call getline(input_unit, line, stat) end do -end program demo_getline +end program example_getline diff --git a/test/example/io/demo_loadnpy.f90 b/test/example/io/example_loadnpy.f90 similarity index 69% rename from test/example/io/demo_loadnpy.f90 rename to test/example/io/example_loadnpy.f90 index aba6bb7ba..b037312ec 100644 --- a/test/example/io/demo_loadnpy.f90 +++ b/test/example/io/example_loadnpy.f90 @@ -1,6 +1,6 @@ -program demo_loadnpy +program example_loadnpy use stdlib_io_npy, only: load_npy implicit none real, allocatable :: x(:, :) call load_npy('example.npy', x) -end program demo_loadnpy +end program example_loadnpy diff --git a/test/example/io/demo_loadtxt.f90 b/test/example/io/example_loadtxt.f90 similarity index 68% rename from test/example/io/demo_loadtxt.f90 rename to test/example/io/example_loadtxt.f90 index 5c77e8853..5db4f02e2 100644 --- a/test/example/io/demo_loadtxt.f90 +++ b/test/example/io/example_loadtxt.f90 @@ -1,6 +1,6 @@ -program demo_loadtxt +program example_loadtxt use stdlib_io, only: loadtxt implicit none real, allocatable :: x(:, :) call loadtxt('example.dat', x) -end program demo_loadtxt +end program example_loadtxt diff --git a/test/example/io/demo_open.f90 b/test/example/io/example_open.f90 similarity index 76% rename from test/example/io/demo_open.f90 rename to test/example/io/example_open.f90 index 6820e82b1..5eef97791 100644 --- a/test/example/io/demo_open.f90 +++ b/test/example/io/example_open.f90 @@ -1,8 +1,8 @@ -program demo_open +program example_open use stdlib_io, only: open implicit none integer :: u u = open ('example.dat', 'wt') write (u, '(a)') 'This is an example for open' close (u) -end program demo_open +end program example_open diff --git a/test/example/io/demo_savenpy.f90 b/test/example/io/example_savenpy.f90 similarity index 67% rename from test/example/io/demo_savenpy.f90 rename to test/example/io/example_savenpy.f90 index d77a04226..b6929f40f 100644 --- a/test/example/io/demo_savenpy.f90 +++ b/test/example/io/example_savenpy.f90 @@ -1,6 +1,6 @@ -program demo_savenpy +program example_savenpy use stdlib_io_npy, only: save_npy implicit none real :: x(3, 2) = 1 call save_npy('example.npy', x) -end program demo_savenpy +end program example_savenpy diff --git a/test/example/io/demo_savetxt.f90 b/test/example/io/example_savetxt.f90 similarity index 66% rename from test/example/io/demo_savetxt.f90 rename to test/example/io/example_savetxt.f90 index a19c8dedd..b1e6b94d9 100644 --- a/test/example/io/demo_savetxt.f90 +++ b/test/example/io/example_savetxt.f90 @@ -1,6 +1,6 @@ -program demo_savetxt +program example_savetxt use stdlib_io, only: savetxt implicit none real :: x(3, 2) = 1 call savetxt('example.dat', x) -end program demo_savetxt +end program example_savetxt diff --git a/test/example/linalg/CMakeLists.txt b/test/example/linalg/CMakeLists.txt index 756644569..3f31a5574 100644 --- a/test/example/linalg/CMakeLists.txt +++ b/test/example/linalg/CMakeLists.txt @@ -1,16 +1,16 @@ -ADD_DEMO(diag1) -ADD_DEMO(diag2) -ADD_DEMO(diag3) -ADD_DEMO(diag4) -ADD_DEMO(diag5) -ADD_DEMO(eye1) -ADD_DEMO(eye2) -ADD_DEMO(is_diagonal) -ADD_DEMO(is_hermitian) -ADD_DEMO(is_hessenberg) -ADD_DEMO(is_skew_symmetric) -ADD_DEMO(is_square) -ADD_DEMO(is_symmetric) -ADD_DEMO(is_triangular) -ADD_DEMO(outer_product) -ADD_DEMO(trace) +ADD_EXAMPLE(diag1) +ADD_EXAMPLE(diag2) +ADD_EXAMPLE(diag3) +ADD_EXAMPLE(diag4) +ADD_EXAMPLE(diag5) +ADD_EXAMPLE(eye1) +ADD_EXAMPLE(eye2) +ADD_EXAMPLE(is_diagonal) +ADD_EXAMPLE(is_hermitian) +ADD_EXAMPLE(is_hessenberg) +ADD_EXAMPLE(is_skew_symmetric) +ADD_EXAMPLE(is_square) +ADD_EXAMPLE(is_symmetric) +ADD_EXAMPLE(is_triangular) +ADD_EXAMPLE(outer_product) +ADD_EXAMPLE(trace) diff --git a/test/example/linalg/demo_diag1.f90 b/test/example/linalg/example_diag1.f90 similarity index 76% rename from test/example/linalg/demo_diag1.f90 rename to test/example/linalg/example_diag1.f90 index bd4491de7..de03ac159 100644 --- a/test/example/linalg/demo_diag1.f90 +++ b/test/example/linalg/example_diag1.f90 @@ -1,7 +1,7 @@ -program demo_diag1 +program example_diag1 use stdlib_linalg, only: diag implicit none real, allocatable :: A(:, :) integer :: i A = diag([(1, i=1, 10)]) ! creates a 10 by 10 identity matrix -end program demo_diag1 +end program example_diag1 diff --git a/test/example/linalg/demo_diag2.f90 b/test/example/linalg/example_diag2.f90 similarity index 80% rename from test/example/linalg/demo_diag2.f90 rename to test/example/linalg/example_diag2.f90 index 6e59bb7af..5dd260bcc 100644 --- a/test/example/linalg/demo_diag2.f90 +++ b/test/example/linalg/example_diag2.f90 @@ -1,8 +1,8 @@ -program demo_diag2 +program example_diag2 use stdlib_linalg, only: diag implicit none real, allocatable :: v(:) real, allocatable :: A(:, :) v = [1, 2, 3, 4, 5] A = diag(v) ! creates a 5 by 5 matrix with elements of v on the diagonal -end program demo_diag2 +end program example_diag2 diff --git a/test/example/linalg/demo_diag3.f90 b/test/example/linalg/example_diag3.f90 similarity index 81% rename from test/example/linalg/demo_diag3.f90 rename to test/example/linalg/example_diag3.f90 index 3ff5026d5..b76533a78 100644 --- a/test/example/linalg/demo_diag3.f90 +++ b/test/example/linalg/example_diag3.f90 @@ -1,4 +1,4 @@ -program demo_diag3 +program example_diag3 use stdlib_linalg, only: diag implicit none integer, parameter :: n = 10 @@ -7,4 +7,4 @@ program demo_diag3 c = 2 ul = -1 A = diag(ul, -1) + diag(c) + diag(ul, 1) ! Gil Strang's favorite matrix -end program demo_diag3 +end program example_diag3 diff --git a/test/example/linalg/demo_diag4.f90 b/test/example/linalg/example_diag4.f90 similarity index 79% rename from test/example/linalg/demo_diag4.f90 rename to test/example/linalg/example_diag4.f90 index 02beb80f0..dd1a848d8 100644 --- a/test/example/linalg/demo_diag4.f90 +++ b/test/example/linalg/example_diag4.f90 @@ -1,4 +1,4 @@ -program demo_diag4 +program example_diag4 use stdlib_linalg, only: diag implicit none integer, parameter :: n = 12 @@ -6,4 +6,4 @@ program demo_diag4 real :: v(n) call random_number(A) v = diag(A) ! v contains diagonal elements of A -end program demo_diag4 +end program example_diag4 diff --git a/test/example/linalg/demo_diag5.f90 b/test/example/linalg/example_diag5.f90 similarity index 83% rename from test/example/linalg/demo_diag5.f90 rename to test/example/linalg/example_diag5.f90 index 03d7d7109..438a4b9b3 100644 --- a/test/example/linalg/demo_diag5.f90 +++ b/test/example/linalg/example_diag5.f90 @@ -1,4 +1,4 @@ -program demo_diag5 +program example_diag5 use stdlib_linalg, only: diag implicit none integer, parameter :: n = 3 @@ -7,4 +7,4 @@ program demo_diag5 A = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [n, n]) v = diag(A, -1) ! v is [2,6] v = diag(A, 1) ! v is [4,8] -end program demo_diag5 +end program example_diag5 diff --git a/test/example/linalg/demo_eye1.f90 b/test/example/linalg/example_eye1.f90 similarity index 92% rename from test/example/linalg/demo_eye1.f90 rename to test/example/linalg/example_eye1.f90 index 3e7723d41..7edda482b 100644 --- a/test/example/linalg/demo_eye1.f90 +++ b/test/example/linalg/example_eye1.f90 @@ -1,4 +1,4 @@ -program demo_eye1 +program example_eye1 use stdlib_linalg, only: eye implicit none integer :: i(2, 2) @@ -11,4 +11,4 @@ program demo_eye1 B = eye(2, 3) !! [1.0,0.0,0.0; 0.0,1.0,0.0] C = eye(2, 2) !! [(1.0,0.0),(0.0,0.0); (0.0,0.0),(1.0,0.0)] C = (1.0, 1.0)*eye(2, 2) !! [(1.0,1.0),(0.0,0.0); (0.0,0.0),(1.0,1.0)] -end program demo_eye1 +end program example_eye1 diff --git a/test/example/linalg/demo_eye2.f90 b/test/example/linalg/example_eye2.f90 similarity index 71% rename from test/example/linalg/demo_eye2.f90 rename to test/example/linalg/example_eye2.f90 index ae28c48de..93eddb76c 100644 --- a/test/example/linalg/demo_eye2.f90 +++ b/test/example/linalg/example_eye2.f90 @@ -1,5 +1,5 @@ -program demo_eye2 +program example_eye2 use stdlib_linalg, only: eye, diag implicit none print *, all(eye(4) == diag([1, 1, 1, 1])) ! prints .true. -end program demo_eye2 +end program example_eye2 diff --git a/test/example/linalg/demo_is_diagonal.f90 b/test/example/linalg/example_is_diagonal.f90 similarity index 81% rename from test/example/linalg/demo_is_diagonal.f90 rename to test/example/linalg/example_is_diagonal.f90 index 0e581340e..bd93a6d19 100644 --- a/test/example/linalg/demo_is_diagonal.f90 +++ b/test/example/linalg/example_is_diagonal.f90 @@ -1,4 +1,4 @@ -program demo_is_diagonal +program example_is_diagonal use stdlib_linalg, only: is_diagonal implicit none real :: A(2, 2), B(2, 2) @@ -7,4 +7,4 @@ program demo_is_diagonal B = reshape([1., 0., 3., 4.], shape(B)) res = is_diagonal(A) ! returns .true. res = is_diagonal(B) ! returns .false. -end program demo_is_diagonal +end program example_is_diagonal diff --git a/test/example/linalg/demo_is_hermitian.f90 b/test/example/linalg/example_is_hermitian.f90 similarity index 85% rename from test/example/linalg/demo_is_hermitian.f90 rename to test/example/linalg/example_is_hermitian.f90 index 5a2529f76..3492dcf7d 100644 --- a/test/example/linalg/demo_is_hermitian.f90 +++ b/test/example/linalg/example_is_hermitian.f90 @@ -1,4 +1,4 @@ -program demo_is_hermitian +program example_is_hermitian use stdlib_linalg, only: is_hermitian implicit none complex :: A(2, 2), B(2, 2) @@ -7,4 +7,4 @@ program demo_is_hermitian B = reshape([cmplx(1., 0.), cmplx(3., 1.), cmplx(3., 1.), cmplx(4., 0.)], shape(B)) res = is_hermitian(A) ! returns .true. res = is_hermitian(B) ! returns .false. -end program demo_is_hermitian +end program example_is_hermitian diff --git a/test/example/linalg/demo_is_hessenberg.f90 b/test/example/linalg/example_is_hessenberg.f90 similarity index 83% rename from test/example/linalg/demo_is_hessenberg.f90 rename to test/example/linalg/example_is_hessenberg.f90 index 20c9ef24d..bb1e74b5d 100644 --- a/test/example/linalg/demo_is_hessenberg.f90 +++ b/test/example/linalg/example_is_hessenberg.f90 @@ -1,4 +1,4 @@ -program demo_is_hessenberg +program example_is_hessenberg use stdlib_linalg, only: is_hessenberg implicit none real :: A(3, 3), B(3, 3) @@ -7,4 +7,4 @@ program demo_is_hessenberg B = reshape([1., 2., 3., 4., 5., 6., 7., 8., 9.], shape(B)) res = is_hessenberg(A, 'u') ! returns .true. res = is_hessenberg(B, 'u') ! returns .false. -end program demo_is_hessenberg +end program example_is_hessenberg diff --git a/test/example/linalg/demo_is_skew_symmetric.f90 b/test/example/linalg/example_is_skew_symmetric.f90 similarity index 79% rename from test/example/linalg/demo_is_skew_symmetric.f90 rename to test/example/linalg/example_is_skew_symmetric.f90 index 4df7a40c9..96d6cb333 100644 --- a/test/example/linalg/demo_is_skew_symmetric.f90 +++ b/test/example/linalg/example_is_skew_symmetric.f90 @@ -1,4 +1,4 @@ -program demo_is_skew_symmetric +program example_is_skew_symmetric use stdlib_linalg, only: is_skew_symmetric implicit none real :: A(2, 2), B(2, 2) @@ -7,4 +7,4 @@ program demo_is_skew_symmetric B = reshape([0., 3., 3., 0.], shape(B)) res = is_skew_symmetric(A) ! returns .true. res = is_skew_symmetric(B) ! returns .false. -end program demo_is_skew_symmetric +end program example_is_skew_symmetric diff --git a/test/example/linalg/demo_is_square.f90 b/test/example/linalg/example_is_square.f90 similarity index 82% rename from test/example/linalg/demo_is_square.f90 rename to test/example/linalg/example_is_square.f90 index d2588c83c..237ea6d6a 100644 --- a/test/example/linalg/demo_is_square.f90 +++ b/test/example/linalg/example_is_square.f90 @@ -1,4 +1,4 @@ -program demo_is_square +program example_is_square use stdlib_linalg, only: is_square implicit none real :: A(2, 2), B(3, 2) @@ -7,4 +7,4 @@ program demo_is_square B = reshape([1., 2., 3., 4., 5., 6.], shape(B)) res = is_square(A) ! returns .true. res = is_square(B) ! returns .false. -end program demo_is_square +end program example_is_square diff --git a/test/example/linalg/demo_is_symmetric.f90 b/test/example/linalg/example_is_symmetric.f90 similarity index 81% rename from test/example/linalg/demo_is_symmetric.f90 rename to test/example/linalg/example_is_symmetric.f90 index 3279cb45b..ead88da47 100644 --- a/test/example/linalg/demo_is_symmetric.f90 +++ b/test/example/linalg/example_is_symmetric.f90 @@ -1,4 +1,4 @@ -program demo_is_symmetric +program example_is_symmetric use stdlib_linalg, only: is_symmetric implicit none real :: A(2, 2), B(2, 2) @@ -7,4 +7,4 @@ program demo_is_symmetric B = reshape([1., 0., 3., 4.], shape(B)) res = is_symmetric(A) ! returns .true. res = is_symmetric(B) ! returns .false. -end program demo_is_symmetric +end program example_is_symmetric diff --git a/test/example/linalg/demo_is_triangular.f90 b/test/example/linalg/example_is_triangular.f90 similarity index 83% rename from test/example/linalg/demo_is_triangular.f90 rename to test/example/linalg/example_is_triangular.f90 index 61b8a9ed1..4cc68b647 100644 --- a/test/example/linalg/demo_is_triangular.f90 +++ b/test/example/linalg/example_is_triangular.f90 @@ -1,4 +1,4 @@ -program demo_is_triangular +program example_is_triangular use stdlib_linalg, only: is_triangular implicit none real :: A(3, 3), B(3, 3) @@ -7,4 +7,4 @@ program demo_is_triangular B = reshape([1., 0., 3., 4., 5., 0., 7., 8., 9.], shape(B)) res = is_triangular(A, 'u') ! returns .true. res = is_triangular(B, 'u') ! returns .false. -end program demo_is_triangular +end program example_is_triangular diff --git a/test/example/linalg/demo_outer_product.f90 b/test/example/linalg/example_outer_product.f90 similarity index 76% rename from test/example/linalg/demo_outer_product.f90 rename to test/example/linalg/example_outer_product.f90 index a1214512c..7c20d5c54 100644 --- a/test/example/linalg/demo_outer_product.f90 +++ b/test/example/linalg/example_outer_product.f90 @@ -1,4 +1,4 @@ -program demo_outer_product +program example_outer_product use stdlib_linalg, only: outer_product implicit none real, allocatable :: A(:, :), u(:), v(:) @@ -6,4 +6,4 @@ program demo_outer_product v = [3., 4.] A = outer_product(u, v) !A = reshape([3., 6., 9., 4., 8., 12.], [3,2]) -end program demo_outer_product +end program example_outer_product diff --git a/test/example/linalg/demo_trace.f90 b/test/example/linalg/example_trace.f90 similarity index 75% rename from test/example/linalg/demo_trace.f90 rename to test/example/linalg/example_trace.f90 index dbb375721..fd9795a0d 100644 --- a/test/example/linalg/demo_trace.f90 +++ b/test/example/linalg/example_trace.f90 @@ -1,7 +1,7 @@ -program demo_trace +program example_trace use stdlib_linalg, only: trace implicit none real :: A(3, 3) A = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [3, 3]) print *, trace(A) ! 1 + 5 + 9 -end program demo_trace +end program example_trace diff --git a/test/example/logger/CMakeLists.txt b/test/example/logger/CMakeLists.txt index 14f9610b9..82c8f0650 100644 --- a/test/example/logger/CMakeLists.txt +++ b/test/example/logger/CMakeLists.txt @@ -1,6 +1,6 @@ -ADD_DEMO(add_log_unit) -ADD_DEMO(configure) -ADD_DEMO(global_logger) -ADD_DEMO(log_io_error) +ADD_EXAMPLE(add_log_unit) +ADD_EXAMPLE(configure) +ADD_EXAMPLE(global_logger) +ADD_EXAMPLE(log_io_error) set_tests_properties(log_io_error PROPERTIES WILL_FAIL true) -#ADD_DEMO(log_text_error) +#ADD_EXAMPLE(log_text_error) diff --git a/test/example/logger/demo_add_log_unit.f90 b/test/example/logger/example_add_log_unit.f90 similarity index 87% rename from test/example/logger/demo_add_log_unit.f90 rename to test/example/logger/example_add_log_unit.f90 index fbdd5b19a..b02292b57 100644 --- a/test/example/logger/demo_add_log_unit.f90 +++ b/test/example/logger/example_add_log_unit.f90 @@ -1,4 +1,4 @@ -program demo_add_log_unit +program example_add_log_unit use stdlib_logger, only: global_logger, read_only_error character(256) :: iomsg @@ -16,4 +16,4 @@ program demo_add_log_unit error stop 'Unable to write to "error_log.txt".' end select -end program demo_add_log_unit +end program example_add_log_unit diff --git a/test/example/logger/demo_configure.f90 b/test/example/logger/example_configure.f90 similarity index 65% rename from test/example/logger/demo_configure.f90 rename to test/example/logger/example_configure.f90 index 680a0af25..582a9f89d 100644 --- a/test/example/logger/demo_configure.f90 +++ b/test/example/logger/example_configure.f90 @@ -1,6 +1,6 @@ -program demo_configure +program example_configure use stdlib_logger, only: global => global_logger call global%configure(indent=.false., max_width=72) -end program demo_configure +end program example_configure diff --git a/test/example/logger/demo_global_logger.f90 b/test/example/logger/example_global_logger.f90 similarity index 80% rename from test/example/logger/demo_global_logger.f90 rename to test/example/logger/example_global_logger.f90 index cc08b1e5d..67d290678 100644 --- a/test/example/logger/demo_global_logger.f90 +++ b/test/example/logger/example_global_logger.f90 @@ -1,4 +1,4 @@ -program demo_global_logger +program example_global_logger use stdlib_logger, global => global_logger integer :: unit, stat @@ -9,4 +9,4 @@ program demo_global_logger error stop 'Unable to open "error_log.txt".' end if -end program demo_global_logger +end program example_global_logger diff --git a/test/example/logger/demo_log_io_error.f90 b/test/example/logger/example_log_io_error.f90 similarity index 91% rename from test/example/logger/demo_log_io_error.f90 rename to test/example/logger/example_log_io_error.f90 index fcf254691..09cfc6dcc 100644 --- a/test/example/logger/demo_log_io_error.f90 +++ b/test/example/logger/example_log_io_error.f90 @@ -1,4 +1,4 @@ -program demo_log_io_error +program example_log_io_error use stdlib_logger, global => global_logger character(*), parameter :: filename = 'dummy.txt' @@ -17,4 +17,4 @@ program demo_log_io_error error stop 'Error on opening a file' end if -end program demo_log_io_error +end program example_log_io_error diff --git a/test/example/logger/demo_log_text_error.f90 b/test/example/logger/example_log_text_error.f90 similarity index 93% rename from test/example/logger/demo_log_text_error.f90 rename to test/example/logger/example_log_text_error.f90 index 93a074a10..1adb11a6e 100644 --- a/test/example/logger/demo_log_text_error.f90 +++ b/test/example/logger/example_log_text_error.f90 @@ -1,4 +1,4 @@ -program demo_log_text_error +program example_log_text_error use stdlib_logger character(*), parameter :: filename = 'dummy.txt' @@ -33,4 +33,4 @@ subroutine check_line(line, status, col_no) status = col_no > 0 end subroutine -end program demo_log_text_error +end program example_log_text_error diff --git a/test/example/math/CMakeLists.txt b/test/example/math/CMakeLists.txt index 7bb8b522c..a75f193f4 100644 --- a/test/example/math/CMakeLists.txt +++ b/test/example/math/CMakeLists.txt @@ -1,15 +1,15 @@ -ADD_DEMO(clip_integer) -ADD_DEMO(clip_real) -ADD_DEMO(diff) -ADD_DEMO(gcd) -ADD_DEMO(linspace_complex) -ADD_DEMO(linspace_int16) -ADD_DEMO(logspace_complex) -ADD_DEMO(logspace_int) -ADD_DEMO(logspace_rstart_cbase) -ADD_DEMO(math_all_close) -ADD_DEMO(math_arange) -ADD_DEMO(math_argd) -ADD_DEMO(math_arg) -ADD_DEMO(math_argpi) -ADD_DEMO(math_is_close) +ADD_EXAMPLE(clip_integer) +ADD_EXAMPLE(clip_real) +ADD_EXAMPLE(diff) +ADD_EXAMPLE(gcd) +ADD_EXAMPLE(linspace_complex) +ADD_EXAMPLE(linspace_int16) +ADD_EXAMPLE(logspace_complex) +ADD_EXAMPLE(logspace_int) +ADD_EXAMPLE(logspace_rstart_cbase) +ADD_EXAMPLE(math_all_close) +ADD_EXAMPLE(math_arange) +ADD_EXAMPLE(math_argd) +ADD_EXAMPLE(math_arg) +ADD_EXAMPLE(math_argpi) +ADD_EXAMPLE(math_is_close) diff --git a/test/example/math/demo_clip_integer.f90 b/test/example/math/example_clip_integer.f90 similarity index 82% rename from test/example/math/demo_clip_integer.f90 rename to test/example/math/example_clip_integer.f90 index 736fe3129..fedb45cff 100644 --- a/test/example/math/demo_clip_integer.f90 +++ b/test/example/math/example_clip_integer.f90 @@ -1,4 +1,4 @@ -program demo_clip_integer +program example_clip_integer use stdlib_math, only: clip use stdlib_kinds, only: int32 implicit none @@ -13,4 +13,4 @@ program demo_clip_integer clipped_value = clip(x, xmin, xmax) ! clipped_value <- 5 -end program demo_clip_integer +end program example_clip_integer diff --git a/test/example/math/demo_clip_real.f90 b/test/example/math/example_clip_real.f90 similarity index 83% rename from test/example/math/demo_clip_real.f90 rename to test/example/math/example_clip_real.f90 index 35f7412b2..d67332919 100644 --- a/test/example/math/demo_clip_real.f90 +++ b/test/example/math/example_clip_real.f90 @@ -1,4 +1,4 @@ -program demo_clip_real +program example_clip_real use stdlib_math, only: clip use stdlib_kinds, only: sp implicit none @@ -13,4 +13,4 @@ program demo_clip_real clipped_value = clip(x, xmin, xmax) ! clipped_value <- 3.02500010 -end program demo_clip_real +end program example_clip_real diff --git a/test/example/math/demo_diff.f90 b/test/example/math/example_diff.f90 similarity index 92% rename from test/example/math/demo_diff.f90 rename to test/example/math/example_diff.f90 index d2ff8b866..415896b8f 100644 --- a/test/example/math/demo_diff.f90 +++ b/test/example/math/example_diff.f90 @@ -1,4 +1,4 @@ -program demo_diff +program example_diff use stdlib_math, only: diff implicit none @@ -19,4 +19,4 @@ program demo_diff print *, diff(i, prepend=[0]) ! [1, 0, 1, 1, 2, 3, 5] print *, diff(i, append=[21]) ! [0, 1, 1, 2, 3, 5, 8] -end program demo_diff +end program example_diff diff --git a/test/example/math/demo_gcd.f90 b/test/example/math/example_gcd.f90 similarity index 71% rename from test/example/math/demo_gcd.f90 rename to test/example/math/example_gcd.f90 index 4a987cc09..3603f3ec3 100644 --- a/test/example/math/demo_gcd.f90 +++ b/test/example/math/example_gcd.f90 @@ -1,4 +1,4 @@ -program demo_gcd +program example_gcd use stdlib_math, only: gcd implicit none integer :: a, b, c @@ -6,4 +6,4 @@ program demo_gcd a = 48 b = 18 c = gcd(a, b) ! returns 6 -end program demo_gcd +end program example_gcd diff --git a/test/example/math/demo_linspace_complex.f90 b/test/example/math/example_linspace_complex.f90 similarity index 78% rename from test/example/math/demo_linspace_complex.f90 rename to test/example/math/example_linspace_complex.f90 index a6b695cd8..a9ff31edd 100644 --- a/test/example/math/demo_linspace_complex.f90 +++ b/test/example/math/example_linspace_complex.f90 @@ -1,4 +1,4 @@ -program demo_linspace_complex +program example_linspace_complex use stdlib_math, only: linspace use stdlib_kinds, only: dp implicit none @@ -9,4 +9,4 @@ program demo_linspace_complex complex(dp) :: z(11) z = linspace(start, end, 11) -end program demo_linspace_complex +end program example_linspace_complex diff --git a/test/example/math/demo_linspace_int16.f90 b/test/example/math/example_linspace_int16.f90 similarity index 76% rename from test/example/math/demo_linspace_int16.f90 rename to test/example/math/example_linspace_int16.f90 index be9d39c96..375a05bb1 100644 --- a/test/example/math/demo_linspace_int16.f90 +++ b/test/example/math/example_linspace_int16.f90 @@ -1,4 +1,4 @@ -program demo_linspace_int16 +program example_linspace_int16 use stdlib_math, only: linspace use stdlib_kinds, only: int16, dp implicit none @@ -9,4 +9,4 @@ program demo_linspace_int16 real(dp) :: r(15) r = linspace(start, end, 15) -end program demo_linspace_int16 +end program example_linspace_int16 diff --git a/test/example/math/demo_logspace_complex.f90 b/test/example/math/example_logspace_complex.f90 similarity index 80% rename from test/example/math/demo_logspace_complex.f90 rename to test/example/math/example_logspace_complex.f90 index 8063666bd..45bb480f7 100644 --- a/test/example/math/demo_logspace_complex.f90 +++ b/test/example/math/example_logspace_complex.f90 @@ -1,4 +1,4 @@ -program demo_logspace_complex +program example_logspace_complex use stdlib_math, only: logspace use stdlib_kinds, only: dp implicit none @@ -9,4 +9,4 @@ program demo_logspace_complex complex(dp) :: z(11) ! Complex values raised to complex powers results in complex values z = logspace(start, end, 11) -end program demo_logspace_complex +end program example_logspace_complex diff --git a/test/example/math/demo_logspace_int.f90 b/test/example/math/example_logspace_int.f90 similarity index 82% rename from test/example/math/demo_logspace_int.f90 rename to test/example/math/example_logspace_int.f90 index e61ea9643..1d9387253 100644 --- a/test/example/math/demo_logspace_int.f90 +++ b/test/example/math/example_logspace_int.f90 @@ -1,4 +1,4 @@ -program demo_logspace_int +program example_logspace_int use stdlib_math, only: logspace use stdlib_kinds, only: dp implicit none @@ -10,4 +10,4 @@ program demo_logspace_int real(dp) :: r(n) ! Integer values raised to real powers results in real values r = logspace(start, end, n) -end program demo_logspace_int +end program example_logspace_int diff --git a/test/example/math/demo_logspace_rstart_cbase.f90 b/test/example/math/example_logspace_rstart_cbase.f90 similarity index 80% rename from test/example/math/demo_logspace_rstart_cbase.f90 rename to test/example/math/example_logspace_rstart_cbase.f90 index 74de85d85..069907a8b 100644 --- a/test/example/math/demo_logspace_rstart_cbase.f90 +++ b/test/example/math/example_logspace_rstart_cbase.f90 @@ -1,4 +1,4 @@ -program demo_logspace_rstart_cbase +program example_logspace_rstart_cbase use stdlib_math, only: logspace use stdlib_kinds, only: dp implicit none @@ -12,4 +12,4 @@ program demo_logspace_rstart_cbase z = logspace(start, end, n, base) -end program demo_logspace_rstart_cbase +end program example_logspace_rstart_cbase diff --git a/test/example/math/demo_math_all_close.f90 b/test/example/math/example_math_all_close.f90 similarity index 80% rename from test/example/math/demo_math_all_close.f90 rename to test/example/math/example_math_all_close.f90 index 02af97805..99f96dbf9 100644 --- a/test/example/math/demo_math_all_close.f90 +++ b/test/example/math/example_math_all_close.f90 @@ -1,4 +1,4 @@ -program demo_math_all_close +program example_math_all_close use stdlib_math, only: all_close real :: y, NAN @@ -12,4 +12,4 @@ program demo_math_all_close print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.) ! NAN, F, T -end program demo_math_all_close +end program example_math_all_close diff --git a/test/example/math/demo_math_arange.f90 b/test/example/math/example_math_arange.f90 similarity index 92% rename from test/example/math/demo_math_arange.f90 rename to test/example/math/example_math_arange.f90 index 4ec0964d9..2c1637d15 100644 --- a/test/example/math/demo_math_arange.f90 +++ b/test/example/math/example_math_arange.f90 @@ -1,4 +1,4 @@ -program demo_math_arange +program example_math_arange use stdlib_math, only: arange print *, arange(3) ! [1,2,3] @@ -16,4 +16,4 @@ program demo_math_arange print *, arange(0.0, 2.0, -2.0) ! [0.0,2.0]. Not recommended: `step` argument is negative! print *, arange(0.0, 2.0, 0.0) ! [0.0,1.0,2.0]. Not recommended: `step` argument is zero! -end program demo_math_arange +end program example_math_arange diff --git a/test/example/math/demo_math_arg.f90 b/test/example/math/example_math_arg.f90 similarity index 83% rename from test/example/math/demo_math_arg.f90 rename to test/example/math/example_math_arg.f90 index 11f9b629c..d1056212a 100644 --- a/test/example/math/demo_math_arg.f90 +++ b/test/example/math/example_math_arg.f90 @@ -1,7 +1,7 @@ -program demo_math_arg +program example_math_arg use stdlib_math, only: arg print *, arg((0.0, 0.0)) ! 0.0 print *, arg((3.0, 4.0)) ! 0.927 print *, arg(2.0*exp((0.0, 0.5))) ! 0.5 print *, arg([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [π/2, 0.0, -π/2, π] -end program demo_math_arg +end program example_math_arg diff --git a/test/example/math/demo_math_argd.f90 b/test/example/math/example_math_argd.f90 similarity index 83% rename from test/example/math/demo_math_argd.f90 rename to test/example/math/example_math_argd.f90 index 7de2963b7..485ce4f0b 100644 --- a/test/example/math/demo_math_argd.f90 +++ b/test/example/math/example_math_argd.f90 @@ -1,7 +1,7 @@ -program demo_math_argd +program example_math_argd use stdlib_math, only: argd print *, argd((0.0, 0.0)) ! 0.0° print *, argd((3.0, 4.0)) ! 53.1° print *, argd(2.0*exp((0.0, 0.5))) ! 28.64° print *, argd([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [90°, 0°, -90°, 180°] -end program demo_math_argd +end program example_math_argd diff --git a/test/example/math/demo_math_argpi.f90 b/test/example/math/example_math_argpi.f90 similarity index 83% rename from test/example/math/demo_math_argpi.f90 rename to test/example/math/example_math_argpi.f90 index 62a0afb78..6914f3ef0 100644 --- a/test/example/math/demo_math_argpi.f90 +++ b/test/example/math/example_math_argpi.f90 @@ -1,7 +1,7 @@ -program demo_math_argpi +program example_math_argpi use stdlib_math, only: argpi print *, argpi((0.0, 0.0)) ! 0.0 print *, argpi((3.0, 4.0)) ! 0.295 print *, argpi(2.0*exp((0.0, 0.5))) ! 0.159 print *, argpi([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [0.5, 0.0, -0.5, 1.0] -end program demo_math_argpi +end program example_math_argpi diff --git a/test/example/math/demo_math_is_close.f90 b/test/example/math/example_math_is_close.f90 similarity index 85% rename from test/example/math/demo_math_is_close.f90 rename to test/example/math/example_math_is_close.f90 index 8d019689e..1775365b0 100644 --- a/test/example/math/demo_math_is_close.f90 +++ b/test/example/math/example_math_is_close.f90 @@ -1,4 +1,4 @@ -program demo_math_is_close +program example_math_is_close use stdlib_math, only: is_close real :: x(2) = [1, 2], y, NAN @@ -11,4 +11,4 @@ program demo_math_is_close print *, NAN, is_close(2.0, NAN), is_close(2.0, NAN, equal_nan=.true.) ! NAN, F, F print *, is_close(NAN, NAN), is_close(NAN, NAN, equal_nan=.true.) ! F, T -end program demo_math_is_close +end program example_math_is_close diff --git a/test/example/optval/CMakeLists.txt b/test/example/optval/CMakeLists.txt index 75af440b2..14dbdc736 100644 --- a/test/example/optval/CMakeLists.txt +++ b/test/example/optval/CMakeLists.txt @@ -1 +1 @@ -ADD_DEMO(optval) +ADD_EXAMPLE(optval) diff --git a/test/example/optval/demo_optval.f90 b/test/example/optval/example_optval.f90 similarity index 84% rename from test/example/optval/demo_optval.f90 rename to test/example/optval/example_optval.f90 index c345db38c..9c29457bc 100644 --- a/test/example/optval/demo_optval.f90 +++ b/test/example/optval/example_optval.f90 @@ -1,4 +1,4 @@ -program demo_optval +program example_optval use stdlib_optval, only: optval implicit none print *, root(64.0) @@ -11,4 +11,4 @@ real function root(x, n) integer, intent(in), optional :: n root = x**(1.0/optval(n, 2)) end function root -end program demo_optval +end program example_optval diff --git a/test/example/quadrature/CMakeLists.txt b/test/example/quadrature/CMakeLists.txt index c06d0f9f7..cd199835d 100644 --- a/test/example/quadrature/CMakeLists.txt +++ b/test/example/quadrature/CMakeLists.txt @@ -1,6 +1,6 @@ -ADD_DEMO(gauss_legendre) -ADD_DEMO(gauss_legendre_lobatto) -ADD_DEMO(simps) -ADD_DEMO(simps_weights) -ADD_DEMO(trapz) -ADD_DEMO(trapz_weights) +ADD_EXAMPLE(gauss_legendre) +ADD_EXAMPLE(gauss_legendre_lobatto) +ADD_EXAMPLE(simps) +ADD_EXAMPLE(simps_weights) +ADD_EXAMPLE(trapz) +ADD_EXAMPLE(trapz_weights) diff --git a/test/example/quadrature/demo_gauss_legendre.f90 b/test/example/quadrature/example_gauss_legendre.f90 similarity index 79% rename from test/example/quadrature/demo_gauss_legendre.f90 rename to test/example/quadrature/example_gauss_legendre.f90 index 37271edd9..7610963ad 100644 --- a/test/example/quadrature/demo_gauss_legendre.f90 +++ b/test/example/quadrature/example_gauss_legendre.f90 @@ -1,4 +1,4 @@ -program demo_gauss_legendre +program example_gauss_legendre use iso_fortran_env, dp => real64 use stdlib_quadrature, only: gauss_legendre implicit none @@ -7,4 +7,4 @@ program demo_gauss_legendre real(dp), dimension(N) :: x, w call gauss_legendre(x, w) print *, "integral of x**2 from -1 to 1 is", sum(x**2*w) -end program demo_gauss_legendre +end program example_gauss_legendre diff --git a/test/example/quadrature/demo_gauss_legendre_lobatto.f90 b/test/example/quadrature/example_gauss_legendre_lobatto.f90 similarity index 76% rename from test/example/quadrature/demo_gauss_legendre_lobatto.f90 rename to test/example/quadrature/example_gauss_legendre_lobatto.f90 index 9ca632a05..569d6fd26 100644 --- a/test/example/quadrature/demo_gauss_legendre_lobatto.f90 +++ b/test/example/quadrature/example_gauss_legendre_lobatto.f90 @@ -1,4 +1,4 @@ -program demo_gauss_legendre_lobatto +program example_gauss_legendre_lobatto use iso_fortran_env, dp => real64 use stdlib_quadrature, only: gauss_legendre_lobatto implicit none @@ -7,4 +7,4 @@ program demo_gauss_legendre_lobatto real(dp), dimension(N) :: x, w call gauss_legendre_lobatto(x, w) print *, "integral of x**2 from -1 to 1 is", sum(x**2*w) -end program demo_gauss_legendre_lobatto +end program example_gauss_legendre_lobatto diff --git a/test/example/quadrature/demo_simps.f90 b/test/example/quadrature/example_simps.f90 similarity index 79% rename from test/example/quadrature/demo_simps.f90 rename to test/example/quadrature/example_simps.f90 index 3d7fd8267..d215c7c8d 100644 --- a/test/example/quadrature/demo_simps.f90 +++ b/test/example/quadrature/example_simps.f90 @@ -1,4 +1,4 @@ -program demo_simps +program example_simps use stdlib_quadrature, only: simps implicit none real, parameter :: x(5) = [0., 1., 2., 3., 4.] @@ -7,4 +7,4 @@ program demo_simps ! 64.0 print *, simps(y, 0.5) ! 32.0 -end program demo_simps +end program example_simps diff --git a/test/example/quadrature/demo_simps_weights.f90 b/test/example/quadrature/example_simps_weights.f90 similarity index 75% rename from test/example/quadrature/demo_simps_weights.f90 rename to test/example/quadrature/example_simps_weights.f90 index ce0dde892..86a172b80 100644 --- a/test/example/quadrature/demo_simps_weights.f90 +++ b/test/example/quadrature/example_simps_weights.f90 @@ -1,4 +1,4 @@ -program demo_simps_weights +program example_simps_weights use stdlib_quadrature, only: simps_weights implicit none real, parameter :: x(5) = [0., 1., 2., 3., 4.] @@ -7,4 +7,4 @@ program demo_simps_weights w = simps_weights(x) print *, sum(w*y) ! 64.0 -end program demo_simps_weights +end program example_simps_weights diff --git a/test/example/quadrature/demo_trapz.f90 b/test/example/quadrature/example_trapz.f90 similarity index 79% rename from test/example/quadrature/demo_trapz.f90 rename to test/example/quadrature/example_trapz.f90 index 95aca38c5..612053fc5 100644 --- a/test/example/quadrature/demo_trapz.f90 +++ b/test/example/quadrature/example_trapz.f90 @@ -1,4 +1,4 @@ -program demo_trapz +program example_trapz use stdlib_quadrature, only: trapz implicit none real, parameter :: x(5) = [0., 1., 2., 3., 4.] @@ -7,4 +7,4 @@ program demo_trapz ! 22.0 print *, trapz(y, 0.5) ! 11.0 -end program demo_trapz +end program example_trapz diff --git a/test/example/quadrature/demo_trapz_weights.f90 b/test/example/quadrature/example_trapz_weights.f90 similarity index 75% rename from test/example/quadrature/demo_trapz_weights.f90 rename to test/example/quadrature/example_trapz_weights.f90 index 9193dfb0a..dfa47ab1a 100644 --- a/test/example/quadrature/demo_trapz_weights.f90 +++ b/test/example/quadrature/example_trapz_weights.f90 @@ -1,4 +1,4 @@ -program demo_trapz_weights +program example_trapz_weights use stdlib_quadrature, only: trapz_weights implicit none real, parameter :: x(5) = [0., 1., 2., 3., 4.] @@ -7,5 +7,5 @@ program demo_trapz_weights w = trapz_weights(x) print *, sum(w*y) ! 22.0 -end program demo_trapz_weights +end program example_trapz_weights diff --git a/test/example/random/CMakeLists.txt b/test/example/random/CMakeLists.txt index cf2dd6de1..11409b17a 100644 --- a/test/example/random/CMakeLists.txt +++ b/test/example/random/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_DEMO(dist_rand) -ADD_DEMO(random_seed) +ADD_EXAMPLE(dist_rand) +ADD_EXAMPLE(random_seed) diff --git a/test/example/random/demo_dist_rand.f90 b/test/example/random/example_dist_rand.f90 similarity index 90% rename from test/example/random/demo_dist_rand.f90 rename to test/example/random/example_dist_rand.f90 index d9ee88f3f..9cb1bf35b 100644 --- a/test/example/random/demo_dist_rand.f90 +++ b/test/example/random/example_dist_rand.f90 @@ -1,4 +1,4 @@ -program demo_dist_rand +program example_dist_rand use stdlib_kinds, only: int8, int16, int32, int64 use stdlib_random, only: dist_rand, random_seed implicit none @@ -14,4 +14,4 @@ program demo_dist_rand ! -1601563881 print *, dist_rand(1_int64) ! random integer in [-2^63, 2^63 - 1] ! 180977695517992208 -end program demo_dist_rand +end program example_dist_rand diff --git a/test/example/random/demo_random_seed.f90 b/test/example/random/example_random_seed.f90 similarity index 75% rename from test/example/random/demo_random_seed.f90 rename to test/example/random/example_random_seed.f90 index 9b405ecec..cad09ef13 100644 --- a/test/example/random/demo_random_seed.f90 +++ b/test/example/random/example_random_seed.f90 @@ -1,8 +1,8 @@ -program demo_random_seed +program example_random_seed use stdlib_random, only: random_seed implicit none integer :: seed_put, seed_get seed_put = 1234567 call random_seed(seed_put, seed_get) ! set and get current value of seed -end program demo_random_seed +end program example_random_seed diff --git a/test/example/selection/CMakeLists.txt b/test/example/selection/CMakeLists.txt index 915b85c5d..d304c184b 100644 --- a/test/example/selection/CMakeLists.txt +++ b/test/example/selection/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_DEMO(arg_select) -ADD_DEMO(select) +ADD_EXAMPLE(arg_select) +ADD_EXAMPLE(select) diff --git a/test/example/selection/demo_arg_select.f90 b/test/example/selection/example_arg_select.f90 similarity index 92% rename from test/example/selection/demo_arg_select.f90 rename to test/example/selection/example_arg_select.f90 index ea0fb86a4..e5cb53696 100644 --- a/test/example/selection/demo_arg_select.f90 +++ b/test/example/selection/example_arg_select.f90 @@ -1,4 +1,4 @@ -program demo_arg_select +program example_arg_select use stdlib_selection, only: arg_select implicit none @@ -26,4 +26,4 @@ program demo_arg_select call arg_select(array, indx, k, kth_smallest, left=2, right=7) print *, array(kth_smallest) ! print 4.0 -end program demo_arg_select +end program example_arg_select diff --git a/test/example/selection/demo_select.f90 b/test/example/selection/example_select.f90 similarity index 92% rename from test/example/selection/demo_select.f90 rename to test/example/selection/example_select.f90 index 4329b8b58..48e4a8e77 100644 --- a/test/example/selection/demo_select.f90 +++ b/test/example/selection/example_select.f90 @@ -1,4 +1,4 @@ -program demo_select +program example_select use stdlib_selection, only: select implicit none @@ -24,4 +24,4 @@ program demo_select call select(array, k, kth_smallest, left=2, right=7) print *, kth_smallest ! print 4.0 -end program demo_select +end program example_select diff --git a/test/example/sorting/CMakeLists.txt b/test/example/sorting/CMakeLists.txt index 807456c81..8a08998d5 100644 --- a/test/example/sorting/CMakeLists.txt +++ b/test/example/sorting/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_DEMO(ord_sort) -ADD_DEMO(sort) +ADD_EXAMPLE(ord_sort) +ADD_EXAMPLE(sort) diff --git a/test/example/sorting/demo_ord_sort.f90 b/test/example/sorting/example_ord_sort.f90 similarity index 81% rename from test/example/sorting/demo_ord_sort.f90 rename to test/example/sorting/example_ord_sort.f90 index 2b73a0fcb..ecbc2544e 100644 --- a/test/example/sorting/demo_ord_sort.f90 +++ b/test/example/sorting/example_ord_sort.f90 @@ -1,4 +1,4 @@ -program demo_ord_sort +program example_ord_sort use stdlib_sorting, only: ord_sort implicit none integer, allocatable :: array1(:), work(:) @@ -7,4 +7,4 @@ program demo_ord_sort allocate (work, mold=array1) call ord_sort(array1, work) print *, array1 !print [1, 3, 4, 4, 5, 9, 10] -end program demo_ord_sort +end program example_ord_sort diff --git a/test/example/sorting/demo_sort.f90 b/test/example/sorting/example_sort.f90 similarity index 80% rename from test/example/sorting/demo_sort.f90 rename to test/example/sorting/example_sort.f90 index 06a58923c..f6926042e 100644 --- a/test/example/sorting/demo_sort.f90 +++ b/test/example/sorting/example_sort.f90 @@ -1,4 +1,4 @@ -program demo_sort +program example_sort use stdlib_sorting, only: sort implicit none integer, allocatable :: array(:) @@ -6,4 +6,4 @@ program demo_sort array = [5, 4, 3, 1, 10, 4, 9] call sort(array) print *, array !print [1, 3, 4, 4, 5, 9, 10] -end program demo_sort +end program example_sort diff --git a/test/example/specialfunctions_gamma/CMakeLists.txt b/test/example/specialfunctions_gamma/CMakeLists.txt index 8c4091b9d..212ba81c0 100644 --- a/test/example/specialfunctions_gamma/CMakeLists.txt +++ b/test/example/specialfunctions_gamma/CMakeLists.txt @@ -1,7 +1,7 @@ -ADD_DEMO(gamma) -ADD_DEMO(gamma_p) -ADD_DEMO(gamma_q) -ADD_DEMO(ligamma) -ADD_DEMO(log_factorial) -ADD_DEMO(log_gamma) -ADD_DEMO(uigamma) +ADD_EXAMPLE(gamma) +ADD_EXAMPLE(gamma_p) +ADD_EXAMPLE(gamma_q) +ADD_EXAMPLE(ligamma) +ADD_EXAMPLE(log_factorial) +ADD_EXAMPLE(log_gamma) +ADD_EXAMPLE(uigamma) diff --git a/test/example/specialfunctions_gamma/demo_gamma.f90 b/test/example/specialfunctions_gamma/example_gamma.f90 similarity index 93% rename from test/example/specialfunctions_gamma/demo_gamma.f90 rename to test/example/specialfunctions_gamma/example_gamma.f90 index ee6a15f8d..6df5f42e4 100644 --- a/test/example/specialfunctions_gamma/demo_gamma.f90 +++ b/test/example/specialfunctions_gamma/example_gamma.f90 @@ -1,4 +1,4 @@ -program demo_gamma +program example_gamma use stdlib_kinds, only: dp, int64 use stdlib_specialfunctions_gamma, only: gamma implicit none @@ -34,4 +34,4 @@ program demo_gamma print *, gamma(z1) ! (-2.78916032990983999E-005, 9.83164600163221218E-006) -end program demo_gamma +end program example_gamma diff --git a/test/example/specialfunctions_gamma/demo_gamma_p.f90 b/test/example/specialfunctions_gamma/example_gamma_p.f90 similarity index 70% rename from test/example/specialfunctions_gamma/demo_gamma_p.f90 rename to test/example/specialfunctions_gamma/example_gamma_p.f90 index b20637ead..589483812 100644 --- a/test/example/specialfunctions_gamma/demo_gamma_p.f90 +++ b/test/example/specialfunctions_gamma/example_gamma_p.f90 @@ -1,8 +1,8 @@ -program demo_gamma_p +program example_gamma_p use stdlib_specialfunctions_gamma, only: rgp => regularized_gamma_p implicit none print *, rgp(3.0, 5.0) ! 0.875347972 -end program demo_gamma_p +end program example_gamma_p diff --git a/test/example/specialfunctions_gamma/demo_gamma_q.f90 b/test/example/specialfunctions_gamma/example_gamma_q.f90 similarity index 70% rename from test/example/specialfunctions_gamma/demo_gamma_q.f90 rename to test/example/specialfunctions_gamma/example_gamma_q.f90 index 877113baf..72edcb3c8 100644 --- a/test/example/specialfunctions_gamma/demo_gamma_q.f90 +++ b/test/example/specialfunctions_gamma/example_gamma_q.f90 @@ -1,8 +1,8 @@ -program demo_gamma_q +program example_gamma_q use stdlib_specialfunctions_gamma, only: rgq => regularized_gamma_q implicit none print *, rgq(3.0, 5.0) ! 0.124652028 -end program demo_gamma_q +end program example_gamma_q diff --git a/test/example/specialfunctions_gamma/demo_ligamma.f90 b/test/example/specialfunctions_gamma/example_ligamma.f90 similarity index 80% rename from test/example/specialfunctions_gamma/demo_ligamma.f90 rename to test/example/specialfunctions_gamma/example_ligamma.f90 index e1706fa8a..19a4cd448 100644 --- a/test/example/specialfunctions_gamma/demo_ligamma.f90 +++ b/test/example/specialfunctions_gamma/example_ligamma.f90 @@ -1,4 +1,4 @@ -program demo_ligamma +program example_ligamma use stdlib_specialfunctions_gamma, only: lig => lower_incomplete_gamma implicit none integer :: p @@ -13,4 +13,4 @@ program demo_ligamma print *, lig(p1, 5.0) ! 1.09715652 -end program demo_ligamma +end program example_ligamma diff --git a/test/example/specialfunctions_gamma/demo_log_factorial.f90 b/test/example/specialfunctions_gamma/example_log_factorial.f90 similarity index 76% rename from test/example/specialfunctions_gamma/demo_log_factorial.f90 rename to test/example/specialfunctions_gamma/example_log_factorial.f90 index d61664f6a..d8419961c 100644 --- a/test/example/specialfunctions_gamma/demo_log_factorial.f90 +++ b/test/example/specialfunctions_gamma/example_log_factorial.f90 @@ -1,4 +1,4 @@ -program demo_log_factorial +program example_log_factorial use stdlib_kinds, only: int64 use stdlib_specialfunctions_gamma, only: lf => log_factorial implicit none @@ -12,4 +12,4 @@ program demo_log_factorial print *, lf(35_int64) ! 92.1361771 -end program demo_log_factorial +end program example_log_factorial diff --git a/test/example/specialfunctions_gamma/demo_log_gamma.f90 b/test/example/specialfunctions_gamma/example_log_gamma.f90 similarity index 91% rename from test/example/specialfunctions_gamma/demo_log_gamma.f90 rename to test/example/specialfunctions_gamma/example_log_gamma.f90 index a6ea2701c..70b093670 100644 --- a/test/example/specialfunctions_gamma/demo_log_gamma.f90 +++ b/test/example/specialfunctions_gamma/example_log_gamma.f90 @@ -1,4 +1,4 @@ -program demo_log_gamma +program example_log_gamma use stdlib_kinds, only: dp use stdlib_specialfunctions_gamma, only: log_gamma implicit none @@ -32,4 +32,4 @@ program demo_log_gamma print *, log_gamma(z1) !(2.5616575105114614, -5.7338247782852498) -end program demo_log_gamma +end program example_log_gamma diff --git a/test/example/specialfunctions_gamma/demo_uigamma.f90 b/test/example/specialfunctions_gamma/example_uigamma.f90 similarity index 76% rename from test/example/specialfunctions_gamma/demo_uigamma.f90 rename to test/example/specialfunctions_gamma/example_uigamma.f90 index eabbeb371..95c07411e 100644 --- a/test/example/specialfunctions_gamma/demo_uigamma.f90 +++ b/test/example/specialfunctions_gamma/example_uigamma.f90 @@ -1,4 +1,4 @@ -program demo_uigamma +program example_uigamma use stdlib_specialfunctions_gamma, only: uig => upper_incomplete_gamma implicit none @@ -9,4 +9,4 @@ program demo_uigamma print *, uig(2.3, 5.0) !6.95552528E-02 -end program demo_uigamma +end program example_uigamma diff --git a/test/example/stats/CMakeLists.txt b/test/example/stats/CMakeLists.txt index 862f883af..94e5f98e9 100644 --- a/test/example/stats/CMakeLists.txt +++ b/test/example/stats/CMakeLists.txt @@ -1,6 +1,6 @@ -ADD_DEMO(corr) -ADD_DEMO(cov) -ADD_DEMO(mean) -ADD_DEMO(median) -ADD_DEMO(moment) -ADD_DEMO(var) +ADD_EXAMPLE(corr) +ADD_EXAMPLE(cov) +ADD_EXAMPLE(mean) +ADD_EXAMPLE(median) +ADD_EXAMPLE(moment) +ADD_EXAMPLE(var) diff --git a/test/example/stats/demo_corr.f90 b/test/example/stats/example_corr.f90 similarity index 86% rename from test/example/stats/demo_corr.f90 rename to test/example/stats/example_corr.f90 index 012b837e8..ecbd2652e 100644 --- a/test/example/stats/demo_corr.f90 +++ b/test/example/stats/example_corr.f90 @@ -1,8 +1,8 @@ -program demo_corr +program example_corr use stdlib_stats, only: corr implicit none real :: x(1:6) = [1., 2., 3., 4., 5., 6.] real :: y(1:2, 1:3) = reshape([-1., 40., -3., 4., 10., 6.], [2, 3]) print *, corr(x, 1) !returns 1. print *, corr(y, 2) !returns reshape([ 1., -.32480, -.32480, 1. ], [ 2, 3]) -end program demo_corr +end program example_corr diff --git a/test/example/stats/demo_cov.f90 b/test/example/stats/example_cov.f90 similarity index 89% rename from test/example/stats/demo_cov.f90 rename to test/example/stats/example_cov.f90 index c9ffb8448..4750afc8e 100644 --- a/test/example/stats/demo_cov.f90 +++ b/test/example/stats/example_cov.f90 @@ -1,4 +1,4 @@ -program demo_cov +program example_cov use stdlib_stats, only: cov implicit none real :: x(1:6) = [1., 2., 3., 4., 5., 6.] @@ -6,4 +6,4 @@ program demo_cov print *, cov(x, 1) !returns 3.5 print *, cov(x, 1, corrected=.false.) !returns 2.9167 print *, cov(y, 1) !returns a square matrix of size 3 with all elements equal to 0.5 -end program demo_cov +end program example_cov diff --git a/test/example/stats/demo_mean.f90 b/test/example/stats/example_mean.f90 similarity index 90% rename from test/example/stats/demo_mean.f90 rename to test/example/stats/example_mean.f90 index e4cee4623..76cccffba 100644 --- a/test/example/stats/demo_mean.f90 +++ b/test/example/stats/example_mean.f90 @@ -1,4 +1,4 @@ -program demo_mean +program example_mean use stdlib_stats, only: mean implicit none real :: x(1:6) = [1., 2., 3., 4., 5., 6.] @@ -7,4 +7,4 @@ program demo_mean print *, mean(y) !returns 3.5 print *, mean(y, 1) !returns [ 1.5, 3.5, 5.5 ] print *, mean(y, 1, y > 3.) !returns [ NaN, 4.0, 5.5 ] -end program demo_mean +end program example_mean diff --git a/test/example/stats/demo_median.f90 b/test/example/stats/example_median.f90 similarity index 90% rename from test/example/stats/demo_median.f90 rename to test/example/stats/example_median.f90 index 36d0ad54f..004e5e228 100644 --- a/test/example/stats/demo_median.f90 +++ b/test/example/stats/example_median.f90 @@ -1,4 +1,4 @@ -program demo_median +program example_median use stdlib_stats, only: median implicit none real :: x(1:6) = [1., 2., 3., 4., 5., 6.] @@ -7,4 +7,4 @@ program demo_median print *, median(y) !returns 3.5 print *, median(y, 1) !returns [ 1.5, 3.5, 5.5 ] print *, median(y, 1, y > 3.) !returns [ NaN, 4.0, 5.5 ] -end program demo_median +end program example_median diff --git a/test/example/stats/demo_moment.f90 b/test/example/stats/example_moment.f90 similarity index 92% rename from test/example/stats/demo_moment.f90 rename to test/example/stats/example_moment.f90 index 3444d8c98..a1a6b38a8 100644 --- a/test/example/stats/demo_moment.f90 +++ b/test/example/stats/example_moment.f90 @@ -1,4 +1,4 @@ -program demo_moment +program example_moment use stdlib_stats, only: moment implicit none real :: x(1:6) = [1., 2., 3., 4., 5., 6.] @@ -9,4 +9,4 @@ program demo_moment print *, moment(y, 2, 1, mask=(y > 3.)) !returns [NaN, 0., 0.25] print *, moment(x, 2, center=0.) !returns 15.1667 print *, moment(y, 1, 1, center=0.) !returns [1.5, 3.5, 5.5] -end program demo_moment +end program example_moment diff --git a/test/example/stats/demo_var.f90 b/test/example/stats/example_var.f90 similarity index 92% rename from test/example/stats/demo_var.f90 rename to test/example/stats/example_var.f90 index 93423a4f1..8b477fff9 100644 --- a/test/example/stats/demo_var.f90 +++ b/test/example/stats/example_var.f90 @@ -1,4 +1,4 @@ -program demo_var +program example_var use stdlib_stats, only: var implicit none real :: x(1:6) = [1., 2., 3., 4., 5., 6.] @@ -9,4 +9,4 @@ program demo_var print *, var(y, 1) !returns [0.5, 0.5, 0.5] print *, var(y, 1, y > 3.) !returns [NaN, NaN, 0.5] print *, var(y, 1, y > 3., corrected=.false.) !returns [NaN, 0., 0.25] -end program demo_var +end program example_var diff --git a/test/example/stats_distribution_exponential/CMakeLists.txt b/test/example/stats_distribution_exponential/CMakeLists.txt index b2cf48649..c3f7fe286 100644 --- a/test/example/stats_distribution_exponential/CMakeLists.txt +++ b/test/example/stats_distribution_exponential/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_DEMO(exponential_cdf) -ADD_DEMO(exponential_pdf) -ADD_DEMO(exponential_rvs) +ADD_EXAMPLE(exponential_cdf) +ADD_EXAMPLE(exponential_pdf) +ADD_EXAMPLE(exponential_rvs) diff --git a/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 b/test/example/stats_distribution_exponential/example_exponential_cdf.f90 similarity index 94% rename from test/example/stats_distribution_exponential/demo_exponential_cdf.f90 rename to test/example/stats_distribution_exponential/example_exponential_cdf.f90 index 162e0a9ba..cc6f2c74f 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_cdf.f90 +++ b/test/example/stats_distribution_exponential/example_exponential_cdf.f90 @@ -1,4 +1,4 @@ -program demo_exponential_cdf +program example_exponential_cdf use stdlib_random, only: random_seed use stdlib_stats_distribution_exponential, only: exp_cdf => cdf_exp, & rexp => rvs_exp @@ -37,5 +37,5 @@ program demo_exponential_cdf ! 8.70351046E-02 -end program demo_exponential_cdf +end program example_exponential_cdf diff --git a/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 b/test/example/stats_distribution_exponential/example_exponential_pdf.f90 similarity index 94% rename from test/example/stats_distribution_exponential/demo_exponential_pdf.f90 rename to test/example/stats_distribution_exponential/example_exponential_pdf.f90 index 88e7f9985..f8eb7a636 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_pdf.f90 +++ b/test/example/stats_distribution_exponential/example_exponential_pdf.f90 @@ -1,4 +1,4 @@ -program demo_exponential_pdf +program example_exponential_pdf use stdlib_random, only: random_seed use stdlib_stats_distribution_exponential, only: exp_pdf => pdf_exp, & rexp => rvs_exp @@ -36,4 +36,4 @@ program demo_exponential_pdf ! 6.03947677E-02 -end program demo_exponential_pdf +end program example_exponential_pdf diff --git a/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 b/test/example/stats_distribution_exponential/example_exponential_rvs.f90 similarity index 92% rename from test/example/stats_distribution_exponential/demo_exponential_rvs.f90 rename to test/example/stats_distribution_exponential/example_exponential_rvs.f90 index 0167c8723..551d2fdce 100644 --- a/test/example/stats_distribution_exponential/demo_exponential_rvs.f90 +++ b/test/example/stats_distribution_exponential/example_exponential_rvs.f90 @@ -1,4 +1,4 @@ -program demo_exponential_rvs +program example_exponential_rvs use stdlib_random, only: random_seed use stdlib_stats_distribution_exponential, only: rexp => rvs_exp @@ -29,4 +29,4 @@ program demo_exponential_rvs ! (1.41435969,4.081114382E-02) -end program demo_exponential_rvs +end program example_exponential_rvs diff --git a/test/example/stats_distribution_normal/CMakeLists.txt b/test/example/stats_distribution_normal/CMakeLists.txt index 897147e24..e42bf2867 100644 --- a/test/example/stats_distribution_normal/CMakeLists.txt +++ b/test/example/stats_distribution_normal/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_DEMO(normal_pdf) -#ADD_DEMO(normal_rvs) -ADD_DEMO(norm_cdf) +ADD_EXAMPLE(normal_pdf) +#ADD_EXAMPLE(normal_rvs) +ADD_EXAMPLE(norm_cdf) diff --git a/test/example/stats_distribution_normal/demo_norm_cdf.f90 b/test/example/stats_distribution_normal/example_norm_cdf.f90 similarity index 96% rename from test/example/stats_distribution_normal/demo_norm_cdf.f90 rename to test/example/stats_distribution_normal/example_norm_cdf.f90 index ecbcc49b7..a67450277 100644 --- a/test/example/stats_distribution_normal/demo_norm_cdf.f90 +++ b/test/example/stats_distribution_normal/example_norm_cdf.f90 @@ -1,4 +1,4 @@ -program demo_norm_cdf +program example_norm_cdf use stdlib_random, only: random_seed use stdlib_stats_distribution_normal, only: norm_cdf => cdf_normal, & norm => rvs_normal @@ -41,5 +41,5 @@ program demo_norm_cdf !4.89511043E-02 -end program demo_norm_cdf +end program example_norm_cdf diff --git a/test/example/stats_distribution_normal/demo_normal_pdf.f90 b/test/example/stats_distribution_normal/example_normal_pdf.f90 similarity index 95% rename from test/example/stats_distribution_normal/demo_normal_pdf.f90 rename to test/example/stats_distribution_normal/example_normal_pdf.f90 index c0353e656..2dc62a370 100644 --- a/test/example/stats_distribution_normal/demo_normal_pdf.f90 +++ b/test/example/stats_distribution_normal/example_normal_pdf.f90 @@ -1,4 +1,4 @@ -program demo_normal_pdf +program example_normal_pdf use stdlib_random, only: random_seed use stdlib_stats_distribution_normal, only: norm_pdf => pdf_normal, & norm => rvs_normal @@ -41,4 +41,4 @@ program demo_normal_pdf ! 5.30100204E-02 -end program demo_normal_pdf +end program example_normal_pdf diff --git a/test/example/stats_distribution_normal/demo_normal_rvs.f90 b/test/example/stats_distribution_normal/example_normal_rvs.f90 similarity index 95% rename from test/example/stats_distribution_normal/demo_normal_rvs.f90 rename to test/example/stats_distribution_normal/example_normal_rvs.f90 index 49966d8ec..935f8aa6b 100644 --- a/test/example/stats_distribution_normal/demo_normal_rvs.f90 +++ b/test/example/stats_distribution_normal/example_normal_rvs.f90 @@ -1,4 +1,4 @@ -program demo_normal_rvs +program example_normal_rvs use stdlib_random, only: random_seed use stdlib_stats_distribution_normal, only: norm => rvs_normal @@ -42,4 +42,4 @@ program demo_normal_rvs ! (1.22566295,2.12518454) -end program demo_normal_rvs +end program example_normal_rvs diff --git a/test/example/stats_distribution_uniform/CMakeLists.txt b/test/example/stats_distribution_uniform/CMakeLists.txt index aae94c934..7060859bc 100644 --- a/test/example/stats_distribution_uniform/CMakeLists.txt +++ b/test/example/stats_distribution_uniform/CMakeLists.txt @@ -1,4 +1,4 @@ -ADD_DEMO(shuffle) -ADD_DEMO(uniform_cdf) -ADD_DEMO(uniform_pdf) -ADD_DEMO(uniform_rvs) +ADD_EXAMPLE(shuffle) +ADD_EXAMPLE(uniform_cdf) +ADD_EXAMPLE(uniform_pdf) +ADD_EXAMPLE(uniform_rvs) diff --git a/test/example/stats_distribution_uniform/demo_shuffle.f90 b/test/example/stats_distribution_uniform/example_shuffle.f90 similarity index 94% rename from test/example/stats_distribution_uniform/demo_shuffle.f90 rename to test/example/stats_distribution_uniform/example_shuffle.f90 index fea48ff3d..b686280e2 100644 --- a/test/example/stats_distribution_uniform/demo_shuffle.f90 +++ b/test/example/stats_distribution_uniform/example_shuffle.f90 @@ -1,4 +1,4 @@ -program demo_shuffle +program example_shuffle use stdlib_random, only: random_seed use stdlib_stats_distribution_uniform, only: shuffle implicit none @@ -27,4 +27,4 @@ program demo_shuffle !(8.0, 8.0) (7.0, 7.0) (4.0, 4.0) (1.0, 1.0) (5.0, 5.0) !(9.0, 9.0) (6.0, 6.0) (3.0, 3.0) (2.0, 2.0) (10.0, 10.0) -end program demo_shuffle +end program example_shuffle diff --git a/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 b/test/example/stats_distribution_uniform/example_uniform_cdf.f90 similarity index 96% rename from test/example/stats_distribution_uniform/demo_uniform_cdf.f90 rename to test/example/stats_distribution_uniform/example_uniform_cdf.f90 index 91dd125bf..d683a2e6f 100644 --- a/test/example/stats_distribution_uniform/demo_uniform_cdf.f90 +++ b/test/example/stats_distribution_uniform/example_uniform_cdf.f90 @@ -1,4 +1,4 @@ -program demo_uniform_cdf +program example_uniform_cdf use stdlib_random, only: random_seed use stdlib_stats_distribution_uniform, only: uni_cdf => cdf_uniform, & uni => rvs_uniform @@ -45,5 +45,5 @@ program demo_uniform_cdf ! joint cumulative distribution at (1.2,0.5) in [(0.,0.), (2.,1.)] ! 0.300000012 -end program demo_uniform_cdf +end program example_uniform_cdf diff --git a/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 b/test/example/stats_distribution_uniform/example_uniform_pdf.f90 similarity index 96% rename from test/example/stats_distribution_uniform/demo_uniform_pdf.f90 rename to test/example/stats_distribution_uniform/example_uniform_pdf.f90 index 5fb6c5024..ac2df37b7 100644 --- a/test/example/stats_distribution_uniform/demo_uniform_pdf.f90 +++ b/test/example/stats_distribution_uniform/example_uniform_pdf.f90 @@ -1,4 +1,4 @@ -program demo_uniform_pdf +program example_uniform_pdf use stdlib_random, only: random_seed use stdlib_stats_distribution_uniform, only: uni_pdf => pdf_uniform, & uni => rvs_uniform @@ -45,5 +45,5 @@ program demo_uniform_pdf ! joint probability density at (-0.1,0.2) in [(-0.5, -0.5), (0.5, 0.5)] ! 1.00000000 -end program demo_uniform_pdf +end program example_uniform_pdf diff --git a/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 b/test/example/stats_distribution_uniform/example_uniform_rvs.f90 similarity index 97% rename from test/example/stats_distribution_uniform/demo_uniform_rvs.f90 rename to test/example/stats_distribution_uniform/example_uniform_rvs.f90 index d63652600..2ac18b1b1 100644 --- a/test/example/stats_distribution_uniform/demo_uniform_rvs.f90 +++ b/test/example/stats_distribution_uniform/example_uniform_rvs.f90 @@ -1,4 +1,4 @@ -program demo_uniform_rvs +program example_uniform_rvs use stdlib_random, only: random_seed use stdlib_stats_distribution_uniform, only: uni => rvs_uniform @@ -76,4 +76,4 @@ program demo_uniform_rvs ! -0.178335011 0.283877611 -2.13934183E-02 -9.21690464E-03 ! 4.56320047E-02 0.220112979 -end program demo_uniform_rvs +end program example_uniform_rvs diff --git a/test/example/string_type/CMakeLists.txt b/test/example/string_type/CMakeLists.txt index 1b6c3f4a7..c3a754cd3 100644 --- a/test/example/string_type/CMakeLists.txt +++ b/test/example/string_type/CMakeLists.txt @@ -1,40 +1,40 @@ -ADD_DEMO(adjustl) -ADD_DEMO(adjustr) -ADD_DEMO(char) -ADD_DEMO(char_position) -ADD_DEMO(char_range) -ADD_DEMO(constructor_character) -ADD_DEMO(constructor_empty) -ADD_DEMO(constructor_integer) -ADD_DEMO(constructor_logical) -ADD_DEMO(constructor_scalar) -ADD_DEMO(cont) -ADD_DEMO(eq) -ADD_DEMO(fread) -ADD_DEMO(fwrite) -ADD_DEMO(ge) -ADD_DEMO(gt) -ADD_DEMO(iachar) -ADD_DEMO(ichar) -ADD_DEMO(index) -ADD_DEMO(le) -ADD_DEMO(len) -ADD_DEMO(len_trim) -ADD_DEMO(lge) -ADD_DEMO(lgt) -ADD_DEMO(lle) -ADD_DEMO(llt) -ADD_DEMO(lt) -ADD_DEMO(move) -ADD_DEMO(ne) -ADD_DEMO(repeat) -ADD_DEMO(reverse) -ADD_DEMO(scan) -ADD_DEMO(to_lower) -ADD_DEMO(to_sentence) -ADD_DEMO(to_title) -ADD_DEMO(to_upper) -ADD_DEMO(trim) -ADD_DEMO(uread) -ADD_DEMO(uwrite) -ADD_DEMO(verify) +ADD_EXAMPLE(adjustl) +ADD_EXAMPLE(adjustr) +ADD_EXAMPLE(char) +ADD_EXAMPLE(char_position) +ADD_EXAMPLE(char_range) +ADD_EXAMPLE(constructor_character) +ADD_EXAMPLE(constructor_empty) +ADD_EXAMPLE(constructor_integer) +ADD_EXAMPLE(constructor_logical) +ADD_EXAMPLE(constructor_scalar) +ADD_EXAMPLE(cont) +ADD_EXAMPLE(eq) +ADD_EXAMPLE(fread) +ADD_EXAMPLE(fwrite) +ADD_EXAMPLE(ge) +ADD_EXAMPLE(gt) +ADD_EXAMPLE(iachar) +ADD_EXAMPLE(ichar) +ADD_EXAMPLE(index) +ADD_EXAMPLE(le) +ADD_EXAMPLE(len) +ADD_EXAMPLE(len_trim) +ADD_EXAMPLE(lge) +ADD_EXAMPLE(lgt) +ADD_EXAMPLE(lle) +ADD_EXAMPLE(llt) +ADD_EXAMPLE(lt) +ADD_EXAMPLE(move) +ADD_EXAMPLE(ne) +ADD_EXAMPLE(repeat) +ADD_EXAMPLE(reverse) +ADD_EXAMPLE(scan) +ADD_EXAMPLE(to_lower) +ADD_EXAMPLE(to_sentence) +ADD_EXAMPLE(to_title) +ADD_EXAMPLE(to_upper) +ADD_EXAMPLE(trim) +ADD_EXAMPLE(uread) +ADD_EXAMPLE(uwrite) +ADD_EXAMPLE(verify) diff --git a/test/example/string_type/demo_adjustl.f90 b/test/example/string_type/example_adjustl.f90 similarity index 80% rename from test/example/string_type/demo_adjustl.f90 rename to test/example/string_type/example_adjustl.f90 index e8fbedb41..3b747d9a6 100644 --- a/test/example/string_type/demo_adjustl.f90 +++ b/test/example/string_type/example_adjustl.f90 @@ -1,4 +1,4 @@ -program demo_adjustl +program example_adjustl use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_adjustl string = " Whitespace" string = adjustl(string) ! char(string) == "Whitespace " -end program demo_adjustl +end program example_adjustl diff --git a/test/example/string_type/demo_adjustr.f90 b/test/example/string_type/example_adjustr.f90 similarity index 80% rename from test/example/string_type/demo_adjustr.f90 rename to test/example/string_type/example_adjustr.f90 index 0a796b395..e2f1451b8 100644 --- a/test/example/string_type/demo_adjustr.f90 +++ b/test/example/string_type/example_adjustr.f90 @@ -1,4 +1,4 @@ -program demo_adjustr +program example_adjustr use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_adjustr string = "Whitespace " string = adjustr(string) ! char(string) == " Whitespace" -end program demo_adjustr +end program example_adjustr diff --git a/test/example/string_type/demo_char.f90 b/test/example/string_type/example_char.f90 similarity index 80% rename from test/example/string_type/demo_char.f90 rename to test/example/string_type/example_char.f90 index 712d1e298..ba5804cc1 100644 --- a/test/example/string_type/demo_char.f90 +++ b/test/example/string_type/example_char.f90 @@ -1,4 +1,4 @@ -program demo_char +program example_char use stdlib_string_type implicit none type(string_type) :: string @@ -7,4 +7,4 @@ program demo_char string = "Character sequence" dlc = char(string) ! dlc == "Character sequence" -end program demo_char +end program example_char diff --git a/test/example/string_type/demo_char_position.f90 b/test/example/string_type/example_char_position.f90 similarity index 83% rename from test/example/string_type/demo_char_position.f90 rename to test/example/string_type/example_char_position.f90 index 6183d47e6..3297950d6 100644 --- a/test/example/string_type/demo_char_position.f90 +++ b/test/example/string_type/example_char_position.f90 @@ -1,4 +1,4 @@ -program demo_char_position +program example_char_position use stdlib_string_type implicit none type(string_type) :: string @@ -10,4 +10,4 @@ program demo_char_position ! dlc == "a" chars = char(string, [3, 5, 8, 12, 14, 15, 18]) ! chars == ["a", "a", "e", "e", "u", "e", "e"] -end program demo_char_position +end program example_char_position diff --git a/test/example/string_type/demo_char_range.f90 b/test/example/string_type/example_char_range.f90 similarity index 75% rename from test/example/string_type/demo_char_range.f90 rename to test/example/string_type/example_char_range.f90 index 8c2c60658..8741baa0c 100644 --- a/test/example/string_type/demo_char_range.f90 +++ b/test/example/string_type/example_char_range.f90 @@ -1,4 +1,4 @@ -program demo_char_range +program example_char_range use stdlib_string_type implicit none type(string_type) :: string @@ -7,4 +7,4 @@ program demo_char_range string = "Fortran" dlc = char(string, 1, 4) ! dlc == "Fort" -end program demo_char_range +end program example_char_range diff --git a/test/example/string_type/demo_constructor_character.f90 b/test/example/string_type/example_constructor_character.f90 similarity index 62% rename from test/example/string_type/demo_constructor_character.f90 rename to test/example/string_type/example_constructor_character.f90 index ebe544547..eeeeb5f61 100644 --- a/test/example/string_type/demo_constructor_character.f90 +++ b/test/example/string_type/example_constructor_character.f90 @@ -1,8 +1,8 @@ -program demo_constructor_character +program example_constructor_character use stdlib_string_type implicit none type(string_type) :: string ! len(string) == 0 string = "Sequence" ! len(string) == 8 -end program demo_constructor_character +end program example_constructor_character diff --git a/test/example/string_type/demo_constructor_empty.f90 b/test/example/string_type/example_constructor_empty.f90 similarity index 61% rename from test/example/string_type/demo_constructor_empty.f90 rename to test/example/string_type/example_constructor_empty.f90 index 8dd80badc..38be70b0b 100644 --- a/test/example/string_type/demo_constructor_empty.f90 +++ b/test/example/string_type/example_constructor_empty.f90 @@ -1,7 +1,7 @@ -program demo_constructor_empty +program example_constructor_empty use stdlib_string_type implicit none type(string_type) :: string string = string_type() ! len(string) == 0 -end program demo_constructor_empty +end program example_constructor_empty diff --git a/test/example/string_type/demo_constructor_integer.f90 b/test/example/string_type/example_constructor_integer.f90 similarity index 68% rename from test/example/string_type/demo_constructor_integer.f90 rename to test/example/string_type/example_constructor_integer.f90 index a2b33453e..dbad31f00 100644 --- a/test/example/string_type/demo_constructor_integer.f90 +++ b/test/example/string_type/example_constructor_integer.f90 @@ -1,4 +1,4 @@ -program demo_constructor_integer +program example_constructor_integer use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_constructor_integer ! len(string) == 2 string = string_type(-289) ! len(string) == 4 -end program demo_constructor_integer +end program example_constructor_integer diff --git a/test/example/string_type/demo_constructor_logical.f90 b/test/example/string_type/example_constructor_logical.f90 similarity index 69% rename from test/example/string_type/demo_constructor_logical.f90 rename to test/example/string_type/example_constructor_logical.f90 index 1c247c1a2..341f4382b 100644 --- a/test/example/string_type/demo_constructor_logical.f90 +++ b/test/example/string_type/example_constructor_logical.f90 @@ -1,4 +1,4 @@ -program demo_constructor_logical +program example_constructor_logical use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_constructor_logical ! len(string) == 1 string = string_type(.false.) ! len(string) == 1 -end program demo_constructor_logical +end program example_constructor_logical diff --git a/test/example/string_type/demo_constructor_scalar.f90 b/test/example/string_type/example_constructor_scalar.f90 similarity index 71% rename from test/example/string_type/demo_constructor_scalar.f90 rename to test/example/string_type/example_constructor_scalar.f90 index bfad75ff4..d49ba231e 100644 --- a/test/example/string_type/demo_constructor_scalar.f90 +++ b/test/example/string_type/example_constructor_scalar.f90 @@ -1,4 +1,4 @@ -program demo_constructor_scalar +program example_constructor_scalar use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_constructor_scalar ! len(string) == 8 string = string_type(" S p a c e d ") ! len(string) == 13 -end program demo_constructor_scalar +end program example_constructor_scalar diff --git a/test/example/string_type/demo_cont.f90 b/test/example/string_type/example_cont.f90 similarity index 75% rename from test/example/string_type/demo_cont.f90 rename to test/example/string_type/example_cont.f90 index 36e426a43..b19e4029f 100644 --- a/test/example/string_type/demo_cont.f90 +++ b/test/example/string_type/example_cont.f90 @@ -1,4 +1,4 @@ -program demo_cont +program example_cont use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_cont string = "Hello, " string = string//"World!" ! len(string) == 13 -end program demo_cont +end program example_cont diff --git a/test/example/string_type/demo_eq.f90 b/test/example/string_type/example_eq.f90 similarity index 85% rename from test/example/string_type/demo_eq.f90 rename to test/example/string_type/example_eq.f90 index 2e1516cf0..7ab27557d 100644 --- a/test/example/string_type/demo_eq.f90 +++ b/test/example/string_type/example_eq.f90 @@ -1,4 +1,4 @@ -program demo_eq +program example_eq use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_eq res = string == "cde" ! res .eqv. .false. -end program demo_eq +end program example_eq diff --git a/test/example/string_type/demo_fread.f90 b/test/example/string_type/example_fread.f90 similarity index 84% rename from test/example/string_type/demo_fread.f90 rename to test/example/string_type/example_fread.f90 index faa3482ee..db1ef7ca8 100644 --- a/test/example/string_type/demo_fread.f90 +++ b/test/example/string_type/example_fread.f90 @@ -1,4 +1,4 @@ -program demo_fread +program example_fread use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_fread read (io, *) string close (io) -end program demo_fread +end program example_fread diff --git a/test/example/string_type/demo_fwrite.f90 b/test/example/string_type/example_fwrite.f90 similarity index 84% rename from test/example/string_type/demo_fwrite.f90 rename to test/example/string_type/example_fwrite.f90 index b7c3bf3a7..30f543258 100644 --- a/test/example/string_type/demo_fwrite.f90 +++ b/test/example/string_type/example_fwrite.f90 @@ -1,4 +1,4 @@ -program demo_fwrite +program example_fwrite use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_fwrite read (io, *) string close (io) -end program demo_fwrite +end program example_fwrite diff --git a/test/example/string_type/demo_ge.f90 b/test/example/string_type/example_ge.f90 similarity index 85% rename from test/example/string_type/demo_ge.f90 rename to test/example/string_type/example_ge.f90 index 2413b5bbf..98c19e701 100644 --- a/test/example/string_type/demo_ge.f90 +++ b/test/example/string_type/example_ge.f90 @@ -1,4 +1,4 @@ -program demo_ge +program example_ge use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_ge res = string >= "cde" ! res .eqv. .false. -end program demo_ge +end program example_ge diff --git a/test/example/string_type/demo_gt.f90 b/test/example/string_type/example_gt.f90 similarity index 84% rename from test/example/string_type/demo_gt.f90 rename to test/example/string_type/example_gt.f90 index 6b9882526..f69f7d851 100644 --- a/test/example/string_type/demo_gt.f90 +++ b/test/example/string_type/example_gt.f90 @@ -1,4 +1,4 @@ -program demo_gt +program example_gt use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_gt res = string > "cde" ! res .eqv. .false. -end program demo_gt +end program example_gt diff --git a/test/example/string_type/demo_iachar.f90 b/test/example/string_type/example_iachar.f90 similarity index 72% rename from test/example/string_type/demo_iachar.f90 rename to test/example/string_type/example_iachar.f90 index 1a34d88f6..76f558a8a 100644 --- a/test/example/string_type/demo_iachar.f90 +++ b/test/example/string_type/example_iachar.f90 @@ -1,4 +1,4 @@ -program demo_iachar +program example_iachar use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_iachar string = "Fortran" code = iachar(string) -end program demo_iachar +end program example_iachar diff --git a/test/example/string_type/demo_ichar.f90 b/test/example/string_type/example_ichar.f90 similarity index 73% rename from test/example/string_type/demo_ichar.f90 rename to test/example/string_type/example_ichar.f90 index 3ecff2c8a..adf51f000 100644 --- a/test/example/string_type/demo_ichar.f90 +++ b/test/example/string_type/example_ichar.f90 @@ -1,4 +1,4 @@ -program demo_ichar +program example_ichar use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_ichar string = "Fortran" code = ichar(string) -end program demo_ichar +end program example_ichar diff --git a/test/example/string_type/demo_index.f90 b/test/example/string_type/example_index.f90 similarity index 85% rename from test/example/string_type/demo_index.f90 rename to test/example/string_type/example_index.f90 index f3488ee96..09ea81f41 100644 --- a/test/example/string_type/demo_index.f90 +++ b/test/example/string_type/example_index.f90 @@ -1,4 +1,4 @@ -program demo_index +program example_index use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_index pos = index(string, "This") ! pos == 0 -end program demo_index +end program example_index diff --git a/test/example/string_type/demo_le.f90 b/test/example/string_type/example_le.f90 similarity index 85% rename from test/example/string_type/demo_le.f90 rename to test/example/string_type/example_le.f90 index a471a52e7..4cf0fb229 100644 --- a/test/example/string_type/demo_le.f90 +++ b/test/example/string_type/example_le.f90 @@ -1,4 +1,4 @@ -program demo_le +program example_le use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_le res = string <= "cde" ! res .eqv. .true. -end program demo_le +end program example_le diff --git a/test/example/string_type/demo_len.f90 b/test/example/string_type/example_len.f90 similarity index 86% rename from test/example/string_type/demo_len.f90 rename to test/example/string_type/example_len.f90 index 2e7dee2cb..6c7685f3f 100644 --- a/test/example/string_type/demo_len.f90 +++ b/test/example/string_type/example_len.f90 @@ -1,4 +1,4 @@ -program demo_len +program example_len use stdlib_string_type implicit none type(string_type) :: string @@ -11,4 +11,4 @@ program demo_len string = "Whitespace " length = len(string) ! length == 38 -end program demo_len +end program example_len diff --git a/test/example/string_type/demo_len_trim.f90 b/test/example/string_type/example_len_trim.f90 similarity index 83% rename from test/example/string_type/demo_len_trim.f90 rename to test/example/string_type/example_len_trim.f90 index a8343caaf..6e119a274 100644 --- a/test/example/string_type/demo_len_trim.f90 +++ b/test/example/string_type/example_len_trim.f90 @@ -1,4 +1,4 @@ -program demo_len_trim +program example_len_trim use stdlib_string_type implicit none type(string_type) :: string @@ -11,4 +11,4 @@ program demo_len_trim string = "Whitespace " length = len_trim(string) ! length == 10 -end program demo_len_trim +end program example_len_trim diff --git a/test/example/string_type/demo_lge.f90 b/test/example/string_type/example_lge.f90 similarity index 84% rename from test/example/string_type/demo_lge.f90 rename to test/example/string_type/example_lge.f90 index 243f6a4c7..4821934ab 100644 --- a/test/example/string_type/demo_lge.f90 +++ b/test/example/string_type/example_lge.f90 @@ -1,4 +1,4 @@ -program demo_lge +program example_lge use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_lge res = lge(string, "cde") ! res .eqv. .false. -end program demo_lge +end program example_lge diff --git a/test/example/string_type/demo_lgt.f90 b/test/example/string_type/example_lgt.f90 similarity index 84% rename from test/example/string_type/demo_lgt.f90 rename to test/example/string_type/example_lgt.f90 index 7ef842baf..abcbdcf2c 100644 --- a/test/example/string_type/demo_lgt.f90 +++ b/test/example/string_type/example_lgt.f90 @@ -1,4 +1,4 @@ -program demo_lgt +program example_lgt use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_lgt res = lgt(string, "cde") ! res .eqv. .false. -end program demo_lgt +end program example_lgt diff --git a/test/example/string_type/demo_lle.f90 b/test/example/string_type/example_lle.f90 similarity index 84% rename from test/example/string_type/demo_lle.f90 rename to test/example/string_type/example_lle.f90 index 85ff5f48c..c452fd39d 100644 --- a/test/example/string_type/demo_lle.f90 +++ b/test/example/string_type/example_lle.f90 @@ -1,4 +1,4 @@ -program demo_lle +program example_lle use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_lle res = lle(string, "cde") ! res .eqv. .true. -end program demo_lle +end program example_lle diff --git a/test/example/string_type/demo_llt.f90 b/test/example/string_type/example_llt.f90 similarity index 84% rename from test/example/string_type/demo_llt.f90 rename to test/example/string_type/example_llt.f90 index 8f5b1856e..1c25100cf 100644 --- a/test/example/string_type/demo_llt.f90 +++ b/test/example/string_type/example_llt.f90 @@ -1,4 +1,4 @@ -program demo_llt +program example_llt use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_llt res = llt(string, "cde") ! res .eqv. .true. -end program demo_llt +end program example_llt diff --git a/test/example/string_type/demo_lt.f90 b/test/example/string_type/example_lt.f90 similarity index 84% rename from test/example/string_type/demo_lt.f90 rename to test/example/string_type/example_lt.f90 index ba277dd59..be8fedfb6 100644 --- a/test/example/string_type/demo_lt.f90 +++ b/test/example/string_type/example_lt.f90 @@ -1,4 +1,4 @@ -program demo_lt +program example_lt use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_lt res = string < "cde" ! res .eqv. .true. -end program demo_lt +end program example_lt diff --git a/test/example/string_type/demo_move.f90 b/test/example/string_type/example_move.f90 similarity index 91% rename from test/example/string_type/demo_move.f90 rename to test/example/string_type/example_move.f90 index e357a4d1f..5ee6e9882 100644 --- a/test/example/string_type/demo_move.f90 +++ b/test/example/string_type/example_move.f90 @@ -1,4 +1,4 @@ -program demo_move +program example_move use stdlib_string_type, only: string_type, assignment(=), move implicit none type(string_type) :: from_string @@ -18,4 +18,4 @@ program demo_move ! from_char <-- (unallocated) ! to_string <-- "move this char" -end program demo_move +end program example_move diff --git a/test/example/string_type/demo_ne.f90 b/test/example/string_type/example_ne.f90 similarity index 85% rename from test/example/string_type/demo_ne.f90 rename to test/example/string_type/example_ne.f90 index 8c9173156..6dfc49b5d 100644 --- a/test/example/string_type/demo_ne.f90 +++ b/test/example/string_type/example_ne.f90 @@ -1,4 +1,4 @@ -program demo_ne +program example_ne use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_ne res = string /= "cde" ! res .eqv. .true. -end program demo_ne +end program example_ne diff --git a/test/example/string_type/demo_repeat.f90 b/test/example/string_type/example_repeat.f90 similarity index 75% rename from test/example/string_type/demo_repeat.f90 rename to test/example/string_type/example_repeat.f90 index 46d207340..c15d0d2c3 100644 --- a/test/example/string_type/demo_repeat.f90 +++ b/test/example/string_type/example_repeat.f90 @@ -1,4 +1,4 @@ -program demo_repeat +program example_repeat use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_repeat string = "What? " string = repeat(string, 3) ! string == "What? What? What? " -end program demo_repeat +end program example_repeat diff --git a/test/example/string_type/demo_reverse.f90 b/test/example/string_type/example_reverse.f90 similarity index 83% rename from test/example/string_type/demo_reverse.f90 rename to test/example/string_type/example_reverse.f90 index f794d2b02..3b63eb778 100644 --- a/test/example/string_type/demo_reverse.f90 +++ b/test/example/string_type/example_reverse.f90 @@ -1,4 +1,4 @@ -program demo_reverse +program example_reverse use stdlib_string_type implicit none type(string_type) :: string, reverse_string @@ -9,4 +9,4 @@ program demo_reverse reverse_string = reverse(string) ! string <-- "Reverse This String" ! reverse_string <-- "gnirtS sihT esreveR" -end program demo_reverse +end program example_reverse diff --git a/test/example/string_type/demo_scan.f90 b/test/example/string_type/example_scan.f90 similarity index 83% rename from test/example/string_type/demo_scan.f90 rename to test/example/string_type/example_scan.f90 index 36f274a1d..c1476ae79 100644 --- a/test/example/string_type/demo_scan.f90 +++ b/test/example/string_type/example_scan.f90 @@ -1,4 +1,4 @@ -program demo_scan +program example_scan use stdlib_string_type implicit none type(string_type) :: string @@ -13,4 +13,4 @@ program demo_scan pos = scan(string, "c++") ! pos == 0 -end program demo_scan +end program example_scan diff --git a/test/example/string_type/demo_to_lower.f90 b/test/example/string_type/example_to_lower.f90 similarity index 84% rename from test/example/string_type/demo_to_lower.f90 rename to test/example/string_type/example_to_lower.f90 index f3e3f0a75..e6bbab4d7 100644 --- a/test/example/string_type/demo_to_lower.f90 +++ b/test/example/string_type/example_to_lower.f90 @@ -1,4 +1,4 @@ -program demo_to_lower +program example_to_lower use stdlib_string_type implicit none type(string_type) :: string, lowercase_string @@ -9,4 +9,4 @@ program demo_to_lower lowercase_string = to_lower(string) ! string <-- "Lowercase This String" ! lowercase_string <-- "lowercase this string" -end program demo_to_lower +end program example_to_lower diff --git a/test/example/string_type/demo_to_sentence.f90 b/test/example/string_type/example_to_sentence.f90 similarity index 83% rename from test/example/string_type/demo_to_sentence.f90 rename to test/example/string_type/example_to_sentence.f90 index 37ddd2c54..0b42acda8 100644 --- a/test/example/string_type/demo_to_sentence.f90 +++ b/test/example/string_type/example_to_sentence.f90 @@ -1,4 +1,4 @@ -program demo_to_sentence +program example_to_sentence use stdlib_string_type implicit none type(string_type) :: string, sentencecase_string @@ -9,4 +9,4 @@ program demo_to_sentence sentencecase_string = to_sentence(string) ! string <-- "sentencecase this string." ! sentencecase_string <-- "Sentencecase this string." -end program demo_to_sentence +end program example_to_sentence diff --git a/test/example/string_type/demo_to_title.f90 b/test/example/string_type/example_to_title.f90 similarity index 84% rename from test/example/string_type/demo_to_title.f90 rename to test/example/string_type/example_to_title.f90 index 2d4787ac3..2e6264ccc 100644 --- a/test/example/string_type/demo_to_title.f90 +++ b/test/example/string_type/example_to_title.f90 @@ -1,4 +1,4 @@ -program demo_to_title +program example_to_title use stdlib_string_type implicit none type(string_type) :: string, titlecase_string @@ -9,4 +9,4 @@ program demo_to_title titlecase_string = to_title(string) ! string <-- "titlecase this string." ! titlecase_string <-- "Titlecase This String." -end program demo_to_title +end program example_to_title diff --git a/test/example/string_type/demo_to_upper.f90 b/test/example/string_type/example_to_upper.f90 similarity index 84% rename from test/example/string_type/demo_to_upper.f90 rename to test/example/string_type/example_to_upper.f90 index 7d287ecd2..ef013a29c 100644 --- a/test/example/string_type/demo_to_upper.f90 +++ b/test/example/string_type/example_to_upper.f90 @@ -1,4 +1,4 @@ -program demo_to_upper +program example_to_upper use stdlib_string_type implicit none type(string_type) :: string, uppercase_string @@ -9,4 +9,4 @@ program demo_to_upper uppercase_string = to_upper(string) ! string <-- "Uppercase This String" ! uppercase_string <-- "UPPERCASE THIS STRING" -end program demo_to_upper +end program example_to_upper diff --git a/test/example/string_type/demo_trim.f90 b/test/example/string_type/example_trim.f90 similarity index 78% rename from test/example/string_type/demo_trim.f90 rename to test/example/string_type/example_trim.f90 index 36507e4d5..8c0b6eea0 100644 --- a/test/example/string_type/demo_trim.f90 +++ b/test/example/string_type/example_trim.f90 @@ -1,4 +1,4 @@ -program demo_trim +program example_trim use stdlib_string_type implicit none type(string_type) :: string @@ -6,4 +6,4 @@ program demo_trim string = "Whitespace " string = trim(string) ! len(string) == 10 -end program demo_trim +end program example_trim diff --git a/test/example/string_type/demo_uread.f90 b/test/example/string_type/example_uread.f90 similarity index 83% rename from test/example/string_type/demo_uread.f90 rename to test/example/string_type/example_uread.f90 index 17cd06322..ed9fe1acd 100644 --- a/test/example/string_type/demo_uread.f90 +++ b/test/example/string_type/example_uread.f90 @@ -1,4 +1,4 @@ -program demo_uread +program example_uread use stdlib_string_type implicit none type(string_type) :: string @@ -12,4 +12,4 @@ program demo_uread read (io) string close (io) -end program demo_uread +end program example_uread diff --git a/test/example/string_type/demo_uwrite.f90 b/test/example/string_type/example_uwrite.f90 similarity index 83% rename from test/example/string_type/demo_uwrite.f90 rename to test/example/string_type/example_uwrite.f90 index 1304f487b..43b3aeaa2 100644 --- a/test/example/string_type/demo_uwrite.f90 +++ b/test/example/string_type/example_uwrite.f90 @@ -1,4 +1,4 @@ -program demo_uwrite +program example_uwrite use stdlib_string_type implicit none type(string_type) :: string @@ -12,4 +12,4 @@ program demo_uwrite read (io) string close (io) -end program demo_uwrite +end program example_uwrite diff --git a/test/example/string_type/demo_verify.f90 b/test/example/string_type/example_verify.f90 similarity index 86% rename from test/example/string_type/demo_verify.f90 rename to test/example/string_type/example_verify.f90 index 2aa208588..a94bbf887 100644 --- a/test/example/string_type/demo_verify.f90 +++ b/test/example/string_type/example_verify.f90 @@ -1,4 +1,4 @@ -program demo_verify +program example_verify use stdlib_string_type implicit none type(string_type) :: string @@ -19,4 +19,4 @@ program demo_verify pos = verify(string, string) ! pos == 0 -end program demo_verify +end program example_verify diff --git a/test/example/stringlist_type/CMakeLists.txt b/test/example/stringlist_type/CMakeLists.txt index 52c3f9a70..53da72da5 100644 --- a/test/example/stringlist_type/CMakeLists.txt +++ b/test/example/stringlist_type/CMakeLists.txt @@ -1,9 +1,9 @@ -ADD_DEMO(stringlist_type_clear) -ADD_DEMO(stringlist_type_concatenate_operator) -ADD_DEMO(stringlist_type_constructor) -ADD_DEMO(stringlist_type_equality_operator) -ADD_DEMO(stringlist_type_fidx_bidx) -ADD_DEMO(stringlist_type_get) -ADD_DEMO(stringlist_type_inequality_operator) -ADD_DEMO(stringlist_type_insert_at) -ADD_DEMO(stringlist_type_len) +ADD_EXAMPLE(stringlist_type_clear) +ADD_EXAMPLE(stringlist_type_concatenate_operator) +ADD_EXAMPLE(stringlist_type_constructor) +ADD_EXAMPLE(stringlist_type_equality_operator) +ADD_EXAMPLE(stringlist_type_fidx_bidx) +ADD_EXAMPLE(stringlist_type_get) +ADD_EXAMPLE(stringlist_type_inequality_operator) +ADD_EXAMPLE(stringlist_type_insert_at) +ADD_EXAMPLE(stringlist_type_len) diff --git a/test/example/stringlist_type/demo_stringlist_type_clear.f90 b/test/example/stringlist_type/example_stringlist_type_clear.f90 similarity index 91% rename from test/example/stringlist_type/demo_stringlist_type_clear.f90 rename to test/example/stringlist_type/example_stringlist_type_clear.f90 index 17c411a74..1834a6320 100644 --- a/test/example/stringlist_type/demo_stringlist_type_clear.f90 +++ b/test/example/stringlist_type/example_stringlist_type_clear.f90 @@ -1,4 +1,4 @@ -program demo_clear +program example_clear use stdlib_stringlist_type, only: stringlist_type, fidx implicit none @@ -16,4 +16,4 @@ program demo_clear call stringlist%insert_at(fidx(1), "Element No. one") ! stringlist <-- {"Element No. one"} -end program demo_clear +end program example_clear diff --git a/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 b/test/example/stringlist_type/example_stringlist_type_concatenate_operator.f90 similarity index 93% rename from test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 rename to test/example/stringlist_type/example_stringlist_type_concatenate_operator.f90 index a85ad4436..104e7a9b8 100644 --- a/test/example/stringlist_type/demo_stringlist_type_concatenate_operator.f90 +++ b/test/example/stringlist_type/example_stringlist_type_concatenate_operator.f90 @@ -1,4 +1,4 @@ -program demo_concatenate_operator +program example_concatenate_operator use stdlib_stringlist_type, only: stringlist_type, operator(//) use stdlib_string_type, only: string_type implicit none @@ -24,4 +24,4 @@ program demo_concatenate_operator first_stringlist = first_stringlist//second_stringlist ! first_stringlist <-- {"Element No. one", "#1", "#2", "Element No. one", "Element No. three", "Element No. four"} -end program demo_concatenate_operator +end program example_concatenate_operator diff --git a/test/example/stringlist_type/demo_stringlist_type_constructor.f90 b/test/example/stringlist_type/example_stringlist_type_constructor.f90 similarity index 87% rename from test/example/stringlist_type/demo_stringlist_type_constructor.f90 rename to test/example/stringlist_type/example_stringlist_type_constructor.f90 index 40c93ea58..f4369eb85 100644 --- a/test/example/stringlist_type/demo_stringlist_type_constructor.f90 +++ b/test/example/stringlist_type/example_stringlist_type_constructor.f90 @@ -1,4 +1,4 @@ -program demo_constructor +program example_constructor use stdlib_stringlist_type, only: stringlist_type use stdlib_string_type, only: string_type implicit none @@ -14,4 +14,4 @@ program demo_constructor stringlist = stringlist_type([string_type("#1"), string_type("#2")]) ! stringlist <-- {"#1", "#2"} -end program demo_constructor +end program example_constructor diff --git a/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 b/test/example/stringlist_type/example_stringlist_type_equality_operator.f90 similarity index 92% rename from test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 rename to test/example/stringlist_type/example_stringlist_type_equality_operator.f90 index 10118be30..dcc46804f 100644 --- a/test/example/stringlist_type/demo_stringlist_type_equality_operator.f90 +++ b/test/example/stringlist_type/example_stringlist_type_equality_operator.f90 @@ -1,4 +1,4 @@ -program demo_equality_operator +program example_equality_operator use stdlib_stringlist_type, only: stringlist_type, fidx, list_head, operator(==) use stdlib_string_type, only: string_type implicit none @@ -26,4 +26,4 @@ program demo_equality_operator print'(a)', stringlist == ["#4", "#3", "#1"] ! .false. -end program demo_equality_operator +end program example_equality_operator diff --git a/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 b/test/example/stringlist_type/example_stringlist_type_fidx_bidx.f90 similarity index 78% rename from test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 rename to test/example/stringlist_type/example_stringlist_type_fidx_bidx.f90 index 952f06639..9a6ec5e85 100644 --- a/test/example/stringlist_type/demo_stringlist_type_fidx_bidx.f90 +++ b/test/example/stringlist_type/example_stringlist_type_fidx_bidx.f90 @@ -1,4 +1,4 @@ -program demo_fidx_bidx +program example_fidx_bidx use stdlib_stringlist_type, only: stringlist_index_type, fidx, bidx implicit none @@ -10,4 +10,4 @@ program demo_fidx_bidx index = bidx(3) ! backward index 3 -end program demo_fidx_bidx +end program example_fidx_bidx diff --git a/test/example/stringlist_type/demo_stringlist_type_get.f90 b/test/example/stringlist_type/example_stringlist_type_get.f90 similarity index 95% rename from test/example/stringlist_type/demo_stringlist_type_get.f90 rename to test/example/stringlist_type/example_stringlist_type_get.f90 index 08325952d..612292290 100644 --- a/test/example/stringlist_type/demo_stringlist_type_get.f90 +++ b/test/example/stringlist_type/example_stringlist_type_get.f90 @@ -1,4 +1,4 @@ -program demo_get +program example_get use stdlib_stringlist_type, only: stringlist_type, fidx, bidx use stdlib_string_type, only: string_type implicit none @@ -25,4 +25,4 @@ program demo_get output = stringlist%get(fidx(0)) ! output <-- "" -end program demo_get +end program example_get diff --git a/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 b/test/example/stringlist_type/example_stringlist_type_inequality_operator.f90 similarity index 91% rename from test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 rename to test/example/stringlist_type/example_stringlist_type_inequality_operator.f90 index d3ac5ffe0..49f64369d 100644 --- a/test/example/stringlist_type/demo_stringlist_type_inequality_operator.f90 +++ b/test/example/stringlist_type/example_stringlist_type_inequality_operator.f90 @@ -1,4 +1,4 @@ -program demo_inequality_operator +program example_inequality_operator use stdlib_stringlist_type, only: stringlist_type, bidx, list_tail, operator(/=) use stdlib_string_type, only: string_type implicit none @@ -26,4 +26,4 @@ program demo_inequality_operator print'(a)', stringlist /= ["#4", "#3", "#1"] ! .true. -end program demo_inequality_operator +end program example_inequality_operator diff --git a/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 b/test/example/stringlist_type/example_stringlist_type_insert_at.f90 similarity index 93% rename from test/example/stringlist_type/demo_stringlist_type_insert_at.f90 rename to test/example/stringlist_type/example_stringlist_type_insert_at.f90 index ebb019247..2b0e99a60 100644 --- a/test/example/stringlist_type/demo_stringlist_type_insert_at.f90 +++ b/test/example/stringlist_type/example_stringlist_type_insert_at.f90 @@ -1,4 +1,4 @@ -program demo_insert_at +program example_insert_at use stdlib_stringlist_type, only: stringlist_type, stringlist_index_type, fidx, bidx use stdlib_string_type, only: string_type implicit none @@ -20,4 +20,4 @@ program demo_insert_at call stringlist%insert_at(bidx(1), "Element No. four") ! stringlist <-- {"Element No. one", "Element No. three", "Element No. two", "Element No. four"} -end program demo_insert_at +end program example_insert_at diff --git a/test/example/stringlist_type/demo_stringlist_type_len.f90 b/test/example/stringlist_type/example_stringlist_type_len.f90 similarity index 90% rename from test/example/stringlist_type/demo_stringlist_type_len.f90 rename to test/example/stringlist_type/example_stringlist_type_len.f90 index 4e5c6f349..e0afb008b 100644 --- a/test/example/stringlist_type/demo_stringlist_type_len.f90 +++ b/test/example/stringlist_type/example_stringlist_type_len.f90 @@ -1,4 +1,4 @@ -program demo_len +program example_len use stdlib_stringlist_type, only: stringlist_type, bidx implicit none @@ -16,4 +16,4 @@ program demo_len print'(a)', stringlist%len() ! 2 -end program demo_len +end program example_len diff --git a/test/example/strings/CMakeLists.txt b/test/example/strings/CMakeLists.txt index 7e36c5c0c..6cc750765 100644 --- a/test/example/strings/CMakeLists.txt +++ b/test/example/strings/CMakeLists.txt @@ -1,11 +1,11 @@ -ADD_DEMO(chomp) -ADD_DEMO(count) -ADD_DEMO(ends_with) -ADD_DEMO(find) -ADD_DEMO(padl) -ADD_DEMO(padr) -ADD_DEMO(replace_all) -ADD_DEMO(slice) -ADD_DEMO(starts_with) -ADD_DEMO(strip) -ADD_DEMO(to_string) +ADD_EXAMPLE(chomp) +ADD_EXAMPLE(count) +ADD_EXAMPLE(ends_with) +ADD_EXAMPLE(find) +ADD_EXAMPLE(padl) +ADD_EXAMPLE(padr) +ADD_EXAMPLE(replace_all) +ADD_EXAMPLE(slice) +ADD_EXAMPLE(starts_with) +ADD_EXAMPLE(strip) +ADD_EXAMPLE(to_string) diff --git a/test/example/strings/demo_chomp.f90 b/test/example/strings/example_chomp.f90 similarity index 92% rename from test/example/strings/demo_chomp.f90 rename to test/example/strings/example_chomp.f90 index 42c0e75c0..dfd0e3fdc 100644 --- a/test/example/strings/demo_chomp.f90 +++ b/test/example/strings/example_chomp.f90 @@ -1,4 +1,4 @@ -program demo_chomp +program example_chomp use stdlib_ascii, only: TAB, VT, LF, CR, FF use stdlib_strings, only: chomp implicit none @@ -11,4 +11,4 @@ program demo_chomp print'(a)', chomp("hello", set=["l", "o"]) ! "he" print'(a)', chomp("hello", "lo") ! "hel" print'(a)', chomp("hello", substring="lo") ! "hel" -end program demo_chomp +end program example_chomp diff --git a/test/example/strings/demo_count.f90 b/test/example/strings/example_count.f90 similarity index 90% rename from test/example/strings/demo_count.f90 rename to test/example/strings/example_count.f90 index 9574276e6..5d02e4859 100644 --- a/test/example/strings/demo_count.f90 +++ b/test/example/strings/example_count.f90 @@ -1,4 +1,4 @@ -program demo_count +program example_count use stdlib_string_type, only: string_type, assignment(=) use stdlib_strings, only: count implicit none @@ -10,4 +10,4 @@ program demo_count print *, count(string, ["would", "chuck", "could"]) ! [1, 4, 1] print *, count("a long queueueueue", "ueu", [.false., .true.]) ! [2, 4] -end program demo_count +end program example_count diff --git a/test/example/strings/demo_ends_with.f90 b/test/example/strings/example_ends_with.f90 similarity index 72% rename from test/example/strings/demo_ends_with.f90 rename to test/example/strings/example_ends_with.f90 index 062c1df51..e7c2c31da 100644 --- a/test/example/strings/demo_ends_with.f90 +++ b/test/example/strings/example_ends_with.f90 @@ -1,6 +1,6 @@ -program demo_ends_with +program example_ends_with use stdlib_strings, only: ends_with implicit none print'(a)', ends_with("pattern", "ern") ! T print'(a)', ends_with("pattern", "pat") ! F -end program demo_ends_with +end program example_ends_with diff --git a/test/example/strings/demo_find.f90 b/test/example/strings/example_find.f90 similarity index 89% rename from test/example/strings/demo_find.f90 rename to test/example/strings/example_find.f90 index de4498396..c389458a9 100644 --- a/test/example/strings/demo_find.f90 +++ b/test/example/strings/example_find.f90 @@ -1,4 +1,4 @@ -program demo_find +program example_find use stdlib_string_type, only: string_type, assignment(=) use stdlib_strings, only: find implicit none @@ -10,4 +10,4 @@ program demo_find print *, find(string, ["a", "c"], [3, 2]) ! [27, 20] print *, find("qwqwqwq", "qwq", 3, [.false., .true.]) ! [0, 5] -end program demo_find +end program example_find diff --git a/test/example/strings/demo_padl.f90 b/test/example/strings/example_padl.f90 similarity index 88% rename from test/example/strings/demo_padl.f90 rename to test/example/strings/example_padl.f90 index 1509412a8..25cd7264b 100644 --- a/test/example/strings/demo_padl.f90 +++ b/test/example/strings/example_padl.f90 @@ -1,4 +1,4 @@ -program demo_padl +program example_padl use stdlib_string_type, only: string_type, assignment(=), write (formatted) use stdlib_strings, only: padl implicit none @@ -12,4 +12,4 @@ program demo_padl string = padl(string, 25) ! string <-- " left pad this string" -end program demo_padl +end program example_padl diff --git a/test/example/strings/demo_padr.f90 b/test/example/strings/example_padr.f90 similarity index 88% rename from test/example/strings/demo_padr.f90 rename to test/example/strings/example_padr.f90 index c552a25ca..4aac7aaa8 100644 --- a/test/example/strings/demo_padr.f90 +++ b/test/example/strings/example_padr.f90 @@ -1,4 +1,4 @@ -program demo_padr +program example_padr use stdlib_string_type, only: string_type, assignment(=), write (formatted) use stdlib_strings, only: padr implicit none @@ -12,4 +12,4 @@ program demo_padr string = padr(string, 25) ! string <-- "right pad this string " -end program demo_padr +end program example_padr diff --git a/test/example/strings/demo_replace_all.f90 b/test/example/strings/example_replace_all.f90 similarity index 90% rename from test/example/strings/demo_replace_all.f90 rename to test/example/strings/example_replace_all.f90 index 848589915..b9029b243 100644 --- a/test/example/strings/demo_replace_all.f90 +++ b/test/example/strings/example_replace_all.f90 @@ -1,4 +1,4 @@ -program demo_replace_all +program example_replace_all use stdlib_string_type, only: string_type, assignment(=), write (formatted) use stdlib_strings, only: replace_all implicit none @@ -13,4 +13,4 @@ program demo_replace_all string = replace_all(string, "hurdles", "technology") ! string <-- "technology here, technology there, technology everywhere" -end program demo_replace_all +end program example_replace_all diff --git a/test/example/strings/demo_slice.f90 b/test/example/strings/example_slice.f90 similarity index 89% rename from test/example/strings/demo_slice.f90 rename to test/example/strings/example_slice.f90 index 80082ee3f..d4516b08c 100644 --- a/test/example/strings/demo_slice.f90 +++ b/test/example/strings/example_slice.f90 @@ -1,4 +1,4 @@ -program demo_slice +program example_slice use stdlib_string_type use stdlib_strings, only: slice implicit none @@ -17,4 +17,4 @@ program demo_slice string = slice(string, 2, 6, 2) ! string <-- "bdf" -end program demo_slice +end program example_slice diff --git a/test/example/strings/demo_starts_with.f90 b/test/example/strings/example_starts_with.f90 similarity index 71% rename from test/example/strings/demo_starts_with.f90 rename to test/example/strings/example_starts_with.f90 index 725074cc8..ab388dbee 100644 --- a/test/example/strings/demo_starts_with.f90 +++ b/test/example/strings/example_starts_with.f90 @@ -1,6 +1,6 @@ -program demo_starts_with +program example_starts_with use stdlib_strings, only: starts_with implicit none print'(a)', starts_with("pattern", "pat") ! T print'(a)', starts_with("pattern", "ern") ! F -end program demo_starts_with +end program example_starts_with diff --git a/test/example/strings/demo_strip.f90 b/test/example/strings/example_strip.f90 similarity index 88% rename from test/example/strings/demo_strip.f90 rename to test/example/strings/example_strip.f90 index d38f3dc2b..4f0d3eae8 100644 --- a/test/example/strings/demo_strip.f90 +++ b/test/example/strings/example_strip.f90 @@ -1,4 +1,4 @@ -program demo_strip +program example_strip use stdlib_ascii, only: TAB, VT, LF, CR, FF use stdlib_strings, only: strip implicit none @@ -7,4 +7,4 @@ program demo_strip print'(a)', strip(" "//TAB//LF//VT//FF//CR) ! "" print'(a)', strip(" ! ")//"!" ! "!!" print'(a)', strip("Hello") ! "Hello" -end program demo_strip +end program example_strip diff --git a/test/example/strings/demo_to_string.f90 b/test/example/strings/example_to_string.f90 similarity index 95% rename from test/example/strings/demo_to_string.f90 rename to test/example/strings/example_to_string.f90 index 6c2e30831..0cb3f5872 100644 --- a/test/example/strings/demo_to_string.f90 +++ b/test/example/strings/example_to_string.f90 @@ -1,4 +1,4 @@ -program demo_to_string +program example_to_string use stdlib_strings, only: to_string !> Example for `complex` type @@ -28,4 +28,4 @@ program demo_to_string print *, to_string(.false., '(I5)') !! "[*]" !! 1 wrong demonstrations(`[*]` from `to_string`) -end program demo_to_string +end program example_to_string diff --git a/test/example/version/CMakeLists.txt b/test/example/version/CMakeLists.txt index 4daa4252d..303a38b53 100644 --- a/test/example/version/CMakeLists.txt +++ b/test/example/version/CMakeLists.txt @@ -1 +1 @@ -ADD_DEMO(version) +ADD_EXAMPLE(version) diff --git a/test/example/version/demo_version.f90 b/test/example/version/example_version.f90 similarity index 76% rename from test/example/version/demo_version.f90 rename to test/example/version/example_version.f90 index 00b803c65..e7382ce6d 100644 --- a/test/example/version/demo_version.f90 +++ b/test/example/version/example_version.f90 @@ -1,7 +1,7 @@ -program demo_version +program example_version use stdlib_version, only: get_stdlib_version implicit none character(len=:), allocatable :: version call get_stdlib_version(string=version) print '(a)', version -end program demo_version +end program example_version From 5d0024b50bb439f20cb638a88d88b77621008c4d Mon Sep 17 00:00:00 2001 From: Ian Giestas Pauli Date: Mon, 4 Jul 2022 16:29:06 -0300 Subject: [PATCH 24/38] Update example_padr.f90 --- test/example/strings/example_padr.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/example/strings/example_padr.f90 b/test/example/strings/example_padr.f90 index 4aac7aaa8..2446e248e 100644 --- a/test/example/strings/example_padr.f90 +++ b/test/example/strings/example_padr.f90 @@ -1,5 +1,5 @@ program example_padr - use stdlib_string_type, only: string_type, assignment(=), write (formatted) + use stdlib_string_type, only: string_type, assignment(=), write (unformatted) use stdlib_strings, only: padr implicit none type(string_type) :: string @@ -7,7 +7,7 @@ program example_padr string = "right pad this string" ! string <-- "right pad this string" - print '(a)', padr(string, 25, "$") ! "right pad this string$$$$" + print*, padr(string, 25, "$") ! "right pad this string$$$$" string = padr(string, 25) ! string <-- "right pad this string " From 6a6900c86adc03ddec0499f972d4188d7b56ccfa Mon Sep 17 00:00:00 2001 From: Ian Giestas Pauli Date: Mon, 4 Jul 2022 16:34:10 -0300 Subject: [PATCH 25/38] Revert last change using unformatted, but this time use the DT descriptor --- test/example/strings/example_padr.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/example/strings/example_padr.f90 b/test/example/strings/example_padr.f90 index 2446e248e..df01a322f 100644 --- a/test/example/strings/example_padr.f90 +++ b/test/example/strings/example_padr.f90 @@ -1,5 +1,5 @@ program example_padr - use stdlib_string_type, only: string_type, assignment(=), write (unformatted) + use stdlib_string_type, only: string_type, assignment(=), write (formatted) use stdlib_strings, only: padr implicit none type(string_type) :: string @@ -7,7 +7,7 @@ program example_padr string = "right pad this string" ! string <-- "right pad this string" - print*, padr(string, 25, "$") ! "right pad this string$$$$" + print '(DT)', padr(string, 25, "$") ! "right pad this string$$$$" string = padr(string, 25) ! string <-- "right pad this string " From 31d02cb1f84bb95e92051f3f6af197fcbae5ae25 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Thu, 7 Jul 2022 14:26:52 +0200 Subject: [PATCH 26/38] fix issues with examples in strings --- test/example/strings/example_padl.f90 | 2 +- test/example/strings/example_padr.f90 | 2 +- test/example/strings/example_replace_all.f90 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/example/strings/example_padl.f90 b/test/example/strings/example_padl.f90 index 25cd7264b..0e0f72ee0 100644 --- a/test/example/strings/example_padl.f90 +++ b/test/example/strings/example_padl.f90 @@ -7,7 +7,7 @@ program example_padl string = "left pad this string" ! string <-- "left pad this string" - print '(a)', padl(string, 25, "$") ! "$$$$$left pad this string" + print '(dt)', padl(string, 25, "$") ! "$$$$$left pad this string" string = padl(string, 25) ! string <-- " left pad this string" diff --git a/test/example/strings/example_padr.f90 b/test/example/strings/example_padr.f90 index 4aac7aaa8..0c567335e 100644 --- a/test/example/strings/example_padr.f90 +++ b/test/example/strings/example_padr.f90 @@ -7,7 +7,7 @@ program example_padr string = "right pad this string" ! string <-- "right pad this string" - print '(a)', padr(string, 25, "$") ! "right pad this string$$$$" + print '(dt)', padr(string, 25, "$") ! "right pad this string$$$$" string = padr(string, 25) ! string <-- "right pad this string " diff --git a/test/example/strings/example_replace_all.f90 b/test/example/strings/example_replace_all.f90 index b9029b243..dc293a771 100644 --- a/test/example/strings/example_replace_all.f90 +++ b/test/example/strings/example_replace_all.f90 @@ -7,7 +7,7 @@ program example_replace_all string = "hurdles here, hurdles there, hurdles everywhere" ! string <-- "hurdles here, hurdles there, hurdles everywhere" - print'(a)', replace_all(string, "hurdles", "learn from") + print'(dt)', replace_all(string, "hurdles", "learn from") ! "learn from here, learn from there, learn from everywhere" string = replace_all(string, "hurdles", "technology") From 9d1748253dd7ee9e5f378b84b396092310468a8a Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Thu, 14 Jul 2022 19:46:44 +0200 Subject: [PATCH 27/38] mv tests/examples to src/examples --- CMakeLists.txt | 1 - doc/specs/stdlib_array.md | 4 +- doc/specs/stdlib_ascii.md | 10 +-- doc/specs/stdlib_bitsets.md | 60 ++++++------- doc/specs/stdlib_error.md | 12 +-- doc/specs/stdlib_hash_procedures.md | 26 +++--- doc/specs/stdlib_hashmaps.md | 54 ++++++------ doc/specs/stdlib_io.md | 14 +-- doc/specs/stdlib_linalg.md | 32 +++---- doc/specs/stdlib_logger.md | 10 +-- doc/specs/stdlib_math.md | 30 +++---- doc/specs/stdlib_optval.md | 2 +- doc/specs/stdlib_quadrature.md | 12 +-- doc/specs/stdlib_random.md | 4 +- doc/specs/stdlib_selection.md | 6 +- doc/specs/stdlib_sorting.md | 4 +- doc/specs/stdlib_specialfunctions_gamma.md | 14 +-- doc/specs/stdlib_stats.md | 12 +-- .../stdlib_stats_distribution_exponential.md | 6 +- doc/specs/stdlib_stats_distribution_normal.md | 6 +- .../stdlib_stats_distribution_uniform.md | 8 +- doc/specs/stdlib_string_type.md | 80 +++++++++--------- doc/specs/stdlib_stringlist_type.md | 18 ++-- doc/specs/stdlib_strings.md | 22 ++--- doc/specs/stdlib_version.md | 2 +- src/CMakeLists.txt | 1 + {test/example => src/examples}/CMakeLists.txt | 0 .../examples}/array/CMakeLists.txt | 0 .../examples}/array/example_falseloc.f90 | 0 .../examples}/array/example_trueloc.f90 | 0 .../examples}/ascii/CMakeLists.txt | 0 .../examples}/ascii/example_ascii_reverse.f90 | 0 .../ascii/example_ascii_to_lower.f90 | 0 .../ascii/example_ascii_to_sentence.f90 | 0 .../ascii/example_ascii_to_title.f90 | 0 .../ascii/example_ascii_to_upper.f90 | 0 .../examples}/bitsets/CMakeLists.txt | 0 .../examples}/bitsets/example_bitsets_all.f90 | 0 .../examples}/bitsets/example_bitsets_and.f90 | 0 .../bitsets/example_bitsets_and_not.f90 | 0 .../examples}/bitsets/example_bitsets_any.f90 | 0 .../bitsets/example_bitsets_assignment.f90 | 0 .../bitsets/example_bitsets_bit_count.f90 | 0 .../bitsets/example_bitsets_bits.f90 | 0 .../bitsets/example_bitsets_clear.f90 | 0 .../bitsets/example_bitsets_equality.f90 | 0 .../bitsets/example_bitsets_extract.f90 | 0 .../bitsets/example_bitsets_flip.f90 | 0 .../bitsets/example_bitsets_from_string.f90 | 0 .../examples}/bitsets/example_bitsets_ge.f90 | 0 .../examples}/bitsets/example_bitsets_gt.f90 | 0 .../bitsets/example_bitsets_inequality.f90 | 0 .../bitsets/example_bitsets_init.f90 | 0 .../bitsets/example_bitsets_input.f90 | 0 .../examples}/bitsets/example_bitsets_le.f90 | 0 .../examples}/bitsets/example_bitsets_lt.f90 | 0 .../bitsets/example_bitsets_none.f90 | 0 .../examples}/bitsets/example_bitsets_not.f90 | 0 .../examples}/bitsets/example_bitsets_or.f90 | 0 .../bitsets/example_bitsets_output.f90 | 0 .../bitsets/example_bitsets_read_bitset.f90 | 0 .../examples}/bitsets/example_bitsets_set.f90 | 0 .../bitsets/example_bitsets_test.f90 | 0 .../bitsets/example_bitsets_to_string.f90 | 0 .../bitsets/example_bitsets_value.f90 | 0 .../bitsets/example_bitsets_write_bitset.f90 | 0 .../examples}/bitsets/example_bitsets_xor.f90 | 0 .../examples}/error/CMakeLists.txt | 0 .../examples}/error/example_check1.f90 | 0 .../examples}/error/example_check2.f90 | 0 .../examples}/error/example_check3.f90 | 0 .../examples}/error/example_check4.f90 | 0 .../examples}/error/example_error_stop1.f90 | 0 .../examples}/error/example_error_stop2.f90 | 0 .../examples}/hash_procedures/CMakeLists.txt | 0 .../example_fibonacci_hash.f90 | 0 .../example_fibonacci_hash_64.f90 | 0 .../hash_procedures/example_fnv_1_hash.f90 | 0 .../hash_procedures/example_fnv_1_hash_64.f90 | 0 .../hash_procedures/example_fnv_1a_hash.f90 | 0 .../example_fnv_1a_hash_64.f90 | 0 .../hash_procedures/example_nmhash32.f90 | 0 .../hash_procedures/example_nmhash32x.f90 | 0 .../hash_procedures/example_pengy_hash.f90 | 0 .../hash_procedures/example_spooky_hash.f90 | 0 .../example_universal_mult_hash.f90 | 0 .../example_universal_mult_hash_64.f90 | 0 .../hash_procedures/example_water_hash.f90 | 0 .../examples}/hashmaps/CMakeLists.txt | 0 .../hashmaps/example_hashmaps_calls.f90 | 0 .../hashmaps/example_hashmaps_copy_key.f90 | 0 .../hashmaps/example_hashmaps_copy_other.f90 | 0 .../hashmaps/example_hashmaps_entries.f90 | 0 .../hashmaps/example_hashmaps_equal_keys.f90 | 0 .../example_hashmaps_fnv_1_hasher.f90 | 0 .../example_hashmaps_fnv_1a_hasher.f90 | 0 .../hashmaps/example_hashmaps_free_key.f90 | 0 .../hashmaps/example_hashmaps_free_other.f90 | 0 .../hashmaps/example_hashmaps_get.f90 | 0 .../example_hashmaps_get_other_data.f90 | 0 .../hashmaps/example_hashmaps_hasher_fun.f90 | 0 .../hashmaps/example_hashmaps_init.f90 | 0 .../hashmaps/example_hashmaps_key_test.f90 | 0 .../hashmaps/example_hashmaps_loading.f90 | 0 .../hashmaps/example_hashmaps_map_entry.f90 | 0 .../hashmaps/example_hashmaps_num_slots.f90 | 0 .../hashmaps/example_hashmaps_probes.f90 | 0 .../hashmaps/example_hashmaps_rehash.f90 | 0 .../hashmaps/example_hashmaps_remove.f90 | 0 ...xample_hashmaps_seeded_nmhash32_hasher.f90 | 0 ...ample_hashmaps_seeded_nmhash32x_hasher.f90 | 0 .../example_hashmaps_seeded_water_hasher.f90 | 0 .../hashmaps/example_hashmaps_set.f90 | 0 .../example_hashmaps_set_other_data.f90 | 0 .../hashmaps/example_hashmaps_slots_bits.f90 | 0 .../hashmaps/example_hashmaps_total_depth.f90 | 0 .../examples}/io/CMakeLists.txt | 0 {test/example => src/examples}/io/example.dat | 0 {test/example => src/examples}/io/example.npy | Bin .../examples}/io/example_fmt_constants.f90 | 0 .../examples}/io/example_getline.f90 | 0 .../examples}/io/example_loadnpy.f90 | 0 .../examples}/io/example_loadtxt.f90 | 0 .../examples}/io/example_open.f90 | 0 .../examples}/io/example_savenpy.f90 | 0 .../examples}/io/example_savetxt.f90 | 0 .../examples}/linalg/CMakeLists.txt | 0 .../examples}/linalg/example_diag1.f90 | 0 .../examples}/linalg/example_diag2.f90 | 0 .../examples}/linalg/example_diag3.f90 | 0 .../examples}/linalg/example_diag4.f90 | 0 .../examples}/linalg/example_diag5.f90 | 0 .../examples}/linalg/example_eye1.f90 | 0 .../examples}/linalg/example_eye2.f90 | 0 .../examples}/linalg/example_is_diagonal.f90 | 0 .../examples}/linalg/example_is_hermitian.f90 | 0 .../linalg/example_is_hessenberg.f90 | 0 .../linalg/example_is_skew_symmetric.f90 | 0 .../examples}/linalg/example_is_square.f90 | 0 .../examples}/linalg/example_is_symmetric.f90 | 0 .../linalg/example_is_triangular.f90 | 0 .../linalg/example_outer_product.f90 | 0 .../examples}/linalg/example_trace.f90 | 0 .../examples}/logger/CMakeLists.txt | 0 .../examples}/logger/example_add_log_unit.f90 | 0 .../examples}/logger/example_configure.f90 | 0 .../logger/example_global_logger.f90 | 0 .../examples}/logger/example_log_io_error.f90 | 0 .../logger/example_log_text_error.f90 | 0 .../examples}/math/CMakeLists.txt | 0 .../examples}/math/example_clip_integer.f90 | 0 .../examples}/math/example_clip_real.f90 | 0 .../examples}/math/example_diff.f90 | 0 .../examples}/math/example_gcd.f90 | 0 .../math/example_linspace_complex.f90 | 0 .../examples}/math/example_linspace_int16.f90 | 0 .../math/example_logspace_complex.f90 | 0 .../examples}/math/example_logspace_int.f90 | 0 .../math/example_logspace_rstart_cbase.f90 | 0 .../examples}/math/example_math_all_close.f90 | 0 .../examples}/math/example_math_arange.f90 | 0 .../examples}/math/example_math_arg.f90 | 0 .../examples}/math/example_math_argd.f90 | 0 .../examples}/math/example_math_argpi.f90 | 0 .../examples}/math/example_math_is_close.f90 | 0 .../examples}/optval/CMakeLists.txt | 0 .../examples}/optval/example_optval.f90 | 0 .../examples}/quadrature/CMakeLists.txt | 0 .../quadrature/example_gauss_legendre.f90 | 0 .../example_gauss_legendre_lobatto.f90 | 0 .../examples}/quadrature/example_simps.f90 | 0 .../quadrature/example_simps_weights.f90 | 0 .../examples}/quadrature/example_trapz.f90 | 0 .../quadrature/example_trapz_weights.f90 | 0 .../examples}/random/CMakeLists.txt | 0 .../examples}/random/example_dist_rand.f90 | 0 .../examples}/random/example_random_seed.f90 | 0 .../examples}/selection/CMakeLists.txt | 0 .../selection/example_arg_select.f90 | 0 .../examples}/selection/example_select.f90 | 0 .../examples}/selection/selection_vs_sort.f90 | 0 .../examples}/sorting/CMakeLists.txt | 0 .../examples}/sorting/example_ord_sort.f90 | 0 .../examples}/sorting/example_sort.f90 | 0 .../specialfunctions_gamma/CMakeLists.txt | 0 .../specialfunctions_gamma/example_gamma.f90 | 0 .../example_gamma_p.f90 | 0 .../example_gamma_q.f90 | 0 .../example_ligamma.f90 | 0 .../example_log_factorial.f90 | 0 .../example_log_gamma.f90 | 0 .../example_uigamma.f90 | 0 .../examples}/stats/CMakeLists.txt | 0 .../examples}/stats/example_corr.f90 | 0 .../examples}/stats/example_cov.f90 | 0 .../examples}/stats/example_mean.f90 | 0 .../examples}/stats/example_median.f90 | 0 .../examples}/stats/example_moment.f90 | 0 .../examples}/stats/example_var.f90 | 0 .../CMakeLists.txt | 0 .../example_exponential_cdf.f90 | 0 .../example_exponential_pdf.f90 | 0 .../example_exponential_rvs.f90 | 0 .../stats_distribution_normal/CMakeLists.txt | 0 .../example_norm_cdf.f90 | 0 .../example_normal_pdf.f90 | 0 .../example_normal_rvs.f90 | 0 .../stats_distribution_uniform/CMakeLists.txt | 0 .../example_shuffle.f90 | 0 .../example_uniform_cdf.f90 | 0 .../example_uniform_pdf.f90 | 0 .../example_uniform_rvs.f90 | 0 .../examples}/string_type/CMakeLists.txt | 0 .../examples}/string_type/example_adjustl.f90 | 0 .../examples}/string_type/example_adjustr.f90 | 0 .../examples}/string_type/example_char.f90 | 0 .../string_type/example_char_position.f90 | 0 .../string_type/example_char_range.f90 | 0 .../example_constructor_character.f90 | 0 .../string_type/example_constructor_empty.f90 | 0 .../example_constructor_integer.f90 | 0 .../example_constructor_logical.f90 | 0 .../example_constructor_scalar.f90 | 0 .../examples}/string_type/example_cont.f90 | 0 .../examples}/string_type/example_eq.f90 | 0 .../examples}/string_type/example_fread.f90 | 0 .../examples}/string_type/example_fwrite.f90 | 0 .../examples}/string_type/example_ge.f90 | 0 .../examples}/string_type/example_gt.f90 | 0 .../examples}/string_type/example_iachar.f90 | 0 .../examples}/string_type/example_ichar.f90 | 0 .../examples}/string_type/example_index.f90 | 0 .../examples}/string_type/example_le.f90 | 0 .../examples}/string_type/example_len.f90 | 0 .../string_type/example_len_trim.f90 | 0 .../examples}/string_type/example_lge.f90 | 0 .../examples}/string_type/example_lgt.f90 | 0 .../examples}/string_type/example_lle.f90 | 0 .../examples}/string_type/example_llt.f90 | 0 .../examples}/string_type/example_lt.f90 | 0 .../examples}/string_type/example_move.f90 | 0 .../examples}/string_type/example_ne.f90 | 0 .../examples}/string_type/example_repeat.f90 | 0 .../examples}/string_type/example_reverse.f90 | 0 .../examples}/string_type/example_scan.f90 | 0 .../string_type/example_to_lower.f90 | 0 .../string_type/example_to_sentence.f90 | 0 .../string_type/example_to_title.f90 | 0 .../string_type/example_to_upper.f90 | 0 .../examples}/string_type/example_trim.f90 | 0 .../examples}/string_type/example_uread.f90 | 0 .../examples}/string_type/example_uwrite.f90 | 0 .../examples}/string_type/example_verify.f90 | 0 .../examples}/stringlist_type/CMakeLists.txt | 0 .../example_stringlist_type_clear.f90 | 0 ...e_stringlist_type_concatenate_operator.f90 | 0 .../example_stringlist_type_constructor.f90 | 0 ...mple_stringlist_type_equality_operator.f90 | 0 .../example_stringlist_type_fidx_bidx.f90 | 0 .../example_stringlist_type_get.f90 | 0 ...le_stringlist_type_inequality_operator.f90 | 0 .../example_stringlist_type_insert_at.f90 | 0 .../example_stringlist_type_len.f90 | 0 .../examples}/strings/CMakeLists.txt | 0 .../examples}/strings/example_chomp.f90 | 0 .../examples}/strings/example_count.f90 | 0 .../examples}/strings/example_ends_with.f90 | 0 .../examples}/strings/example_find.f90 | 0 .../examples}/strings/example_padl.f90 | 0 .../examples}/strings/example_padr.f90 | 0 .../examples}/strings/example_replace_all.f90 | 0 .../examples}/strings/example_slice.f90 | 0 .../examples}/strings/example_starts_with.f90 | 0 .../examples}/strings/example_strip.f90 | 0 .../examples}/strings/example_to_string.f90 | 0 .../examples}/version/CMakeLists.txt | 0 .../examples}/version/example_version.f90 | 0 test/CMakeLists.txt | 1 - 278 files changed, 225 insertions(+), 226 deletions(-) rename {test/example => src/examples}/CMakeLists.txt (100%) rename {test/example => src/examples}/array/CMakeLists.txt (100%) rename {test/example => src/examples}/array/example_falseloc.f90 (100%) rename {test/example => src/examples}/array/example_trueloc.f90 (100%) rename {test/example => src/examples}/ascii/CMakeLists.txt (100%) rename {test/example => src/examples}/ascii/example_ascii_reverse.f90 (100%) rename {test/example => src/examples}/ascii/example_ascii_to_lower.f90 (100%) rename {test/example => src/examples}/ascii/example_ascii_to_sentence.f90 (100%) rename {test/example => src/examples}/ascii/example_ascii_to_title.f90 (100%) rename {test/example => src/examples}/ascii/example_ascii_to_upper.f90 (100%) rename {test/example => src/examples}/bitsets/CMakeLists.txt (100%) rename {test/example => src/examples}/bitsets/example_bitsets_all.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_and.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_and_not.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_any.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_assignment.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_bit_count.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_bits.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_clear.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_equality.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_extract.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_flip.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_from_string.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_ge.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_gt.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_inequality.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_init.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_input.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_le.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_lt.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_none.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_not.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_or.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_output.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_read_bitset.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_set.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_test.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_to_string.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_value.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_write_bitset.f90 (100%) rename {test/example => src/examples}/bitsets/example_bitsets_xor.f90 (100%) rename {test/example => src/examples}/error/CMakeLists.txt (100%) rename {test/example => src/examples}/error/example_check1.f90 (100%) rename {test/example => src/examples}/error/example_check2.f90 (100%) rename {test/example => src/examples}/error/example_check3.f90 (100%) rename {test/example => src/examples}/error/example_check4.f90 (100%) rename {test/example => src/examples}/error/example_error_stop1.f90 (100%) rename {test/example => src/examples}/error/example_error_stop2.f90 (100%) rename {test/example => src/examples}/hash_procedures/CMakeLists.txt (100%) rename {test/example => src/examples}/hash_procedures/example_fibonacci_hash.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_fibonacci_hash_64.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_fnv_1_hash.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_fnv_1_hash_64.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_fnv_1a_hash.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_fnv_1a_hash_64.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_nmhash32.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_nmhash32x.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_pengy_hash.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_spooky_hash.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_universal_mult_hash.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_universal_mult_hash_64.f90 (100%) rename {test/example => src/examples}/hash_procedures/example_water_hash.f90 (100%) rename {test/example => src/examples}/hashmaps/CMakeLists.txt (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_calls.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_copy_key.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_copy_other.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_entries.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_equal_keys.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_fnv_1_hasher.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_fnv_1a_hasher.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_free_key.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_free_other.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_get.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_get_other_data.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_hasher_fun.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_init.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_key_test.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_loading.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_map_entry.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_num_slots.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_probes.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_rehash.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_remove.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_seeded_water_hasher.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_set.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_set_other_data.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_slots_bits.f90 (100%) rename {test/example => src/examples}/hashmaps/example_hashmaps_total_depth.f90 (100%) rename {test/example => src/examples}/io/CMakeLists.txt (100%) rename {test/example => src/examples}/io/example.dat (100%) rename {test/example => src/examples}/io/example.npy (100%) rename {test/example => src/examples}/io/example_fmt_constants.f90 (100%) rename {test/example => src/examples}/io/example_getline.f90 (100%) rename {test/example => src/examples}/io/example_loadnpy.f90 (100%) rename {test/example => src/examples}/io/example_loadtxt.f90 (100%) rename {test/example => src/examples}/io/example_open.f90 (100%) rename {test/example => src/examples}/io/example_savenpy.f90 (100%) rename {test/example => src/examples}/io/example_savetxt.f90 (100%) rename {test/example => src/examples}/linalg/CMakeLists.txt (100%) rename {test/example => src/examples}/linalg/example_diag1.f90 (100%) rename {test/example => src/examples}/linalg/example_diag2.f90 (100%) rename {test/example => src/examples}/linalg/example_diag3.f90 (100%) rename {test/example => src/examples}/linalg/example_diag4.f90 (100%) rename {test/example => src/examples}/linalg/example_diag5.f90 (100%) rename {test/example => src/examples}/linalg/example_eye1.f90 (100%) rename {test/example => src/examples}/linalg/example_eye2.f90 (100%) rename {test/example => src/examples}/linalg/example_is_diagonal.f90 (100%) rename {test/example => src/examples}/linalg/example_is_hermitian.f90 (100%) rename {test/example => src/examples}/linalg/example_is_hessenberg.f90 (100%) rename {test/example => src/examples}/linalg/example_is_skew_symmetric.f90 (100%) rename {test/example => src/examples}/linalg/example_is_square.f90 (100%) rename {test/example => src/examples}/linalg/example_is_symmetric.f90 (100%) rename {test/example => src/examples}/linalg/example_is_triangular.f90 (100%) rename {test/example => src/examples}/linalg/example_outer_product.f90 (100%) rename {test/example => src/examples}/linalg/example_trace.f90 (100%) rename {test/example => src/examples}/logger/CMakeLists.txt (100%) rename {test/example => src/examples}/logger/example_add_log_unit.f90 (100%) rename {test/example => src/examples}/logger/example_configure.f90 (100%) rename {test/example => src/examples}/logger/example_global_logger.f90 (100%) rename {test/example => src/examples}/logger/example_log_io_error.f90 (100%) rename {test/example => src/examples}/logger/example_log_text_error.f90 (100%) rename {test/example => src/examples}/math/CMakeLists.txt (100%) rename {test/example => src/examples}/math/example_clip_integer.f90 (100%) rename {test/example => src/examples}/math/example_clip_real.f90 (100%) rename {test/example => src/examples}/math/example_diff.f90 (100%) rename {test/example => src/examples}/math/example_gcd.f90 (100%) rename {test/example => src/examples}/math/example_linspace_complex.f90 (100%) rename {test/example => src/examples}/math/example_linspace_int16.f90 (100%) rename {test/example => src/examples}/math/example_logspace_complex.f90 (100%) rename {test/example => src/examples}/math/example_logspace_int.f90 (100%) rename {test/example => src/examples}/math/example_logspace_rstart_cbase.f90 (100%) rename {test/example => src/examples}/math/example_math_all_close.f90 (100%) rename {test/example => src/examples}/math/example_math_arange.f90 (100%) rename {test/example => src/examples}/math/example_math_arg.f90 (100%) rename {test/example => src/examples}/math/example_math_argd.f90 (100%) rename {test/example => src/examples}/math/example_math_argpi.f90 (100%) rename {test/example => src/examples}/math/example_math_is_close.f90 (100%) rename {test/example => src/examples}/optval/CMakeLists.txt (100%) rename {test/example => src/examples}/optval/example_optval.f90 (100%) rename {test/example => src/examples}/quadrature/CMakeLists.txt (100%) rename {test/example => src/examples}/quadrature/example_gauss_legendre.f90 (100%) rename {test/example => src/examples}/quadrature/example_gauss_legendre_lobatto.f90 (100%) rename {test/example => src/examples}/quadrature/example_simps.f90 (100%) rename {test/example => src/examples}/quadrature/example_simps_weights.f90 (100%) rename {test/example => src/examples}/quadrature/example_trapz.f90 (100%) rename {test/example => src/examples}/quadrature/example_trapz_weights.f90 (100%) rename {test/example => src/examples}/random/CMakeLists.txt (100%) rename {test/example => src/examples}/random/example_dist_rand.f90 (100%) rename {test/example => src/examples}/random/example_random_seed.f90 (100%) rename {test/example => src/examples}/selection/CMakeLists.txt (100%) rename {test/example => src/examples}/selection/example_arg_select.f90 (100%) rename {test/example => src/examples}/selection/example_select.f90 (100%) rename {test/example => src/examples}/selection/selection_vs_sort.f90 (100%) rename {test/example => src/examples}/sorting/CMakeLists.txt (100%) rename {test/example => src/examples}/sorting/example_ord_sort.f90 (100%) rename {test/example => src/examples}/sorting/example_sort.f90 (100%) rename {test/example => src/examples}/specialfunctions_gamma/CMakeLists.txt (100%) rename {test/example => src/examples}/specialfunctions_gamma/example_gamma.f90 (100%) rename {test/example => src/examples}/specialfunctions_gamma/example_gamma_p.f90 (100%) rename {test/example => src/examples}/specialfunctions_gamma/example_gamma_q.f90 (100%) rename {test/example => src/examples}/specialfunctions_gamma/example_ligamma.f90 (100%) rename {test/example => src/examples}/specialfunctions_gamma/example_log_factorial.f90 (100%) rename {test/example => src/examples}/specialfunctions_gamma/example_log_gamma.f90 (100%) rename {test/example => src/examples}/specialfunctions_gamma/example_uigamma.f90 (100%) rename {test/example => src/examples}/stats/CMakeLists.txt (100%) rename {test/example => src/examples}/stats/example_corr.f90 (100%) rename {test/example => src/examples}/stats/example_cov.f90 (100%) rename {test/example => src/examples}/stats/example_mean.f90 (100%) rename {test/example => src/examples}/stats/example_median.f90 (100%) rename {test/example => src/examples}/stats/example_moment.f90 (100%) rename {test/example => src/examples}/stats/example_var.f90 (100%) rename {test/example => src/examples}/stats_distribution_exponential/CMakeLists.txt (100%) rename {test/example => src/examples}/stats_distribution_exponential/example_exponential_cdf.f90 (100%) rename {test/example => src/examples}/stats_distribution_exponential/example_exponential_pdf.f90 (100%) rename {test/example => src/examples}/stats_distribution_exponential/example_exponential_rvs.f90 (100%) rename {test/example => src/examples}/stats_distribution_normal/CMakeLists.txt (100%) rename {test/example => src/examples}/stats_distribution_normal/example_norm_cdf.f90 (100%) rename {test/example => src/examples}/stats_distribution_normal/example_normal_pdf.f90 (100%) rename {test/example => src/examples}/stats_distribution_normal/example_normal_rvs.f90 (100%) rename {test/example => src/examples}/stats_distribution_uniform/CMakeLists.txt (100%) rename {test/example => src/examples}/stats_distribution_uniform/example_shuffle.f90 (100%) rename {test/example => src/examples}/stats_distribution_uniform/example_uniform_cdf.f90 (100%) rename {test/example => src/examples}/stats_distribution_uniform/example_uniform_pdf.f90 (100%) rename {test/example => src/examples}/stats_distribution_uniform/example_uniform_rvs.f90 (100%) rename {test/example => src/examples}/string_type/CMakeLists.txt (100%) rename {test/example => src/examples}/string_type/example_adjustl.f90 (100%) rename {test/example => src/examples}/string_type/example_adjustr.f90 (100%) rename {test/example => src/examples}/string_type/example_char.f90 (100%) rename {test/example => src/examples}/string_type/example_char_position.f90 (100%) rename {test/example => src/examples}/string_type/example_char_range.f90 (100%) rename {test/example => src/examples}/string_type/example_constructor_character.f90 (100%) rename {test/example => src/examples}/string_type/example_constructor_empty.f90 (100%) rename {test/example => src/examples}/string_type/example_constructor_integer.f90 (100%) rename {test/example => src/examples}/string_type/example_constructor_logical.f90 (100%) rename {test/example => src/examples}/string_type/example_constructor_scalar.f90 (100%) rename {test/example => src/examples}/string_type/example_cont.f90 (100%) rename {test/example => src/examples}/string_type/example_eq.f90 (100%) rename {test/example => src/examples}/string_type/example_fread.f90 (100%) rename {test/example => src/examples}/string_type/example_fwrite.f90 (100%) rename {test/example => src/examples}/string_type/example_ge.f90 (100%) rename {test/example => src/examples}/string_type/example_gt.f90 (100%) rename {test/example => src/examples}/string_type/example_iachar.f90 (100%) rename {test/example => src/examples}/string_type/example_ichar.f90 (100%) rename {test/example => src/examples}/string_type/example_index.f90 (100%) rename {test/example => src/examples}/string_type/example_le.f90 (100%) rename {test/example => src/examples}/string_type/example_len.f90 (100%) rename {test/example => src/examples}/string_type/example_len_trim.f90 (100%) rename {test/example => src/examples}/string_type/example_lge.f90 (100%) rename {test/example => src/examples}/string_type/example_lgt.f90 (100%) rename {test/example => src/examples}/string_type/example_lle.f90 (100%) rename {test/example => src/examples}/string_type/example_llt.f90 (100%) rename {test/example => src/examples}/string_type/example_lt.f90 (100%) rename {test/example => src/examples}/string_type/example_move.f90 (100%) rename {test/example => src/examples}/string_type/example_ne.f90 (100%) rename {test/example => src/examples}/string_type/example_repeat.f90 (100%) rename {test/example => src/examples}/string_type/example_reverse.f90 (100%) rename {test/example => src/examples}/string_type/example_scan.f90 (100%) rename {test/example => src/examples}/string_type/example_to_lower.f90 (100%) rename {test/example => src/examples}/string_type/example_to_sentence.f90 (100%) rename {test/example => src/examples}/string_type/example_to_title.f90 (100%) rename {test/example => src/examples}/string_type/example_to_upper.f90 (100%) rename {test/example => src/examples}/string_type/example_trim.f90 (100%) rename {test/example => src/examples}/string_type/example_uread.f90 (100%) rename {test/example => src/examples}/string_type/example_uwrite.f90 (100%) rename {test/example => src/examples}/string_type/example_verify.f90 (100%) rename {test/example => src/examples}/stringlist_type/CMakeLists.txt (100%) rename {test/example => src/examples}/stringlist_type/example_stringlist_type_clear.f90 (100%) rename {test/example => src/examples}/stringlist_type/example_stringlist_type_concatenate_operator.f90 (100%) rename {test/example => src/examples}/stringlist_type/example_stringlist_type_constructor.f90 (100%) rename {test/example => src/examples}/stringlist_type/example_stringlist_type_equality_operator.f90 (100%) rename {test/example => src/examples}/stringlist_type/example_stringlist_type_fidx_bidx.f90 (100%) rename {test/example => src/examples}/stringlist_type/example_stringlist_type_get.f90 (100%) rename {test/example => src/examples}/stringlist_type/example_stringlist_type_inequality_operator.f90 (100%) rename {test/example => src/examples}/stringlist_type/example_stringlist_type_insert_at.f90 (100%) rename {test/example => src/examples}/stringlist_type/example_stringlist_type_len.f90 (100%) rename {test/example => src/examples}/strings/CMakeLists.txt (100%) rename {test/example => src/examples}/strings/example_chomp.f90 (100%) rename {test/example => src/examples}/strings/example_count.f90 (100%) rename {test/example => src/examples}/strings/example_ends_with.f90 (100%) rename {test/example => src/examples}/strings/example_find.f90 (100%) rename {test/example => src/examples}/strings/example_padl.f90 (100%) rename {test/example => src/examples}/strings/example_padr.f90 (100%) rename {test/example => src/examples}/strings/example_replace_all.f90 (100%) rename {test/example => src/examples}/strings/example_slice.f90 (100%) rename {test/example => src/examples}/strings/example_starts_with.f90 (100%) rename {test/example => src/examples}/strings/example_strip.f90 (100%) rename {test/example => src/examples}/strings/example_to_string.f90 (100%) rename {test/example => src/examples}/version/CMakeLists.txt (100%) rename {test/example => src/examples}/version/example_version.f90 (100%) delete mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e4bc5b90..0b78699e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,6 @@ if(NOT FYPP) endif() add_subdirectory(src) -add_subdirectory(test) install(EXPORT ${PROJECT_NAME}-targets NAMESPACE ${PROJECT_NAME}:: diff --git a/doc/specs/stdlib_array.md b/doc/specs/stdlib_array.md index 0730fce16..9c379da11 100644 --- a/doc/specs/stdlib_array.md +++ b/doc/specs/stdlib_array.md @@ -46,7 +46,7 @@ Returns an array of default integer size, with a maximum length of `size(array)` #### Examples ```fortran -{!test/example/array/example_trueloc.f90!} +{!src/examples/array/example_trueloc.f90!} ``` @@ -83,5 +83,5 @@ Returns an array of default integer size, with a maximum length of `size(array)` #### Examples ```fortran -{!test/example/array/example_falseloc.f90!} +{!src/examples/array/example_falseloc.f90!} ``` diff --git a/doc/specs/stdlib_ascii.md b/doc/specs/stdlib_ascii.md index 897843960..2931fbaa6 100644 --- a/doc/specs/stdlib_ascii.md +++ b/doc/specs/stdlib_ascii.md @@ -51,7 +51,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/example/ascii/example_ascii_to_lower.f90!} +{!src/examples/ascii/example_ascii_to_lower.f90!} ``` ### `to_upper` @@ -83,7 +83,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/example/ascii/example_ascii_to_upper.f90!} +{!src/examples/ascii/example_ascii_to_upper.f90!} ``` ### `to_title` @@ -120,7 +120,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/example/ascii/example_ascii_to_title.f90!} +{!src/examples/ascii/example_ascii_to_title.f90!} ``` ### `to_sentence` @@ -155,7 +155,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/example/ascii/example_ascii_to_sentence.f90!} +{!src/examples/ascii/example_ascii_to_sentence.f90!} ``` ### `reverse` @@ -187,5 +187,5 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!test/example/ascii/example_ascii_reverse.f90!} +{!src/examples/ascii/example_ascii_reverse.f90!} ``` diff --git a/doc/specs/stdlib_bitsets.md b/doc/specs/stdlib_bitsets.md index 9ed11df96..f97a76aa5 100644 --- a/doc/specs/stdlib_bitsets.md +++ b/doc/specs/stdlib_bitsets.md @@ -205,7 +205,7 @@ is mapped to a set bit, and `.false.` is mapped to an unset bit. #### Example ```fortran -{!test/example/bitsets/example_bitsets_assignment.f90!} +{!src/examples/bitsets/example_bitsets_assignment.f90!} ``` ### Table of the non-member comparison operations @@ -259,7 +259,7 @@ otherwise it is `.false.`. #### Example ```fortran -{!test/example/bitsets/example_bitsets_all.f90!} +{!src/examples/bitsets/example_bitsets_all.f90!} ``` ### `and` - bitwise `and` of the bits of two bitsets @@ -296,7 +296,7 @@ number of bits as `set1`. #### Example ```fortran -{!test/example/bitsets/example_bitsets_and.f90!} +{!src/examples/bitsets/example_bitsets_and.f90!} ``` ### `and_not` - Bitwise `and` of one bitset with the negation of another @@ -334,7 +334,7 @@ number of bits as `set1`, otherwise the result is undefined. #### Example ```fortran -{!test/example/bitsets/example_bitsets_and_not.f90!} +{!src/examples/bitsets/example_bitsets_and_not.f90!} ``` ### `any` - determine whether any bits are set @@ -368,7 +368,7 @@ is `.false.`. #### Example ```fortran -{!test/example/bitsets/example_bitsets_any.f90!} +{!src/examples/bitsets/example_bitsets_any.f90!} ``` ### `bit_count` - return the number of bits that are set @@ -402,7 +402,7 @@ equal to the number of bits that are set in `self`. #### Example ```fortran -{!test/example/bitsets/example_bitsets_bit_count.f90!} +{!src/examples/bitsets/example_bitsets_bit_count.f90!} ``` #### `bits` - returns the number of bits @@ -436,7 +436,7 @@ the number of defined bits in `self`. #### Example ```fortran -{!test/example/bitsets/example_bitsets_bits.f90!} +{!src/examples/bitsets/example_bitsets_bits.f90!} ``` ### `clear` - clears a sequence of one or more bits @@ -487,7 +487,7 @@ an `intent(in)` argument. #### Example ```fortran -{!test/example/bitsets/example_bitsets_clear.f90!} +{!src/examples/bitsets/example_bitsets_clear.f90!} ``` ### `extract` - create a new bitset from a range in an old bitset @@ -538,7 +538,7 @@ an `intent(out)` argument. If present it shall have one of the values: #### Example ```fortran -{!test/example/bitsets/example_bitsets_extract.f90!} +{!src/examples/bitsets/example_bitsets_extract.f90!} ``` ### `flip` - flip the values of a sequence of one or more bits @@ -590,7 +590,7 @@ an `intent(in)` argument. #### Example ```fortran -{!test/example/bitsets/example_bitsets_flip.f90!} +{!src/examples/bitsets/example_bitsets_flip.f90!} ``` ### `from_string` - initializes a bitset from a binary literal @@ -640,7 +640,7 @@ codes: #### Example ```fortran -{!test/example/bitsets/example_bitsets_from_string.f90!} +{!src/examples/bitsets/example_bitsets_from_string.f90!} ``` ### `init` - `bitset_type` initialization routines @@ -689,7 +689,7 @@ stop code. It can have any of the following error codes: #### Example ```fortran -{!test/example/bitsets/example_bitsets_init.f90!} +{!src/examples/bitsets/example_bitsets_init.f90!} ``` ### `input` - reads a bitset from an unformatted file @@ -742,7 +742,7 @@ values for this `status` are: #### Example ```fortran -{!test/example/bitsets/example_bitsets_input.f90!} +{!src/examples/bitsets/example_bitsets_input.f90!} ``` ### `none` - determines whether no bits are set @@ -777,7 +777,7 @@ The result is `.true.` if no bits in `self` are set, otherwise it is #### Example ```fortran -{!test/example/bitsets/example_bitsets_none.f90!} +{!src/examples/bitsets/example_bitsets_none.f90!} ``` ### `not` - Performs the logical complement on a bitset @@ -807,7 +807,7 @@ complement of their values on input. #### Example ```fortran -{!test/example/bitsets/example_bitsets_not.f90!} +{!src/examples/bitsets/example_bitsets_not.f90!} ``` ### `or` - Bitwise OR of the bits of two bitsets @@ -844,7 +844,7 @@ otherwise the results are undefined. #### Example ```fortran -{!test/example/bitsets/example_bitsets_or.f90!} +{!src/examples/bitsets/example_bitsets_or.f90!} ``` ### `output` - Writes a binary representation of a bitset to a file @@ -887,7 +887,7 @@ code. The two code values have the meaning: #### Example ```fortran -{!test/example/bitsets/example_bitsets_output.f90!} +{!src/examples/bitsets/example_bitsets_output.f90!} ``` ### `read_bitset` - initializes `self` with the value of a *bitset_literal* @@ -968,7 +968,7 @@ as its error code. The possible error codes are: #### Example ```fortran -{!test/example/bitsets/example_bitsets_read_bitset.f90!} +{!src/examples/bitsets/example_bitsets_read_bitset.f90!} ``` ### `set` - sets a sequence of one or more bits to 1 @@ -1022,7 +1022,7 @@ Elemental subroutine #### Example ```fortran -{!test/example/bitsets/example_bitsets_set.f90!} +{!src/examples/bitsets/example_bitsets_set.f90!} ``` ### `test` - determine whether a bit is set @@ -1062,7 +1062,7 @@ otherwise it is `.false.`. If `pos` is outside the range #### Example ```fortran -{!test/example/bitsets/example_bitsets_test.f90!} +{!src/examples/bitsets/example_bitsets_test.f90!} ``` ### `to_string` - represent a bitset as a binary literal @@ -1106,7 +1106,7 @@ the stop code. The values have the following meanings: #### Example ```fortran -{!test/example/bitsets/example_bitsets_to_string.f90!} +{!src/examples/bitsets/example_bitsets_to_string.f90!} ``` ### `value` - determine the value of a bit @@ -1145,7 +1145,7 @@ is zero. #### Example ```fortran -{!test/example/bitsets/example_bitsets_value.f90!} +{!src/examples/bitsets/example_bitsets_value.f90!} ``` ### `write_bitset` - writes a *bitset-literal* @@ -1212,7 +1212,7 @@ the following error code values: #### Example ```fortran -{!test/example/bitsets/example_bitsets_write_bitset.f90!} +{!src/examples/bitsets/example_bitsets_write_bitset.f90!} ``` ### `xor` - bitwise exclusive `or` @@ -1249,7 +1249,7 @@ samee number of bits, otherwise the result is undefined. #### Example ```fortran -{!test/example/bitsets/example_bitsets_xor.f90!} +{!src/examples/bitsets/example_bitsets_xor.f90!} ``` ## Specification of the `stdlib_bitsets` operators @@ -1295,7 +1295,7 @@ to the same value, otherwise the result is `.false.`. #### Example ```fortran -{!test/example/bitsets/example_bitsets_equality.f90!} +{!src/examples/bitsets/example_bitsets_equality.f90!} ``` ### `/=` - compare two bitsets to determine whether any bits differ in value @@ -1339,7 +1339,7 @@ the result is `.false.`. #### Example ```fortran -{!test/example/bitsets/example_bitsets_inequality.f90!} +{!src/examples/bitsets/example_bitsets_inequality.f90!} ``` ### `>=` - compare two bitsets to determine whether the first is greater than or equal to the second @@ -1386,7 +1386,7 @@ or the highest order different bit is set to 1 in `set1` and to 0 in #### Example ```fortran -{!test/example/bitsets/example_bitsets_ge.f90!} +{!src/examples/bitsets/example_bitsets_ge.f90!} ``` ### `>` - compare two bitsets to determine whether the first is greater than the other @@ -1433,7 +1433,7 @@ highest order different bit is set to 1 in `set1` and to 0 in `set2`, #### Example ```fortran -{!test/example/bitsets/example_bitsets_gt.f90!} +{!src/examples/bitsets/example_bitsets_gt.f90!} ``` ### `<=` - compare two bitsets to determine whether the first is less than or equal to the other @@ -1480,7 +1480,7 @@ or the highest order different bit is set to 0 in `set1` and to 1 in #### Example ```fortran -{!test/example/bitsets/example_bitsets_le.f90!} +{!src/examples/bitsets/example_bitsets_le.f90!} ``` ### `<` - compare two bitsets to determine whether the first is less than the other @@ -1527,5 +1527,5 @@ highest order different bit is set to 0 in `set1` and to 1 in `set2`, #### Example ```fortran -{!test/example/bitsets/example_bitsets_lt.f90!} +{!src/examples/bitsets/example_bitsets_lt.f90!} ``` diff --git a/doc/specs/stdlib_error.md b/doc/specs/stdlib_error.md index 179cd39f6..2bade4666 100644 --- a/doc/specs/stdlib_error.md +++ b/doc/specs/stdlib_error.md @@ -53,16 +53,16 @@ If `condition` is `.false.`, and: #### Examples ```fortran -{!test/example/error/example_check1.f90!} +{!src/examples/error/example_check1.f90!} ``` ```fortran -{!test/example/error/example_check2.f90!} +{!src/examples/error/example_check2.f90!} ``` ```fortran -{!test/example/error/example_check3.f90!} +{!src/examples/error/example_check3.f90!} ``` ```fortran -{!test/example/error/example_check4.f90!} +{!src/examples/error/example_check4.f90!} ``` ### `error_stop` - aborts the program @@ -94,11 +94,11 @@ Aborts the program with printing the message `msg` to `stderr` and a nonzero exi Without error code: ```fortran -{!test/example/error/example_error_stop1.f90!} +{!src/examples/error/example_error_stop1.f90!} ``` With error code: ```fortran -{!test/example/error/example_error_stop2.f90!} +{!src/examples/error/example_error_stop2.f90!} ``` diff --git a/doc/specs/stdlib_hash_procedures.md b/doc/specs/stdlib_hash_procedures.md index 052c78d8a..40749a948 100644 --- a/doc/specs/stdlib_hash_procedures.md +++ b/doc/specs/stdlib_hash_procedures.md @@ -543,7 +543,7 @@ E. Knuth. It multiplies the `key` by the odd valued approximation to ##### Example ```fortran -{!test/example/hash_procedures/example_fibonacci_hash.f90!} +{!src/examples/hash_procedures/example_fibonacci_hash.f90!} ``` #### `fnv_1_hash`- calculates a hash code from a key @@ -597,7 +597,7 @@ function for character strings. ##### Example ```fortran -{!test/example/hash_procedures/example_fnv_1_hash.f90!} +{!src/examples/hash_procedures/example_fnv_1_hash.f90!} ``` @@ -651,7 +651,7 @@ function for character strings. ##### Example ```fortran -{!test/example/hash_procedures/example_fnv_1a_hash.f90!} +{!src/examples/hash_procedures/example_fnv_1a_hash.f90!} ``` @@ -818,7 +818,7 @@ function for character strings. ##### Example ```fortran -{!test/example/hash_procedures/example_nmhash32.f90!} +{!src/examples/hash_procedures/example_nmhash32.f90!} ``` @@ -870,7 +870,7 @@ function for character strings. ##### Example ```fortran -{!test/example/hash_procedures/example_nmhash32x.f90!} +{!src/examples/hash_procedures/example_nmhash32x.f90!} ``` #### `odd_random_integer` - returns an odd integer @@ -953,7 +953,7 @@ It multiplies the `key` by `seed`, and returns the ##### Example ```fortran -{!test/example/hash_procedures/example_universal_mult_hash.f90!} +{!src/examples/hash_procedures/example_universal_mult_hash.f90!} ``` #### `water_hash`- calculates a hash code from a key and a seed @@ -1011,7 +1011,7 @@ function for character strings. ##### Example ```fortran -{!test/example/hash_procedures/example_water_hash.f90!} +{!src/examples/hash_procedures/example_water_hash.f90!} ``` ## The `stdlib_hash_64bit` module @@ -1102,7 +1102,7 @@ E. Knuth. It multiplies the `key` by the odd valued approximation to ##### Example ```fortran -{!test/example/hash_procedures/example_fibonacci_hash_64.f90!} +{!src/examples/hash_procedures/example_fibonacci_hash_64.f90!} ``` #### `FNV_1`- calculates a hash code from a key @@ -1156,7 +1156,7 @@ function for character strings. ##### Example ```fortran -{!test/example/hash_procedures/example_fnv_1_hash_64.f90!} +{!src/examples/hash_procedures/example_fnv_1_hash_64.f90!} ``` @@ -1210,7 +1210,7 @@ function for character strings. ##### Example ```fortran -{!test/example/hash_procedures/example_fnv_1a_hash_64.f90!} +{!src/examples/hash_procedures/example_fnv_1a_hash_64.f90!} ``` @@ -1370,7 +1370,7 @@ function for character strings. ##### Example ```fortran -{!test/example/hash_procedures/example_pengy_hash.f90!} +{!src/examples/hash_procedures/example_pengy_hash.f90!} ``` @@ -1420,7 +1420,7 @@ and has no known bad seeds. ##### Example ```fortran -{!test/example/hash_procedures/example_spooky_hash.f90!} +{!src/examples/hash_procedures/example_spooky_hash.f90!} ``` #### `universal_mult_hash` - maps an integer to a smaller number of bits @@ -1469,7 +1469,7 @@ It multiplies the `key` by `seed`, and returns the ```fortran -{!test/example/hash_procedures/example_universal_mult_hash_64.f90!} +{!src/examples/hash_procedures/example_universal_mult_hash_64.f90!} ``` diff --git a/doc/specs/stdlib_hashmaps.md b/doc/specs/stdlib_hashmaps.md index 537ec6146..d7e452862 100644 --- a/doc/specs/stdlib_hashmaps.md +++ b/doc/specs/stdlib_hashmaps.md @@ -227,7 +227,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_copy_key.f90!} +{!src/examples/hashmaps/example_hashmaps_copy_key.f90!} ``` #### `copy_other` - Returns a copy of the other data @@ -259,7 +259,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_copy_other.f90!} +{!src/examples/hashmaps/example_hashmaps_copy_other.f90!} ``` @@ -325,7 +325,7 @@ expected to be minor compared to its faster hashing rate. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_fnv_1_hasher.f90!} +{!src/examples/hashmaps/example_hashmaps_fnv_1_hasher.f90!} ``` @@ -377,7 +377,7 @@ expected to be minor compared to its faster hashing rate. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_fnv_1a_hasher.f90!} +{!src/examples/hashmaps/example_hashmaps_fnv_1a_hasher.f90!} ``` #### `free_key` - frees the memory associated with a key @@ -407,7 +407,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_free_key.f90!} +{!src/examples/hashmaps/example_hashmaps_free_key.f90!} ``` #### `free_other` - frees the memory associated with other data @@ -437,7 +437,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_free_other.f90!} +{!src/examples/hashmaps/example_hashmaps_free_other.f90!} ``` @@ -481,7 +481,7 @@ an allocatable of `class(*)`. It is an `intent(out)` argument. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_get.f90!} +{!src/examples/hashmaps/example_hashmaps_get.f90!} ``` @@ -525,7 +525,7 @@ pointers intended for use as a hash function for the hash maps. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_hasher_fun.f90!} +{!src/examples/hashmaps/example_hashmaps_hasher_fun.f90!} ``` #### `operator(==)` - Compares two keys for equality @@ -565,7 +565,7 @@ The result is `.true.` if the keys are equal, otherwise `.falss.`. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_equal_keys.f90!} +{!src/examples/hashmaps/example_hashmaps_equal_keys.f90!} ``` #### `seeded_nmhash32_hasher`- calculates a hash code from a key @@ -615,7 +615,7 @@ This code passes the SMHasher tests. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90!} +{!src/examples/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90!} ``` #### `seeded_nmhash32x_hasher`- calculates a hash code from a key @@ -664,7 +664,7 @@ This code passes the SMHasher tests. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90!} +{!src/examples/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90!} ``` #### `seeded_water_hasher`- calculates a hash code from a key @@ -714,7 +714,7 @@ This code passes the SMHasher tests. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_seeded_water_hasher.f90!} +{!src/examples/hashmaps/example_hashmaps_seeded_water_hasher.f90!} ``` @@ -763,7 +763,7 @@ value to an `int8` vector. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_set.f90!} +{!src/examples/hashmaps/example_hashmaps_set.f90!} ``` @@ -1209,7 +1209,7 @@ The result will be the number of procedure calls on the hash map. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_calls.f90!} +{!src/examples/hashmaps/example_hashmaps_calls.f90!} ``` @@ -1247,7 +1247,7 @@ The result will be the number of entries in the hash map. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_entries.f90!} +{!src/examples/hashmaps/example_hashmaps_entries.f90!} ``` @@ -1295,7 +1295,7 @@ undefined. ```fortran -{!test/example/hashmaps/example_hashmaps_get_other_data.f90!} +{!src/examples/hashmaps/example_hashmaps_get_other_data.f90!} ``` @@ -1358,7 +1358,7 @@ has the value `alloc_fault`. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_init.f90!} +{!src/examples/hashmaps/example_hashmaps_init.f90!} ``` @@ -1400,7 +1400,7 @@ is being examined. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_key_test.f90!} +{!src/examples/hashmaps/example_hashmaps_key_test.f90!} ``` @@ -1440,7 +1440,7 @@ number of slots in the hash map. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_loading.f90!} +{!src/examples/hashmaps/example_hashmaps_loading.f90!} ``` #### `map_entry` - inserts an entry into the hash map @@ -1490,7 +1490,7 @@ is ignored. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_map_entry.f90!} +{!src/examples/hashmaps/example_hashmaps_map_entry.f90!} ``` #### `map_probes` - returns the number of hash map probes @@ -1529,7 +1529,7 @@ rehashing. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_probes.f90!} +{!src/examples/hashmaps/example_hashmaps_probes.f90!} ``` #### `num_slots` - returns the number of hash map slots. @@ -1567,7 +1567,7 @@ The result is the number of slots in `map`. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_num_slots.f90!} +{!src/examples/hashmaps/example_hashmaps_num_slots.f90!} ``` @@ -1602,7 +1602,7 @@ It is the hash method to be used by `map`. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_rehash.f90!} +{!src/examples/hashmaps/example_hashmaps_rehash.f90!} ``` #### `remove` - removes an entry from the hash map @@ -1643,7 +1643,7 @@ absent, the procedure returns with no entry with the given key. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_remove.f90!} +{!src/examples/hashmaps/example_hashmaps_remove.f90!} ``` #### `set_other_data` - replaces the other data for an entry @@ -1690,7 +1690,7 @@ not exist and nothing was done. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_set_other_data.f90!} +{!src/examples/hashmaps/example_hashmaps_set_other_data.f90!} ``` #### `slots_bits` - returns the number of bits used to address the hash map slots @@ -1728,7 +1728,7 @@ The result is the number of bits used in addressing the slots in `map`. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_slots_bits.f90!} +{!src/examples/hashmaps/example_hashmaps_slots_bits.f90!} ``` @@ -1769,5 +1769,5 @@ from their slot index the map. ##### Example ```fortran -{!test/example/hashmaps/example_hashmaps_total_depth.f90!} +{!src/examples/hashmaps/example_hashmaps_total_depth.f90!} ``` diff --git a/doc/specs/stdlib_io.md b/doc/specs/stdlib_io.md index a9c82c94f..238c73ed5 100644 --- a/doc/specs/stdlib_io.md +++ b/doc/specs/stdlib_io.md @@ -36,7 +36,7 @@ Returns an allocated rank-2 `array` with the content of `filename`. ### Example ```fortran -{!test/example/io/example_loadtxt.f90!} +{!src/examples/io/example_loadtxt.f90!} ``` @@ -86,7 +86,7 @@ The result is a scalar of type `integer`. ### Example ```fortran -{!test/example/io/example_open.f90!} +{!src/examples/io/example_open.f90!} ``` @@ -116,7 +116,7 @@ Provides a text file called `filename` that contains the rank-2 `array`. ### Example ```fortran -{!test/example/io/example_savetxt.f90!} +{!src/examples/io/example_savetxt.f90!} ``` @@ -157,7 +157,7 @@ Returns an allocated `array` with the content of `filename` in case of success. ### Example ```fortran -{!test/example/io/example_loadnpy.f90!} +{!src/examples/io/example_loadnpy.f90!} ``` @@ -198,7 +198,7 @@ Provides a npy file called `filename` that contains the rank-2 `array`. ### Example ```fortran -{!test/example/io/example_savenpy.f90!} +{!src/examples/io/example_savenpy.f90!} ``` ## `getline` @@ -236,7 +236,7 @@ Read a whole line from a formatted unit into a string variable ### Example ```fortran -{!test/example/io/example_getline.f90!} +{!src/examples/io/example_getline.f90!} ``` ## Formatting constants @@ -253,5 +253,5 @@ Provides formats for all kinds as defined in the `stdlib_kinds` module. ### Example ```fortran -{!test/example/io/example_fmt_constants.f90!} +{!src/examples/io/example_fmt_constants.f90!} ``` diff --git a/doc/specs/stdlib_linalg.md b/doc/specs/stdlib_linalg.md index 2edd38a2d..4a415529b 100644 --- a/doc/specs/stdlib_linalg.md +++ b/doc/specs/stdlib_linalg.md @@ -33,23 +33,23 @@ Returns a diagonal array or a vector with the extracted diagonal elements. ### Example ```fortran -{!test/example/linalg/example_diag1.f90!} +{!src/examples/linalg/example_diag1.f90!} ``` ```fortran -{!test/example/linalg/example_diag2.f90!} +{!src/examples/linalg/example_diag2.f90!} ``` ```fortran -{!test/example/linalg/example_diag3.f90!} +{!src/examples/linalg/example_diag3.f90!} ``` ```fortran -{!test/example/linalg/example_diag4.f90!} +{!src/examples/linalg/example_diag4.f90!} ``` ```fortran -{!test/example/linalg/example_diag5.f90!} +{!src/examples/linalg/example_diag5.f90!} ``` ## `eye` - Construct the identity matrix @@ -96,11 +96,11 @@ A = eye(2,2)/2.0 !! A == diag([0.5, 0.5]) ### Example ```fortran -{!test/example/linalg/example_eye1.f90!} +{!src/examples/linalg/example_eye1.f90!} ``` ```fortran -{!test/example/linalg/example_eye2.f90!} +{!src/examples/linalg/example_eye2.f90!} ``` ## `trace` - Trace of a matrix @@ -127,7 +127,7 @@ Returns the trace of the matrix, i.e. the sum of diagonal elements. ### Example ```fortran -{!test/example/linalg/example_trace.f90!} +{!src/examples/linalg/example_trace.f90!} ``` ## `outer_product` - Computes the outer product of two vectors @@ -157,7 +157,7 @@ Returns a rank-2 array equal to `u v^T` (where `u, v` are considered column vect ### Example ```fortran -{!test/example/linalg/example_outer_product.f90!} +{!src/examples/linalg/example_outer_product.f90!} ``` ## `is_square` - Checks if a matrix is square @@ -185,7 +185,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is square, and ` ### Example ```fortran -{!test/example/linalg/example_is_square.f90!} +{!src/examples/linalg/example_is_square.f90!} ``` ## `is_diagonal` - Checks if a matrix is diagonal @@ -214,7 +214,7 @@ Note that nonsquare matrices may be diagonal, so long as `a_ij = 0` when `i /= j ### Example ```fortran -{!test/example/linalg/example_is_diagonal.f90!} +{!src/examples/linalg/example_is_diagonal.f90!} ``` ## `is_symmetric` - Checks if a matrix is symmetric @@ -242,7 +242,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is symmetric, an ### Example ```fortran -{!test/example/linalg/example_is_symmetric.f90!} +{!src/examples/linalg/example_is_symmetric.f90!} ``` ## `is_skew_symmetric` - Checks if a matrix is skew-symmetric @@ -270,7 +270,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is skew-symmetri ### Example ```fortran -{!test/example/linalg/example_is_skew_symmetric.f90!} +{!src/examples/linalg/example_is_skew_symmetric.f90!} ``` ## `is_hermitian` - Checks if a matrix is Hermitian @@ -298,7 +298,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is Hermitian, an ### Example ```fortran -{!test/example/linalg/example_is_hermitian.f90!} +{!src/examples/linalg/example_is_hermitian.f90!} ``` ## `is_triangular` - Checks if a matrix is triangular @@ -330,7 +330,7 @@ Specifically, upper triangular matrices satisfy `a_ij = 0` when `j < i`, and low ### Example ```fortran -{!test/example/linalg/example_is_triangular.f90!} +{!src/examples/linalg/example_is_triangular.f90!} ``` ## `is_hessenberg` - Checks if a matrix is hessenberg @@ -362,5 +362,5 @@ Specifically, upper Hessenberg matrices satisfy `a_ij = 0` when `j < i-1`, and l ### Example ```fortran -{!test/example/linalg/example_is_hessenberg.f90!} +{!src/examples/linalg/example_is_hessenberg.f90!} ``` diff --git a/doc/specs/stdlib_logger.md b/doc/specs/stdlib_logger.md index f9ca089aa..e9d5221d4 100644 --- a/doc/specs/stdlib_logger.md +++ b/doc/specs/stdlib_logger.md @@ -195,7 +195,7 @@ an `intent(in)` argument. It shall be the name of the file to be opened. #### Example ```fortran -{!test/example/logger/example_global_logger.f90!} +{!src/examples/logger/example_global_logger.f90!} ``` ### `add_log_unit` - add a unit to the array `self % log_units` @@ -251,7 +251,7 @@ to `unit`. #### Example ```fortran -{!test/example/logger/example_add_log_unit.f90!} +{!src/examples/logger/example_add_log_unit.f90!} ``` ### `configuration` - report a logger's configuration @@ -378,7 +378,7 @@ Pure subroutine #### Example ```fortran -{!test/example/logger/example_configure.f90!} +{!src/examples/logger/example_configure.f90!} ``` ### `log_debug` - Writes the string `message` to `self % log_units` @@ -668,7 +668,7 @@ Subroutine #### Example ```fortran -{!test/example/logger/example_log_io_error.f90!} +{!src/examples/logger/example_log_io_error.f90!} ``` ### `log_message` - write the string `message` to `self % log_units` @@ -817,7 +817,7 @@ Subroutine #### Example ```fortran -{!test/example/logger/example_log_text_error.f90!} +{!src/examples/logger/example_log_text_error.f90!} ``` ### `log_units_assigned` - returns the number of active I/O units diff --git a/doc/specs/stdlib_math.md b/doc/specs/stdlib_math.md index 89d5356fe..a9f44ee8c 100644 --- a/doc/specs/stdlib_math.md +++ b/doc/specs/stdlib_math.md @@ -51,14 +51,14 @@ The output is a scalar of `type` and `kind` same as to that of the arguments. Here inputs are of type `integer` and kind `int32` ```fortran -{!test/example/math/example_clip_integer.f90!} +{!src/examples/math/example_clip_integer.f90!} ``` ##### Example 2: Here inputs are of type `real` and kind `sp` ```fortran -{!test/example/math/example_clip_real.f90!} +{!src/examples/math/example_clip_real.f90!} ``` ### `gcd` function @@ -95,7 +95,7 @@ Returns an integer of the same `kind` as that of the arguments. ##### Example 1: ```fortran -{!test/example/math/example_gcd.f90!} +{!src/examples/math/example_gcd.f90!} ``` ### `linspace` - Create a linearly spaced rank one array @@ -138,14 +138,14 @@ If `start`/`end` are `integer` types, the `result` will default to a `real(dp)` Here inputs are of type `complex` and kind `dp` ```fortran -{!test/example/math/example_linspace_complex.f90!} +{!src/examples/math/example_linspace_complex.f90!} ``` ##### Example 2: Here inputs are of type `integer` and kind `int16`, with the result defaulting to `real(dp)`. ```fortran -{!test/example/math/example_linspace_int16.f90!} +{!src/examples/math/example_linspace_int16.f90!} ``` ### `logspace` - Create a logarithmically spaced rank one array @@ -207,21 +207,21 @@ For function calls where the `base` is specified, the `type` and `kind` of the r Here inputs are of type `complex` and kind `dp`. `n` and `base` is not specified and thus default to 50 and 10, respectively. ```fortran -{!test/example/math/example_logspace_complex.f90!} +{!src/examples/math/example_logspace_complex.f90!} ``` ##### Example 2: Here inputs are of type `integer` and default kind. `base` is not specified and thus defaults to 10. ```fortran -{!test/example/math/example_logspace_int.f90!} +{!src/examples/math/example_logspace_int.f90!} ``` ##### Example 3: Here `start`/`end` are of type `real` and double precision. `base` is type `complex` and also double precision. ```fortran -{!test/example/math/example_logspace_rstart_cbase.f90!} +{!src/examples/math/example_logspace_rstart_cbase.f90!} ``` ### `arange` function @@ -271,7 +271,7 @@ For `real` type arguments, the length of the result vector is `floor((end - star #### Example ```fortran -{!test/example/math/example_math_arange.f90!} +{!src/examples/math/example_math_arange.f90!} ``` ### `arg` function @@ -307,7 +307,7 @@ Notes: Although the angle of the complex number `0` is undefined, `arg((0,0))` r #### Example ```fortran -{!test/example/math/example_math_arg.f90!} +{!src/examples/math/example_math_arg.f90!} ``` ### `argd` function @@ -343,7 +343,7 @@ Notes: Although the angle of the complex number `0` is undefined, `argd((0,0))` #### Example ```fortran -{!test/example/math/example_math_argd.f90!} +{!src/examples/math/example_math_argd.f90!} ``` ### `argpi` function @@ -379,7 +379,7 @@ Notes: Although the angle of the complex number `0` is undefined, `argpi((0,0))` #### Example ```fortran -{!test/example/math/example_math_argpi.f90!} +{!src/examples/math/example_math_argpi.f90!} ``` ### `is_close` function @@ -439,7 +439,7 @@ Returns a `logical` scalar/array. #### Example ```fortran -{!test/example/math/example_math_is_close.f90!} +{!src/examples/math/example_math_is_close.f90!} ``` ### `all_close` function @@ -490,7 +490,7 @@ Returns a `logical` scalar. #### Example ```fortran -{!test/example/math/example_math_all_close.f90!} +{!src/examples/math/example_math_all_close.f90!} ``` ### `diff` function @@ -552,5 +552,5 @@ When both `prepend` and `append` are not present, the result `y` has one fewer e #### Example ```fortran -{!test/example/math/example_diff.f90!} +{!src/examples/math/example_diff.f90!} ``` diff --git a/doc/specs/stdlib_optval.md b/doc/specs/stdlib_optval.md index 6abd8ff91..79a1625eb 100644 --- a/doc/specs/stdlib_optval.md +++ b/doc/specs/stdlib_optval.md @@ -35,5 +35,5 @@ If `x` is present, the result is `x`, otherwise the result is `default`. ### Example ```fortran -{!test/example/optval/example_optval.f90!} +{!src/examples/optval/example_optval.f90!} ``` diff --git a/doc/specs/stdlib_quadrature.md b/doc/specs/stdlib_quadrature.md index 4566d4d9a..579a0737d 100644 --- a/doc/specs/stdlib_quadrature.md +++ b/doc/specs/stdlib_quadrature.md @@ -39,7 +39,7 @@ If the size of `y` is zero or one, the result is zero. ### Example ```fortran -{!test/example/quadrature/example_trapz.f90!} +{!src/examples/quadrature/example_trapz.f90!} ``` ## `trapz_weights` - trapezoidal rule weights for given abscissas @@ -69,7 +69,7 @@ If the size of `x` is one, then the sole element of the result is zero. ### Example ```fortran -{!test/example/quadrature/example_trapz_weights.f90!} +{!src/examples/quadrature/example_trapz_weights.f90!} ``` ## `simps` - integrate sampled values using Simpson's rule @@ -111,7 +111,7 @@ If the size of `y` is two, the result is the same as if `trapz` had been called ### Example ```fortran -{!test/example/quadrature/example_simps.f90!} +{!src/examples/quadrature/example_simps.f90!} ``` ## `simps_weights` - Simpson's rule weights for given abscissas @@ -147,7 +147,7 @@ If the size of `x` is two, then the result is the same as if `trapz_weights` had ### Example ```fortran -{!test/example/quadrature/example_simps_weights.f90!} +{!src/examples/quadrature/example_simps_weights.f90!} ``` ## `gauss_legendre` - Gauss-Legendre quadrature (a.k.a. Gaussian quadrature) nodes and weights @@ -185,7 +185,7 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -{!test/example/quadrature/example_gauss_legendre.f90!} +{!src/examples/quadrature/example_gauss_legendre.f90!} ``` ## `gauss_legendre_lobatto` - Gauss-Legendre-Lobatto quadrature nodes and weights @@ -223,5 +223,5 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -{!test/example/quadrature/example_gauss_legendre_lobatto.f90!} +{!src/examples/quadrature/example_gauss_legendre_lobatto.f90!} ``` diff --git a/doc/specs/stdlib_random.md b/doc/specs/stdlib_random.md index 14c14f210..a82bab433 100644 --- a/doc/specs/stdlib_random.md +++ b/doc/specs/stdlib_random.md @@ -33,7 +33,7 @@ Return a scalar of type `integer`. ### Example ```fortran -{!test/example/random/example_random_seed.f90!} +{!src/examples/random/example_random_seed.f90!} ``` ## `dist_rand` - Get a random integer with specified kind @@ -61,5 +61,5 @@ Return a scalar of type `integer`. ### Example ```fortran -{!test/example/random/example_dist_rand.f90!} +{!src/examples/random/example_dist_rand.f90!} ``` diff --git a/doc/specs/stdlib_selection.md b/doc/specs/stdlib_selection.md index f2e7a3b79..9eb7b6093 100644 --- a/doc/specs/stdlib_selection.md +++ b/doc/specs/stdlib_selection.md @@ -107,7 +107,7 @@ code here to be released under stdlib's MIT license. ### Example ```fortran -{!test/example/selection/example_select.f90!} +{!src/examples/selection/example_select.f90!} ``` ## `arg_select` - find the index of the k-th smallest value in an input array @@ -190,7 +190,7 @@ code here to be released under stdlib's MIT license. ```fortran -{!test/example/selection/example_arg_select.f90!} +{!src/examples/selection/example_arg_select.f90!} ``` ## Comparison with using `sort` @@ -201,7 +201,7 @@ should see a speed improvement with the selection routines which grows like LOG(size(`array`)). ```fortran -{!test/example/selection/selection_vs_sort.f90!} +{!src/examples/selection/selection_vs_sort.f90!} ``` The results seem consistent with expectations when the `array` is large; the program prints: diff --git a/doc/specs/stdlib_sorting.md b/doc/specs/stdlib_sorting.md index 5d90e1bd3..d2a90e9e6 100644 --- a/doc/specs/stdlib_sorting.md +++ b/doc/specs/stdlib_sorting.md @@ -261,7 +261,7 @@ function `LGT`. ##### Example ```fortran -{!test/example/sorting/example_ord_sort.f90!} +{!src/examples/sorting/example_ord_sort.f90!} ``` #### `sort` - sorts an input array @@ -315,7 +315,7 @@ element of `array` is a `NaN`. Sorting of `CHARACTER(*)` and ```fortran -{!test/example/sorting/example_sort.f90!} +{!src/examples/sorting/example_sort.f90!} ``` #### `sort_index` - creates an array of sorting indices for an input array, while also sorting the array. diff --git a/doc/specs/stdlib_specialfunctions_gamma.md b/doc/specs/stdlib_specialfunctions_gamma.md index f95103bb3..3c1bf1ea1 100644 --- a/doc/specs/stdlib_specialfunctions_gamma.md +++ b/doc/specs/stdlib_specialfunctions_gamma.md @@ -38,7 +38,7 @@ The function returns a value with the same type and kind as input argument. ### Example ```fortran -{!test/example/specialfunctions_gamma/example_gamma.f90!} +{!src/examples/specialfunctions_gamma/example_gamma.f90!} ``` ## `log_gamma` - Calculate the natural logarithm of the gamma function @@ -72,7 +72,7 @@ The function returns real single precision values for integer input arguments, w ### Example ```fortran -{!test/example/specialfunctions_gamma/example_log_gamma.f90!} +{!src/examples/specialfunctions_gamma/example_log_gamma.f90!} ``` ## `log_factorial` - calculate the logarithm of a factorial @@ -103,7 +103,7 @@ The function returns real type values with single precision. ### Example ```fortran -{!test/example/specialfunctions_gamma/example_log_factorial.f90!} +{!src/examples/specialfunctions_gamma/example_log_factorial.f90!} ``` ## `lower_incomplete_gamma` - calculate lower incomplete gamma integral @@ -140,7 +140,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!test/example/specialfunctions_gamma/example_ligamma.f90!} +{!src/examples/specialfunctions_gamma/example_ligamma.f90!} ``` ## `upper_incomplete_gamma` - calculate the upper incomplete gamma integral @@ -177,7 +177,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!test/example/specialfunctions_gamma/example_uigamma.f90!} +{!src/examples/specialfunctions_gamma/example_uigamma.f90!} ``` ## `log_lower_incomplete_gamma` - calculate the natural logarithm of the lower incomplete gamma integral @@ -272,7 +272,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!test/example/specialfunctions_gamma/example_gamma_p.f90!} +{!src/examples/specialfunctions_gamma/example_gamma_p.f90!} ``` ## `regularized_gamma_q` - calculate the gamma quotient Q @@ -309,5 +309,5 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!test/example/specialfunctions_gamma/example_gamma_q.f90!} +{!src/examples/specialfunctions_gamma/example_gamma_q.f90!} ``` diff --git a/doc/specs/stdlib_stats.md b/doc/specs/stdlib_stats.md index cb4d54a77..f8ba6da19 100644 --- a/doc/specs/stdlib_stats.md +++ b/doc/specs/stdlib_stats.md @@ -52,7 +52,7 @@ If `mask` is specified, the result is the Pearson correlation of all elements of ### Example ```fortran -{!test/example/stats/example_corr.f90!} +{!src/examples/stats/example_corr.f90!} ``` ## `cov` - covariance of array elements @@ -108,7 +108,7 @@ If `mask` is specified, the result is the covariance of all elements of `array` ### Example ```fortran -{!test/example/stats/example_cov.f90!} +{!src/examples/stats/example_cov.f90!} ``` ## `mean` - mean of array elements @@ -151,7 +151,7 @@ If `mask` is specified, the result is the mean of all elements of `array` corres ### Example ```fortran -{!test/example/stats/example_mean.f90!} +{!src/examples/stats/example_mean.f90!} ``` ## `median` - median of array elements @@ -216,7 +216,7 @@ If `mask` is specified, the result is the median of all elements of `array` corr ### Example ```fortran -{!test/example/stats/example_median.f90!} +{!src/examples/stats/example_median.f90!} ``` ## `moment` - central moments of array elements @@ -280,7 +280,7 @@ If `mask` is specified, the result is the _k_-th (central) moment of all elemen ### Example ```fortran -{!test/example/stats/example_moment.f90!} +{!src/examples/stats/example_moment.f90!} ``` ## `var` - variance of array elements @@ -338,5 +338,5 @@ If the variance is computed with only one single element, then the result is IEE ### Example ```fortran -{!test/example/stats/example_var.f90!} +{!src/examples/stats/example_var.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_exponential.md b/doc/specs/stdlib_stats_distribution_exponential.md index 8fad691f9..e1b82aed7 100644 --- a/doc/specs/stdlib_stats_distribution_exponential.md +++ b/doc/specs/stdlib_stats_distribution_exponential.md @@ -46,7 +46,7 @@ The result is a scalar or rank one array with a size of `array_size`, and has th ### Example ```fortran -{!test/example/stats_distribution_exponential/example_exponential_rvs.f90!} +{!src/examples/stats_distribution_exponential/example_exponential_rvs.f90!} ``` ## `pdf_exp` - exponential distribution probability density function @@ -90,7 +90,7 @@ The result is a scalar or an array, with a shape conformable to arguments, and h ### Example ```fortran -{!test/example/stats_distribution_exponential/example_exponential_pdf.f90!} +{!src/examples/stats_distribution_exponential/example_exponential_pdf.f90!} ``` ## `cdf_exp` - exponential cumulative distribution function @@ -134,5 +134,5 @@ The result is a scalar or an array, with a shape conformable to arguments, and h ### Example ```fortran -{!test/example/stats_distribution_exponential/example_exponential_cdf.f90!} +{!src/examples/stats_distribution_exponential/example_exponential_cdf.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_normal.md b/doc/specs/stdlib_stats_distribution_normal.md index a453349c3..c2a0c9b50 100644 --- a/doc/specs/stdlib_stats_distribution_normal.md +++ b/doc/specs/stdlib_stats_distribution_normal.md @@ -49,7 +49,7 @@ The result is a scalar or rank one array, with a size of `array_size`, and as th ### Example ```fortran -{!test/example/stats_distribution_normal/example_normal_rvs.f90!} +{!src/examples/stats_distribution_normal/example_normal_rvs.f90!} ``` ## `pdf_normal` - normal distribution probability density function @@ -93,7 +93,7 @@ The result is a scalar or an array, with a shape conformable to arguments, and a ### Example ```fortran -{!test/example/stats_distribution_normal/example_normal_pdf.f90!} +{!src/examples/stats_distribution_normal/example_normal_pdf.f90!} ``` ## `cdf_normal` - normal distribution cumulative distribution function @@ -137,5 +137,5 @@ The result is a scalar or an array, with a shape conformable to arguments, as th ### Example ```fortran -{!test/example/stats_distribution_normal/example_norm_cdf.f90!} +{!src/examples/stats_distribution_normal/example_norm_cdf.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_uniform.md b/doc/specs/stdlib_stats_distribution_uniform.md index f2adc9b5f..3023bcd74 100644 --- a/doc/specs/stdlib_stats_distribution_uniform.md +++ b/doc/specs/stdlib_stats_distribution_uniform.md @@ -35,7 +35,7 @@ Return a randomized rank one array of the input type. ### Example ```fortran -{!test/example/stats_distribution_uniform/example_shuffle.f90!} +{!src/examples/stats_distribution_uniform/example_shuffle.f90!} ``` ## `rvs_uniform` - uniform distribution random variates @@ -85,7 +85,7 @@ The result is a scalar or a rank one array with size of `array_size`, of type `i ### Example ```fortran -{!test/example/stats_distribution_uniform/example_uniform_rvs.f90!} +{!src/examples/stats_distribution_uniform/example_uniform_rvs.f90!} ``` ## `pdf_uniform` - Uniform distribution probability density function @@ -133,7 +133,7 @@ The result is a scalar or an array, with a shape conformable to arguments, of ty ### Example ```fortran -{!test/example/stats_distribution_uniform/example_uniform_pdf.f90!} +{!src/examples/stats_distribution_uniform/example_uniform_pdf.f90!} ``` ## `cdf_uniform` - Uniform distribution cumulative distribution function @@ -183,5 +183,5 @@ The result is a scalar or an array, with a shape conformable to arguments, of ty ### Example ```fortran -{!test/example/stats_distribution_uniform/example_uniform_cdf.f90!} +{!src/examples/stats_distribution_uniform/example_uniform_cdf.f90!} ``` diff --git a/doc/specs/stdlib_string_type.md b/doc/specs/stdlib_string_type.md index f77ab2bcb..7483d7ecf 100644 --- a/doc/specs/stdlib_string_type.md +++ b/doc/specs/stdlib_string_type.md @@ -67,7 +67,7 @@ The result is an instance of `string_type` with zero length. #### Example ```fortran -{!test/example/string_type/example_constructor_empty.f90!} +{!src/examples/string_type/example_constructor_empty.f90!} ``` @@ -105,7 +105,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!test/example/string_type/example_constructor_scalar.f90!} +{!src/examples/string_type/example_constructor_scalar.f90!} ``` @@ -139,7 +139,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!test/example/string_type/example_constructor_integer.f90!} +{!src/examples/string_type/example_constructor_integer.f90!} ``` @@ -173,7 +173,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!test/example/string_type/example_constructor_logical.f90!} +{!src/examples/string_type/example_constructor_logical.f90!} ``` @@ -202,7 +202,7 @@ Elemental subroutine, `assignment(=)`. #### Example ```fortran -{!test/example/string_type/example_constructor_character.f90!} +{!src/examples/string_type/example_constructor_character.f90!} ``` @@ -236,7 +236,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/example/string_type/example_len.f90!} +{!src/examples/string_type/example_len.f90!} ``` @@ -271,7 +271,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/example/string_type/example_len_trim.f90!} +{!src/examples/string_type/example_len_trim.f90!} ``` @@ -306,7 +306,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/example/string_type/example_trim.f90!} +{!src/examples/string_type/example_trim.f90!} ``` @@ -341,7 +341,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/example/string_type/example_adjustl.f90!} +{!src/examples/string_type/example_adjustl.f90!} ``` @@ -376,7 +376,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/example/string_type/example_adjustr.f90!} +{!src/examples/string_type/example_adjustr.f90!} ``` @@ -412,7 +412,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/example/string_type/example_repeat.f90!} +{!src/examples/string_type/example_repeat.f90!} ``` @@ -446,7 +446,7 @@ The result is a scalar character value. #### Example ```fortran -{!test/example/string_type/example_char.f90!} +{!src/examples/string_type/example_char.f90!} ``` @@ -481,7 +481,7 @@ The result is a scalar character value. #### Example ```fortran -{!test/example/string_type/example_char_position.f90!} +{!src/examples/string_type/example_char_position.f90!} ``` @@ -517,7 +517,7 @@ The result is a scalar character value. #### Example ```fortran -{!test/example/string_type/example_char_range.f90!} +{!src/examples/string_type/example_char_range.f90!} ``` @@ -554,7 +554,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/example/string_type/example_ichar.f90!} +{!src/examples/string_type/example_ichar.f90!} ``` @@ -591,7 +591,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/example/string_type/example_iachar.f90!} +{!src/examples/string_type/example_iachar.f90!} ``` @@ -631,7 +631,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/example/string_type/example_index.f90!} +{!src/examples/string_type/example_index.f90!} ``` @@ -671,7 +671,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/example/string_type/example_scan.f90!} +{!src/examples/string_type/example_scan.f90!} ``` @@ -711,7 +711,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!test/example/string_type/example_verify.f90!} +{!src/examples/string_type/example_verify.f90!} ``` @@ -750,7 +750,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_lgt.f90!} +{!src/examples/string_type/example_lgt.f90!} ``` @@ -789,7 +789,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_llt.f90!} +{!src/examples/string_type/example_llt.f90!} ``` @@ -829,7 +829,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_lge.f90!} +{!src/examples/string_type/example_lge.f90!} ``` @@ -869,7 +869,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_lle.f90!} +{!src/examples/string_type/example_lle.f90!} ``` @@ -904,7 +904,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/example/string_type/example_to_lower.f90!} +{!src/examples/string_type/example_to_lower.f90!} ``` @@ -939,7 +939,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/example/string_type/example_to_upper.f90!} +{!src/examples/string_type/example_to_upper.f90!} ``` @@ -979,7 +979,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/example/string_type/example_to_title.f90!} +{!src/examples/string_type/example_to_title.f90!} ``` @@ -1016,7 +1016,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/example/string_type/example_to_sentence.f90!} +{!src/examples/string_type/example_to_sentence.f90!} ``` @@ -1050,7 +1050,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!test/example/string_type/example_reverse.f90!} +{!src/examples/string_type/example_reverse.f90!} ``` @@ -1092,7 +1092,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_gt.f90!} +{!src/examples/string_type/example_gt.f90!} ``` @@ -1134,7 +1134,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_lt.f90!} +{!src/examples/string_type/example_lt.f90!} ``` @@ -1176,7 +1176,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_ge.f90!} +{!src/examples/string_type/example_ge.f90!} ``` @@ -1218,7 +1218,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_le.f90!} +{!src/examples/string_type/example_le.f90!} ``` @@ -1260,7 +1260,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_eq.f90!} +{!src/examples/string_type/example_eq.f90!} ``` @@ -1302,7 +1302,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!test/example/string_type/example_ne.f90!} +{!src/examples/string_type/example_ne.f90!} ``` @@ -1341,7 +1341,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!test/example/string_type/example_cont.f90!} +{!src/examples/string_type/example_cont.f90!} ``` @@ -1378,7 +1378,7 @@ Unformatted user defined derived type output. #### Example ```fortran -{!test/example/string_type/example_uwrite.f90!} +{!src/examples/string_type/example_uwrite.f90!} ``` @@ -1421,7 +1421,7 @@ Formatted user defined derived type output. #### Example ```fortran -{!test/example/string_type/example_fwrite.f90!} +{!src/examples/string_type/example_fwrite.f90!} ``` @@ -1460,7 +1460,7 @@ Unformatted derived type input. #### Example ```fortran -{!test/example/string_type/example_uread.f90!} +{!src/examples/string_type/example_uread.f90!} ``` @@ -1507,7 +1507,7 @@ Formatted derived type input. #### Example ```fortran -{!test/example/string_type/example_fread.f90!} +{!src/examples/string_type/example_fread.f90!} ``` @@ -1542,5 +1542,5 @@ Pure subroutine (Elemental subroutine, only when both `from` and `to` are `type( #### Example ```fortran -{!test/example/string_type/example_move.f90!} +{!src/examples/string_type/example_move.f90!} ``` diff --git a/doc/specs/stdlib_stringlist_type.md b/doc/specs/stdlib_stringlist_type.md index 304ad9060..74a9746eb 100644 --- a/doc/specs/stdlib_stringlist_type.md +++ b/doc/specs/stdlib_stringlist_type.md @@ -72,7 +72,7 @@ The result is of type `stringlist_index_type`. #### Example ```fortran -{!test/example/stringlist_type/example_stringlist_type_fidx_bidx.f90!} +{!src/examples/stringlist_type/example_stringlist_type_fidx_bidx.f90!} ``` @@ -108,7 +108,7 @@ The result is an instance of type `stringlist_type`. #### Example ```fortran -{!test/example/stringlist_type/example_stringlist_type_constructor.f90!} +{!src/examples/stringlist_type/example_stringlist_type_constructor.f90!} ``` @@ -142,7 +142,7 @@ Pure subroutine. #### Example ```fortran -{!test/example/stringlist_type/example_stringlist_type_insert_at.f90!} +{!src/examples/stringlist_type/example_stringlist_type_insert_at.f90!} ``` @@ -177,7 +177,7 @@ The result is a string of type `string_type`. #### Example ```fortran -{!test/example/stringlist_type/example_stringlist_type_get.f90!} +{!src/examples/stringlist_type/example_stringlist_type_get.f90!} ``` @@ -211,7 +211,7 @@ The result is of type `integer`. #### Example ```fortran -{!test/example/stringlist_type/example_stringlist_type_len.f90!} +{!src/examples/stringlist_type/example_stringlist_type_len.f90!} ``` @@ -241,7 +241,7 @@ No arguments. #### Example ```fortran -{!test/example/stringlist_type/example_stringlist_type_clear.f90!} +{!src/examples/stringlist_type/example_stringlist_type_clear.f90!} ``` @@ -283,7 +283,7 @@ The result is a default `logical` scalar value. #### Example ```fortran -{!test/example/stringlist_type/example_stringlist_type_equality_operator.f90!} +{!src/examples/stringlist_type/example_stringlist_type_equality_operator.f90!} ``` @@ -325,7 +325,7 @@ The result is a default `logical` scalar value. #### Example ```fortran -{!test/example/stringlist_type/example_stringlist_type_inequality_operator.f90!} +{!src/examples/stringlist_type/example_stringlist_type_inequality_operator.f90!} ``` @@ -365,5 +365,5 @@ The result is an instance of `[[stdlib_stringlist_type(module):stringlist_type(t #### Example ```fortran -{!test/example/stringlist_type/example_stringlist_type_concatenate_operator.f90!} +{!src/examples/stringlist_type/example_stringlist_type_concatenate_operator.f90!} ``` diff --git a/doc/specs/stdlib_strings.md b/doc/specs/stdlib_strings.md index 16e135850..e5af3bd1a 100644 --- a/doc/specs/stdlib_strings.md +++ b/doc/specs/stdlib_strings.md @@ -45,7 +45,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/example/strings/example_strip.f90!} +{!src/examples/strings/example_strip.f90!} ``` @@ -84,7 +84,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/example/strings/example_chomp.f90!} +{!src/examples/strings/example_chomp.f90!} ``` @@ -121,7 +121,7 @@ The result is of scalar logical type. #### Example ```fortran -{!test/example/strings/example_starts_with.f90!} +{!src/examples/strings/example_starts_with.f90!} ``` @@ -158,7 +158,7 @@ The result is of scalar logical type. #### Example ```fortran -{!test/example/strings/example_ends_with.f90!} +{!src/examples/strings/example_ends_with.f90!} ``` @@ -213,7 +213,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/example/strings/example_slice.f90!} +{!src/examples/strings/example_slice.f90!} ``` @@ -258,7 +258,7 @@ The result is a scalar of integer type or an integer array of rank equal to the #### Example ```fortran -{!test/example/strings/example_find.f90!} +{!src/examples/strings/example_find.f90!} ``` @@ -298,7 +298,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/example/strings/example_replace_all.f90!} +{!src/examples/strings/example_replace_all.f90!} ``` @@ -338,7 +338,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/example/strings/example_padl.f90!} +{!src/examples/strings/example_padl.f90!} ``` @@ -378,7 +378,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!test/example/strings/example_padr.f90!} +{!src/examples/strings/example_padr.f90!} ``` @@ -418,7 +418,7 @@ The result is a scalar of integer type or an integer array of rank equal to the #### Example ```fortran -{!test/example/strings/example_count.f90!} +{!src/examples/strings/example_count.f90!} ``` @@ -457,5 +457,5 @@ The result is an `allocatable` length `character` scalar with up to `128` cached #### Example ```fortran -{!test/example/strings/example_to_string.f90!} +{!src/examples/strings/example_to_string.f90!} ``` diff --git a/doc/specs/stdlib_version.md b/doc/specs/stdlib_version.md index 1cbf3d3df..25ede8a98 100644 --- a/doc/specs/stdlib_version.md +++ b/doc/specs/stdlib_version.md @@ -54,5 +54,5 @@ Pure subroutine. #### Example ```fortran -{!test/example/version/example_version.f90!} +{!src/examples/version/example_version.f90!} ``` diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b79d920e9..7cacd4d02 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -137,6 +137,7 @@ endif() if(BUILD_TESTING) enable_testing() add_subdirectory(tests) + add_subdirectory(examples) endif() install(TARGETS ${PROJECT_NAME} diff --git a/test/example/CMakeLists.txt b/src/examples/CMakeLists.txt similarity index 100% rename from test/example/CMakeLists.txt rename to src/examples/CMakeLists.txt diff --git a/test/example/array/CMakeLists.txt b/src/examples/array/CMakeLists.txt similarity index 100% rename from test/example/array/CMakeLists.txt rename to src/examples/array/CMakeLists.txt diff --git a/test/example/array/example_falseloc.f90 b/src/examples/array/example_falseloc.f90 similarity index 100% rename from test/example/array/example_falseloc.f90 rename to src/examples/array/example_falseloc.f90 diff --git a/test/example/array/example_trueloc.f90 b/src/examples/array/example_trueloc.f90 similarity index 100% rename from test/example/array/example_trueloc.f90 rename to src/examples/array/example_trueloc.f90 diff --git a/test/example/ascii/CMakeLists.txt b/src/examples/ascii/CMakeLists.txt similarity index 100% rename from test/example/ascii/CMakeLists.txt rename to src/examples/ascii/CMakeLists.txt diff --git a/test/example/ascii/example_ascii_reverse.f90 b/src/examples/ascii/example_ascii_reverse.f90 similarity index 100% rename from test/example/ascii/example_ascii_reverse.f90 rename to src/examples/ascii/example_ascii_reverse.f90 diff --git a/test/example/ascii/example_ascii_to_lower.f90 b/src/examples/ascii/example_ascii_to_lower.f90 similarity index 100% rename from test/example/ascii/example_ascii_to_lower.f90 rename to src/examples/ascii/example_ascii_to_lower.f90 diff --git a/test/example/ascii/example_ascii_to_sentence.f90 b/src/examples/ascii/example_ascii_to_sentence.f90 similarity index 100% rename from test/example/ascii/example_ascii_to_sentence.f90 rename to src/examples/ascii/example_ascii_to_sentence.f90 diff --git a/test/example/ascii/example_ascii_to_title.f90 b/src/examples/ascii/example_ascii_to_title.f90 similarity index 100% rename from test/example/ascii/example_ascii_to_title.f90 rename to src/examples/ascii/example_ascii_to_title.f90 diff --git a/test/example/ascii/example_ascii_to_upper.f90 b/src/examples/ascii/example_ascii_to_upper.f90 similarity index 100% rename from test/example/ascii/example_ascii_to_upper.f90 rename to src/examples/ascii/example_ascii_to_upper.f90 diff --git a/test/example/bitsets/CMakeLists.txt b/src/examples/bitsets/CMakeLists.txt similarity index 100% rename from test/example/bitsets/CMakeLists.txt rename to src/examples/bitsets/CMakeLists.txt diff --git a/test/example/bitsets/example_bitsets_all.f90 b/src/examples/bitsets/example_bitsets_all.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_all.f90 rename to src/examples/bitsets/example_bitsets_all.f90 diff --git a/test/example/bitsets/example_bitsets_and.f90 b/src/examples/bitsets/example_bitsets_and.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_and.f90 rename to src/examples/bitsets/example_bitsets_and.f90 diff --git a/test/example/bitsets/example_bitsets_and_not.f90 b/src/examples/bitsets/example_bitsets_and_not.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_and_not.f90 rename to src/examples/bitsets/example_bitsets_and_not.f90 diff --git a/test/example/bitsets/example_bitsets_any.f90 b/src/examples/bitsets/example_bitsets_any.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_any.f90 rename to src/examples/bitsets/example_bitsets_any.f90 diff --git a/test/example/bitsets/example_bitsets_assignment.f90 b/src/examples/bitsets/example_bitsets_assignment.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_assignment.f90 rename to src/examples/bitsets/example_bitsets_assignment.f90 diff --git a/test/example/bitsets/example_bitsets_bit_count.f90 b/src/examples/bitsets/example_bitsets_bit_count.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_bit_count.f90 rename to src/examples/bitsets/example_bitsets_bit_count.f90 diff --git a/test/example/bitsets/example_bitsets_bits.f90 b/src/examples/bitsets/example_bitsets_bits.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_bits.f90 rename to src/examples/bitsets/example_bitsets_bits.f90 diff --git a/test/example/bitsets/example_bitsets_clear.f90 b/src/examples/bitsets/example_bitsets_clear.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_clear.f90 rename to src/examples/bitsets/example_bitsets_clear.f90 diff --git a/test/example/bitsets/example_bitsets_equality.f90 b/src/examples/bitsets/example_bitsets_equality.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_equality.f90 rename to src/examples/bitsets/example_bitsets_equality.f90 diff --git a/test/example/bitsets/example_bitsets_extract.f90 b/src/examples/bitsets/example_bitsets_extract.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_extract.f90 rename to src/examples/bitsets/example_bitsets_extract.f90 diff --git a/test/example/bitsets/example_bitsets_flip.f90 b/src/examples/bitsets/example_bitsets_flip.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_flip.f90 rename to src/examples/bitsets/example_bitsets_flip.f90 diff --git a/test/example/bitsets/example_bitsets_from_string.f90 b/src/examples/bitsets/example_bitsets_from_string.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_from_string.f90 rename to src/examples/bitsets/example_bitsets_from_string.f90 diff --git a/test/example/bitsets/example_bitsets_ge.f90 b/src/examples/bitsets/example_bitsets_ge.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_ge.f90 rename to src/examples/bitsets/example_bitsets_ge.f90 diff --git a/test/example/bitsets/example_bitsets_gt.f90 b/src/examples/bitsets/example_bitsets_gt.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_gt.f90 rename to src/examples/bitsets/example_bitsets_gt.f90 diff --git a/test/example/bitsets/example_bitsets_inequality.f90 b/src/examples/bitsets/example_bitsets_inequality.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_inequality.f90 rename to src/examples/bitsets/example_bitsets_inequality.f90 diff --git a/test/example/bitsets/example_bitsets_init.f90 b/src/examples/bitsets/example_bitsets_init.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_init.f90 rename to src/examples/bitsets/example_bitsets_init.f90 diff --git a/test/example/bitsets/example_bitsets_input.f90 b/src/examples/bitsets/example_bitsets_input.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_input.f90 rename to src/examples/bitsets/example_bitsets_input.f90 diff --git a/test/example/bitsets/example_bitsets_le.f90 b/src/examples/bitsets/example_bitsets_le.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_le.f90 rename to src/examples/bitsets/example_bitsets_le.f90 diff --git a/test/example/bitsets/example_bitsets_lt.f90 b/src/examples/bitsets/example_bitsets_lt.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_lt.f90 rename to src/examples/bitsets/example_bitsets_lt.f90 diff --git a/test/example/bitsets/example_bitsets_none.f90 b/src/examples/bitsets/example_bitsets_none.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_none.f90 rename to src/examples/bitsets/example_bitsets_none.f90 diff --git a/test/example/bitsets/example_bitsets_not.f90 b/src/examples/bitsets/example_bitsets_not.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_not.f90 rename to src/examples/bitsets/example_bitsets_not.f90 diff --git a/test/example/bitsets/example_bitsets_or.f90 b/src/examples/bitsets/example_bitsets_or.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_or.f90 rename to src/examples/bitsets/example_bitsets_or.f90 diff --git a/test/example/bitsets/example_bitsets_output.f90 b/src/examples/bitsets/example_bitsets_output.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_output.f90 rename to src/examples/bitsets/example_bitsets_output.f90 diff --git a/test/example/bitsets/example_bitsets_read_bitset.f90 b/src/examples/bitsets/example_bitsets_read_bitset.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_read_bitset.f90 rename to src/examples/bitsets/example_bitsets_read_bitset.f90 diff --git a/test/example/bitsets/example_bitsets_set.f90 b/src/examples/bitsets/example_bitsets_set.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_set.f90 rename to src/examples/bitsets/example_bitsets_set.f90 diff --git a/test/example/bitsets/example_bitsets_test.f90 b/src/examples/bitsets/example_bitsets_test.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_test.f90 rename to src/examples/bitsets/example_bitsets_test.f90 diff --git a/test/example/bitsets/example_bitsets_to_string.f90 b/src/examples/bitsets/example_bitsets_to_string.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_to_string.f90 rename to src/examples/bitsets/example_bitsets_to_string.f90 diff --git a/test/example/bitsets/example_bitsets_value.f90 b/src/examples/bitsets/example_bitsets_value.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_value.f90 rename to src/examples/bitsets/example_bitsets_value.f90 diff --git a/test/example/bitsets/example_bitsets_write_bitset.f90 b/src/examples/bitsets/example_bitsets_write_bitset.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_write_bitset.f90 rename to src/examples/bitsets/example_bitsets_write_bitset.f90 diff --git a/test/example/bitsets/example_bitsets_xor.f90 b/src/examples/bitsets/example_bitsets_xor.f90 similarity index 100% rename from test/example/bitsets/example_bitsets_xor.f90 rename to src/examples/bitsets/example_bitsets_xor.f90 diff --git a/test/example/error/CMakeLists.txt b/src/examples/error/CMakeLists.txt similarity index 100% rename from test/example/error/CMakeLists.txt rename to src/examples/error/CMakeLists.txt diff --git a/test/example/error/example_check1.f90 b/src/examples/error/example_check1.f90 similarity index 100% rename from test/example/error/example_check1.f90 rename to src/examples/error/example_check1.f90 diff --git a/test/example/error/example_check2.f90 b/src/examples/error/example_check2.f90 similarity index 100% rename from test/example/error/example_check2.f90 rename to src/examples/error/example_check2.f90 diff --git a/test/example/error/example_check3.f90 b/src/examples/error/example_check3.f90 similarity index 100% rename from test/example/error/example_check3.f90 rename to src/examples/error/example_check3.f90 diff --git a/test/example/error/example_check4.f90 b/src/examples/error/example_check4.f90 similarity index 100% rename from test/example/error/example_check4.f90 rename to src/examples/error/example_check4.f90 diff --git a/test/example/error/example_error_stop1.f90 b/src/examples/error/example_error_stop1.f90 similarity index 100% rename from test/example/error/example_error_stop1.f90 rename to src/examples/error/example_error_stop1.f90 diff --git a/test/example/error/example_error_stop2.f90 b/src/examples/error/example_error_stop2.f90 similarity index 100% rename from test/example/error/example_error_stop2.f90 rename to src/examples/error/example_error_stop2.f90 diff --git a/test/example/hash_procedures/CMakeLists.txt b/src/examples/hash_procedures/CMakeLists.txt similarity index 100% rename from test/example/hash_procedures/CMakeLists.txt rename to src/examples/hash_procedures/CMakeLists.txt diff --git a/test/example/hash_procedures/example_fibonacci_hash.f90 b/src/examples/hash_procedures/example_fibonacci_hash.f90 similarity index 100% rename from test/example/hash_procedures/example_fibonacci_hash.f90 rename to src/examples/hash_procedures/example_fibonacci_hash.f90 diff --git a/test/example/hash_procedures/example_fibonacci_hash_64.f90 b/src/examples/hash_procedures/example_fibonacci_hash_64.f90 similarity index 100% rename from test/example/hash_procedures/example_fibonacci_hash_64.f90 rename to src/examples/hash_procedures/example_fibonacci_hash_64.f90 diff --git a/test/example/hash_procedures/example_fnv_1_hash.f90 b/src/examples/hash_procedures/example_fnv_1_hash.f90 similarity index 100% rename from test/example/hash_procedures/example_fnv_1_hash.f90 rename to src/examples/hash_procedures/example_fnv_1_hash.f90 diff --git a/test/example/hash_procedures/example_fnv_1_hash_64.f90 b/src/examples/hash_procedures/example_fnv_1_hash_64.f90 similarity index 100% rename from test/example/hash_procedures/example_fnv_1_hash_64.f90 rename to src/examples/hash_procedures/example_fnv_1_hash_64.f90 diff --git a/test/example/hash_procedures/example_fnv_1a_hash.f90 b/src/examples/hash_procedures/example_fnv_1a_hash.f90 similarity index 100% rename from test/example/hash_procedures/example_fnv_1a_hash.f90 rename to src/examples/hash_procedures/example_fnv_1a_hash.f90 diff --git a/test/example/hash_procedures/example_fnv_1a_hash_64.f90 b/src/examples/hash_procedures/example_fnv_1a_hash_64.f90 similarity index 100% rename from test/example/hash_procedures/example_fnv_1a_hash_64.f90 rename to src/examples/hash_procedures/example_fnv_1a_hash_64.f90 diff --git a/test/example/hash_procedures/example_nmhash32.f90 b/src/examples/hash_procedures/example_nmhash32.f90 similarity index 100% rename from test/example/hash_procedures/example_nmhash32.f90 rename to src/examples/hash_procedures/example_nmhash32.f90 diff --git a/test/example/hash_procedures/example_nmhash32x.f90 b/src/examples/hash_procedures/example_nmhash32x.f90 similarity index 100% rename from test/example/hash_procedures/example_nmhash32x.f90 rename to src/examples/hash_procedures/example_nmhash32x.f90 diff --git a/test/example/hash_procedures/example_pengy_hash.f90 b/src/examples/hash_procedures/example_pengy_hash.f90 similarity index 100% rename from test/example/hash_procedures/example_pengy_hash.f90 rename to src/examples/hash_procedures/example_pengy_hash.f90 diff --git a/test/example/hash_procedures/example_spooky_hash.f90 b/src/examples/hash_procedures/example_spooky_hash.f90 similarity index 100% rename from test/example/hash_procedures/example_spooky_hash.f90 rename to src/examples/hash_procedures/example_spooky_hash.f90 diff --git a/test/example/hash_procedures/example_universal_mult_hash.f90 b/src/examples/hash_procedures/example_universal_mult_hash.f90 similarity index 100% rename from test/example/hash_procedures/example_universal_mult_hash.f90 rename to src/examples/hash_procedures/example_universal_mult_hash.f90 diff --git a/test/example/hash_procedures/example_universal_mult_hash_64.f90 b/src/examples/hash_procedures/example_universal_mult_hash_64.f90 similarity index 100% rename from test/example/hash_procedures/example_universal_mult_hash_64.f90 rename to src/examples/hash_procedures/example_universal_mult_hash_64.f90 diff --git a/test/example/hash_procedures/example_water_hash.f90 b/src/examples/hash_procedures/example_water_hash.f90 similarity index 100% rename from test/example/hash_procedures/example_water_hash.f90 rename to src/examples/hash_procedures/example_water_hash.f90 diff --git a/test/example/hashmaps/CMakeLists.txt b/src/examples/hashmaps/CMakeLists.txt similarity index 100% rename from test/example/hashmaps/CMakeLists.txt rename to src/examples/hashmaps/CMakeLists.txt diff --git a/test/example/hashmaps/example_hashmaps_calls.f90 b/src/examples/hashmaps/example_hashmaps_calls.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_calls.f90 rename to src/examples/hashmaps/example_hashmaps_calls.f90 diff --git a/test/example/hashmaps/example_hashmaps_copy_key.f90 b/src/examples/hashmaps/example_hashmaps_copy_key.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_copy_key.f90 rename to src/examples/hashmaps/example_hashmaps_copy_key.f90 diff --git a/test/example/hashmaps/example_hashmaps_copy_other.f90 b/src/examples/hashmaps/example_hashmaps_copy_other.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_copy_other.f90 rename to src/examples/hashmaps/example_hashmaps_copy_other.f90 diff --git a/test/example/hashmaps/example_hashmaps_entries.f90 b/src/examples/hashmaps/example_hashmaps_entries.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_entries.f90 rename to src/examples/hashmaps/example_hashmaps_entries.f90 diff --git a/test/example/hashmaps/example_hashmaps_equal_keys.f90 b/src/examples/hashmaps/example_hashmaps_equal_keys.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_equal_keys.f90 rename to src/examples/hashmaps/example_hashmaps_equal_keys.f90 diff --git a/test/example/hashmaps/example_hashmaps_fnv_1_hasher.f90 b/src/examples/hashmaps/example_hashmaps_fnv_1_hasher.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_fnv_1_hasher.f90 rename to src/examples/hashmaps/example_hashmaps_fnv_1_hasher.f90 diff --git a/test/example/hashmaps/example_hashmaps_fnv_1a_hasher.f90 b/src/examples/hashmaps/example_hashmaps_fnv_1a_hasher.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_fnv_1a_hasher.f90 rename to src/examples/hashmaps/example_hashmaps_fnv_1a_hasher.f90 diff --git a/test/example/hashmaps/example_hashmaps_free_key.f90 b/src/examples/hashmaps/example_hashmaps_free_key.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_free_key.f90 rename to src/examples/hashmaps/example_hashmaps_free_key.f90 diff --git a/test/example/hashmaps/example_hashmaps_free_other.f90 b/src/examples/hashmaps/example_hashmaps_free_other.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_free_other.f90 rename to src/examples/hashmaps/example_hashmaps_free_other.f90 diff --git a/test/example/hashmaps/example_hashmaps_get.f90 b/src/examples/hashmaps/example_hashmaps_get.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_get.f90 rename to src/examples/hashmaps/example_hashmaps_get.f90 diff --git a/test/example/hashmaps/example_hashmaps_get_other_data.f90 b/src/examples/hashmaps/example_hashmaps_get_other_data.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_get_other_data.f90 rename to src/examples/hashmaps/example_hashmaps_get_other_data.f90 diff --git a/test/example/hashmaps/example_hashmaps_hasher_fun.f90 b/src/examples/hashmaps/example_hashmaps_hasher_fun.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_hasher_fun.f90 rename to src/examples/hashmaps/example_hashmaps_hasher_fun.f90 diff --git a/test/example/hashmaps/example_hashmaps_init.f90 b/src/examples/hashmaps/example_hashmaps_init.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_init.f90 rename to src/examples/hashmaps/example_hashmaps_init.f90 diff --git a/test/example/hashmaps/example_hashmaps_key_test.f90 b/src/examples/hashmaps/example_hashmaps_key_test.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_key_test.f90 rename to src/examples/hashmaps/example_hashmaps_key_test.f90 diff --git a/test/example/hashmaps/example_hashmaps_loading.f90 b/src/examples/hashmaps/example_hashmaps_loading.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_loading.f90 rename to src/examples/hashmaps/example_hashmaps_loading.f90 diff --git a/test/example/hashmaps/example_hashmaps_map_entry.f90 b/src/examples/hashmaps/example_hashmaps_map_entry.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_map_entry.f90 rename to src/examples/hashmaps/example_hashmaps_map_entry.f90 diff --git a/test/example/hashmaps/example_hashmaps_num_slots.f90 b/src/examples/hashmaps/example_hashmaps_num_slots.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_num_slots.f90 rename to src/examples/hashmaps/example_hashmaps_num_slots.f90 diff --git a/test/example/hashmaps/example_hashmaps_probes.f90 b/src/examples/hashmaps/example_hashmaps_probes.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_probes.f90 rename to src/examples/hashmaps/example_hashmaps_probes.f90 diff --git a/test/example/hashmaps/example_hashmaps_rehash.f90 b/src/examples/hashmaps/example_hashmaps_rehash.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_rehash.f90 rename to src/examples/hashmaps/example_hashmaps_rehash.f90 diff --git a/test/example/hashmaps/example_hashmaps_remove.f90 b/src/examples/hashmaps/example_hashmaps_remove.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_remove.f90 rename to src/examples/hashmaps/example_hashmaps_remove.f90 diff --git a/test/example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 b/src/examples/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 rename to src/examples/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 diff --git a/test/example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 b/src/examples/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 rename to src/examples/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 diff --git a/test/example/hashmaps/example_hashmaps_seeded_water_hasher.f90 b/src/examples/hashmaps/example_hashmaps_seeded_water_hasher.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_seeded_water_hasher.f90 rename to src/examples/hashmaps/example_hashmaps_seeded_water_hasher.f90 diff --git a/test/example/hashmaps/example_hashmaps_set.f90 b/src/examples/hashmaps/example_hashmaps_set.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_set.f90 rename to src/examples/hashmaps/example_hashmaps_set.f90 diff --git a/test/example/hashmaps/example_hashmaps_set_other_data.f90 b/src/examples/hashmaps/example_hashmaps_set_other_data.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_set_other_data.f90 rename to src/examples/hashmaps/example_hashmaps_set_other_data.f90 diff --git a/test/example/hashmaps/example_hashmaps_slots_bits.f90 b/src/examples/hashmaps/example_hashmaps_slots_bits.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_slots_bits.f90 rename to src/examples/hashmaps/example_hashmaps_slots_bits.f90 diff --git a/test/example/hashmaps/example_hashmaps_total_depth.f90 b/src/examples/hashmaps/example_hashmaps_total_depth.f90 similarity index 100% rename from test/example/hashmaps/example_hashmaps_total_depth.f90 rename to src/examples/hashmaps/example_hashmaps_total_depth.f90 diff --git a/test/example/io/CMakeLists.txt b/src/examples/io/CMakeLists.txt similarity index 100% rename from test/example/io/CMakeLists.txt rename to src/examples/io/CMakeLists.txt diff --git a/test/example/io/example.dat b/src/examples/io/example.dat similarity index 100% rename from test/example/io/example.dat rename to src/examples/io/example.dat diff --git a/test/example/io/example.npy b/src/examples/io/example.npy similarity index 100% rename from test/example/io/example.npy rename to src/examples/io/example.npy diff --git a/test/example/io/example_fmt_constants.f90 b/src/examples/io/example_fmt_constants.f90 similarity index 100% rename from test/example/io/example_fmt_constants.f90 rename to src/examples/io/example_fmt_constants.f90 diff --git a/test/example/io/example_getline.f90 b/src/examples/io/example_getline.f90 similarity index 100% rename from test/example/io/example_getline.f90 rename to src/examples/io/example_getline.f90 diff --git a/test/example/io/example_loadnpy.f90 b/src/examples/io/example_loadnpy.f90 similarity index 100% rename from test/example/io/example_loadnpy.f90 rename to src/examples/io/example_loadnpy.f90 diff --git a/test/example/io/example_loadtxt.f90 b/src/examples/io/example_loadtxt.f90 similarity index 100% rename from test/example/io/example_loadtxt.f90 rename to src/examples/io/example_loadtxt.f90 diff --git a/test/example/io/example_open.f90 b/src/examples/io/example_open.f90 similarity index 100% rename from test/example/io/example_open.f90 rename to src/examples/io/example_open.f90 diff --git a/test/example/io/example_savenpy.f90 b/src/examples/io/example_savenpy.f90 similarity index 100% rename from test/example/io/example_savenpy.f90 rename to src/examples/io/example_savenpy.f90 diff --git a/test/example/io/example_savetxt.f90 b/src/examples/io/example_savetxt.f90 similarity index 100% rename from test/example/io/example_savetxt.f90 rename to src/examples/io/example_savetxt.f90 diff --git a/test/example/linalg/CMakeLists.txt b/src/examples/linalg/CMakeLists.txt similarity index 100% rename from test/example/linalg/CMakeLists.txt rename to src/examples/linalg/CMakeLists.txt diff --git a/test/example/linalg/example_diag1.f90 b/src/examples/linalg/example_diag1.f90 similarity index 100% rename from test/example/linalg/example_diag1.f90 rename to src/examples/linalg/example_diag1.f90 diff --git a/test/example/linalg/example_diag2.f90 b/src/examples/linalg/example_diag2.f90 similarity index 100% rename from test/example/linalg/example_diag2.f90 rename to src/examples/linalg/example_diag2.f90 diff --git a/test/example/linalg/example_diag3.f90 b/src/examples/linalg/example_diag3.f90 similarity index 100% rename from test/example/linalg/example_diag3.f90 rename to src/examples/linalg/example_diag3.f90 diff --git a/test/example/linalg/example_diag4.f90 b/src/examples/linalg/example_diag4.f90 similarity index 100% rename from test/example/linalg/example_diag4.f90 rename to src/examples/linalg/example_diag4.f90 diff --git a/test/example/linalg/example_diag5.f90 b/src/examples/linalg/example_diag5.f90 similarity index 100% rename from test/example/linalg/example_diag5.f90 rename to src/examples/linalg/example_diag5.f90 diff --git a/test/example/linalg/example_eye1.f90 b/src/examples/linalg/example_eye1.f90 similarity index 100% rename from test/example/linalg/example_eye1.f90 rename to src/examples/linalg/example_eye1.f90 diff --git a/test/example/linalg/example_eye2.f90 b/src/examples/linalg/example_eye2.f90 similarity index 100% rename from test/example/linalg/example_eye2.f90 rename to src/examples/linalg/example_eye2.f90 diff --git a/test/example/linalg/example_is_diagonal.f90 b/src/examples/linalg/example_is_diagonal.f90 similarity index 100% rename from test/example/linalg/example_is_diagonal.f90 rename to src/examples/linalg/example_is_diagonal.f90 diff --git a/test/example/linalg/example_is_hermitian.f90 b/src/examples/linalg/example_is_hermitian.f90 similarity index 100% rename from test/example/linalg/example_is_hermitian.f90 rename to src/examples/linalg/example_is_hermitian.f90 diff --git a/test/example/linalg/example_is_hessenberg.f90 b/src/examples/linalg/example_is_hessenberg.f90 similarity index 100% rename from test/example/linalg/example_is_hessenberg.f90 rename to src/examples/linalg/example_is_hessenberg.f90 diff --git a/test/example/linalg/example_is_skew_symmetric.f90 b/src/examples/linalg/example_is_skew_symmetric.f90 similarity index 100% rename from test/example/linalg/example_is_skew_symmetric.f90 rename to src/examples/linalg/example_is_skew_symmetric.f90 diff --git a/test/example/linalg/example_is_square.f90 b/src/examples/linalg/example_is_square.f90 similarity index 100% rename from test/example/linalg/example_is_square.f90 rename to src/examples/linalg/example_is_square.f90 diff --git a/test/example/linalg/example_is_symmetric.f90 b/src/examples/linalg/example_is_symmetric.f90 similarity index 100% rename from test/example/linalg/example_is_symmetric.f90 rename to src/examples/linalg/example_is_symmetric.f90 diff --git a/test/example/linalg/example_is_triangular.f90 b/src/examples/linalg/example_is_triangular.f90 similarity index 100% rename from test/example/linalg/example_is_triangular.f90 rename to src/examples/linalg/example_is_triangular.f90 diff --git a/test/example/linalg/example_outer_product.f90 b/src/examples/linalg/example_outer_product.f90 similarity index 100% rename from test/example/linalg/example_outer_product.f90 rename to src/examples/linalg/example_outer_product.f90 diff --git a/test/example/linalg/example_trace.f90 b/src/examples/linalg/example_trace.f90 similarity index 100% rename from test/example/linalg/example_trace.f90 rename to src/examples/linalg/example_trace.f90 diff --git a/test/example/logger/CMakeLists.txt b/src/examples/logger/CMakeLists.txt similarity index 100% rename from test/example/logger/CMakeLists.txt rename to src/examples/logger/CMakeLists.txt diff --git a/test/example/logger/example_add_log_unit.f90 b/src/examples/logger/example_add_log_unit.f90 similarity index 100% rename from test/example/logger/example_add_log_unit.f90 rename to src/examples/logger/example_add_log_unit.f90 diff --git a/test/example/logger/example_configure.f90 b/src/examples/logger/example_configure.f90 similarity index 100% rename from test/example/logger/example_configure.f90 rename to src/examples/logger/example_configure.f90 diff --git a/test/example/logger/example_global_logger.f90 b/src/examples/logger/example_global_logger.f90 similarity index 100% rename from test/example/logger/example_global_logger.f90 rename to src/examples/logger/example_global_logger.f90 diff --git a/test/example/logger/example_log_io_error.f90 b/src/examples/logger/example_log_io_error.f90 similarity index 100% rename from test/example/logger/example_log_io_error.f90 rename to src/examples/logger/example_log_io_error.f90 diff --git a/test/example/logger/example_log_text_error.f90 b/src/examples/logger/example_log_text_error.f90 similarity index 100% rename from test/example/logger/example_log_text_error.f90 rename to src/examples/logger/example_log_text_error.f90 diff --git a/test/example/math/CMakeLists.txt b/src/examples/math/CMakeLists.txt similarity index 100% rename from test/example/math/CMakeLists.txt rename to src/examples/math/CMakeLists.txt diff --git a/test/example/math/example_clip_integer.f90 b/src/examples/math/example_clip_integer.f90 similarity index 100% rename from test/example/math/example_clip_integer.f90 rename to src/examples/math/example_clip_integer.f90 diff --git a/test/example/math/example_clip_real.f90 b/src/examples/math/example_clip_real.f90 similarity index 100% rename from test/example/math/example_clip_real.f90 rename to src/examples/math/example_clip_real.f90 diff --git a/test/example/math/example_diff.f90 b/src/examples/math/example_diff.f90 similarity index 100% rename from test/example/math/example_diff.f90 rename to src/examples/math/example_diff.f90 diff --git a/test/example/math/example_gcd.f90 b/src/examples/math/example_gcd.f90 similarity index 100% rename from test/example/math/example_gcd.f90 rename to src/examples/math/example_gcd.f90 diff --git a/test/example/math/example_linspace_complex.f90 b/src/examples/math/example_linspace_complex.f90 similarity index 100% rename from test/example/math/example_linspace_complex.f90 rename to src/examples/math/example_linspace_complex.f90 diff --git a/test/example/math/example_linspace_int16.f90 b/src/examples/math/example_linspace_int16.f90 similarity index 100% rename from test/example/math/example_linspace_int16.f90 rename to src/examples/math/example_linspace_int16.f90 diff --git a/test/example/math/example_logspace_complex.f90 b/src/examples/math/example_logspace_complex.f90 similarity index 100% rename from test/example/math/example_logspace_complex.f90 rename to src/examples/math/example_logspace_complex.f90 diff --git a/test/example/math/example_logspace_int.f90 b/src/examples/math/example_logspace_int.f90 similarity index 100% rename from test/example/math/example_logspace_int.f90 rename to src/examples/math/example_logspace_int.f90 diff --git a/test/example/math/example_logspace_rstart_cbase.f90 b/src/examples/math/example_logspace_rstart_cbase.f90 similarity index 100% rename from test/example/math/example_logspace_rstart_cbase.f90 rename to src/examples/math/example_logspace_rstart_cbase.f90 diff --git a/test/example/math/example_math_all_close.f90 b/src/examples/math/example_math_all_close.f90 similarity index 100% rename from test/example/math/example_math_all_close.f90 rename to src/examples/math/example_math_all_close.f90 diff --git a/test/example/math/example_math_arange.f90 b/src/examples/math/example_math_arange.f90 similarity index 100% rename from test/example/math/example_math_arange.f90 rename to src/examples/math/example_math_arange.f90 diff --git a/test/example/math/example_math_arg.f90 b/src/examples/math/example_math_arg.f90 similarity index 100% rename from test/example/math/example_math_arg.f90 rename to src/examples/math/example_math_arg.f90 diff --git a/test/example/math/example_math_argd.f90 b/src/examples/math/example_math_argd.f90 similarity index 100% rename from test/example/math/example_math_argd.f90 rename to src/examples/math/example_math_argd.f90 diff --git a/test/example/math/example_math_argpi.f90 b/src/examples/math/example_math_argpi.f90 similarity index 100% rename from test/example/math/example_math_argpi.f90 rename to src/examples/math/example_math_argpi.f90 diff --git a/test/example/math/example_math_is_close.f90 b/src/examples/math/example_math_is_close.f90 similarity index 100% rename from test/example/math/example_math_is_close.f90 rename to src/examples/math/example_math_is_close.f90 diff --git a/test/example/optval/CMakeLists.txt b/src/examples/optval/CMakeLists.txt similarity index 100% rename from test/example/optval/CMakeLists.txt rename to src/examples/optval/CMakeLists.txt diff --git a/test/example/optval/example_optval.f90 b/src/examples/optval/example_optval.f90 similarity index 100% rename from test/example/optval/example_optval.f90 rename to src/examples/optval/example_optval.f90 diff --git a/test/example/quadrature/CMakeLists.txt b/src/examples/quadrature/CMakeLists.txt similarity index 100% rename from test/example/quadrature/CMakeLists.txt rename to src/examples/quadrature/CMakeLists.txt diff --git a/test/example/quadrature/example_gauss_legendre.f90 b/src/examples/quadrature/example_gauss_legendre.f90 similarity index 100% rename from test/example/quadrature/example_gauss_legendre.f90 rename to src/examples/quadrature/example_gauss_legendre.f90 diff --git a/test/example/quadrature/example_gauss_legendre_lobatto.f90 b/src/examples/quadrature/example_gauss_legendre_lobatto.f90 similarity index 100% rename from test/example/quadrature/example_gauss_legendre_lobatto.f90 rename to src/examples/quadrature/example_gauss_legendre_lobatto.f90 diff --git a/test/example/quadrature/example_simps.f90 b/src/examples/quadrature/example_simps.f90 similarity index 100% rename from test/example/quadrature/example_simps.f90 rename to src/examples/quadrature/example_simps.f90 diff --git a/test/example/quadrature/example_simps_weights.f90 b/src/examples/quadrature/example_simps_weights.f90 similarity index 100% rename from test/example/quadrature/example_simps_weights.f90 rename to src/examples/quadrature/example_simps_weights.f90 diff --git a/test/example/quadrature/example_trapz.f90 b/src/examples/quadrature/example_trapz.f90 similarity index 100% rename from test/example/quadrature/example_trapz.f90 rename to src/examples/quadrature/example_trapz.f90 diff --git a/test/example/quadrature/example_trapz_weights.f90 b/src/examples/quadrature/example_trapz_weights.f90 similarity index 100% rename from test/example/quadrature/example_trapz_weights.f90 rename to src/examples/quadrature/example_trapz_weights.f90 diff --git a/test/example/random/CMakeLists.txt b/src/examples/random/CMakeLists.txt similarity index 100% rename from test/example/random/CMakeLists.txt rename to src/examples/random/CMakeLists.txt diff --git a/test/example/random/example_dist_rand.f90 b/src/examples/random/example_dist_rand.f90 similarity index 100% rename from test/example/random/example_dist_rand.f90 rename to src/examples/random/example_dist_rand.f90 diff --git a/test/example/random/example_random_seed.f90 b/src/examples/random/example_random_seed.f90 similarity index 100% rename from test/example/random/example_random_seed.f90 rename to src/examples/random/example_random_seed.f90 diff --git a/test/example/selection/CMakeLists.txt b/src/examples/selection/CMakeLists.txt similarity index 100% rename from test/example/selection/CMakeLists.txt rename to src/examples/selection/CMakeLists.txt diff --git a/test/example/selection/example_arg_select.f90 b/src/examples/selection/example_arg_select.f90 similarity index 100% rename from test/example/selection/example_arg_select.f90 rename to src/examples/selection/example_arg_select.f90 diff --git a/test/example/selection/example_select.f90 b/src/examples/selection/example_select.f90 similarity index 100% rename from test/example/selection/example_select.f90 rename to src/examples/selection/example_select.f90 diff --git a/test/example/selection/selection_vs_sort.f90 b/src/examples/selection/selection_vs_sort.f90 similarity index 100% rename from test/example/selection/selection_vs_sort.f90 rename to src/examples/selection/selection_vs_sort.f90 diff --git a/test/example/sorting/CMakeLists.txt b/src/examples/sorting/CMakeLists.txt similarity index 100% rename from test/example/sorting/CMakeLists.txt rename to src/examples/sorting/CMakeLists.txt diff --git a/test/example/sorting/example_ord_sort.f90 b/src/examples/sorting/example_ord_sort.f90 similarity index 100% rename from test/example/sorting/example_ord_sort.f90 rename to src/examples/sorting/example_ord_sort.f90 diff --git a/test/example/sorting/example_sort.f90 b/src/examples/sorting/example_sort.f90 similarity index 100% rename from test/example/sorting/example_sort.f90 rename to src/examples/sorting/example_sort.f90 diff --git a/test/example/specialfunctions_gamma/CMakeLists.txt b/src/examples/specialfunctions_gamma/CMakeLists.txt similarity index 100% rename from test/example/specialfunctions_gamma/CMakeLists.txt rename to src/examples/specialfunctions_gamma/CMakeLists.txt diff --git a/test/example/specialfunctions_gamma/example_gamma.f90 b/src/examples/specialfunctions_gamma/example_gamma.f90 similarity index 100% rename from test/example/specialfunctions_gamma/example_gamma.f90 rename to src/examples/specialfunctions_gamma/example_gamma.f90 diff --git a/test/example/specialfunctions_gamma/example_gamma_p.f90 b/src/examples/specialfunctions_gamma/example_gamma_p.f90 similarity index 100% rename from test/example/specialfunctions_gamma/example_gamma_p.f90 rename to src/examples/specialfunctions_gamma/example_gamma_p.f90 diff --git a/test/example/specialfunctions_gamma/example_gamma_q.f90 b/src/examples/specialfunctions_gamma/example_gamma_q.f90 similarity index 100% rename from test/example/specialfunctions_gamma/example_gamma_q.f90 rename to src/examples/specialfunctions_gamma/example_gamma_q.f90 diff --git a/test/example/specialfunctions_gamma/example_ligamma.f90 b/src/examples/specialfunctions_gamma/example_ligamma.f90 similarity index 100% rename from test/example/specialfunctions_gamma/example_ligamma.f90 rename to src/examples/specialfunctions_gamma/example_ligamma.f90 diff --git a/test/example/specialfunctions_gamma/example_log_factorial.f90 b/src/examples/specialfunctions_gamma/example_log_factorial.f90 similarity index 100% rename from test/example/specialfunctions_gamma/example_log_factorial.f90 rename to src/examples/specialfunctions_gamma/example_log_factorial.f90 diff --git a/test/example/specialfunctions_gamma/example_log_gamma.f90 b/src/examples/specialfunctions_gamma/example_log_gamma.f90 similarity index 100% rename from test/example/specialfunctions_gamma/example_log_gamma.f90 rename to src/examples/specialfunctions_gamma/example_log_gamma.f90 diff --git a/test/example/specialfunctions_gamma/example_uigamma.f90 b/src/examples/specialfunctions_gamma/example_uigamma.f90 similarity index 100% rename from test/example/specialfunctions_gamma/example_uigamma.f90 rename to src/examples/specialfunctions_gamma/example_uigamma.f90 diff --git a/test/example/stats/CMakeLists.txt b/src/examples/stats/CMakeLists.txt similarity index 100% rename from test/example/stats/CMakeLists.txt rename to src/examples/stats/CMakeLists.txt diff --git a/test/example/stats/example_corr.f90 b/src/examples/stats/example_corr.f90 similarity index 100% rename from test/example/stats/example_corr.f90 rename to src/examples/stats/example_corr.f90 diff --git a/test/example/stats/example_cov.f90 b/src/examples/stats/example_cov.f90 similarity index 100% rename from test/example/stats/example_cov.f90 rename to src/examples/stats/example_cov.f90 diff --git a/test/example/stats/example_mean.f90 b/src/examples/stats/example_mean.f90 similarity index 100% rename from test/example/stats/example_mean.f90 rename to src/examples/stats/example_mean.f90 diff --git a/test/example/stats/example_median.f90 b/src/examples/stats/example_median.f90 similarity index 100% rename from test/example/stats/example_median.f90 rename to src/examples/stats/example_median.f90 diff --git a/test/example/stats/example_moment.f90 b/src/examples/stats/example_moment.f90 similarity index 100% rename from test/example/stats/example_moment.f90 rename to src/examples/stats/example_moment.f90 diff --git a/test/example/stats/example_var.f90 b/src/examples/stats/example_var.f90 similarity index 100% rename from test/example/stats/example_var.f90 rename to src/examples/stats/example_var.f90 diff --git a/test/example/stats_distribution_exponential/CMakeLists.txt b/src/examples/stats_distribution_exponential/CMakeLists.txt similarity index 100% rename from test/example/stats_distribution_exponential/CMakeLists.txt rename to src/examples/stats_distribution_exponential/CMakeLists.txt diff --git a/test/example/stats_distribution_exponential/example_exponential_cdf.f90 b/src/examples/stats_distribution_exponential/example_exponential_cdf.f90 similarity index 100% rename from test/example/stats_distribution_exponential/example_exponential_cdf.f90 rename to src/examples/stats_distribution_exponential/example_exponential_cdf.f90 diff --git a/test/example/stats_distribution_exponential/example_exponential_pdf.f90 b/src/examples/stats_distribution_exponential/example_exponential_pdf.f90 similarity index 100% rename from test/example/stats_distribution_exponential/example_exponential_pdf.f90 rename to src/examples/stats_distribution_exponential/example_exponential_pdf.f90 diff --git a/test/example/stats_distribution_exponential/example_exponential_rvs.f90 b/src/examples/stats_distribution_exponential/example_exponential_rvs.f90 similarity index 100% rename from test/example/stats_distribution_exponential/example_exponential_rvs.f90 rename to src/examples/stats_distribution_exponential/example_exponential_rvs.f90 diff --git a/test/example/stats_distribution_normal/CMakeLists.txt b/src/examples/stats_distribution_normal/CMakeLists.txt similarity index 100% rename from test/example/stats_distribution_normal/CMakeLists.txt rename to src/examples/stats_distribution_normal/CMakeLists.txt diff --git a/test/example/stats_distribution_normal/example_norm_cdf.f90 b/src/examples/stats_distribution_normal/example_norm_cdf.f90 similarity index 100% rename from test/example/stats_distribution_normal/example_norm_cdf.f90 rename to src/examples/stats_distribution_normal/example_norm_cdf.f90 diff --git a/test/example/stats_distribution_normal/example_normal_pdf.f90 b/src/examples/stats_distribution_normal/example_normal_pdf.f90 similarity index 100% rename from test/example/stats_distribution_normal/example_normal_pdf.f90 rename to src/examples/stats_distribution_normal/example_normal_pdf.f90 diff --git a/test/example/stats_distribution_normal/example_normal_rvs.f90 b/src/examples/stats_distribution_normal/example_normal_rvs.f90 similarity index 100% rename from test/example/stats_distribution_normal/example_normal_rvs.f90 rename to src/examples/stats_distribution_normal/example_normal_rvs.f90 diff --git a/test/example/stats_distribution_uniform/CMakeLists.txt b/src/examples/stats_distribution_uniform/CMakeLists.txt similarity index 100% rename from test/example/stats_distribution_uniform/CMakeLists.txt rename to src/examples/stats_distribution_uniform/CMakeLists.txt diff --git a/test/example/stats_distribution_uniform/example_shuffle.f90 b/src/examples/stats_distribution_uniform/example_shuffle.f90 similarity index 100% rename from test/example/stats_distribution_uniform/example_shuffle.f90 rename to src/examples/stats_distribution_uniform/example_shuffle.f90 diff --git a/test/example/stats_distribution_uniform/example_uniform_cdf.f90 b/src/examples/stats_distribution_uniform/example_uniform_cdf.f90 similarity index 100% rename from test/example/stats_distribution_uniform/example_uniform_cdf.f90 rename to src/examples/stats_distribution_uniform/example_uniform_cdf.f90 diff --git a/test/example/stats_distribution_uniform/example_uniform_pdf.f90 b/src/examples/stats_distribution_uniform/example_uniform_pdf.f90 similarity index 100% rename from test/example/stats_distribution_uniform/example_uniform_pdf.f90 rename to src/examples/stats_distribution_uniform/example_uniform_pdf.f90 diff --git a/test/example/stats_distribution_uniform/example_uniform_rvs.f90 b/src/examples/stats_distribution_uniform/example_uniform_rvs.f90 similarity index 100% rename from test/example/stats_distribution_uniform/example_uniform_rvs.f90 rename to src/examples/stats_distribution_uniform/example_uniform_rvs.f90 diff --git a/test/example/string_type/CMakeLists.txt b/src/examples/string_type/CMakeLists.txt similarity index 100% rename from test/example/string_type/CMakeLists.txt rename to src/examples/string_type/CMakeLists.txt diff --git a/test/example/string_type/example_adjustl.f90 b/src/examples/string_type/example_adjustl.f90 similarity index 100% rename from test/example/string_type/example_adjustl.f90 rename to src/examples/string_type/example_adjustl.f90 diff --git a/test/example/string_type/example_adjustr.f90 b/src/examples/string_type/example_adjustr.f90 similarity index 100% rename from test/example/string_type/example_adjustr.f90 rename to src/examples/string_type/example_adjustr.f90 diff --git a/test/example/string_type/example_char.f90 b/src/examples/string_type/example_char.f90 similarity index 100% rename from test/example/string_type/example_char.f90 rename to src/examples/string_type/example_char.f90 diff --git a/test/example/string_type/example_char_position.f90 b/src/examples/string_type/example_char_position.f90 similarity index 100% rename from test/example/string_type/example_char_position.f90 rename to src/examples/string_type/example_char_position.f90 diff --git a/test/example/string_type/example_char_range.f90 b/src/examples/string_type/example_char_range.f90 similarity index 100% rename from test/example/string_type/example_char_range.f90 rename to src/examples/string_type/example_char_range.f90 diff --git a/test/example/string_type/example_constructor_character.f90 b/src/examples/string_type/example_constructor_character.f90 similarity index 100% rename from test/example/string_type/example_constructor_character.f90 rename to src/examples/string_type/example_constructor_character.f90 diff --git a/test/example/string_type/example_constructor_empty.f90 b/src/examples/string_type/example_constructor_empty.f90 similarity index 100% rename from test/example/string_type/example_constructor_empty.f90 rename to src/examples/string_type/example_constructor_empty.f90 diff --git a/test/example/string_type/example_constructor_integer.f90 b/src/examples/string_type/example_constructor_integer.f90 similarity index 100% rename from test/example/string_type/example_constructor_integer.f90 rename to src/examples/string_type/example_constructor_integer.f90 diff --git a/test/example/string_type/example_constructor_logical.f90 b/src/examples/string_type/example_constructor_logical.f90 similarity index 100% rename from test/example/string_type/example_constructor_logical.f90 rename to src/examples/string_type/example_constructor_logical.f90 diff --git a/test/example/string_type/example_constructor_scalar.f90 b/src/examples/string_type/example_constructor_scalar.f90 similarity index 100% rename from test/example/string_type/example_constructor_scalar.f90 rename to src/examples/string_type/example_constructor_scalar.f90 diff --git a/test/example/string_type/example_cont.f90 b/src/examples/string_type/example_cont.f90 similarity index 100% rename from test/example/string_type/example_cont.f90 rename to src/examples/string_type/example_cont.f90 diff --git a/test/example/string_type/example_eq.f90 b/src/examples/string_type/example_eq.f90 similarity index 100% rename from test/example/string_type/example_eq.f90 rename to src/examples/string_type/example_eq.f90 diff --git a/test/example/string_type/example_fread.f90 b/src/examples/string_type/example_fread.f90 similarity index 100% rename from test/example/string_type/example_fread.f90 rename to src/examples/string_type/example_fread.f90 diff --git a/test/example/string_type/example_fwrite.f90 b/src/examples/string_type/example_fwrite.f90 similarity index 100% rename from test/example/string_type/example_fwrite.f90 rename to src/examples/string_type/example_fwrite.f90 diff --git a/test/example/string_type/example_ge.f90 b/src/examples/string_type/example_ge.f90 similarity index 100% rename from test/example/string_type/example_ge.f90 rename to src/examples/string_type/example_ge.f90 diff --git a/test/example/string_type/example_gt.f90 b/src/examples/string_type/example_gt.f90 similarity index 100% rename from test/example/string_type/example_gt.f90 rename to src/examples/string_type/example_gt.f90 diff --git a/test/example/string_type/example_iachar.f90 b/src/examples/string_type/example_iachar.f90 similarity index 100% rename from test/example/string_type/example_iachar.f90 rename to src/examples/string_type/example_iachar.f90 diff --git a/test/example/string_type/example_ichar.f90 b/src/examples/string_type/example_ichar.f90 similarity index 100% rename from test/example/string_type/example_ichar.f90 rename to src/examples/string_type/example_ichar.f90 diff --git a/test/example/string_type/example_index.f90 b/src/examples/string_type/example_index.f90 similarity index 100% rename from test/example/string_type/example_index.f90 rename to src/examples/string_type/example_index.f90 diff --git a/test/example/string_type/example_le.f90 b/src/examples/string_type/example_le.f90 similarity index 100% rename from test/example/string_type/example_le.f90 rename to src/examples/string_type/example_le.f90 diff --git a/test/example/string_type/example_len.f90 b/src/examples/string_type/example_len.f90 similarity index 100% rename from test/example/string_type/example_len.f90 rename to src/examples/string_type/example_len.f90 diff --git a/test/example/string_type/example_len_trim.f90 b/src/examples/string_type/example_len_trim.f90 similarity index 100% rename from test/example/string_type/example_len_trim.f90 rename to src/examples/string_type/example_len_trim.f90 diff --git a/test/example/string_type/example_lge.f90 b/src/examples/string_type/example_lge.f90 similarity index 100% rename from test/example/string_type/example_lge.f90 rename to src/examples/string_type/example_lge.f90 diff --git a/test/example/string_type/example_lgt.f90 b/src/examples/string_type/example_lgt.f90 similarity index 100% rename from test/example/string_type/example_lgt.f90 rename to src/examples/string_type/example_lgt.f90 diff --git a/test/example/string_type/example_lle.f90 b/src/examples/string_type/example_lle.f90 similarity index 100% rename from test/example/string_type/example_lle.f90 rename to src/examples/string_type/example_lle.f90 diff --git a/test/example/string_type/example_llt.f90 b/src/examples/string_type/example_llt.f90 similarity index 100% rename from test/example/string_type/example_llt.f90 rename to src/examples/string_type/example_llt.f90 diff --git a/test/example/string_type/example_lt.f90 b/src/examples/string_type/example_lt.f90 similarity index 100% rename from test/example/string_type/example_lt.f90 rename to src/examples/string_type/example_lt.f90 diff --git a/test/example/string_type/example_move.f90 b/src/examples/string_type/example_move.f90 similarity index 100% rename from test/example/string_type/example_move.f90 rename to src/examples/string_type/example_move.f90 diff --git a/test/example/string_type/example_ne.f90 b/src/examples/string_type/example_ne.f90 similarity index 100% rename from test/example/string_type/example_ne.f90 rename to src/examples/string_type/example_ne.f90 diff --git a/test/example/string_type/example_repeat.f90 b/src/examples/string_type/example_repeat.f90 similarity index 100% rename from test/example/string_type/example_repeat.f90 rename to src/examples/string_type/example_repeat.f90 diff --git a/test/example/string_type/example_reverse.f90 b/src/examples/string_type/example_reverse.f90 similarity index 100% rename from test/example/string_type/example_reverse.f90 rename to src/examples/string_type/example_reverse.f90 diff --git a/test/example/string_type/example_scan.f90 b/src/examples/string_type/example_scan.f90 similarity index 100% rename from test/example/string_type/example_scan.f90 rename to src/examples/string_type/example_scan.f90 diff --git a/test/example/string_type/example_to_lower.f90 b/src/examples/string_type/example_to_lower.f90 similarity index 100% rename from test/example/string_type/example_to_lower.f90 rename to src/examples/string_type/example_to_lower.f90 diff --git a/test/example/string_type/example_to_sentence.f90 b/src/examples/string_type/example_to_sentence.f90 similarity index 100% rename from test/example/string_type/example_to_sentence.f90 rename to src/examples/string_type/example_to_sentence.f90 diff --git a/test/example/string_type/example_to_title.f90 b/src/examples/string_type/example_to_title.f90 similarity index 100% rename from test/example/string_type/example_to_title.f90 rename to src/examples/string_type/example_to_title.f90 diff --git a/test/example/string_type/example_to_upper.f90 b/src/examples/string_type/example_to_upper.f90 similarity index 100% rename from test/example/string_type/example_to_upper.f90 rename to src/examples/string_type/example_to_upper.f90 diff --git a/test/example/string_type/example_trim.f90 b/src/examples/string_type/example_trim.f90 similarity index 100% rename from test/example/string_type/example_trim.f90 rename to src/examples/string_type/example_trim.f90 diff --git a/test/example/string_type/example_uread.f90 b/src/examples/string_type/example_uread.f90 similarity index 100% rename from test/example/string_type/example_uread.f90 rename to src/examples/string_type/example_uread.f90 diff --git a/test/example/string_type/example_uwrite.f90 b/src/examples/string_type/example_uwrite.f90 similarity index 100% rename from test/example/string_type/example_uwrite.f90 rename to src/examples/string_type/example_uwrite.f90 diff --git a/test/example/string_type/example_verify.f90 b/src/examples/string_type/example_verify.f90 similarity index 100% rename from test/example/string_type/example_verify.f90 rename to src/examples/string_type/example_verify.f90 diff --git a/test/example/stringlist_type/CMakeLists.txt b/src/examples/stringlist_type/CMakeLists.txt similarity index 100% rename from test/example/stringlist_type/CMakeLists.txt rename to src/examples/stringlist_type/CMakeLists.txt diff --git a/test/example/stringlist_type/example_stringlist_type_clear.f90 b/src/examples/stringlist_type/example_stringlist_type_clear.f90 similarity index 100% rename from test/example/stringlist_type/example_stringlist_type_clear.f90 rename to src/examples/stringlist_type/example_stringlist_type_clear.f90 diff --git a/test/example/stringlist_type/example_stringlist_type_concatenate_operator.f90 b/src/examples/stringlist_type/example_stringlist_type_concatenate_operator.f90 similarity index 100% rename from test/example/stringlist_type/example_stringlist_type_concatenate_operator.f90 rename to src/examples/stringlist_type/example_stringlist_type_concatenate_operator.f90 diff --git a/test/example/stringlist_type/example_stringlist_type_constructor.f90 b/src/examples/stringlist_type/example_stringlist_type_constructor.f90 similarity index 100% rename from test/example/stringlist_type/example_stringlist_type_constructor.f90 rename to src/examples/stringlist_type/example_stringlist_type_constructor.f90 diff --git a/test/example/stringlist_type/example_stringlist_type_equality_operator.f90 b/src/examples/stringlist_type/example_stringlist_type_equality_operator.f90 similarity index 100% rename from test/example/stringlist_type/example_stringlist_type_equality_operator.f90 rename to src/examples/stringlist_type/example_stringlist_type_equality_operator.f90 diff --git a/test/example/stringlist_type/example_stringlist_type_fidx_bidx.f90 b/src/examples/stringlist_type/example_stringlist_type_fidx_bidx.f90 similarity index 100% rename from test/example/stringlist_type/example_stringlist_type_fidx_bidx.f90 rename to src/examples/stringlist_type/example_stringlist_type_fidx_bidx.f90 diff --git a/test/example/stringlist_type/example_stringlist_type_get.f90 b/src/examples/stringlist_type/example_stringlist_type_get.f90 similarity index 100% rename from test/example/stringlist_type/example_stringlist_type_get.f90 rename to src/examples/stringlist_type/example_stringlist_type_get.f90 diff --git a/test/example/stringlist_type/example_stringlist_type_inequality_operator.f90 b/src/examples/stringlist_type/example_stringlist_type_inequality_operator.f90 similarity index 100% rename from test/example/stringlist_type/example_stringlist_type_inequality_operator.f90 rename to src/examples/stringlist_type/example_stringlist_type_inequality_operator.f90 diff --git a/test/example/stringlist_type/example_stringlist_type_insert_at.f90 b/src/examples/stringlist_type/example_stringlist_type_insert_at.f90 similarity index 100% rename from test/example/stringlist_type/example_stringlist_type_insert_at.f90 rename to src/examples/stringlist_type/example_stringlist_type_insert_at.f90 diff --git a/test/example/stringlist_type/example_stringlist_type_len.f90 b/src/examples/stringlist_type/example_stringlist_type_len.f90 similarity index 100% rename from test/example/stringlist_type/example_stringlist_type_len.f90 rename to src/examples/stringlist_type/example_stringlist_type_len.f90 diff --git a/test/example/strings/CMakeLists.txt b/src/examples/strings/CMakeLists.txt similarity index 100% rename from test/example/strings/CMakeLists.txt rename to src/examples/strings/CMakeLists.txt diff --git a/test/example/strings/example_chomp.f90 b/src/examples/strings/example_chomp.f90 similarity index 100% rename from test/example/strings/example_chomp.f90 rename to src/examples/strings/example_chomp.f90 diff --git a/test/example/strings/example_count.f90 b/src/examples/strings/example_count.f90 similarity index 100% rename from test/example/strings/example_count.f90 rename to src/examples/strings/example_count.f90 diff --git a/test/example/strings/example_ends_with.f90 b/src/examples/strings/example_ends_with.f90 similarity index 100% rename from test/example/strings/example_ends_with.f90 rename to src/examples/strings/example_ends_with.f90 diff --git a/test/example/strings/example_find.f90 b/src/examples/strings/example_find.f90 similarity index 100% rename from test/example/strings/example_find.f90 rename to src/examples/strings/example_find.f90 diff --git a/test/example/strings/example_padl.f90 b/src/examples/strings/example_padl.f90 similarity index 100% rename from test/example/strings/example_padl.f90 rename to src/examples/strings/example_padl.f90 diff --git a/test/example/strings/example_padr.f90 b/src/examples/strings/example_padr.f90 similarity index 100% rename from test/example/strings/example_padr.f90 rename to src/examples/strings/example_padr.f90 diff --git a/test/example/strings/example_replace_all.f90 b/src/examples/strings/example_replace_all.f90 similarity index 100% rename from test/example/strings/example_replace_all.f90 rename to src/examples/strings/example_replace_all.f90 diff --git a/test/example/strings/example_slice.f90 b/src/examples/strings/example_slice.f90 similarity index 100% rename from test/example/strings/example_slice.f90 rename to src/examples/strings/example_slice.f90 diff --git a/test/example/strings/example_starts_with.f90 b/src/examples/strings/example_starts_with.f90 similarity index 100% rename from test/example/strings/example_starts_with.f90 rename to src/examples/strings/example_starts_with.f90 diff --git a/test/example/strings/example_strip.f90 b/src/examples/strings/example_strip.f90 similarity index 100% rename from test/example/strings/example_strip.f90 rename to src/examples/strings/example_strip.f90 diff --git a/test/example/strings/example_to_string.f90 b/src/examples/strings/example_to_string.f90 similarity index 100% rename from test/example/strings/example_to_string.f90 rename to src/examples/strings/example_to_string.f90 diff --git a/test/example/version/CMakeLists.txt b/src/examples/version/CMakeLists.txt similarity index 100% rename from test/example/version/CMakeLists.txt rename to src/examples/version/CMakeLists.txt diff --git a/test/example/version/example_version.f90 b/src/examples/version/example_version.f90 similarity index 100% rename from test/example/version/example_version.f90 rename to src/examples/version/example_version.f90 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index a5c4dce3c..000000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(example) From e2f362de9a67c24b4f39e6ca6a7106fdbe4371ec Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Thu, 14 Jul 2022 19:52:46 +0200 Subject: [PATCH 28/38] fix ci/fpm-deployment.sh --- ci/fpm-deployment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/fpm-deployment.sh b/ci/fpm-deployment.sh index d87944dd6..3369e65f6 100644 --- a/ci/fpm-deployment.sh +++ b/ci/fpm-deployment.sh @@ -49,7 +49,7 @@ find src -maxdepth 1 -iname "*.fypp" \ find src -maxdepth 1 -iname "*.f90" -exec cp {} "$destdir/src/" \; find src/tests -name "test_*.f90" -exec cp {} "$destdir/test/" \; find src/tests -name "*.dat" -exec cp {} "$destdir/" \; -find test/example -name "example_*.f90" -exec cp {} "$destdir/example/" \; +find src/examples -name "example_*.f90" -exec cp {} "$destdir/example/" \; # Include additional files cp "${include[@]}" "$destdir/" From b607ef3c9758af24f223a179ba4e5ed59756830b Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Fri, 22 Jul 2022 17:01:35 +0200 Subject: [PATCH 29/38] Update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 117159df2..18512f66c 100644 --- a/README.md +++ b/README.md @@ -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/src/tests +``` + 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 From 6988336d4de03e7202d55fcf2bedd5d56d4bfe07 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Fri, 22 Jul 2022 19:45:52 +0200 Subject: [PATCH 30/38] fix log_text_error --- src/examples/logger/example_log_text_error.f90 | 2 +- src/examples/stats_distribution_normal/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/examples/logger/example_log_text_error.f90 b/src/examples/logger/example_log_text_error.f90 index 1adb11a6e..b94f231a9 100644 --- a/src/examples/logger/example_log_text_error.f90 +++ b/src/examples/logger/example_log_text_error.f90 @@ -30,7 +30,7 @@ subroutine check_line(line, status, col_no) ! scan the line for forbidden characters col_no = scan(line, ".$/") ! col_no > 0 means there is a forbidden character - status = col_no > 0 + status = col_no end subroutine end program example_log_text_error diff --git a/src/examples/stats_distribution_normal/CMakeLists.txt b/src/examples/stats_distribution_normal/CMakeLists.txt index e42bf2867..955f00ee1 100644 --- a/src/examples/stats_distribution_normal/CMakeLists.txt +++ b/src/examples/stats_distribution_normal/CMakeLists.txt @@ -1,3 +1,3 @@ ADD_EXAMPLE(normal_pdf) -#ADD_EXAMPLE(normal_rvs) +ADD_EXAMPLE(normal_rvs) ADD_EXAMPLE(norm_cdf) From d6444821aca00845cfa612a3c885df3535a9fb2e Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Fri, 22 Jul 2022 19:46:32 +0200 Subject: [PATCH 31/38] add log_text_error in CMakeLists.txt --- src/examples/logger/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/examples/logger/CMakeLists.txt b/src/examples/logger/CMakeLists.txt index 82c8f0650..ecccf6eab 100644 --- a/src/examples/logger/CMakeLists.txt +++ b/src/examples/logger/CMakeLists.txt @@ -3,4 +3,5 @@ ADD_EXAMPLE(configure) ADD_EXAMPLE(global_logger) ADD_EXAMPLE(log_io_error) set_tests_properties(log_io_error PROPERTIES WILL_FAIL true) -#ADD_EXAMPLE(log_text_error) +ADD_EXAMPLE(log_text_error) +set_tests_properties(log_text_error PROPERTIES WILL_FAIL true) From 29a091e1f245aae72da42101e5fd8a610163ebfc Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Fri, 22 Jul 2022 20:30:50 +0200 Subject: [PATCH 32/38] add a dummy file for logger examples --- src/examples/logger/dummy.txt | 2 ++ src/examples/logger/example_log_io_error.f90 | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 src/examples/logger/dummy.txt diff --git a/src/examples/logger/dummy.txt b/src/examples/logger/dummy.txt new file mode 100644 index 000000000..bebb7bc86 --- /dev/null +++ b/src/examples/logger/dummy.txt @@ -0,0 +1,2 @@ +a word +it should fail with the presence of this .$/ diff --git a/src/examples/logger/example_log_io_error.f90 b/src/examples/logger/example_log_io_error.f90 index 09cfc6dcc..47389aa12 100644 --- a/src/examples/logger/example_log_io_error.f90 +++ b/src/examples/logger/example_log_io_error.f90 @@ -1,11 +1,11 @@ program example_log_io_error use stdlib_logger, global => global_logger - character(*), parameter :: filename = 'dummy.txt' + character(*), parameter :: filename = 'nodummy.txt' integer :: iostat, lun character(128) :: iomsg character(*), parameter :: message = & - 'Failure in opening "dummy.txt".' + 'Failure in opening "nodummy.txt".' open (newunit=lun, file=filename, form='formatted', & status='old', iostat=iostat, iomsg=iomsg) From 5fc1caab1af2f0497dccf21100c4086cbbddc405 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Mon, 25 Jul 2022 16:45:07 +0200 Subject: [PATCH 33/38] add instructions to run the examples with fpm --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 18512f66c..af54da6a8 100644 --- a/README.md +++ b/README.md @@ -184,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] From a647c5d22d8d24485c549cdde0cb21133129aa9b Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Sun, 31 Jul 2022 21:41:06 +0200 Subject: [PATCH 34/38] mv src/examples to example --- {src/examples => example}/CMakeLists.txt | 0 {src/examples => example}/array/CMakeLists.txt | 0 .../examples => example}/array/example_falseloc.f90 | 0 {src/examples => example}/array/example_trueloc.f90 | 0 {src/examples => example}/ascii/CMakeLists.txt | 0 .../ascii/example_ascii_reverse.f90 | 0 .../ascii/example_ascii_to_lower.f90 | 0 .../ascii/example_ascii_to_sentence.f90 | 0 .../ascii/example_ascii_to_title.f90 | 0 .../ascii/example_ascii_to_upper.f90 | 0 {src/examples => example}/bitsets/CMakeLists.txt | 0 .../bitsets/example_bitsets_all.f90 | 0 .../bitsets/example_bitsets_and.f90 | 0 .../bitsets/example_bitsets_and_not.f90 | 0 .../bitsets/example_bitsets_any.f90 | 0 .../bitsets/example_bitsets_assignment.f90 | 0 .../bitsets/example_bitsets_bit_count.f90 | 0 .../bitsets/example_bitsets_bits.f90 | 0 .../bitsets/example_bitsets_clear.f90 | 0 .../bitsets/example_bitsets_equality.f90 | 0 .../bitsets/example_bitsets_extract.f90 | 0 .../bitsets/example_bitsets_flip.f90 | 0 .../bitsets/example_bitsets_from_string.f90 | 0 .../bitsets/example_bitsets_ge.f90 | 0 .../bitsets/example_bitsets_gt.f90 | 0 .../bitsets/example_bitsets_inequality.f90 | 0 .../bitsets/example_bitsets_init.f90 | 0 .../bitsets/example_bitsets_input.f90 | 0 .../bitsets/example_bitsets_le.f90 | 0 .../bitsets/example_bitsets_lt.f90 | 0 .../bitsets/example_bitsets_none.f90 | 0 .../bitsets/example_bitsets_not.f90 | 0 .../bitsets/example_bitsets_or.f90 | 0 .../bitsets/example_bitsets_output.f90 | 0 .../bitsets/example_bitsets_read_bitset.f90 | 0 .../bitsets/example_bitsets_set.f90 | 0 .../bitsets/example_bitsets_test.f90 | 0 .../bitsets/example_bitsets_to_string.f90 | 0 .../bitsets/example_bitsets_value.f90 | 0 .../bitsets/example_bitsets_write_bitset.f90 | 0 .../bitsets/example_bitsets_xor.f90 | 0 {src/examples => example}/error/CMakeLists.txt | 0 {src/examples => example}/error/example_check1.f90 | 0 {src/examples => example}/error/example_check2.f90 | 0 {src/examples => example}/error/example_check3.f90 | 0 {src/examples => example}/error/example_check4.f90 | 0 .../error/example_error_stop1.f90 | 0 .../error/example_error_stop2.f90 | 0 .../hash_procedures/CMakeLists.txt | 0 .../hash_procedures/example_fibonacci_hash.f90 | 0 .../hash_procedures/example_fibonacci_hash_64.f90 | 0 .../hash_procedures/example_fnv_1_hash.f90 | 0 .../hash_procedures/example_fnv_1_hash_64.f90 | 0 .../hash_procedures/example_fnv_1a_hash.f90 | 0 .../hash_procedures/example_fnv_1a_hash_64.f90 | 0 .../hash_procedures/example_nmhash32.f90 | 0 .../hash_procedures/example_nmhash32x.f90 | 0 .../hash_procedures/example_pengy_hash.f90 | 0 .../hash_procedures/example_spooky_hash.f90 | 0 .../hash_procedures/example_universal_mult_hash.f90 | 0 .../example_universal_mult_hash_64.f90 | 0 .../hash_procedures/example_water_hash.f90 | 0 {src/examples => example}/hashmaps/CMakeLists.txt | 0 .../hashmaps/example_hashmaps_calls.f90 | 0 .../hashmaps/example_hashmaps_copy_key.f90 | 0 .../hashmaps/example_hashmaps_copy_other.f90 | 0 .../hashmaps/example_hashmaps_entries.f90 | 0 .../hashmaps/example_hashmaps_equal_keys.f90 | 0 .../hashmaps/example_hashmaps_fnv_1_hasher.f90 | 0 .../hashmaps/example_hashmaps_fnv_1a_hasher.f90 | 0 .../hashmaps/example_hashmaps_free_key.f90 | 0 .../hashmaps/example_hashmaps_free_other.f90 | 0 .../hashmaps/example_hashmaps_get.f90 | 0 .../hashmaps/example_hashmaps_get_other_data.f90 | 0 .../hashmaps/example_hashmaps_hasher_fun.f90 | 0 .../hashmaps/example_hashmaps_init.f90 | 0 .../hashmaps/example_hashmaps_key_test.f90 | 0 .../hashmaps/example_hashmaps_loading.f90 | 0 .../hashmaps/example_hashmaps_map_entry.f90 | 0 .../hashmaps/example_hashmaps_num_slots.f90 | 0 .../hashmaps/example_hashmaps_probes.f90 | 0 .../hashmaps/example_hashmaps_rehash.f90 | 0 .../hashmaps/example_hashmaps_remove.f90 | 0 .../example_hashmaps_seeded_nmhash32_hasher.f90 | 0 .../example_hashmaps_seeded_nmhash32x_hasher.f90 | 0 .../example_hashmaps_seeded_water_hasher.f90 | 0 .../hashmaps/example_hashmaps_set.f90 | 0 .../hashmaps/example_hashmaps_set_other_data.f90 | 0 .../hashmaps/example_hashmaps_slots_bits.f90 | 0 .../hashmaps/example_hashmaps_total_depth.f90 | 0 {src/examples => example}/io/CMakeLists.txt | 0 {src/examples => example}/io/example.dat | 0 {src/examples => example}/io/example.npy | Bin .../io/example_fmt_constants.f90 | 0 {src/examples => example}/io/example_getline.f90 | 0 {src/examples => example}/io/example_loadnpy.f90 | 0 {src/examples => example}/io/example_loadtxt.f90 | 0 {src/examples => example}/io/example_open.f90 | 0 {src/examples => example}/io/example_savenpy.f90 | 0 {src/examples => example}/io/example_savetxt.f90 | 0 {src/examples => example}/linalg/CMakeLists.txt | 0 {src/examples => example}/linalg/example_diag1.f90 | 0 {src/examples => example}/linalg/example_diag2.f90 | 0 {src/examples => example}/linalg/example_diag3.f90 | 0 {src/examples => example}/linalg/example_diag4.f90 | 0 {src/examples => example}/linalg/example_diag5.f90 | 0 {src/examples => example}/linalg/example_eye1.f90 | 0 {src/examples => example}/linalg/example_eye2.f90 | 0 .../linalg/example_is_diagonal.f90 | 0 .../linalg/example_is_hermitian.f90 | 0 .../linalg/example_is_hessenberg.f90 | 0 .../linalg/example_is_skew_symmetric.f90 | 0 .../linalg/example_is_square.f90 | 0 .../linalg/example_is_symmetric.f90 | 0 .../linalg/example_is_triangular.f90 | 0 .../linalg/example_outer_product.f90 | 0 {src/examples => example}/linalg/example_trace.f90 | 0 {src/examples => example}/logger/CMakeLists.txt | 0 {src/examples => example}/logger/dummy.txt | 0 .../logger/example_add_log_unit.f90 | 0 .../logger/example_configure.f90 | 0 .../logger/example_global_logger.f90 | 0 .../logger/example_log_io_error.f90 | 0 .../logger/example_log_text_error.f90 | 0 {src/examples => example}/math/CMakeLists.txt | 0 .../math/example_clip_integer.f90 | 0 .../examples => example}/math/example_clip_real.f90 | 0 {src/examples => example}/math/example_diff.f90 | 0 {src/examples => example}/math/example_gcd.f90 | 0 .../math/example_linspace_complex.f90 | 0 .../math/example_linspace_int16.f90 | 0 .../math/example_logspace_complex.f90 | 0 .../math/example_logspace_int.f90 | 0 .../math/example_logspace_rstart_cbase.f90 | 0 .../math/example_math_all_close.f90 | 0 .../math/example_math_arange.f90 | 0 {src/examples => example}/math/example_math_arg.f90 | 0 .../examples => example}/math/example_math_argd.f90 | 0 .../math/example_math_argpi.f90 | 0 .../math/example_math_is_close.f90 | 0 {src/examples => example}/optval/CMakeLists.txt | 0 {src/examples => example}/optval/example_optval.f90 | 0 {src/examples => example}/quadrature/CMakeLists.txt | 0 .../quadrature/example_gauss_legendre.f90 | 0 .../quadrature/example_gauss_legendre_lobatto.f90 | 0 .../quadrature/example_simps.f90 | 0 .../quadrature/example_simps_weights.f90 | 0 .../quadrature/example_trapz.f90 | 0 .../quadrature/example_trapz_weights.f90 | 0 {src/examples => example}/random/CMakeLists.txt | 0 .../random/example_dist_rand.f90 | 0 .../random/example_random_seed.f90 | 0 {src/examples => example}/selection/CMakeLists.txt | 0 .../selection/example_arg_select.f90 | 0 .../selection/example_select.f90 | 0 .../selection/selection_vs_sort.f90 | 0 {src/examples => example}/sorting/CMakeLists.txt | 0 .../sorting/example_ord_sort.f90 | 0 {src/examples => example}/sorting/example_sort.f90 | 0 .../specialfunctions_gamma/CMakeLists.txt | 0 .../specialfunctions_gamma/example_gamma.f90 | 0 .../specialfunctions_gamma/example_gamma_p.f90 | 0 .../specialfunctions_gamma/example_gamma_q.f90 | 0 .../specialfunctions_gamma/example_ligamma.f90 | 0 .../example_log_factorial.f90 | 0 .../specialfunctions_gamma/example_log_gamma.f90 | 0 .../specialfunctions_gamma/example_uigamma.f90 | 0 {src/examples => example}/stats/CMakeLists.txt | 0 {src/examples => example}/stats/example_corr.f90 | 0 {src/examples => example}/stats/example_cov.f90 | 0 {src/examples => example}/stats/example_mean.f90 | 0 {src/examples => example}/stats/example_median.f90 | 0 {src/examples => example}/stats/example_moment.f90 | 0 {src/examples => example}/stats/example_var.f90 | 0 .../stats_distribution_exponential/CMakeLists.txt | 0 .../example_exponential_cdf.f90 | 0 .../example_exponential_pdf.f90 | 0 .../example_exponential_rvs.f90 | 0 .../stats_distribution_normal/CMakeLists.txt | 0 .../stats_distribution_normal/example_norm_cdf.f90 | 0 .../example_normal_pdf.f90 | 0 .../example_normal_rvs.f90 | 0 .../stats_distribution_uniform/CMakeLists.txt | 0 .../stats_distribution_uniform/example_shuffle.f90 | 0 .../example_uniform_cdf.f90 | 0 .../example_uniform_pdf.f90 | 0 .../example_uniform_rvs.f90 | 0 .../examples => example}/string_type/CMakeLists.txt | 0 .../string_type/example_adjustl.f90 | 0 .../string_type/example_adjustr.f90 | 0 .../string_type/example_char.f90 | 0 .../string_type/example_char_position.f90 | 0 .../string_type/example_char_range.f90 | 0 .../string_type/example_constructor_character.f90 | 0 .../string_type/example_constructor_empty.f90 | 0 .../string_type/example_constructor_integer.f90 | 0 .../string_type/example_constructor_logical.f90 | 0 .../string_type/example_constructor_scalar.f90 | 0 .../string_type/example_cont.f90 | 0 .../examples => example}/string_type/example_eq.f90 | 0 .../string_type/example_fread.f90 | 0 .../string_type/example_fwrite.f90 | 0 .../examples => example}/string_type/example_ge.f90 | 0 .../examples => example}/string_type/example_gt.f90 | 0 .../string_type/example_iachar.f90 | 0 .../string_type/example_ichar.f90 | 0 .../string_type/example_index.f90 | 0 .../examples => example}/string_type/example_le.f90 | 0 .../string_type/example_len.f90 | 0 .../string_type/example_len_trim.f90 | 0 .../string_type/example_lge.f90 | 0 .../string_type/example_lgt.f90 | 0 .../string_type/example_lle.f90 | 0 .../string_type/example_llt.f90 | 0 .../examples => example}/string_type/example_lt.f90 | 0 .../string_type/example_move.f90 | 0 .../examples => example}/string_type/example_ne.f90 | 0 .../string_type/example_repeat.f90 | 0 .../string_type/example_reverse.f90 | 0 .../string_type/example_scan.f90 | 0 .../string_type/example_to_lower.f90 | 0 .../string_type/example_to_sentence.f90 | 0 .../string_type/example_to_title.f90 | 0 .../string_type/example_to_upper.f90 | 0 .../string_type/example_trim.f90 | 0 .../string_type/example_uread.f90 | 0 .../string_type/example_uwrite.f90 | 0 .../string_type/example_verify.f90 | 0 .../stringlist_type/CMakeLists.txt | 0 .../example_stringlist_type_clear.f90 | 0 ...example_stringlist_type_concatenate_operator.f90 | 0 .../example_stringlist_type_constructor.f90 | 0 .../example_stringlist_type_equality_operator.f90 | 0 .../example_stringlist_type_fidx_bidx.f90 | 0 .../stringlist_type/example_stringlist_type_get.f90 | 0 .../example_stringlist_type_inequality_operator.f90 | 0 .../example_stringlist_type_insert_at.f90 | 0 .../stringlist_type/example_stringlist_type_len.f90 | 0 {src/examples => example}/strings/CMakeLists.txt | 0 {src/examples => example}/strings/example_chomp.f90 | 0 {src/examples => example}/strings/example_count.f90 | 0 .../strings/example_ends_with.f90 | 0 {src/examples => example}/strings/example_find.f90 | 0 {src/examples => example}/strings/example_padl.f90 | 0 {src/examples => example}/strings/example_padr.f90 | 0 .../strings/example_replace_all.f90 | 0 {src/examples => example}/strings/example_slice.f90 | 0 .../strings/example_starts_with.f90 | 0 {src/examples => example}/strings/example_strip.f90 | 0 .../strings/example_to_string.f90 | 0 {src/examples => example}/version/CMakeLists.txt | 0 .../version/example_version.f90 | 0 252 files changed, 0 insertions(+), 0 deletions(-) rename {src/examples => example}/CMakeLists.txt (100%) rename {src/examples => example}/array/CMakeLists.txt (100%) rename {src/examples => example}/array/example_falseloc.f90 (100%) rename {src/examples => example}/array/example_trueloc.f90 (100%) rename {src/examples => example}/ascii/CMakeLists.txt (100%) rename {src/examples => example}/ascii/example_ascii_reverse.f90 (100%) rename {src/examples => example}/ascii/example_ascii_to_lower.f90 (100%) rename {src/examples => example}/ascii/example_ascii_to_sentence.f90 (100%) rename {src/examples => example}/ascii/example_ascii_to_title.f90 (100%) rename {src/examples => example}/ascii/example_ascii_to_upper.f90 (100%) rename {src/examples => example}/bitsets/CMakeLists.txt (100%) rename {src/examples => example}/bitsets/example_bitsets_all.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_and.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_and_not.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_any.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_assignment.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_bit_count.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_bits.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_clear.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_equality.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_extract.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_flip.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_from_string.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_ge.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_gt.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_inequality.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_init.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_input.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_le.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_lt.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_none.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_not.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_or.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_output.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_read_bitset.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_set.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_test.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_to_string.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_value.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_write_bitset.f90 (100%) rename {src/examples => example}/bitsets/example_bitsets_xor.f90 (100%) rename {src/examples => example}/error/CMakeLists.txt (100%) rename {src/examples => example}/error/example_check1.f90 (100%) rename {src/examples => example}/error/example_check2.f90 (100%) rename {src/examples => example}/error/example_check3.f90 (100%) rename {src/examples => example}/error/example_check4.f90 (100%) rename {src/examples => example}/error/example_error_stop1.f90 (100%) rename {src/examples => example}/error/example_error_stop2.f90 (100%) rename {src/examples => example}/hash_procedures/CMakeLists.txt (100%) rename {src/examples => example}/hash_procedures/example_fibonacci_hash.f90 (100%) rename {src/examples => example}/hash_procedures/example_fibonacci_hash_64.f90 (100%) rename {src/examples => example}/hash_procedures/example_fnv_1_hash.f90 (100%) rename {src/examples => example}/hash_procedures/example_fnv_1_hash_64.f90 (100%) rename {src/examples => example}/hash_procedures/example_fnv_1a_hash.f90 (100%) rename {src/examples => example}/hash_procedures/example_fnv_1a_hash_64.f90 (100%) rename {src/examples => example}/hash_procedures/example_nmhash32.f90 (100%) rename {src/examples => example}/hash_procedures/example_nmhash32x.f90 (100%) rename {src/examples => example}/hash_procedures/example_pengy_hash.f90 (100%) rename {src/examples => example}/hash_procedures/example_spooky_hash.f90 (100%) rename {src/examples => example}/hash_procedures/example_universal_mult_hash.f90 (100%) rename {src/examples => example}/hash_procedures/example_universal_mult_hash_64.f90 (100%) rename {src/examples => example}/hash_procedures/example_water_hash.f90 (100%) rename {src/examples => example}/hashmaps/CMakeLists.txt (100%) rename {src/examples => example}/hashmaps/example_hashmaps_calls.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_copy_key.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_copy_other.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_entries.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_equal_keys.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_fnv_1_hasher.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_fnv_1a_hasher.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_free_key.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_free_other.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_get.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_get_other_data.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_hasher_fun.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_init.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_key_test.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_loading.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_map_entry.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_num_slots.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_probes.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_rehash.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_remove.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_seeded_water_hasher.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_set.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_set_other_data.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_slots_bits.f90 (100%) rename {src/examples => example}/hashmaps/example_hashmaps_total_depth.f90 (100%) rename {src/examples => example}/io/CMakeLists.txt (100%) rename {src/examples => example}/io/example.dat (100%) rename {src/examples => example}/io/example.npy (100%) rename {src/examples => example}/io/example_fmt_constants.f90 (100%) rename {src/examples => example}/io/example_getline.f90 (100%) rename {src/examples => example}/io/example_loadnpy.f90 (100%) rename {src/examples => example}/io/example_loadtxt.f90 (100%) rename {src/examples => example}/io/example_open.f90 (100%) rename {src/examples => example}/io/example_savenpy.f90 (100%) rename {src/examples => example}/io/example_savetxt.f90 (100%) rename {src/examples => example}/linalg/CMakeLists.txt (100%) rename {src/examples => example}/linalg/example_diag1.f90 (100%) rename {src/examples => example}/linalg/example_diag2.f90 (100%) rename {src/examples => example}/linalg/example_diag3.f90 (100%) rename {src/examples => example}/linalg/example_diag4.f90 (100%) rename {src/examples => example}/linalg/example_diag5.f90 (100%) rename {src/examples => example}/linalg/example_eye1.f90 (100%) rename {src/examples => example}/linalg/example_eye2.f90 (100%) rename {src/examples => example}/linalg/example_is_diagonal.f90 (100%) rename {src/examples => example}/linalg/example_is_hermitian.f90 (100%) rename {src/examples => example}/linalg/example_is_hessenberg.f90 (100%) rename {src/examples => example}/linalg/example_is_skew_symmetric.f90 (100%) rename {src/examples => example}/linalg/example_is_square.f90 (100%) rename {src/examples => example}/linalg/example_is_symmetric.f90 (100%) rename {src/examples => example}/linalg/example_is_triangular.f90 (100%) rename {src/examples => example}/linalg/example_outer_product.f90 (100%) rename {src/examples => example}/linalg/example_trace.f90 (100%) rename {src/examples => example}/logger/CMakeLists.txt (100%) rename {src/examples => example}/logger/dummy.txt (100%) rename {src/examples => example}/logger/example_add_log_unit.f90 (100%) rename {src/examples => example}/logger/example_configure.f90 (100%) rename {src/examples => example}/logger/example_global_logger.f90 (100%) rename {src/examples => example}/logger/example_log_io_error.f90 (100%) rename {src/examples => example}/logger/example_log_text_error.f90 (100%) rename {src/examples => example}/math/CMakeLists.txt (100%) rename {src/examples => example}/math/example_clip_integer.f90 (100%) rename {src/examples => example}/math/example_clip_real.f90 (100%) rename {src/examples => example}/math/example_diff.f90 (100%) rename {src/examples => example}/math/example_gcd.f90 (100%) rename {src/examples => example}/math/example_linspace_complex.f90 (100%) rename {src/examples => example}/math/example_linspace_int16.f90 (100%) rename {src/examples => example}/math/example_logspace_complex.f90 (100%) rename {src/examples => example}/math/example_logspace_int.f90 (100%) rename {src/examples => example}/math/example_logspace_rstart_cbase.f90 (100%) rename {src/examples => example}/math/example_math_all_close.f90 (100%) rename {src/examples => example}/math/example_math_arange.f90 (100%) rename {src/examples => example}/math/example_math_arg.f90 (100%) rename {src/examples => example}/math/example_math_argd.f90 (100%) rename {src/examples => example}/math/example_math_argpi.f90 (100%) rename {src/examples => example}/math/example_math_is_close.f90 (100%) rename {src/examples => example}/optval/CMakeLists.txt (100%) rename {src/examples => example}/optval/example_optval.f90 (100%) rename {src/examples => example}/quadrature/CMakeLists.txt (100%) rename {src/examples => example}/quadrature/example_gauss_legendre.f90 (100%) rename {src/examples => example}/quadrature/example_gauss_legendre_lobatto.f90 (100%) rename {src/examples => example}/quadrature/example_simps.f90 (100%) rename {src/examples => example}/quadrature/example_simps_weights.f90 (100%) rename {src/examples => example}/quadrature/example_trapz.f90 (100%) rename {src/examples => example}/quadrature/example_trapz_weights.f90 (100%) rename {src/examples => example}/random/CMakeLists.txt (100%) rename {src/examples => example}/random/example_dist_rand.f90 (100%) rename {src/examples => example}/random/example_random_seed.f90 (100%) rename {src/examples => example}/selection/CMakeLists.txt (100%) rename {src/examples => example}/selection/example_arg_select.f90 (100%) rename {src/examples => example}/selection/example_select.f90 (100%) rename {src/examples => example}/selection/selection_vs_sort.f90 (100%) rename {src/examples => example}/sorting/CMakeLists.txt (100%) rename {src/examples => example}/sorting/example_ord_sort.f90 (100%) rename {src/examples => example}/sorting/example_sort.f90 (100%) rename {src/examples => example}/specialfunctions_gamma/CMakeLists.txt (100%) rename {src/examples => example}/specialfunctions_gamma/example_gamma.f90 (100%) rename {src/examples => example}/specialfunctions_gamma/example_gamma_p.f90 (100%) rename {src/examples => example}/specialfunctions_gamma/example_gamma_q.f90 (100%) rename {src/examples => example}/specialfunctions_gamma/example_ligamma.f90 (100%) rename {src/examples => example}/specialfunctions_gamma/example_log_factorial.f90 (100%) rename {src/examples => example}/specialfunctions_gamma/example_log_gamma.f90 (100%) rename {src/examples => example}/specialfunctions_gamma/example_uigamma.f90 (100%) rename {src/examples => example}/stats/CMakeLists.txt (100%) rename {src/examples => example}/stats/example_corr.f90 (100%) rename {src/examples => example}/stats/example_cov.f90 (100%) rename {src/examples => example}/stats/example_mean.f90 (100%) rename {src/examples => example}/stats/example_median.f90 (100%) rename {src/examples => example}/stats/example_moment.f90 (100%) rename {src/examples => example}/stats/example_var.f90 (100%) rename {src/examples => example}/stats_distribution_exponential/CMakeLists.txt (100%) rename {src/examples => example}/stats_distribution_exponential/example_exponential_cdf.f90 (100%) rename {src/examples => example}/stats_distribution_exponential/example_exponential_pdf.f90 (100%) rename {src/examples => example}/stats_distribution_exponential/example_exponential_rvs.f90 (100%) rename {src/examples => example}/stats_distribution_normal/CMakeLists.txt (100%) rename {src/examples => example}/stats_distribution_normal/example_norm_cdf.f90 (100%) rename {src/examples => example}/stats_distribution_normal/example_normal_pdf.f90 (100%) rename {src/examples => example}/stats_distribution_normal/example_normal_rvs.f90 (100%) rename {src/examples => example}/stats_distribution_uniform/CMakeLists.txt (100%) rename {src/examples => example}/stats_distribution_uniform/example_shuffle.f90 (100%) rename {src/examples => example}/stats_distribution_uniform/example_uniform_cdf.f90 (100%) rename {src/examples => example}/stats_distribution_uniform/example_uniform_pdf.f90 (100%) rename {src/examples => example}/stats_distribution_uniform/example_uniform_rvs.f90 (100%) rename {src/examples => example}/string_type/CMakeLists.txt (100%) rename {src/examples => example}/string_type/example_adjustl.f90 (100%) rename {src/examples => example}/string_type/example_adjustr.f90 (100%) rename {src/examples => example}/string_type/example_char.f90 (100%) rename {src/examples => example}/string_type/example_char_position.f90 (100%) rename {src/examples => example}/string_type/example_char_range.f90 (100%) rename {src/examples => example}/string_type/example_constructor_character.f90 (100%) rename {src/examples => example}/string_type/example_constructor_empty.f90 (100%) rename {src/examples => example}/string_type/example_constructor_integer.f90 (100%) rename {src/examples => example}/string_type/example_constructor_logical.f90 (100%) rename {src/examples => example}/string_type/example_constructor_scalar.f90 (100%) rename {src/examples => example}/string_type/example_cont.f90 (100%) rename {src/examples => example}/string_type/example_eq.f90 (100%) rename {src/examples => example}/string_type/example_fread.f90 (100%) rename {src/examples => example}/string_type/example_fwrite.f90 (100%) rename {src/examples => example}/string_type/example_ge.f90 (100%) rename {src/examples => example}/string_type/example_gt.f90 (100%) rename {src/examples => example}/string_type/example_iachar.f90 (100%) rename {src/examples => example}/string_type/example_ichar.f90 (100%) rename {src/examples => example}/string_type/example_index.f90 (100%) rename {src/examples => example}/string_type/example_le.f90 (100%) rename {src/examples => example}/string_type/example_len.f90 (100%) rename {src/examples => example}/string_type/example_len_trim.f90 (100%) rename {src/examples => example}/string_type/example_lge.f90 (100%) rename {src/examples => example}/string_type/example_lgt.f90 (100%) rename {src/examples => example}/string_type/example_lle.f90 (100%) rename {src/examples => example}/string_type/example_llt.f90 (100%) rename {src/examples => example}/string_type/example_lt.f90 (100%) rename {src/examples => example}/string_type/example_move.f90 (100%) rename {src/examples => example}/string_type/example_ne.f90 (100%) rename {src/examples => example}/string_type/example_repeat.f90 (100%) rename {src/examples => example}/string_type/example_reverse.f90 (100%) rename {src/examples => example}/string_type/example_scan.f90 (100%) rename {src/examples => example}/string_type/example_to_lower.f90 (100%) rename {src/examples => example}/string_type/example_to_sentence.f90 (100%) rename {src/examples => example}/string_type/example_to_title.f90 (100%) rename {src/examples => example}/string_type/example_to_upper.f90 (100%) rename {src/examples => example}/string_type/example_trim.f90 (100%) rename {src/examples => example}/string_type/example_uread.f90 (100%) rename {src/examples => example}/string_type/example_uwrite.f90 (100%) rename {src/examples => example}/string_type/example_verify.f90 (100%) rename {src/examples => example}/stringlist_type/CMakeLists.txt (100%) rename {src/examples => example}/stringlist_type/example_stringlist_type_clear.f90 (100%) rename {src/examples => example}/stringlist_type/example_stringlist_type_concatenate_operator.f90 (100%) rename {src/examples => example}/stringlist_type/example_stringlist_type_constructor.f90 (100%) rename {src/examples => example}/stringlist_type/example_stringlist_type_equality_operator.f90 (100%) rename {src/examples => example}/stringlist_type/example_stringlist_type_fidx_bidx.f90 (100%) rename {src/examples => example}/stringlist_type/example_stringlist_type_get.f90 (100%) rename {src/examples => example}/stringlist_type/example_stringlist_type_inequality_operator.f90 (100%) rename {src/examples => example}/stringlist_type/example_stringlist_type_insert_at.f90 (100%) rename {src/examples => example}/stringlist_type/example_stringlist_type_len.f90 (100%) rename {src/examples => example}/strings/CMakeLists.txt (100%) rename {src/examples => example}/strings/example_chomp.f90 (100%) rename {src/examples => example}/strings/example_count.f90 (100%) rename {src/examples => example}/strings/example_ends_with.f90 (100%) rename {src/examples => example}/strings/example_find.f90 (100%) rename {src/examples => example}/strings/example_padl.f90 (100%) rename {src/examples => example}/strings/example_padr.f90 (100%) rename {src/examples => example}/strings/example_replace_all.f90 (100%) rename {src/examples => example}/strings/example_slice.f90 (100%) rename {src/examples => example}/strings/example_starts_with.f90 (100%) rename {src/examples => example}/strings/example_strip.f90 (100%) rename {src/examples => example}/strings/example_to_string.f90 (100%) rename {src/examples => example}/version/CMakeLists.txt (100%) rename {src/examples => example}/version/example_version.f90 (100%) diff --git a/src/examples/CMakeLists.txt b/example/CMakeLists.txt similarity index 100% rename from src/examples/CMakeLists.txt rename to example/CMakeLists.txt diff --git a/src/examples/array/CMakeLists.txt b/example/array/CMakeLists.txt similarity index 100% rename from src/examples/array/CMakeLists.txt rename to example/array/CMakeLists.txt diff --git a/src/examples/array/example_falseloc.f90 b/example/array/example_falseloc.f90 similarity index 100% rename from src/examples/array/example_falseloc.f90 rename to example/array/example_falseloc.f90 diff --git a/src/examples/array/example_trueloc.f90 b/example/array/example_trueloc.f90 similarity index 100% rename from src/examples/array/example_trueloc.f90 rename to example/array/example_trueloc.f90 diff --git a/src/examples/ascii/CMakeLists.txt b/example/ascii/CMakeLists.txt similarity index 100% rename from src/examples/ascii/CMakeLists.txt rename to example/ascii/CMakeLists.txt diff --git a/src/examples/ascii/example_ascii_reverse.f90 b/example/ascii/example_ascii_reverse.f90 similarity index 100% rename from src/examples/ascii/example_ascii_reverse.f90 rename to example/ascii/example_ascii_reverse.f90 diff --git a/src/examples/ascii/example_ascii_to_lower.f90 b/example/ascii/example_ascii_to_lower.f90 similarity index 100% rename from src/examples/ascii/example_ascii_to_lower.f90 rename to example/ascii/example_ascii_to_lower.f90 diff --git a/src/examples/ascii/example_ascii_to_sentence.f90 b/example/ascii/example_ascii_to_sentence.f90 similarity index 100% rename from src/examples/ascii/example_ascii_to_sentence.f90 rename to example/ascii/example_ascii_to_sentence.f90 diff --git a/src/examples/ascii/example_ascii_to_title.f90 b/example/ascii/example_ascii_to_title.f90 similarity index 100% rename from src/examples/ascii/example_ascii_to_title.f90 rename to example/ascii/example_ascii_to_title.f90 diff --git a/src/examples/ascii/example_ascii_to_upper.f90 b/example/ascii/example_ascii_to_upper.f90 similarity index 100% rename from src/examples/ascii/example_ascii_to_upper.f90 rename to example/ascii/example_ascii_to_upper.f90 diff --git a/src/examples/bitsets/CMakeLists.txt b/example/bitsets/CMakeLists.txt similarity index 100% rename from src/examples/bitsets/CMakeLists.txt rename to example/bitsets/CMakeLists.txt diff --git a/src/examples/bitsets/example_bitsets_all.f90 b/example/bitsets/example_bitsets_all.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_all.f90 rename to example/bitsets/example_bitsets_all.f90 diff --git a/src/examples/bitsets/example_bitsets_and.f90 b/example/bitsets/example_bitsets_and.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_and.f90 rename to example/bitsets/example_bitsets_and.f90 diff --git a/src/examples/bitsets/example_bitsets_and_not.f90 b/example/bitsets/example_bitsets_and_not.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_and_not.f90 rename to example/bitsets/example_bitsets_and_not.f90 diff --git a/src/examples/bitsets/example_bitsets_any.f90 b/example/bitsets/example_bitsets_any.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_any.f90 rename to example/bitsets/example_bitsets_any.f90 diff --git a/src/examples/bitsets/example_bitsets_assignment.f90 b/example/bitsets/example_bitsets_assignment.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_assignment.f90 rename to example/bitsets/example_bitsets_assignment.f90 diff --git a/src/examples/bitsets/example_bitsets_bit_count.f90 b/example/bitsets/example_bitsets_bit_count.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_bit_count.f90 rename to example/bitsets/example_bitsets_bit_count.f90 diff --git a/src/examples/bitsets/example_bitsets_bits.f90 b/example/bitsets/example_bitsets_bits.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_bits.f90 rename to example/bitsets/example_bitsets_bits.f90 diff --git a/src/examples/bitsets/example_bitsets_clear.f90 b/example/bitsets/example_bitsets_clear.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_clear.f90 rename to example/bitsets/example_bitsets_clear.f90 diff --git a/src/examples/bitsets/example_bitsets_equality.f90 b/example/bitsets/example_bitsets_equality.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_equality.f90 rename to example/bitsets/example_bitsets_equality.f90 diff --git a/src/examples/bitsets/example_bitsets_extract.f90 b/example/bitsets/example_bitsets_extract.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_extract.f90 rename to example/bitsets/example_bitsets_extract.f90 diff --git a/src/examples/bitsets/example_bitsets_flip.f90 b/example/bitsets/example_bitsets_flip.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_flip.f90 rename to example/bitsets/example_bitsets_flip.f90 diff --git a/src/examples/bitsets/example_bitsets_from_string.f90 b/example/bitsets/example_bitsets_from_string.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_from_string.f90 rename to example/bitsets/example_bitsets_from_string.f90 diff --git a/src/examples/bitsets/example_bitsets_ge.f90 b/example/bitsets/example_bitsets_ge.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_ge.f90 rename to example/bitsets/example_bitsets_ge.f90 diff --git a/src/examples/bitsets/example_bitsets_gt.f90 b/example/bitsets/example_bitsets_gt.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_gt.f90 rename to example/bitsets/example_bitsets_gt.f90 diff --git a/src/examples/bitsets/example_bitsets_inequality.f90 b/example/bitsets/example_bitsets_inequality.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_inequality.f90 rename to example/bitsets/example_bitsets_inequality.f90 diff --git a/src/examples/bitsets/example_bitsets_init.f90 b/example/bitsets/example_bitsets_init.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_init.f90 rename to example/bitsets/example_bitsets_init.f90 diff --git a/src/examples/bitsets/example_bitsets_input.f90 b/example/bitsets/example_bitsets_input.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_input.f90 rename to example/bitsets/example_bitsets_input.f90 diff --git a/src/examples/bitsets/example_bitsets_le.f90 b/example/bitsets/example_bitsets_le.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_le.f90 rename to example/bitsets/example_bitsets_le.f90 diff --git a/src/examples/bitsets/example_bitsets_lt.f90 b/example/bitsets/example_bitsets_lt.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_lt.f90 rename to example/bitsets/example_bitsets_lt.f90 diff --git a/src/examples/bitsets/example_bitsets_none.f90 b/example/bitsets/example_bitsets_none.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_none.f90 rename to example/bitsets/example_bitsets_none.f90 diff --git a/src/examples/bitsets/example_bitsets_not.f90 b/example/bitsets/example_bitsets_not.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_not.f90 rename to example/bitsets/example_bitsets_not.f90 diff --git a/src/examples/bitsets/example_bitsets_or.f90 b/example/bitsets/example_bitsets_or.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_or.f90 rename to example/bitsets/example_bitsets_or.f90 diff --git a/src/examples/bitsets/example_bitsets_output.f90 b/example/bitsets/example_bitsets_output.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_output.f90 rename to example/bitsets/example_bitsets_output.f90 diff --git a/src/examples/bitsets/example_bitsets_read_bitset.f90 b/example/bitsets/example_bitsets_read_bitset.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_read_bitset.f90 rename to example/bitsets/example_bitsets_read_bitset.f90 diff --git a/src/examples/bitsets/example_bitsets_set.f90 b/example/bitsets/example_bitsets_set.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_set.f90 rename to example/bitsets/example_bitsets_set.f90 diff --git a/src/examples/bitsets/example_bitsets_test.f90 b/example/bitsets/example_bitsets_test.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_test.f90 rename to example/bitsets/example_bitsets_test.f90 diff --git a/src/examples/bitsets/example_bitsets_to_string.f90 b/example/bitsets/example_bitsets_to_string.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_to_string.f90 rename to example/bitsets/example_bitsets_to_string.f90 diff --git a/src/examples/bitsets/example_bitsets_value.f90 b/example/bitsets/example_bitsets_value.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_value.f90 rename to example/bitsets/example_bitsets_value.f90 diff --git a/src/examples/bitsets/example_bitsets_write_bitset.f90 b/example/bitsets/example_bitsets_write_bitset.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_write_bitset.f90 rename to example/bitsets/example_bitsets_write_bitset.f90 diff --git a/src/examples/bitsets/example_bitsets_xor.f90 b/example/bitsets/example_bitsets_xor.f90 similarity index 100% rename from src/examples/bitsets/example_bitsets_xor.f90 rename to example/bitsets/example_bitsets_xor.f90 diff --git a/src/examples/error/CMakeLists.txt b/example/error/CMakeLists.txt similarity index 100% rename from src/examples/error/CMakeLists.txt rename to example/error/CMakeLists.txt diff --git a/src/examples/error/example_check1.f90 b/example/error/example_check1.f90 similarity index 100% rename from src/examples/error/example_check1.f90 rename to example/error/example_check1.f90 diff --git a/src/examples/error/example_check2.f90 b/example/error/example_check2.f90 similarity index 100% rename from src/examples/error/example_check2.f90 rename to example/error/example_check2.f90 diff --git a/src/examples/error/example_check3.f90 b/example/error/example_check3.f90 similarity index 100% rename from src/examples/error/example_check3.f90 rename to example/error/example_check3.f90 diff --git a/src/examples/error/example_check4.f90 b/example/error/example_check4.f90 similarity index 100% rename from src/examples/error/example_check4.f90 rename to example/error/example_check4.f90 diff --git a/src/examples/error/example_error_stop1.f90 b/example/error/example_error_stop1.f90 similarity index 100% rename from src/examples/error/example_error_stop1.f90 rename to example/error/example_error_stop1.f90 diff --git a/src/examples/error/example_error_stop2.f90 b/example/error/example_error_stop2.f90 similarity index 100% rename from src/examples/error/example_error_stop2.f90 rename to example/error/example_error_stop2.f90 diff --git a/src/examples/hash_procedures/CMakeLists.txt b/example/hash_procedures/CMakeLists.txt similarity index 100% rename from src/examples/hash_procedures/CMakeLists.txt rename to example/hash_procedures/CMakeLists.txt diff --git a/src/examples/hash_procedures/example_fibonacci_hash.f90 b/example/hash_procedures/example_fibonacci_hash.f90 similarity index 100% rename from src/examples/hash_procedures/example_fibonacci_hash.f90 rename to example/hash_procedures/example_fibonacci_hash.f90 diff --git a/src/examples/hash_procedures/example_fibonacci_hash_64.f90 b/example/hash_procedures/example_fibonacci_hash_64.f90 similarity index 100% rename from src/examples/hash_procedures/example_fibonacci_hash_64.f90 rename to example/hash_procedures/example_fibonacci_hash_64.f90 diff --git a/src/examples/hash_procedures/example_fnv_1_hash.f90 b/example/hash_procedures/example_fnv_1_hash.f90 similarity index 100% rename from src/examples/hash_procedures/example_fnv_1_hash.f90 rename to example/hash_procedures/example_fnv_1_hash.f90 diff --git a/src/examples/hash_procedures/example_fnv_1_hash_64.f90 b/example/hash_procedures/example_fnv_1_hash_64.f90 similarity index 100% rename from src/examples/hash_procedures/example_fnv_1_hash_64.f90 rename to example/hash_procedures/example_fnv_1_hash_64.f90 diff --git a/src/examples/hash_procedures/example_fnv_1a_hash.f90 b/example/hash_procedures/example_fnv_1a_hash.f90 similarity index 100% rename from src/examples/hash_procedures/example_fnv_1a_hash.f90 rename to example/hash_procedures/example_fnv_1a_hash.f90 diff --git a/src/examples/hash_procedures/example_fnv_1a_hash_64.f90 b/example/hash_procedures/example_fnv_1a_hash_64.f90 similarity index 100% rename from src/examples/hash_procedures/example_fnv_1a_hash_64.f90 rename to example/hash_procedures/example_fnv_1a_hash_64.f90 diff --git a/src/examples/hash_procedures/example_nmhash32.f90 b/example/hash_procedures/example_nmhash32.f90 similarity index 100% rename from src/examples/hash_procedures/example_nmhash32.f90 rename to example/hash_procedures/example_nmhash32.f90 diff --git a/src/examples/hash_procedures/example_nmhash32x.f90 b/example/hash_procedures/example_nmhash32x.f90 similarity index 100% rename from src/examples/hash_procedures/example_nmhash32x.f90 rename to example/hash_procedures/example_nmhash32x.f90 diff --git a/src/examples/hash_procedures/example_pengy_hash.f90 b/example/hash_procedures/example_pengy_hash.f90 similarity index 100% rename from src/examples/hash_procedures/example_pengy_hash.f90 rename to example/hash_procedures/example_pengy_hash.f90 diff --git a/src/examples/hash_procedures/example_spooky_hash.f90 b/example/hash_procedures/example_spooky_hash.f90 similarity index 100% rename from src/examples/hash_procedures/example_spooky_hash.f90 rename to example/hash_procedures/example_spooky_hash.f90 diff --git a/src/examples/hash_procedures/example_universal_mult_hash.f90 b/example/hash_procedures/example_universal_mult_hash.f90 similarity index 100% rename from src/examples/hash_procedures/example_universal_mult_hash.f90 rename to example/hash_procedures/example_universal_mult_hash.f90 diff --git a/src/examples/hash_procedures/example_universal_mult_hash_64.f90 b/example/hash_procedures/example_universal_mult_hash_64.f90 similarity index 100% rename from src/examples/hash_procedures/example_universal_mult_hash_64.f90 rename to example/hash_procedures/example_universal_mult_hash_64.f90 diff --git a/src/examples/hash_procedures/example_water_hash.f90 b/example/hash_procedures/example_water_hash.f90 similarity index 100% rename from src/examples/hash_procedures/example_water_hash.f90 rename to example/hash_procedures/example_water_hash.f90 diff --git a/src/examples/hashmaps/CMakeLists.txt b/example/hashmaps/CMakeLists.txt similarity index 100% rename from src/examples/hashmaps/CMakeLists.txt rename to example/hashmaps/CMakeLists.txt diff --git a/src/examples/hashmaps/example_hashmaps_calls.f90 b/example/hashmaps/example_hashmaps_calls.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_calls.f90 rename to example/hashmaps/example_hashmaps_calls.f90 diff --git a/src/examples/hashmaps/example_hashmaps_copy_key.f90 b/example/hashmaps/example_hashmaps_copy_key.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_copy_key.f90 rename to example/hashmaps/example_hashmaps_copy_key.f90 diff --git a/src/examples/hashmaps/example_hashmaps_copy_other.f90 b/example/hashmaps/example_hashmaps_copy_other.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_copy_other.f90 rename to example/hashmaps/example_hashmaps_copy_other.f90 diff --git a/src/examples/hashmaps/example_hashmaps_entries.f90 b/example/hashmaps/example_hashmaps_entries.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_entries.f90 rename to example/hashmaps/example_hashmaps_entries.f90 diff --git a/src/examples/hashmaps/example_hashmaps_equal_keys.f90 b/example/hashmaps/example_hashmaps_equal_keys.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_equal_keys.f90 rename to example/hashmaps/example_hashmaps_equal_keys.f90 diff --git a/src/examples/hashmaps/example_hashmaps_fnv_1_hasher.f90 b/example/hashmaps/example_hashmaps_fnv_1_hasher.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_fnv_1_hasher.f90 rename to example/hashmaps/example_hashmaps_fnv_1_hasher.f90 diff --git a/src/examples/hashmaps/example_hashmaps_fnv_1a_hasher.f90 b/example/hashmaps/example_hashmaps_fnv_1a_hasher.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_fnv_1a_hasher.f90 rename to example/hashmaps/example_hashmaps_fnv_1a_hasher.f90 diff --git a/src/examples/hashmaps/example_hashmaps_free_key.f90 b/example/hashmaps/example_hashmaps_free_key.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_free_key.f90 rename to example/hashmaps/example_hashmaps_free_key.f90 diff --git a/src/examples/hashmaps/example_hashmaps_free_other.f90 b/example/hashmaps/example_hashmaps_free_other.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_free_other.f90 rename to example/hashmaps/example_hashmaps_free_other.f90 diff --git a/src/examples/hashmaps/example_hashmaps_get.f90 b/example/hashmaps/example_hashmaps_get.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_get.f90 rename to example/hashmaps/example_hashmaps_get.f90 diff --git a/src/examples/hashmaps/example_hashmaps_get_other_data.f90 b/example/hashmaps/example_hashmaps_get_other_data.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_get_other_data.f90 rename to example/hashmaps/example_hashmaps_get_other_data.f90 diff --git a/src/examples/hashmaps/example_hashmaps_hasher_fun.f90 b/example/hashmaps/example_hashmaps_hasher_fun.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_hasher_fun.f90 rename to example/hashmaps/example_hashmaps_hasher_fun.f90 diff --git a/src/examples/hashmaps/example_hashmaps_init.f90 b/example/hashmaps/example_hashmaps_init.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_init.f90 rename to example/hashmaps/example_hashmaps_init.f90 diff --git a/src/examples/hashmaps/example_hashmaps_key_test.f90 b/example/hashmaps/example_hashmaps_key_test.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_key_test.f90 rename to example/hashmaps/example_hashmaps_key_test.f90 diff --git a/src/examples/hashmaps/example_hashmaps_loading.f90 b/example/hashmaps/example_hashmaps_loading.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_loading.f90 rename to example/hashmaps/example_hashmaps_loading.f90 diff --git a/src/examples/hashmaps/example_hashmaps_map_entry.f90 b/example/hashmaps/example_hashmaps_map_entry.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_map_entry.f90 rename to example/hashmaps/example_hashmaps_map_entry.f90 diff --git a/src/examples/hashmaps/example_hashmaps_num_slots.f90 b/example/hashmaps/example_hashmaps_num_slots.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_num_slots.f90 rename to example/hashmaps/example_hashmaps_num_slots.f90 diff --git a/src/examples/hashmaps/example_hashmaps_probes.f90 b/example/hashmaps/example_hashmaps_probes.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_probes.f90 rename to example/hashmaps/example_hashmaps_probes.f90 diff --git a/src/examples/hashmaps/example_hashmaps_rehash.f90 b/example/hashmaps/example_hashmaps_rehash.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_rehash.f90 rename to example/hashmaps/example_hashmaps_rehash.f90 diff --git a/src/examples/hashmaps/example_hashmaps_remove.f90 b/example/hashmaps/example_hashmaps_remove.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_remove.f90 rename to example/hashmaps/example_hashmaps_remove.f90 diff --git a/src/examples/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 b/example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 rename to example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90 diff --git a/src/examples/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 b/example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 rename to example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90 diff --git a/src/examples/hashmaps/example_hashmaps_seeded_water_hasher.f90 b/example/hashmaps/example_hashmaps_seeded_water_hasher.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_seeded_water_hasher.f90 rename to example/hashmaps/example_hashmaps_seeded_water_hasher.f90 diff --git a/src/examples/hashmaps/example_hashmaps_set.f90 b/example/hashmaps/example_hashmaps_set.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_set.f90 rename to example/hashmaps/example_hashmaps_set.f90 diff --git a/src/examples/hashmaps/example_hashmaps_set_other_data.f90 b/example/hashmaps/example_hashmaps_set_other_data.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_set_other_data.f90 rename to example/hashmaps/example_hashmaps_set_other_data.f90 diff --git a/src/examples/hashmaps/example_hashmaps_slots_bits.f90 b/example/hashmaps/example_hashmaps_slots_bits.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_slots_bits.f90 rename to example/hashmaps/example_hashmaps_slots_bits.f90 diff --git a/src/examples/hashmaps/example_hashmaps_total_depth.f90 b/example/hashmaps/example_hashmaps_total_depth.f90 similarity index 100% rename from src/examples/hashmaps/example_hashmaps_total_depth.f90 rename to example/hashmaps/example_hashmaps_total_depth.f90 diff --git a/src/examples/io/CMakeLists.txt b/example/io/CMakeLists.txt similarity index 100% rename from src/examples/io/CMakeLists.txt rename to example/io/CMakeLists.txt diff --git a/src/examples/io/example.dat b/example/io/example.dat similarity index 100% rename from src/examples/io/example.dat rename to example/io/example.dat diff --git a/src/examples/io/example.npy b/example/io/example.npy similarity index 100% rename from src/examples/io/example.npy rename to example/io/example.npy diff --git a/src/examples/io/example_fmt_constants.f90 b/example/io/example_fmt_constants.f90 similarity index 100% rename from src/examples/io/example_fmt_constants.f90 rename to example/io/example_fmt_constants.f90 diff --git a/src/examples/io/example_getline.f90 b/example/io/example_getline.f90 similarity index 100% rename from src/examples/io/example_getline.f90 rename to example/io/example_getline.f90 diff --git a/src/examples/io/example_loadnpy.f90 b/example/io/example_loadnpy.f90 similarity index 100% rename from src/examples/io/example_loadnpy.f90 rename to example/io/example_loadnpy.f90 diff --git a/src/examples/io/example_loadtxt.f90 b/example/io/example_loadtxt.f90 similarity index 100% rename from src/examples/io/example_loadtxt.f90 rename to example/io/example_loadtxt.f90 diff --git a/src/examples/io/example_open.f90 b/example/io/example_open.f90 similarity index 100% rename from src/examples/io/example_open.f90 rename to example/io/example_open.f90 diff --git a/src/examples/io/example_savenpy.f90 b/example/io/example_savenpy.f90 similarity index 100% rename from src/examples/io/example_savenpy.f90 rename to example/io/example_savenpy.f90 diff --git a/src/examples/io/example_savetxt.f90 b/example/io/example_savetxt.f90 similarity index 100% rename from src/examples/io/example_savetxt.f90 rename to example/io/example_savetxt.f90 diff --git a/src/examples/linalg/CMakeLists.txt b/example/linalg/CMakeLists.txt similarity index 100% rename from src/examples/linalg/CMakeLists.txt rename to example/linalg/CMakeLists.txt diff --git a/src/examples/linalg/example_diag1.f90 b/example/linalg/example_diag1.f90 similarity index 100% rename from src/examples/linalg/example_diag1.f90 rename to example/linalg/example_diag1.f90 diff --git a/src/examples/linalg/example_diag2.f90 b/example/linalg/example_diag2.f90 similarity index 100% rename from src/examples/linalg/example_diag2.f90 rename to example/linalg/example_diag2.f90 diff --git a/src/examples/linalg/example_diag3.f90 b/example/linalg/example_diag3.f90 similarity index 100% rename from src/examples/linalg/example_diag3.f90 rename to example/linalg/example_diag3.f90 diff --git a/src/examples/linalg/example_diag4.f90 b/example/linalg/example_diag4.f90 similarity index 100% rename from src/examples/linalg/example_diag4.f90 rename to example/linalg/example_diag4.f90 diff --git a/src/examples/linalg/example_diag5.f90 b/example/linalg/example_diag5.f90 similarity index 100% rename from src/examples/linalg/example_diag5.f90 rename to example/linalg/example_diag5.f90 diff --git a/src/examples/linalg/example_eye1.f90 b/example/linalg/example_eye1.f90 similarity index 100% rename from src/examples/linalg/example_eye1.f90 rename to example/linalg/example_eye1.f90 diff --git a/src/examples/linalg/example_eye2.f90 b/example/linalg/example_eye2.f90 similarity index 100% rename from src/examples/linalg/example_eye2.f90 rename to example/linalg/example_eye2.f90 diff --git a/src/examples/linalg/example_is_diagonal.f90 b/example/linalg/example_is_diagonal.f90 similarity index 100% rename from src/examples/linalg/example_is_diagonal.f90 rename to example/linalg/example_is_diagonal.f90 diff --git a/src/examples/linalg/example_is_hermitian.f90 b/example/linalg/example_is_hermitian.f90 similarity index 100% rename from src/examples/linalg/example_is_hermitian.f90 rename to example/linalg/example_is_hermitian.f90 diff --git a/src/examples/linalg/example_is_hessenberg.f90 b/example/linalg/example_is_hessenberg.f90 similarity index 100% rename from src/examples/linalg/example_is_hessenberg.f90 rename to example/linalg/example_is_hessenberg.f90 diff --git a/src/examples/linalg/example_is_skew_symmetric.f90 b/example/linalg/example_is_skew_symmetric.f90 similarity index 100% rename from src/examples/linalg/example_is_skew_symmetric.f90 rename to example/linalg/example_is_skew_symmetric.f90 diff --git a/src/examples/linalg/example_is_square.f90 b/example/linalg/example_is_square.f90 similarity index 100% rename from src/examples/linalg/example_is_square.f90 rename to example/linalg/example_is_square.f90 diff --git a/src/examples/linalg/example_is_symmetric.f90 b/example/linalg/example_is_symmetric.f90 similarity index 100% rename from src/examples/linalg/example_is_symmetric.f90 rename to example/linalg/example_is_symmetric.f90 diff --git a/src/examples/linalg/example_is_triangular.f90 b/example/linalg/example_is_triangular.f90 similarity index 100% rename from src/examples/linalg/example_is_triangular.f90 rename to example/linalg/example_is_triangular.f90 diff --git a/src/examples/linalg/example_outer_product.f90 b/example/linalg/example_outer_product.f90 similarity index 100% rename from src/examples/linalg/example_outer_product.f90 rename to example/linalg/example_outer_product.f90 diff --git a/src/examples/linalg/example_trace.f90 b/example/linalg/example_trace.f90 similarity index 100% rename from src/examples/linalg/example_trace.f90 rename to example/linalg/example_trace.f90 diff --git a/src/examples/logger/CMakeLists.txt b/example/logger/CMakeLists.txt similarity index 100% rename from src/examples/logger/CMakeLists.txt rename to example/logger/CMakeLists.txt diff --git a/src/examples/logger/dummy.txt b/example/logger/dummy.txt similarity index 100% rename from src/examples/logger/dummy.txt rename to example/logger/dummy.txt diff --git a/src/examples/logger/example_add_log_unit.f90 b/example/logger/example_add_log_unit.f90 similarity index 100% rename from src/examples/logger/example_add_log_unit.f90 rename to example/logger/example_add_log_unit.f90 diff --git a/src/examples/logger/example_configure.f90 b/example/logger/example_configure.f90 similarity index 100% rename from src/examples/logger/example_configure.f90 rename to example/logger/example_configure.f90 diff --git a/src/examples/logger/example_global_logger.f90 b/example/logger/example_global_logger.f90 similarity index 100% rename from src/examples/logger/example_global_logger.f90 rename to example/logger/example_global_logger.f90 diff --git a/src/examples/logger/example_log_io_error.f90 b/example/logger/example_log_io_error.f90 similarity index 100% rename from src/examples/logger/example_log_io_error.f90 rename to example/logger/example_log_io_error.f90 diff --git a/src/examples/logger/example_log_text_error.f90 b/example/logger/example_log_text_error.f90 similarity index 100% rename from src/examples/logger/example_log_text_error.f90 rename to example/logger/example_log_text_error.f90 diff --git a/src/examples/math/CMakeLists.txt b/example/math/CMakeLists.txt similarity index 100% rename from src/examples/math/CMakeLists.txt rename to example/math/CMakeLists.txt diff --git a/src/examples/math/example_clip_integer.f90 b/example/math/example_clip_integer.f90 similarity index 100% rename from src/examples/math/example_clip_integer.f90 rename to example/math/example_clip_integer.f90 diff --git a/src/examples/math/example_clip_real.f90 b/example/math/example_clip_real.f90 similarity index 100% rename from src/examples/math/example_clip_real.f90 rename to example/math/example_clip_real.f90 diff --git a/src/examples/math/example_diff.f90 b/example/math/example_diff.f90 similarity index 100% rename from src/examples/math/example_diff.f90 rename to example/math/example_diff.f90 diff --git a/src/examples/math/example_gcd.f90 b/example/math/example_gcd.f90 similarity index 100% rename from src/examples/math/example_gcd.f90 rename to example/math/example_gcd.f90 diff --git a/src/examples/math/example_linspace_complex.f90 b/example/math/example_linspace_complex.f90 similarity index 100% rename from src/examples/math/example_linspace_complex.f90 rename to example/math/example_linspace_complex.f90 diff --git a/src/examples/math/example_linspace_int16.f90 b/example/math/example_linspace_int16.f90 similarity index 100% rename from src/examples/math/example_linspace_int16.f90 rename to example/math/example_linspace_int16.f90 diff --git a/src/examples/math/example_logspace_complex.f90 b/example/math/example_logspace_complex.f90 similarity index 100% rename from src/examples/math/example_logspace_complex.f90 rename to example/math/example_logspace_complex.f90 diff --git a/src/examples/math/example_logspace_int.f90 b/example/math/example_logspace_int.f90 similarity index 100% rename from src/examples/math/example_logspace_int.f90 rename to example/math/example_logspace_int.f90 diff --git a/src/examples/math/example_logspace_rstart_cbase.f90 b/example/math/example_logspace_rstart_cbase.f90 similarity index 100% rename from src/examples/math/example_logspace_rstart_cbase.f90 rename to example/math/example_logspace_rstart_cbase.f90 diff --git a/src/examples/math/example_math_all_close.f90 b/example/math/example_math_all_close.f90 similarity index 100% rename from src/examples/math/example_math_all_close.f90 rename to example/math/example_math_all_close.f90 diff --git a/src/examples/math/example_math_arange.f90 b/example/math/example_math_arange.f90 similarity index 100% rename from src/examples/math/example_math_arange.f90 rename to example/math/example_math_arange.f90 diff --git a/src/examples/math/example_math_arg.f90 b/example/math/example_math_arg.f90 similarity index 100% rename from src/examples/math/example_math_arg.f90 rename to example/math/example_math_arg.f90 diff --git a/src/examples/math/example_math_argd.f90 b/example/math/example_math_argd.f90 similarity index 100% rename from src/examples/math/example_math_argd.f90 rename to example/math/example_math_argd.f90 diff --git a/src/examples/math/example_math_argpi.f90 b/example/math/example_math_argpi.f90 similarity index 100% rename from src/examples/math/example_math_argpi.f90 rename to example/math/example_math_argpi.f90 diff --git a/src/examples/math/example_math_is_close.f90 b/example/math/example_math_is_close.f90 similarity index 100% rename from src/examples/math/example_math_is_close.f90 rename to example/math/example_math_is_close.f90 diff --git a/src/examples/optval/CMakeLists.txt b/example/optval/CMakeLists.txt similarity index 100% rename from src/examples/optval/CMakeLists.txt rename to example/optval/CMakeLists.txt diff --git a/src/examples/optval/example_optval.f90 b/example/optval/example_optval.f90 similarity index 100% rename from src/examples/optval/example_optval.f90 rename to example/optval/example_optval.f90 diff --git a/src/examples/quadrature/CMakeLists.txt b/example/quadrature/CMakeLists.txt similarity index 100% rename from src/examples/quadrature/CMakeLists.txt rename to example/quadrature/CMakeLists.txt diff --git a/src/examples/quadrature/example_gauss_legendre.f90 b/example/quadrature/example_gauss_legendre.f90 similarity index 100% rename from src/examples/quadrature/example_gauss_legendre.f90 rename to example/quadrature/example_gauss_legendre.f90 diff --git a/src/examples/quadrature/example_gauss_legendre_lobatto.f90 b/example/quadrature/example_gauss_legendre_lobatto.f90 similarity index 100% rename from src/examples/quadrature/example_gauss_legendre_lobatto.f90 rename to example/quadrature/example_gauss_legendre_lobatto.f90 diff --git a/src/examples/quadrature/example_simps.f90 b/example/quadrature/example_simps.f90 similarity index 100% rename from src/examples/quadrature/example_simps.f90 rename to example/quadrature/example_simps.f90 diff --git a/src/examples/quadrature/example_simps_weights.f90 b/example/quadrature/example_simps_weights.f90 similarity index 100% rename from src/examples/quadrature/example_simps_weights.f90 rename to example/quadrature/example_simps_weights.f90 diff --git a/src/examples/quadrature/example_trapz.f90 b/example/quadrature/example_trapz.f90 similarity index 100% rename from src/examples/quadrature/example_trapz.f90 rename to example/quadrature/example_trapz.f90 diff --git a/src/examples/quadrature/example_trapz_weights.f90 b/example/quadrature/example_trapz_weights.f90 similarity index 100% rename from src/examples/quadrature/example_trapz_weights.f90 rename to example/quadrature/example_trapz_weights.f90 diff --git a/src/examples/random/CMakeLists.txt b/example/random/CMakeLists.txt similarity index 100% rename from src/examples/random/CMakeLists.txt rename to example/random/CMakeLists.txt diff --git a/src/examples/random/example_dist_rand.f90 b/example/random/example_dist_rand.f90 similarity index 100% rename from src/examples/random/example_dist_rand.f90 rename to example/random/example_dist_rand.f90 diff --git a/src/examples/random/example_random_seed.f90 b/example/random/example_random_seed.f90 similarity index 100% rename from src/examples/random/example_random_seed.f90 rename to example/random/example_random_seed.f90 diff --git a/src/examples/selection/CMakeLists.txt b/example/selection/CMakeLists.txt similarity index 100% rename from src/examples/selection/CMakeLists.txt rename to example/selection/CMakeLists.txt diff --git a/src/examples/selection/example_arg_select.f90 b/example/selection/example_arg_select.f90 similarity index 100% rename from src/examples/selection/example_arg_select.f90 rename to example/selection/example_arg_select.f90 diff --git a/src/examples/selection/example_select.f90 b/example/selection/example_select.f90 similarity index 100% rename from src/examples/selection/example_select.f90 rename to example/selection/example_select.f90 diff --git a/src/examples/selection/selection_vs_sort.f90 b/example/selection/selection_vs_sort.f90 similarity index 100% rename from src/examples/selection/selection_vs_sort.f90 rename to example/selection/selection_vs_sort.f90 diff --git a/src/examples/sorting/CMakeLists.txt b/example/sorting/CMakeLists.txt similarity index 100% rename from src/examples/sorting/CMakeLists.txt rename to example/sorting/CMakeLists.txt diff --git a/src/examples/sorting/example_ord_sort.f90 b/example/sorting/example_ord_sort.f90 similarity index 100% rename from src/examples/sorting/example_ord_sort.f90 rename to example/sorting/example_ord_sort.f90 diff --git a/src/examples/sorting/example_sort.f90 b/example/sorting/example_sort.f90 similarity index 100% rename from src/examples/sorting/example_sort.f90 rename to example/sorting/example_sort.f90 diff --git a/src/examples/specialfunctions_gamma/CMakeLists.txt b/example/specialfunctions_gamma/CMakeLists.txt similarity index 100% rename from src/examples/specialfunctions_gamma/CMakeLists.txt rename to example/specialfunctions_gamma/CMakeLists.txt diff --git a/src/examples/specialfunctions_gamma/example_gamma.f90 b/example/specialfunctions_gamma/example_gamma.f90 similarity index 100% rename from src/examples/specialfunctions_gamma/example_gamma.f90 rename to example/specialfunctions_gamma/example_gamma.f90 diff --git a/src/examples/specialfunctions_gamma/example_gamma_p.f90 b/example/specialfunctions_gamma/example_gamma_p.f90 similarity index 100% rename from src/examples/specialfunctions_gamma/example_gamma_p.f90 rename to example/specialfunctions_gamma/example_gamma_p.f90 diff --git a/src/examples/specialfunctions_gamma/example_gamma_q.f90 b/example/specialfunctions_gamma/example_gamma_q.f90 similarity index 100% rename from src/examples/specialfunctions_gamma/example_gamma_q.f90 rename to example/specialfunctions_gamma/example_gamma_q.f90 diff --git a/src/examples/specialfunctions_gamma/example_ligamma.f90 b/example/specialfunctions_gamma/example_ligamma.f90 similarity index 100% rename from src/examples/specialfunctions_gamma/example_ligamma.f90 rename to example/specialfunctions_gamma/example_ligamma.f90 diff --git a/src/examples/specialfunctions_gamma/example_log_factorial.f90 b/example/specialfunctions_gamma/example_log_factorial.f90 similarity index 100% rename from src/examples/specialfunctions_gamma/example_log_factorial.f90 rename to example/specialfunctions_gamma/example_log_factorial.f90 diff --git a/src/examples/specialfunctions_gamma/example_log_gamma.f90 b/example/specialfunctions_gamma/example_log_gamma.f90 similarity index 100% rename from src/examples/specialfunctions_gamma/example_log_gamma.f90 rename to example/specialfunctions_gamma/example_log_gamma.f90 diff --git a/src/examples/specialfunctions_gamma/example_uigamma.f90 b/example/specialfunctions_gamma/example_uigamma.f90 similarity index 100% rename from src/examples/specialfunctions_gamma/example_uigamma.f90 rename to example/specialfunctions_gamma/example_uigamma.f90 diff --git a/src/examples/stats/CMakeLists.txt b/example/stats/CMakeLists.txt similarity index 100% rename from src/examples/stats/CMakeLists.txt rename to example/stats/CMakeLists.txt diff --git a/src/examples/stats/example_corr.f90 b/example/stats/example_corr.f90 similarity index 100% rename from src/examples/stats/example_corr.f90 rename to example/stats/example_corr.f90 diff --git a/src/examples/stats/example_cov.f90 b/example/stats/example_cov.f90 similarity index 100% rename from src/examples/stats/example_cov.f90 rename to example/stats/example_cov.f90 diff --git a/src/examples/stats/example_mean.f90 b/example/stats/example_mean.f90 similarity index 100% rename from src/examples/stats/example_mean.f90 rename to example/stats/example_mean.f90 diff --git a/src/examples/stats/example_median.f90 b/example/stats/example_median.f90 similarity index 100% rename from src/examples/stats/example_median.f90 rename to example/stats/example_median.f90 diff --git a/src/examples/stats/example_moment.f90 b/example/stats/example_moment.f90 similarity index 100% rename from src/examples/stats/example_moment.f90 rename to example/stats/example_moment.f90 diff --git a/src/examples/stats/example_var.f90 b/example/stats/example_var.f90 similarity index 100% rename from src/examples/stats/example_var.f90 rename to example/stats/example_var.f90 diff --git a/src/examples/stats_distribution_exponential/CMakeLists.txt b/example/stats_distribution_exponential/CMakeLists.txt similarity index 100% rename from src/examples/stats_distribution_exponential/CMakeLists.txt rename to example/stats_distribution_exponential/CMakeLists.txt diff --git a/src/examples/stats_distribution_exponential/example_exponential_cdf.f90 b/example/stats_distribution_exponential/example_exponential_cdf.f90 similarity index 100% rename from src/examples/stats_distribution_exponential/example_exponential_cdf.f90 rename to example/stats_distribution_exponential/example_exponential_cdf.f90 diff --git a/src/examples/stats_distribution_exponential/example_exponential_pdf.f90 b/example/stats_distribution_exponential/example_exponential_pdf.f90 similarity index 100% rename from src/examples/stats_distribution_exponential/example_exponential_pdf.f90 rename to example/stats_distribution_exponential/example_exponential_pdf.f90 diff --git a/src/examples/stats_distribution_exponential/example_exponential_rvs.f90 b/example/stats_distribution_exponential/example_exponential_rvs.f90 similarity index 100% rename from src/examples/stats_distribution_exponential/example_exponential_rvs.f90 rename to example/stats_distribution_exponential/example_exponential_rvs.f90 diff --git a/src/examples/stats_distribution_normal/CMakeLists.txt b/example/stats_distribution_normal/CMakeLists.txt similarity index 100% rename from src/examples/stats_distribution_normal/CMakeLists.txt rename to example/stats_distribution_normal/CMakeLists.txt diff --git a/src/examples/stats_distribution_normal/example_norm_cdf.f90 b/example/stats_distribution_normal/example_norm_cdf.f90 similarity index 100% rename from src/examples/stats_distribution_normal/example_norm_cdf.f90 rename to example/stats_distribution_normal/example_norm_cdf.f90 diff --git a/src/examples/stats_distribution_normal/example_normal_pdf.f90 b/example/stats_distribution_normal/example_normal_pdf.f90 similarity index 100% rename from src/examples/stats_distribution_normal/example_normal_pdf.f90 rename to example/stats_distribution_normal/example_normal_pdf.f90 diff --git a/src/examples/stats_distribution_normal/example_normal_rvs.f90 b/example/stats_distribution_normal/example_normal_rvs.f90 similarity index 100% rename from src/examples/stats_distribution_normal/example_normal_rvs.f90 rename to example/stats_distribution_normal/example_normal_rvs.f90 diff --git a/src/examples/stats_distribution_uniform/CMakeLists.txt b/example/stats_distribution_uniform/CMakeLists.txt similarity index 100% rename from src/examples/stats_distribution_uniform/CMakeLists.txt rename to example/stats_distribution_uniform/CMakeLists.txt diff --git a/src/examples/stats_distribution_uniform/example_shuffle.f90 b/example/stats_distribution_uniform/example_shuffle.f90 similarity index 100% rename from src/examples/stats_distribution_uniform/example_shuffle.f90 rename to example/stats_distribution_uniform/example_shuffle.f90 diff --git a/src/examples/stats_distribution_uniform/example_uniform_cdf.f90 b/example/stats_distribution_uniform/example_uniform_cdf.f90 similarity index 100% rename from src/examples/stats_distribution_uniform/example_uniform_cdf.f90 rename to example/stats_distribution_uniform/example_uniform_cdf.f90 diff --git a/src/examples/stats_distribution_uniform/example_uniform_pdf.f90 b/example/stats_distribution_uniform/example_uniform_pdf.f90 similarity index 100% rename from src/examples/stats_distribution_uniform/example_uniform_pdf.f90 rename to example/stats_distribution_uniform/example_uniform_pdf.f90 diff --git a/src/examples/stats_distribution_uniform/example_uniform_rvs.f90 b/example/stats_distribution_uniform/example_uniform_rvs.f90 similarity index 100% rename from src/examples/stats_distribution_uniform/example_uniform_rvs.f90 rename to example/stats_distribution_uniform/example_uniform_rvs.f90 diff --git a/src/examples/string_type/CMakeLists.txt b/example/string_type/CMakeLists.txt similarity index 100% rename from src/examples/string_type/CMakeLists.txt rename to example/string_type/CMakeLists.txt diff --git a/src/examples/string_type/example_adjustl.f90 b/example/string_type/example_adjustl.f90 similarity index 100% rename from src/examples/string_type/example_adjustl.f90 rename to example/string_type/example_adjustl.f90 diff --git a/src/examples/string_type/example_adjustr.f90 b/example/string_type/example_adjustr.f90 similarity index 100% rename from src/examples/string_type/example_adjustr.f90 rename to example/string_type/example_adjustr.f90 diff --git a/src/examples/string_type/example_char.f90 b/example/string_type/example_char.f90 similarity index 100% rename from src/examples/string_type/example_char.f90 rename to example/string_type/example_char.f90 diff --git a/src/examples/string_type/example_char_position.f90 b/example/string_type/example_char_position.f90 similarity index 100% rename from src/examples/string_type/example_char_position.f90 rename to example/string_type/example_char_position.f90 diff --git a/src/examples/string_type/example_char_range.f90 b/example/string_type/example_char_range.f90 similarity index 100% rename from src/examples/string_type/example_char_range.f90 rename to example/string_type/example_char_range.f90 diff --git a/src/examples/string_type/example_constructor_character.f90 b/example/string_type/example_constructor_character.f90 similarity index 100% rename from src/examples/string_type/example_constructor_character.f90 rename to example/string_type/example_constructor_character.f90 diff --git a/src/examples/string_type/example_constructor_empty.f90 b/example/string_type/example_constructor_empty.f90 similarity index 100% rename from src/examples/string_type/example_constructor_empty.f90 rename to example/string_type/example_constructor_empty.f90 diff --git a/src/examples/string_type/example_constructor_integer.f90 b/example/string_type/example_constructor_integer.f90 similarity index 100% rename from src/examples/string_type/example_constructor_integer.f90 rename to example/string_type/example_constructor_integer.f90 diff --git a/src/examples/string_type/example_constructor_logical.f90 b/example/string_type/example_constructor_logical.f90 similarity index 100% rename from src/examples/string_type/example_constructor_logical.f90 rename to example/string_type/example_constructor_logical.f90 diff --git a/src/examples/string_type/example_constructor_scalar.f90 b/example/string_type/example_constructor_scalar.f90 similarity index 100% rename from src/examples/string_type/example_constructor_scalar.f90 rename to example/string_type/example_constructor_scalar.f90 diff --git a/src/examples/string_type/example_cont.f90 b/example/string_type/example_cont.f90 similarity index 100% rename from src/examples/string_type/example_cont.f90 rename to example/string_type/example_cont.f90 diff --git a/src/examples/string_type/example_eq.f90 b/example/string_type/example_eq.f90 similarity index 100% rename from src/examples/string_type/example_eq.f90 rename to example/string_type/example_eq.f90 diff --git a/src/examples/string_type/example_fread.f90 b/example/string_type/example_fread.f90 similarity index 100% rename from src/examples/string_type/example_fread.f90 rename to example/string_type/example_fread.f90 diff --git a/src/examples/string_type/example_fwrite.f90 b/example/string_type/example_fwrite.f90 similarity index 100% rename from src/examples/string_type/example_fwrite.f90 rename to example/string_type/example_fwrite.f90 diff --git a/src/examples/string_type/example_ge.f90 b/example/string_type/example_ge.f90 similarity index 100% rename from src/examples/string_type/example_ge.f90 rename to example/string_type/example_ge.f90 diff --git a/src/examples/string_type/example_gt.f90 b/example/string_type/example_gt.f90 similarity index 100% rename from src/examples/string_type/example_gt.f90 rename to example/string_type/example_gt.f90 diff --git a/src/examples/string_type/example_iachar.f90 b/example/string_type/example_iachar.f90 similarity index 100% rename from src/examples/string_type/example_iachar.f90 rename to example/string_type/example_iachar.f90 diff --git a/src/examples/string_type/example_ichar.f90 b/example/string_type/example_ichar.f90 similarity index 100% rename from src/examples/string_type/example_ichar.f90 rename to example/string_type/example_ichar.f90 diff --git a/src/examples/string_type/example_index.f90 b/example/string_type/example_index.f90 similarity index 100% rename from src/examples/string_type/example_index.f90 rename to example/string_type/example_index.f90 diff --git a/src/examples/string_type/example_le.f90 b/example/string_type/example_le.f90 similarity index 100% rename from src/examples/string_type/example_le.f90 rename to example/string_type/example_le.f90 diff --git a/src/examples/string_type/example_len.f90 b/example/string_type/example_len.f90 similarity index 100% rename from src/examples/string_type/example_len.f90 rename to example/string_type/example_len.f90 diff --git a/src/examples/string_type/example_len_trim.f90 b/example/string_type/example_len_trim.f90 similarity index 100% rename from src/examples/string_type/example_len_trim.f90 rename to example/string_type/example_len_trim.f90 diff --git a/src/examples/string_type/example_lge.f90 b/example/string_type/example_lge.f90 similarity index 100% rename from src/examples/string_type/example_lge.f90 rename to example/string_type/example_lge.f90 diff --git a/src/examples/string_type/example_lgt.f90 b/example/string_type/example_lgt.f90 similarity index 100% rename from src/examples/string_type/example_lgt.f90 rename to example/string_type/example_lgt.f90 diff --git a/src/examples/string_type/example_lle.f90 b/example/string_type/example_lle.f90 similarity index 100% rename from src/examples/string_type/example_lle.f90 rename to example/string_type/example_lle.f90 diff --git a/src/examples/string_type/example_llt.f90 b/example/string_type/example_llt.f90 similarity index 100% rename from src/examples/string_type/example_llt.f90 rename to example/string_type/example_llt.f90 diff --git a/src/examples/string_type/example_lt.f90 b/example/string_type/example_lt.f90 similarity index 100% rename from src/examples/string_type/example_lt.f90 rename to example/string_type/example_lt.f90 diff --git a/src/examples/string_type/example_move.f90 b/example/string_type/example_move.f90 similarity index 100% rename from src/examples/string_type/example_move.f90 rename to example/string_type/example_move.f90 diff --git a/src/examples/string_type/example_ne.f90 b/example/string_type/example_ne.f90 similarity index 100% rename from src/examples/string_type/example_ne.f90 rename to example/string_type/example_ne.f90 diff --git a/src/examples/string_type/example_repeat.f90 b/example/string_type/example_repeat.f90 similarity index 100% rename from src/examples/string_type/example_repeat.f90 rename to example/string_type/example_repeat.f90 diff --git a/src/examples/string_type/example_reverse.f90 b/example/string_type/example_reverse.f90 similarity index 100% rename from src/examples/string_type/example_reverse.f90 rename to example/string_type/example_reverse.f90 diff --git a/src/examples/string_type/example_scan.f90 b/example/string_type/example_scan.f90 similarity index 100% rename from src/examples/string_type/example_scan.f90 rename to example/string_type/example_scan.f90 diff --git a/src/examples/string_type/example_to_lower.f90 b/example/string_type/example_to_lower.f90 similarity index 100% rename from src/examples/string_type/example_to_lower.f90 rename to example/string_type/example_to_lower.f90 diff --git a/src/examples/string_type/example_to_sentence.f90 b/example/string_type/example_to_sentence.f90 similarity index 100% rename from src/examples/string_type/example_to_sentence.f90 rename to example/string_type/example_to_sentence.f90 diff --git a/src/examples/string_type/example_to_title.f90 b/example/string_type/example_to_title.f90 similarity index 100% rename from src/examples/string_type/example_to_title.f90 rename to example/string_type/example_to_title.f90 diff --git a/src/examples/string_type/example_to_upper.f90 b/example/string_type/example_to_upper.f90 similarity index 100% rename from src/examples/string_type/example_to_upper.f90 rename to example/string_type/example_to_upper.f90 diff --git a/src/examples/string_type/example_trim.f90 b/example/string_type/example_trim.f90 similarity index 100% rename from src/examples/string_type/example_trim.f90 rename to example/string_type/example_trim.f90 diff --git a/src/examples/string_type/example_uread.f90 b/example/string_type/example_uread.f90 similarity index 100% rename from src/examples/string_type/example_uread.f90 rename to example/string_type/example_uread.f90 diff --git a/src/examples/string_type/example_uwrite.f90 b/example/string_type/example_uwrite.f90 similarity index 100% rename from src/examples/string_type/example_uwrite.f90 rename to example/string_type/example_uwrite.f90 diff --git a/src/examples/string_type/example_verify.f90 b/example/string_type/example_verify.f90 similarity index 100% rename from src/examples/string_type/example_verify.f90 rename to example/string_type/example_verify.f90 diff --git a/src/examples/stringlist_type/CMakeLists.txt b/example/stringlist_type/CMakeLists.txt similarity index 100% rename from src/examples/stringlist_type/CMakeLists.txt rename to example/stringlist_type/CMakeLists.txt diff --git a/src/examples/stringlist_type/example_stringlist_type_clear.f90 b/example/stringlist_type/example_stringlist_type_clear.f90 similarity index 100% rename from src/examples/stringlist_type/example_stringlist_type_clear.f90 rename to example/stringlist_type/example_stringlist_type_clear.f90 diff --git a/src/examples/stringlist_type/example_stringlist_type_concatenate_operator.f90 b/example/stringlist_type/example_stringlist_type_concatenate_operator.f90 similarity index 100% rename from src/examples/stringlist_type/example_stringlist_type_concatenate_operator.f90 rename to example/stringlist_type/example_stringlist_type_concatenate_operator.f90 diff --git a/src/examples/stringlist_type/example_stringlist_type_constructor.f90 b/example/stringlist_type/example_stringlist_type_constructor.f90 similarity index 100% rename from src/examples/stringlist_type/example_stringlist_type_constructor.f90 rename to example/stringlist_type/example_stringlist_type_constructor.f90 diff --git a/src/examples/stringlist_type/example_stringlist_type_equality_operator.f90 b/example/stringlist_type/example_stringlist_type_equality_operator.f90 similarity index 100% rename from src/examples/stringlist_type/example_stringlist_type_equality_operator.f90 rename to example/stringlist_type/example_stringlist_type_equality_operator.f90 diff --git a/src/examples/stringlist_type/example_stringlist_type_fidx_bidx.f90 b/example/stringlist_type/example_stringlist_type_fidx_bidx.f90 similarity index 100% rename from src/examples/stringlist_type/example_stringlist_type_fidx_bidx.f90 rename to example/stringlist_type/example_stringlist_type_fidx_bidx.f90 diff --git a/src/examples/stringlist_type/example_stringlist_type_get.f90 b/example/stringlist_type/example_stringlist_type_get.f90 similarity index 100% rename from src/examples/stringlist_type/example_stringlist_type_get.f90 rename to example/stringlist_type/example_stringlist_type_get.f90 diff --git a/src/examples/stringlist_type/example_stringlist_type_inequality_operator.f90 b/example/stringlist_type/example_stringlist_type_inequality_operator.f90 similarity index 100% rename from src/examples/stringlist_type/example_stringlist_type_inequality_operator.f90 rename to example/stringlist_type/example_stringlist_type_inequality_operator.f90 diff --git a/src/examples/stringlist_type/example_stringlist_type_insert_at.f90 b/example/stringlist_type/example_stringlist_type_insert_at.f90 similarity index 100% rename from src/examples/stringlist_type/example_stringlist_type_insert_at.f90 rename to example/stringlist_type/example_stringlist_type_insert_at.f90 diff --git a/src/examples/stringlist_type/example_stringlist_type_len.f90 b/example/stringlist_type/example_stringlist_type_len.f90 similarity index 100% rename from src/examples/stringlist_type/example_stringlist_type_len.f90 rename to example/stringlist_type/example_stringlist_type_len.f90 diff --git a/src/examples/strings/CMakeLists.txt b/example/strings/CMakeLists.txt similarity index 100% rename from src/examples/strings/CMakeLists.txt rename to example/strings/CMakeLists.txt diff --git a/src/examples/strings/example_chomp.f90 b/example/strings/example_chomp.f90 similarity index 100% rename from src/examples/strings/example_chomp.f90 rename to example/strings/example_chomp.f90 diff --git a/src/examples/strings/example_count.f90 b/example/strings/example_count.f90 similarity index 100% rename from src/examples/strings/example_count.f90 rename to example/strings/example_count.f90 diff --git a/src/examples/strings/example_ends_with.f90 b/example/strings/example_ends_with.f90 similarity index 100% rename from src/examples/strings/example_ends_with.f90 rename to example/strings/example_ends_with.f90 diff --git a/src/examples/strings/example_find.f90 b/example/strings/example_find.f90 similarity index 100% rename from src/examples/strings/example_find.f90 rename to example/strings/example_find.f90 diff --git a/src/examples/strings/example_padl.f90 b/example/strings/example_padl.f90 similarity index 100% rename from src/examples/strings/example_padl.f90 rename to example/strings/example_padl.f90 diff --git a/src/examples/strings/example_padr.f90 b/example/strings/example_padr.f90 similarity index 100% rename from src/examples/strings/example_padr.f90 rename to example/strings/example_padr.f90 diff --git a/src/examples/strings/example_replace_all.f90 b/example/strings/example_replace_all.f90 similarity index 100% rename from src/examples/strings/example_replace_all.f90 rename to example/strings/example_replace_all.f90 diff --git a/src/examples/strings/example_slice.f90 b/example/strings/example_slice.f90 similarity index 100% rename from src/examples/strings/example_slice.f90 rename to example/strings/example_slice.f90 diff --git a/src/examples/strings/example_starts_with.f90 b/example/strings/example_starts_with.f90 similarity index 100% rename from src/examples/strings/example_starts_with.f90 rename to example/strings/example_starts_with.f90 diff --git a/src/examples/strings/example_strip.f90 b/example/strings/example_strip.f90 similarity index 100% rename from src/examples/strings/example_strip.f90 rename to example/strings/example_strip.f90 diff --git a/src/examples/strings/example_to_string.f90 b/example/strings/example_to_string.f90 similarity index 100% rename from src/examples/strings/example_to_string.f90 rename to example/strings/example_to_string.f90 diff --git a/src/examples/version/CMakeLists.txt b/example/version/CMakeLists.txt similarity index 100% rename from src/examples/version/CMakeLists.txt rename to example/version/CMakeLists.txt diff --git a/src/examples/version/example_version.f90 b/example/version/example_version.f90 similarity index 100% rename from src/examples/version/example_version.f90 rename to example/version/example_version.f90 From dda3b454981057b9a4209312b767e4160092093f Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Sun, 31 Jul 2022 21:52:51 +0200 Subject: [PATCH 35/38] update CMakeLists.txt --- CMakeLists.txt | 1 + src/CMakeLists.txt | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8007a672e..26f49a428 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,7 @@ add_subdirectory(src) if(BUILD_TESTING) enable_testing() add_subdirectory(test) + add_subdirectory(example) endif() install(EXPORT ${PROJECT_NAME}-targets diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e99a3365..0fb95a2d3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -116,8 +116,6 @@ else() target_sources(${PROJECT_NAME} PRIVATE f08estop.f90) endif() -add_subdirectory(examples) - install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" From 79b53a229d2d50926fd39937258d1a0a3bb2a2b5 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Sun, 31 Jul 2022 21:57:08 +0200 Subject: [PATCH 36/38] update fpm-deployment --- ci/fpm-deployment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/fpm-deployment.sh b/ci/fpm-deployment.sh index 3e65c95a1..bdd3c2b6e 100644 --- a/ci/fpm-deployment.sh +++ b/ci/fpm-deployment.sh @@ -49,7 +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 src/examples -name "example_*.f90" -exec cp {} "$destdir/example/" \; +find example -name "example_*.f90" -exec cp {} "$destdir/example/" \; # Include additional files cp "${include[@]}" "$destdir/" From 6b2b5d28341190bdfb6f1361c99a4480adfa96e9 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Sun, 31 Jul 2022 22:04:43 +0200 Subject: [PATCH 37/38] update specs --- doc/specs/stdlib_array.md | 4 +- doc/specs/stdlib_ascii.md | 10 +-- doc/specs/stdlib_bitsets.md | 60 +++++++------- doc/specs/stdlib_error.md | 12 +-- doc/specs/stdlib_hash_procedures.md | 26 +++--- doc/specs/stdlib_hashmaps.md | 54 ++++++------- doc/specs/stdlib_io.md | 14 ++-- doc/specs/stdlib_linalg.md | 32 ++++---- doc/specs/stdlib_logger.md | 10 +-- doc/specs/stdlib_math.md | 30 +++---- doc/specs/stdlib_optval.md | 2 +- doc/specs/stdlib_quadrature.md | 12 +-- doc/specs/stdlib_random.md | 4 +- doc/specs/stdlib_selection.md | 6 +- doc/specs/stdlib_sorting.md | 4 +- doc/specs/stdlib_specialfunctions_gamma.md | 14 ++-- doc/specs/stdlib_stats.md | 12 +-- .../stdlib_stats_distribution_exponential.md | 6 +- doc/specs/stdlib_stats_distribution_normal.md | 6 +- .../stdlib_stats_distribution_uniform.md | 8 +- doc/specs/stdlib_string_type.md | 80 +++++++++---------- doc/specs/stdlib_stringlist_type.md | 18 ++--- doc/specs/stdlib_strings.md | 22 ++--- doc/specs/stdlib_version.md | 2 +- 24 files changed, 224 insertions(+), 224 deletions(-) diff --git a/doc/specs/stdlib_array.md b/doc/specs/stdlib_array.md index 9c379da11..f9353aa22 100644 --- a/doc/specs/stdlib_array.md +++ b/doc/specs/stdlib_array.md @@ -46,7 +46,7 @@ Returns an array of default integer size, with a maximum length of `size(array)` #### Examples ```fortran -{!src/examples/array/example_trueloc.f90!} +{!example/array/example_trueloc.f90!} ``` @@ -83,5 +83,5 @@ Returns an array of default integer size, with a maximum length of `size(array)` #### Examples ```fortran -{!src/examples/array/example_falseloc.f90!} +{!example/array/example_falseloc.f90!} ``` diff --git a/doc/specs/stdlib_ascii.md b/doc/specs/stdlib_ascii.md index 2931fbaa6..260ff8d50 100644 --- a/doc/specs/stdlib_ascii.md +++ b/doc/specs/stdlib_ascii.md @@ -51,7 +51,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!src/examples/ascii/example_ascii_to_lower.f90!} +{!example/ascii/example_ascii_to_lower.f90!} ``` ### `to_upper` @@ -83,7 +83,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!src/examples/ascii/example_ascii_to_upper.f90!} +{!example/ascii/example_ascii_to_upper.f90!} ``` ### `to_title` @@ -120,7 +120,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!src/examples/ascii/example_ascii_to_title.f90!} +{!example/ascii/example_ascii_to_title.f90!} ``` ### `to_sentence` @@ -155,7 +155,7 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!src/examples/ascii/example_ascii_to_sentence.f90!} +{!example/ascii/example_ascii_to_sentence.f90!} ``` ### `reverse` @@ -187,5 +187,5 @@ The result is an intrinsic character type of the same length as `string`. #### Example ```fortran -{!src/examples/ascii/example_ascii_reverse.f90!} +{!example/ascii/example_ascii_reverse.f90!} ``` diff --git a/doc/specs/stdlib_bitsets.md b/doc/specs/stdlib_bitsets.md index f97a76aa5..77da22b9b 100644 --- a/doc/specs/stdlib_bitsets.md +++ b/doc/specs/stdlib_bitsets.md @@ -205,7 +205,7 @@ is mapped to a set bit, and `.false.` is mapped to an unset bit. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_assignment.f90!} +{!example/bitsets/example_bitsets_assignment.f90!} ``` ### Table of the non-member comparison operations @@ -259,7 +259,7 @@ otherwise it is `.false.`. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_all.f90!} +{!example/bitsets/example_bitsets_all.f90!} ``` ### `and` - bitwise `and` of the bits of two bitsets @@ -296,7 +296,7 @@ number of bits as `set1`. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_and.f90!} +{!example/bitsets/example_bitsets_and.f90!} ``` ### `and_not` - Bitwise `and` of one bitset with the negation of another @@ -334,7 +334,7 @@ number of bits as `set1`, otherwise the result is undefined. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_and_not.f90!} +{!example/bitsets/example_bitsets_and_not.f90!} ``` ### `any` - determine whether any bits are set @@ -368,7 +368,7 @@ is `.false.`. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_any.f90!} +{!example/bitsets/example_bitsets_any.f90!} ``` ### `bit_count` - return the number of bits that are set @@ -402,7 +402,7 @@ equal to the number of bits that are set in `self`. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_bit_count.f90!} +{!example/bitsets/example_bitsets_bit_count.f90!} ``` #### `bits` - returns the number of bits @@ -436,7 +436,7 @@ the number of defined bits in `self`. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_bits.f90!} +{!example/bitsets/example_bitsets_bits.f90!} ``` ### `clear` - clears a sequence of one or more bits @@ -487,7 +487,7 @@ an `intent(in)` argument. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_clear.f90!} +{!example/bitsets/example_bitsets_clear.f90!} ``` ### `extract` - create a new bitset from a range in an old bitset @@ -538,7 +538,7 @@ an `intent(out)` argument. If present it shall have one of the values: #### Example ```fortran -{!src/examples/bitsets/example_bitsets_extract.f90!} +{!example/bitsets/example_bitsets_extract.f90!} ``` ### `flip` - flip the values of a sequence of one or more bits @@ -590,7 +590,7 @@ an `intent(in)` argument. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_flip.f90!} +{!example/bitsets/example_bitsets_flip.f90!} ``` ### `from_string` - initializes a bitset from a binary literal @@ -640,7 +640,7 @@ codes: #### Example ```fortran -{!src/examples/bitsets/example_bitsets_from_string.f90!} +{!example/bitsets/example_bitsets_from_string.f90!} ``` ### `init` - `bitset_type` initialization routines @@ -689,7 +689,7 @@ stop code. It can have any of the following error codes: #### Example ```fortran -{!src/examples/bitsets/example_bitsets_init.f90!} +{!example/bitsets/example_bitsets_init.f90!} ``` ### `input` - reads a bitset from an unformatted file @@ -742,7 +742,7 @@ values for this `status` are: #### Example ```fortran -{!src/examples/bitsets/example_bitsets_input.f90!} +{!example/bitsets/example_bitsets_input.f90!} ``` ### `none` - determines whether no bits are set @@ -777,7 +777,7 @@ The result is `.true.` if no bits in `self` are set, otherwise it is #### Example ```fortran -{!src/examples/bitsets/example_bitsets_none.f90!} +{!example/bitsets/example_bitsets_none.f90!} ``` ### `not` - Performs the logical complement on a bitset @@ -807,7 +807,7 @@ complement of their values on input. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_not.f90!} +{!example/bitsets/example_bitsets_not.f90!} ``` ### `or` - Bitwise OR of the bits of two bitsets @@ -844,7 +844,7 @@ otherwise the results are undefined. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_or.f90!} +{!example/bitsets/example_bitsets_or.f90!} ``` ### `output` - Writes a binary representation of a bitset to a file @@ -887,7 +887,7 @@ code. The two code values have the meaning: #### Example ```fortran -{!src/examples/bitsets/example_bitsets_output.f90!} +{!example/bitsets/example_bitsets_output.f90!} ``` ### `read_bitset` - initializes `self` with the value of a *bitset_literal* @@ -968,7 +968,7 @@ as its error code. The possible error codes are: #### Example ```fortran -{!src/examples/bitsets/example_bitsets_read_bitset.f90!} +{!example/bitsets/example_bitsets_read_bitset.f90!} ``` ### `set` - sets a sequence of one or more bits to 1 @@ -1022,7 +1022,7 @@ Elemental subroutine #### Example ```fortran -{!src/examples/bitsets/example_bitsets_set.f90!} +{!example/bitsets/example_bitsets_set.f90!} ``` ### `test` - determine whether a bit is set @@ -1062,7 +1062,7 @@ otherwise it is `.false.`. If `pos` is outside the range #### Example ```fortran -{!src/examples/bitsets/example_bitsets_test.f90!} +{!example/bitsets/example_bitsets_test.f90!} ``` ### `to_string` - represent a bitset as a binary literal @@ -1106,7 +1106,7 @@ the stop code. The values have the following meanings: #### Example ```fortran -{!src/examples/bitsets/example_bitsets_to_string.f90!} +{!example/bitsets/example_bitsets_to_string.f90!} ``` ### `value` - determine the value of a bit @@ -1145,7 +1145,7 @@ is zero. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_value.f90!} +{!example/bitsets/example_bitsets_value.f90!} ``` ### `write_bitset` - writes a *bitset-literal* @@ -1212,7 +1212,7 @@ the following error code values: #### Example ```fortran -{!src/examples/bitsets/example_bitsets_write_bitset.f90!} +{!example/bitsets/example_bitsets_write_bitset.f90!} ``` ### `xor` - bitwise exclusive `or` @@ -1249,7 +1249,7 @@ samee number of bits, otherwise the result is undefined. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_xor.f90!} +{!example/bitsets/example_bitsets_xor.f90!} ``` ## Specification of the `stdlib_bitsets` operators @@ -1295,7 +1295,7 @@ to the same value, otherwise the result is `.false.`. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_equality.f90!} +{!example/bitsets/example_bitsets_equality.f90!} ``` ### `/=` - compare two bitsets to determine whether any bits differ in value @@ -1339,7 +1339,7 @@ the result is `.false.`. #### Example ```fortran -{!src/examples/bitsets/example_bitsets_inequality.f90!} +{!example/bitsets/example_bitsets_inequality.f90!} ``` ### `>=` - compare two bitsets to determine whether the first is greater than or equal to the second @@ -1386,7 +1386,7 @@ or the highest order different bit is set to 1 in `set1` and to 0 in #### Example ```fortran -{!src/examples/bitsets/example_bitsets_ge.f90!} +{!example/bitsets/example_bitsets_ge.f90!} ``` ### `>` - compare two bitsets to determine whether the first is greater than the other @@ -1433,7 +1433,7 @@ highest order different bit is set to 1 in `set1` and to 0 in `set2`, #### Example ```fortran -{!src/examples/bitsets/example_bitsets_gt.f90!} +{!example/bitsets/example_bitsets_gt.f90!} ``` ### `<=` - compare two bitsets to determine whether the first is less than or equal to the other @@ -1480,7 +1480,7 @@ or the highest order different bit is set to 0 in `set1` and to 1 in #### Example ```fortran -{!src/examples/bitsets/example_bitsets_le.f90!} +{!example/bitsets/example_bitsets_le.f90!} ``` ### `<` - compare two bitsets to determine whether the first is less than the other @@ -1527,5 +1527,5 @@ highest order different bit is set to 0 in `set1` and to 1 in `set2`, #### Example ```fortran -{!src/examples/bitsets/example_bitsets_lt.f90!} +{!example/bitsets/example_bitsets_lt.f90!} ``` diff --git a/doc/specs/stdlib_error.md b/doc/specs/stdlib_error.md index 2bade4666..aca862b11 100644 --- a/doc/specs/stdlib_error.md +++ b/doc/specs/stdlib_error.md @@ -53,16 +53,16 @@ If `condition` is `.false.`, and: #### Examples ```fortran -{!src/examples/error/example_check1.f90!} +{!example/error/example_check1.f90!} ``` ```fortran -{!src/examples/error/example_check2.f90!} +{!example/error/example_check2.f90!} ``` ```fortran -{!src/examples/error/example_check3.f90!} +{!example/error/example_check3.f90!} ``` ```fortran -{!src/examples/error/example_check4.f90!} +{!example/error/example_check4.f90!} ``` ### `error_stop` - aborts the program @@ -94,11 +94,11 @@ Aborts the program with printing the message `msg` to `stderr` and a nonzero exi Without error code: ```fortran -{!src/examples/error/example_error_stop1.f90!} +{!example/error/example_error_stop1.f90!} ``` With error code: ```fortran -{!src/examples/error/example_error_stop2.f90!} +{!example/error/example_error_stop2.f90!} ``` diff --git a/doc/specs/stdlib_hash_procedures.md b/doc/specs/stdlib_hash_procedures.md index 449f4ed85..c790b1ef3 100644 --- a/doc/specs/stdlib_hash_procedures.md +++ b/doc/specs/stdlib_hash_procedures.md @@ -543,7 +543,7 @@ E. Knuth. It multiplies the `key` by the odd valued approximation to ##### Example ```fortran -{!src/examples/hash_procedures/example_fibonacci_hash.f90!} +{!example/hash_procedures/example_fibonacci_hash.f90!} ``` #### `fnv_1_hash`- calculates a hash code from a key @@ -597,7 +597,7 @@ function for character strings. ##### Example ```fortran -{!src/examples/hash_procedures/example_fnv_1_hash.f90!} +{!example/hash_procedures/example_fnv_1_hash.f90!} ``` @@ -651,7 +651,7 @@ function for character strings. ##### Example ```fortran -{!src/examples/hash_procedures/example_fnv_1a_hash.f90!} +{!example/hash_procedures/example_fnv_1a_hash.f90!} ``` @@ -818,7 +818,7 @@ function for character strings. ##### Example ```fortran -{!src/examples/hash_procedures/example_nmhash32.f90!} +{!example/hash_procedures/example_nmhash32.f90!} ``` @@ -870,7 +870,7 @@ function for character strings. ##### Example ```fortran -{!src/examples/hash_procedures/example_nmhash32x.f90!} +{!example/hash_procedures/example_nmhash32x.f90!} ``` #### `odd_random_integer` - returns an odd integer @@ -953,7 +953,7 @@ It multiplies the `key` by `seed`, and returns the ##### Example ```fortran -{!src/examples/hash_procedures/example_universal_mult_hash.f90!} +{!example/hash_procedures/example_universal_mult_hash.f90!} ``` #### `water_hash`- calculates a hash code from a key and a seed @@ -1011,7 +1011,7 @@ function for character strings. ##### Example ```fortran -{!src/examples/hash_procedures/example_water_hash.f90!} +{!example/hash_procedures/example_water_hash.f90!} ``` ## The `stdlib_hash_64bit` module @@ -1102,7 +1102,7 @@ E. Knuth. It multiplies the `key` by the odd valued approximation to ##### Example ```fortran -{!src/examples/hash_procedures/example_fibonacci_hash_64.f90!} +{!example/hash_procedures/example_fibonacci_hash_64.f90!} ``` #### `FNV_1`- calculates a hash code from a key @@ -1156,7 +1156,7 @@ function for character strings. ##### Example ```fortran -{!src/examples/hash_procedures/example_fnv_1_hash_64.f90!} +{!example/hash_procedures/example_fnv_1_hash_64.f90!} ``` @@ -1210,7 +1210,7 @@ function for character strings. ##### Example ```fortran -{!src/examples/hash_procedures/example_fnv_1a_hash_64.f90!} +{!example/hash_procedures/example_fnv_1a_hash_64.f90!} ``` @@ -1370,7 +1370,7 @@ function for character strings. ##### Example ```fortran -{!src/examples/hash_procedures/example_pengy_hash.f90!} +{!example/hash_procedures/example_pengy_hash.f90!} ``` @@ -1420,7 +1420,7 @@ and has no known bad seeds. ##### Example ```fortran -{!src/examples/hash_procedures/example_spooky_hash.f90!} +{!example/hash_procedures/example_spooky_hash.f90!} ``` #### `universal_mult_hash` - maps an integer to a smaller number of bits @@ -1469,7 +1469,7 @@ It multiplies the `key` by `seed`, and returns the ```fortran -{!src/examples/hash_procedures/example_universal_mult_hash_64.f90!} +{!example/hash_procedures/example_universal_mult_hash_64.f90!} ``` diff --git a/doc/specs/stdlib_hashmaps.md b/doc/specs/stdlib_hashmaps.md index d7e452862..65dfb1351 100644 --- a/doc/specs/stdlib_hashmaps.md +++ b/doc/specs/stdlib_hashmaps.md @@ -227,7 +227,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_copy_key.f90!} +{!example/hashmaps/example_hashmaps_copy_key.f90!} ``` #### `copy_other` - Returns a copy of the other data @@ -259,7 +259,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_copy_other.f90!} +{!example/hashmaps/example_hashmaps_copy_other.f90!} ``` @@ -325,7 +325,7 @@ expected to be minor compared to its faster hashing rate. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_fnv_1_hasher.f90!} +{!example/hashmaps/example_hashmaps_fnv_1_hasher.f90!} ``` @@ -377,7 +377,7 @@ expected to be minor compared to its faster hashing rate. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_fnv_1a_hasher.f90!} +{!example/hashmaps/example_hashmaps_fnv_1a_hasher.f90!} ``` #### `free_key` - frees the memory associated with a key @@ -407,7 +407,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_free_key.f90!} +{!example/hashmaps/example_hashmaps_free_key.f90!} ``` #### `free_other` - frees the memory associated with other data @@ -437,7 +437,7 @@ is an `intent(out)` argument. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_free_other.f90!} +{!example/hashmaps/example_hashmaps_free_other.f90!} ``` @@ -481,7 +481,7 @@ an allocatable of `class(*)`. It is an `intent(out)` argument. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_get.f90!} +{!example/hashmaps/example_hashmaps_get.f90!} ``` @@ -525,7 +525,7 @@ pointers intended for use as a hash function for the hash maps. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_hasher_fun.f90!} +{!example/hashmaps/example_hashmaps_hasher_fun.f90!} ``` #### `operator(==)` - Compares two keys for equality @@ -565,7 +565,7 @@ The result is `.true.` if the keys are equal, otherwise `.falss.`. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_equal_keys.f90!} +{!example/hashmaps/example_hashmaps_equal_keys.f90!} ``` #### `seeded_nmhash32_hasher`- calculates a hash code from a key @@ -615,7 +615,7 @@ This code passes the SMHasher tests. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90!} +{!example/hashmaps/example_hashmaps_seeded_nmhash32_hasher.f90!} ``` #### `seeded_nmhash32x_hasher`- calculates a hash code from a key @@ -664,7 +664,7 @@ This code passes the SMHasher tests. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90!} +{!example/hashmaps/example_hashmaps_seeded_nmhash32x_hasher.f90!} ``` #### `seeded_water_hasher`- calculates a hash code from a key @@ -714,7 +714,7 @@ This code passes the SMHasher tests. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_seeded_water_hasher.f90!} +{!example/hashmaps/example_hashmaps_seeded_water_hasher.f90!} ``` @@ -763,7 +763,7 @@ value to an `int8` vector. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_set.f90!} +{!example/hashmaps/example_hashmaps_set.f90!} ``` @@ -1209,7 +1209,7 @@ The result will be the number of procedure calls on the hash map. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_calls.f90!} +{!example/hashmaps/example_hashmaps_calls.f90!} ``` @@ -1247,7 +1247,7 @@ The result will be the number of entries in the hash map. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_entries.f90!} +{!example/hashmaps/example_hashmaps_entries.f90!} ``` @@ -1295,7 +1295,7 @@ undefined. ```fortran -{!src/examples/hashmaps/example_hashmaps_get_other_data.f90!} +{!example/hashmaps/example_hashmaps_get_other_data.f90!} ``` @@ -1358,7 +1358,7 @@ has the value `alloc_fault`. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_init.f90!} +{!example/hashmaps/example_hashmaps_init.f90!} ``` @@ -1400,7 +1400,7 @@ is being examined. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_key_test.f90!} +{!example/hashmaps/example_hashmaps_key_test.f90!} ``` @@ -1440,7 +1440,7 @@ number of slots in the hash map. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_loading.f90!} +{!example/hashmaps/example_hashmaps_loading.f90!} ``` #### `map_entry` - inserts an entry into the hash map @@ -1490,7 +1490,7 @@ is ignored. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_map_entry.f90!} +{!example/hashmaps/example_hashmaps_map_entry.f90!} ``` #### `map_probes` - returns the number of hash map probes @@ -1529,7 +1529,7 @@ rehashing. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_probes.f90!} +{!example/hashmaps/example_hashmaps_probes.f90!} ``` #### `num_slots` - returns the number of hash map slots. @@ -1567,7 +1567,7 @@ The result is the number of slots in `map`. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_num_slots.f90!} +{!example/hashmaps/example_hashmaps_num_slots.f90!} ``` @@ -1602,7 +1602,7 @@ It is the hash method to be used by `map`. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_rehash.f90!} +{!example/hashmaps/example_hashmaps_rehash.f90!} ``` #### `remove` - removes an entry from the hash map @@ -1643,7 +1643,7 @@ absent, the procedure returns with no entry with the given key. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_remove.f90!} +{!example/hashmaps/example_hashmaps_remove.f90!} ``` #### `set_other_data` - replaces the other data for an entry @@ -1690,7 +1690,7 @@ not exist and nothing was done. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_set_other_data.f90!} +{!example/hashmaps/example_hashmaps_set_other_data.f90!} ``` #### `slots_bits` - returns the number of bits used to address the hash map slots @@ -1728,7 +1728,7 @@ The result is the number of bits used in addressing the slots in `map`. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_slots_bits.f90!} +{!example/hashmaps/example_hashmaps_slots_bits.f90!} ``` @@ -1769,5 +1769,5 @@ from their slot index the map. ##### Example ```fortran -{!src/examples/hashmaps/example_hashmaps_total_depth.f90!} +{!example/hashmaps/example_hashmaps_total_depth.f90!} ``` diff --git a/doc/specs/stdlib_io.md b/doc/specs/stdlib_io.md index 238c73ed5..3ed75d638 100644 --- a/doc/specs/stdlib_io.md +++ b/doc/specs/stdlib_io.md @@ -36,7 +36,7 @@ Returns an allocated rank-2 `array` with the content of `filename`. ### Example ```fortran -{!src/examples/io/example_loadtxt.f90!} +{!example/io/example_loadtxt.f90!} ``` @@ -86,7 +86,7 @@ The result is a scalar of type `integer`. ### Example ```fortran -{!src/examples/io/example_open.f90!} +{!example/io/example_open.f90!} ``` @@ -116,7 +116,7 @@ Provides a text file called `filename` that contains the rank-2 `array`. ### Example ```fortran -{!src/examples/io/example_savetxt.f90!} +{!example/io/example_savetxt.f90!} ``` @@ -157,7 +157,7 @@ Returns an allocated `array` with the content of `filename` in case of success. ### Example ```fortran -{!src/examples/io/example_loadnpy.f90!} +{!example/io/example_loadnpy.f90!} ``` @@ -198,7 +198,7 @@ Provides a npy file called `filename` that contains the rank-2 `array`. ### Example ```fortran -{!src/examples/io/example_savenpy.f90!} +{!example/io/example_savenpy.f90!} ``` ## `getline` @@ -236,7 +236,7 @@ Read a whole line from a formatted unit into a string variable ### Example ```fortran -{!src/examples/io/example_getline.f90!} +{!example/io/example_getline.f90!} ``` ## Formatting constants @@ -253,5 +253,5 @@ Provides formats for all kinds as defined in the `stdlib_kinds` module. ### Example ```fortran -{!src/examples/io/example_fmt_constants.f90!} +{!example/io/example_fmt_constants.f90!} ``` diff --git a/doc/specs/stdlib_linalg.md b/doc/specs/stdlib_linalg.md index 4a415529b..f7569e0c6 100644 --- a/doc/specs/stdlib_linalg.md +++ b/doc/specs/stdlib_linalg.md @@ -33,23 +33,23 @@ Returns a diagonal array or a vector with the extracted diagonal elements. ### Example ```fortran -{!src/examples/linalg/example_diag1.f90!} +{!example/linalg/example_diag1.f90!} ``` ```fortran -{!src/examples/linalg/example_diag2.f90!} +{!example/linalg/example_diag2.f90!} ``` ```fortran -{!src/examples/linalg/example_diag3.f90!} +{!example/linalg/example_diag3.f90!} ``` ```fortran -{!src/examples/linalg/example_diag4.f90!} +{!example/linalg/example_diag4.f90!} ``` ```fortran -{!src/examples/linalg/example_diag5.f90!} +{!example/linalg/example_diag5.f90!} ``` ## `eye` - Construct the identity matrix @@ -96,11 +96,11 @@ A = eye(2,2)/2.0 !! A == diag([0.5, 0.5]) ### Example ```fortran -{!src/examples/linalg/example_eye1.f90!} +{!example/linalg/example_eye1.f90!} ``` ```fortran -{!src/examples/linalg/example_eye2.f90!} +{!example/linalg/example_eye2.f90!} ``` ## `trace` - Trace of a matrix @@ -127,7 +127,7 @@ Returns the trace of the matrix, i.e. the sum of diagonal elements. ### Example ```fortran -{!src/examples/linalg/example_trace.f90!} +{!example/linalg/example_trace.f90!} ``` ## `outer_product` - Computes the outer product of two vectors @@ -157,7 +157,7 @@ Returns a rank-2 array equal to `u v^T` (where `u, v` are considered column vect ### Example ```fortran -{!src/examples/linalg/example_outer_product.f90!} +{!example/linalg/example_outer_product.f90!} ``` ## `is_square` - Checks if a matrix is square @@ -185,7 +185,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is square, and ` ### Example ```fortran -{!src/examples/linalg/example_is_square.f90!} +{!example/linalg/example_is_square.f90!} ``` ## `is_diagonal` - Checks if a matrix is diagonal @@ -214,7 +214,7 @@ Note that nonsquare matrices may be diagonal, so long as `a_ij = 0` when `i /= j ### Example ```fortran -{!src/examples/linalg/example_is_diagonal.f90!} +{!example/linalg/example_is_diagonal.f90!} ``` ## `is_symmetric` - Checks if a matrix is symmetric @@ -242,7 +242,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is symmetric, an ### Example ```fortran -{!src/examples/linalg/example_is_symmetric.f90!} +{!example/linalg/example_is_symmetric.f90!} ``` ## `is_skew_symmetric` - Checks if a matrix is skew-symmetric @@ -270,7 +270,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is skew-symmetri ### Example ```fortran -{!src/examples/linalg/example_is_skew_symmetric.f90!} +{!example/linalg/example_is_skew_symmetric.f90!} ``` ## `is_hermitian` - Checks if a matrix is Hermitian @@ -298,7 +298,7 @@ Returns a `logical` scalar that is `.true.` if the input matrix is Hermitian, an ### Example ```fortran -{!src/examples/linalg/example_is_hermitian.f90!} +{!example/linalg/example_is_hermitian.f90!} ``` ## `is_triangular` - Checks if a matrix is triangular @@ -330,7 +330,7 @@ Specifically, upper triangular matrices satisfy `a_ij = 0` when `j < i`, and low ### Example ```fortran -{!src/examples/linalg/example_is_triangular.f90!} +{!example/linalg/example_is_triangular.f90!} ``` ## `is_hessenberg` - Checks if a matrix is hessenberg @@ -362,5 +362,5 @@ Specifically, upper Hessenberg matrices satisfy `a_ij = 0` when `j < i-1`, and l ### Example ```fortran -{!src/examples/linalg/example_is_hessenberg.f90!} +{!example/linalg/example_is_hessenberg.f90!} ``` diff --git a/doc/specs/stdlib_logger.md b/doc/specs/stdlib_logger.md index e9d5221d4..7e6cf6c8e 100644 --- a/doc/specs/stdlib_logger.md +++ b/doc/specs/stdlib_logger.md @@ -195,7 +195,7 @@ an `intent(in)` argument. It shall be the name of the file to be opened. #### Example ```fortran -{!src/examples/logger/example_global_logger.f90!} +{!example/logger/example_global_logger.f90!} ``` ### `add_log_unit` - add a unit to the array `self % log_units` @@ -251,7 +251,7 @@ to `unit`. #### Example ```fortran -{!src/examples/logger/example_add_log_unit.f90!} +{!example/logger/example_add_log_unit.f90!} ``` ### `configuration` - report a logger's configuration @@ -378,7 +378,7 @@ Pure subroutine #### Example ```fortran -{!src/examples/logger/example_configure.f90!} +{!example/logger/example_configure.f90!} ``` ### `log_debug` - Writes the string `message` to `self % log_units` @@ -668,7 +668,7 @@ Subroutine #### Example ```fortran -{!src/examples/logger/example_log_io_error.f90!} +{!example/logger/example_log_io_error.f90!} ``` ### `log_message` - write the string `message` to `self % log_units` @@ -817,7 +817,7 @@ Subroutine #### Example ```fortran -{!src/examples/logger/example_log_text_error.f90!} +{!example/logger/example_log_text_error.f90!} ``` ### `log_units_assigned` - returns the number of active I/O units diff --git a/doc/specs/stdlib_math.md b/doc/specs/stdlib_math.md index a9f44ee8c..eb7b7cc2f 100644 --- a/doc/specs/stdlib_math.md +++ b/doc/specs/stdlib_math.md @@ -51,14 +51,14 @@ The output is a scalar of `type` and `kind` same as to that of the arguments. Here inputs are of type `integer` and kind `int32` ```fortran -{!src/examples/math/example_clip_integer.f90!} +{!example/math/example_clip_integer.f90!} ``` ##### Example 2: Here inputs are of type `real` and kind `sp` ```fortran -{!src/examples/math/example_clip_real.f90!} +{!example/math/example_clip_real.f90!} ``` ### `gcd` function @@ -95,7 +95,7 @@ Returns an integer of the same `kind` as that of the arguments. ##### Example 1: ```fortran -{!src/examples/math/example_gcd.f90!} +{!example/math/example_gcd.f90!} ``` ### `linspace` - Create a linearly spaced rank one array @@ -138,14 +138,14 @@ If `start`/`end` are `integer` types, the `result` will default to a `real(dp)` Here inputs are of type `complex` and kind `dp` ```fortran -{!src/examples/math/example_linspace_complex.f90!} +{!example/math/example_linspace_complex.f90!} ``` ##### Example 2: Here inputs are of type `integer` and kind `int16`, with the result defaulting to `real(dp)`. ```fortran -{!src/examples/math/example_linspace_int16.f90!} +{!example/math/example_linspace_int16.f90!} ``` ### `logspace` - Create a logarithmically spaced rank one array @@ -207,21 +207,21 @@ For function calls where the `base` is specified, the `type` and `kind` of the r Here inputs are of type `complex` and kind `dp`. `n` and `base` is not specified and thus default to 50 and 10, respectively. ```fortran -{!src/examples/math/example_logspace_complex.f90!} +{!example/math/example_logspace_complex.f90!} ``` ##### Example 2: Here inputs are of type `integer` and default kind. `base` is not specified and thus defaults to 10. ```fortran -{!src/examples/math/example_logspace_int.f90!} +{!example/math/example_logspace_int.f90!} ``` ##### Example 3: Here `start`/`end` are of type `real` and double precision. `base` is type `complex` and also double precision. ```fortran -{!src/examples/math/example_logspace_rstart_cbase.f90!} +{!example/math/example_logspace_rstart_cbase.f90!} ``` ### `arange` function @@ -271,7 +271,7 @@ For `real` type arguments, the length of the result vector is `floor((end - star #### Example ```fortran -{!src/examples/math/example_math_arange.f90!} +{!example/math/example_math_arange.f90!} ``` ### `arg` function @@ -307,7 +307,7 @@ Notes: Although the angle of the complex number `0` is undefined, `arg((0,0))` r #### Example ```fortran -{!src/examples/math/example_math_arg.f90!} +{!example/math/example_math_arg.f90!} ``` ### `argd` function @@ -343,7 +343,7 @@ Notes: Although the angle of the complex number `0` is undefined, `argd((0,0))` #### Example ```fortran -{!src/examples/math/example_math_argd.f90!} +{!example/math/example_math_argd.f90!} ``` ### `argpi` function @@ -379,7 +379,7 @@ Notes: Although the angle of the complex number `0` is undefined, `argpi((0,0))` #### Example ```fortran -{!src/examples/math/example_math_argpi.f90!} +{!example/math/example_math_argpi.f90!} ``` ### `is_close` function @@ -439,7 +439,7 @@ Returns a `logical` scalar/array. #### Example ```fortran -{!src/examples/math/example_math_is_close.f90!} +{!example/math/example_math_is_close.f90!} ``` ### `all_close` function @@ -490,7 +490,7 @@ Returns a `logical` scalar. #### Example ```fortran -{!src/examples/math/example_math_all_close.f90!} +{!example/math/example_math_all_close.f90!} ``` ### `diff` function @@ -552,5 +552,5 @@ When both `prepend` and `append` are not present, the result `y` has one fewer e #### Example ```fortran -{!src/examples/math/example_diff.f90!} +{!example/math/example_diff.f90!} ``` diff --git a/doc/specs/stdlib_optval.md b/doc/specs/stdlib_optval.md index 79a1625eb..95e3972a0 100644 --- a/doc/specs/stdlib_optval.md +++ b/doc/specs/stdlib_optval.md @@ -35,5 +35,5 @@ If `x` is present, the result is `x`, otherwise the result is `default`. ### Example ```fortran -{!src/examples/optval/example_optval.f90!} +{!example/optval/example_optval.f90!} ``` diff --git a/doc/specs/stdlib_quadrature.md b/doc/specs/stdlib_quadrature.md index 579a0737d..a582bd42a 100644 --- a/doc/specs/stdlib_quadrature.md +++ b/doc/specs/stdlib_quadrature.md @@ -39,7 +39,7 @@ If the size of `y` is zero or one, the result is zero. ### Example ```fortran -{!src/examples/quadrature/example_trapz.f90!} +{!example/quadrature/example_trapz.f90!} ``` ## `trapz_weights` - trapezoidal rule weights for given abscissas @@ -69,7 +69,7 @@ If the size of `x` is one, then the sole element of the result is zero. ### Example ```fortran -{!src/examples/quadrature/example_trapz_weights.f90!} +{!example/quadrature/example_trapz_weights.f90!} ``` ## `simps` - integrate sampled values using Simpson's rule @@ -111,7 +111,7 @@ If the size of `y` is two, the result is the same as if `trapz` had been called ### Example ```fortran -{!src/examples/quadrature/example_simps.f90!} +{!example/quadrature/example_simps.f90!} ``` ## `simps_weights` - Simpson's rule weights for given abscissas @@ -147,7 +147,7 @@ If the size of `x` is two, then the result is the same as if `trapz_weights` had ### Example ```fortran -{!src/examples/quadrature/example_simps_weights.f90!} +{!example/quadrature/example_simps_weights.f90!} ``` ## `gauss_legendre` - Gauss-Legendre quadrature (a.k.a. Gaussian quadrature) nodes and weights @@ -185,7 +185,7 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -{!src/examples/quadrature/example_gauss_legendre.f90!} +{!example/quadrature/example_gauss_legendre.f90!} ``` ## `gauss_legendre_lobatto` - Gauss-Legendre-Lobatto quadrature nodes and weights @@ -223,5 +223,5 @@ If not specified, the default integral is -1 to 1. ### Example ```fortran -{!src/examples/quadrature/example_gauss_legendre_lobatto.f90!} +{!example/quadrature/example_gauss_legendre_lobatto.f90!} ``` diff --git a/doc/specs/stdlib_random.md b/doc/specs/stdlib_random.md index a82bab433..0bc72415a 100644 --- a/doc/specs/stdlib_random.md +++ b/doc/specs/stdlib_random.md @@ -33,7 +33,7 @@ Return a scalar of type `integer`. ### Example ```fortran -{!src/examples/random/example_random_seed.f90!} +{!example/random/example_random_seed.f90!} ``` ## `dist_rand` - Get a random integer with specified kind @@ -61,5 +61,5 @@ Return a scalar of type `integer`. ### Example ```fortran -{!src/examples/random/example_dist_rand.f90!} +{!example/random/example_dist_rand.f90!} ``` diff --git a/doc/specs/stdlib_selection.md b/doc/specs/stdlib_selection.md index 9eb7b6093..9f2772f2b 100644 --- a/doc/specs/stdlib_selection.md +++ b/doc/specs/stdlib_selection.md @@ -107,7 +107,7 @@ code here to be released under stdlib's MIT license. ### Example ```fortran -{!src/examples/selection/example_select.f90!} +{!example/selection/example_select.f90!} ``` ## `arg_select` - find the index of the k-th smallest value in an input array @@ -190,7 +190,7 @@ code here to be released under stdlib's MIT license. ```fortran -{!src/examples/selection/example_arg_select.f90!} +{!example/selection/example_arg_select.f90!} ``` ## Comparison with using `sort` @@ -201,7 +201,7 @@ should see a speed improvement with the selection routines which grows like LOG(size(`array`)). ```fortran -{!src/examples/selection/selection_vs_sort.f90!} +{!example/selection/selection_vs_sort.f90!} ``` The results seem consistent with expectations when the `array` is large; the program prints: diff --git a/doc/specs/stdlib_sorting.md b/doc/specs/stdlib_sorting.md index d2a90e9e6..59c484f1d 100644 --- a/doc/specs/stdlib_sorting.md +++ b/doc/specs/stdlib_sorting.md @@ -261,7 +261,7 @@ function `LGT`. ##### Example ```fortran -{!src/examples/sorting/example_ord_sort.f90!} +{!example/sorting/example_ord_sort.f90!} ``` #### `sort` - sorts an input array @@ -315,7 +315,7 @@ element of `array` is a `NaN`. Sorting of `CHARACTER(*)` and ```fortran -{!src/examples/sorting/example_sort.f90!} +{!example/sorting/example_sort.f90!} ``` #### `sort_index` - creates an array of sorting indices for an input array, while also sorting the array. diff --git a/doc/specs/stdlib_specialfunctions_gamma.md b/doc/specs/stdlib_specialfunctions_gamma.md index 3c1bf1ea1..7e83da715 100644 --- a/doc/specs/stdlib_specialfunctions_gamma.md +++ b/doc/specs/stdlib_specialfunctions_gamma.md @@ -38,7 +38,7 @@ The function returns a value with the same type and kind as input argument. ### Example ```fortran -{!src/examples/specialfunctions_gamma/example_gamma.f90!} +{!example/specialfunctions_gamma/example_gamma.f90!} ``` ## `log_gamma` - Calculate the natural logarithm of the gamma function @@ -72,7 +72,7 @@ The function returns real single precision values for integer input arguments, w ### Example ```fortran -{!src/examples/specialfunctions_gamma/example_log_gamma.f90!} +{!example/specialfunctions_gamma/example_log_gamma.f90!} ``` ## `log_factorial` - calculate the logarithm of a factorial @@ -103,7 +103,7 @@ The function returns real type values with single precision. ### Example ```fortran -{!src/examples/specialfunctions_gamma/example_log_factorial.f90!} +{!example/specialfunctions_gamma/example_log_factorial.f90!} ``` ## `lower_incomplete_gamma` - calculate lower incomplete gamma integral @@ -140,7 +140,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!src/examples/specialfunctions_gamma/example_ligamma.f90!} +{!example/specialfunctions_gamma/example_ligamma.f90!} ``` ## `upper_incomplete_gamma` - calculate the upper incomplete gamma integral @@ -177,7 +177,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!src/examples/specialfunctions_gamma/example_uigamma.f90!} +{!example/specialfunctions_gamma/example_uigamma.f90!} ``` ## `log_lower_incomplete_gamma` - calculate the natural logarithm of the lower incomplete gamma integral @@ -272,7 +272,7 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!src/examples/specialfunctions_gamma/example_gamma_p.f90!} +{!example/specialfunctions_gamma/example_gamma_p.f90!} ``` ## `regularized_gamma_q` - calculate the gamma quotient Q @@ -309,5 +309,5 @@ The function returns a real type value with the same kind as argument x. ### Example ```fortran -{!src/examples/specialfunctions_gamma/example_gamma_q.f90!} +{!example/specialfunctions_gamma/example_gamma_q.f90!} ``` diff --git a/doc/specs/stdlib_stats.md b/doc/specs/stdlib_stats.md index f8ba6da19..c79f218fd 100644 --- a/doc/specs/stdlib_stats.md +++ b/doc/specs/stdlib_stats.md @@ -52,7 +52,7 @@ If `mask` is specified, the result is the Pearson correlation of all elements of ### Example ```fortran -{!src/examples/stats/example_corr.f90!} +{!example/stats/example_corr.f90!} ``` ## `cov` - covariance of array elements @@ -108,7 +108,7 @@ If `mask` is specified, the result is the covariance of all elements of `array` ### Example ```fortran -{!src/examples/stats/example_cov.f90!} +{!example/stats/example_cov.f90!} ``` ## `mean` - mean of array elements @@ -151,7 +151,7 @@ If `mask` is specified, the result is the mean of all elements of `array` corres ### Example ```fortran -{!src/examples/stats/example_mean.f90!} +{!example/stats/example_mean.f90!} ``` ## `median` - median of array elements @@ -216,7 +216,7 @@ If `mask` is specified, the result is the median of all elements of `array` corr ### Example ```fortran -{!src/examples/stats/example_median.f90!} +{!example/stats/example_median.f90!} ``` ## `moment` - central moments of array elements @@ -280,7 +280,7 @@ If `mask` is specified, the result is the _k_-th (central) moment of all elemen ### Example ```fortran -{!src/examples/stats/example_moment.f90!} +{!example/stats/example_moment.f90!} ``` ## `var` - variance of array elements @@ -338,5 +338,5 @@ If the variance is computed with only one single element, then the result is IEE ### Example ```fortran -{!src/examples/stats/example_var.f90!} +{!example/stats/example_var.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_exponential.md b/doc/specs/stdlib_stats_distribution_exponential.md index e1b82aed7..4be87df65 100644 --- a/doc/specs/stdlib_stats_distribution_exponential.md +++ b/doc/specs/stdlib_stats_distribution_exponential.md @@ -46,7 +46,7 @@ The result is a scalar or rank one array with a size of `array_size`, and has th ### Example ```fortran -{!src/examples/stats_distribution_exponential/example_exponential_rvs.f90!} +{!example/stats_distribution_exponential/example_exponential_rvs.f90!} ``` ## `pdf_exp` - exponential distribution probability density function @@ -90,7 +90,7 @@ The result is a scalar or an array, with a shape conformable to arguments, and h ### Example ```fortran -{!src/examples/stats_distribution_exponential/example_exponential_pdf.f90!} +{!example/stats_distribution_exponential/example_exponential_pdf.f90!} ``` ## `cdf_exp` - exponential cumulative distribution function @@ -134,5 +134,5 @@ The result is a scalar or an array, with a shape conformable to arguments, and h ### Example ```fortran -{!src/examples/stats_distribution_exponential/example_exponential_cdf.f90!} +{!example/stats_distribution_exponential/example_exponential_cdf.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_normal.md b/doc/specs/stdlib_stats_distribution_normal.md index c2a0c9b50..20d8b5956 100644 --- a/doc/specs/stdlib_stats_distribution_normal.md +++ b/doc/specs/stdlib_stats_distribution_normal.md @@ -49,7 +49,7 @@ The result is a scalar or rank one array, with a size of `array_size`, and as th ### Example ```fortran -{!src/examples/stats_distribution_normal/example_normal_rvs.f90!} +{!example/stats_distribution_normal/example_normal_rvs.f90!} ``` ## `pdf_normal` - normal distribution probability density function @@ -93,7 +93,7 @@ The result is a scalar or an array, with a shape conformable to arguments, and a ### Example ```fortran -{!src/examples/stats_distribution_normal/example_normal_pdf.f90!} +{!example/stats_distribution_normal/example_normal_pdf.f90!} ``` ## `cdf_normal` - normal distribution cumulative distribution function @@ -137,5 +137,5 @@ The result is a scalar or an array, with a shape conformable to arguments, as th ### Example ```fortran -{!src/examples/stats_distribution_normal/example_norm_cdf.f90!} +{!example/stats_distribution_normal/example_norm_cdf.f90!} ``` diff --git a/doc/specs/stdlib_stats_distribution_uniform.md b/doc/specs/stdlib_stats_distribution_uniform.md index 3023bcd74..3d8882cbd 100644 --- a/doc/specs/stdlib_stats_distribution_uniform.md +++ b/doc/specs/stdlib_stats_distribution_uniform.md @@ -35,7 +35,7 @@ Return a randomized rank one array of the input type. ### Example ```fortran -{!src/examples/stats_distribution_uniform/example_shuffle.f90!} +{!example/stats_distribution_uniform/example_shuffle.f90!} ``` ## `rvs_uniform` - uniform distribution random variates @@ -85,7 +85,7 @@ The result is a scalar or a rank one array with size of `array_size`, of type `i ### Example ```fortran -{!src/examples/stats_distribution_uniform/example_uniform_rvs.f90!} +{!example/stats_distribution_uniform/example_uniform_rvs.f90!} ``` ## `pdf_uniform` - Uniform distribution probability density function @@ -133,7 +133,7 @@ The result is a scalar or an array, with a shape conformable to arguments, of ty ### Example ```fortran -{!src/examples/stats_distribution_uniform/example_uniform_pdf.f90!} +{!example/stats_distribution_uniform/example_uniform_pdf.f90!} ``` ## `cdf_uniform` - Uniform distribution cumulative distribution function @@ -183,5 +183,5 @@ The result is a scalar or an array, with a shape conformable to arguments, of ty ### Example ```fortran -{!src/examples/stats_distribution_uniform/example_uniform_cdf.f90!} +{!example/stats_distribution_uniform/example_uniform_cdf.f90!} ``` diff --git a/doc/specs/stdlib_string_type.md b/doc/specs/stdlib_string_type.md index 7483d7ecf..a0444b442 100644 --- a/doc/specs/stdlib_string_type.md +++ b/doc/specs/stdlib_string_type.md @@ -67,7 +67,7 @@ The result is an instance of `string_type` with zero length. #### Example ```fortran -{!src/examples/string_type/example_constructor_empty.f90!} +{!example/string_type/example_constructor_empty.f90!} ``` @@ -105,7 +105,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!src/examples/string_type/example_constructor_scalar.f90!} +{!example/string_type/example_constructor_scalar.f90!} ``` @@ -139,7 +139,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!src/examples/string_type/example_constructor_integer.f90!} +{!example/string_type/example_constructor_integer.f90!} ``` @@ -173,7 +173,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!src/examples/string_type/example_constructor_logical.f90!} +{!example/string_type/example_constructor_logical.f90!} ``` @@ -202,7 +202,7 @@ Elemental subroutine, `assignment(=)`. #### Example ```fortran -{!src/examples/string_type/example_constructor_character.f90!} +{!example/string_type/example_constructor_character.f90!} ``` @@ -236,7 +236,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!src/examples/string_type/example_len.f90!} +{!example/string_type/example_len.f90!} ``` @@ -271,7 +271,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!src/examples/string_type/example_len_trim.f90!} +{!example/string_type/example_len_trim.f90!} ``` @@ -306,7 +306,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!src/examples/string_type/example_trim.f90!} +{!example/string_type/example_trim.f90!} ``` @@ -341,7 +341,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!src/examples/string_type/example_adjustl.f90!} +{!example/string_type/example_adjustl.f90!} ``` @@ -376,7 +376,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!src/examples/string_type/example_adjustr.f90!} +{!example/string_type/example_adjustr.f90!} ``` @@ -412,7 +412,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!src/examples/string_type/example_repeat.f90!} +{!example/string_type/example_repeat.f90!} ``` @@ -446,7 +446,7 @@ The result is a scalar character value. #### Example ```fortran -{!src/examples/string_type/example_char.f90!} +{!example/string_type/example_char.f90!} ``` @@ -481,7 +481,7 @@ The result is a scalar character value. #### Example ```fortran -{!src/examples/string_type/example_char_position.f90!} +{!example/string_type/example_char_position.f90!} ``` @@ -517,7 +517,7 @@ The result is a scalar character value. #### Example ```fortran -{!src/examples/string_type/example_char_range.f90!} +{!example/string_type/example_char_range.f90!} ``` @@ -554,7 +554,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!src/examples/string_type/example_ichar.f90!} +{!example/string_type/example_ichar.f90!} ``` @@ -591,7 +591,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!src/examples/string_type/example_iachar.f90!} +{!example/string_type/example_iachar.f90!} ``` @@ -631,7 +631,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!src/examples/string_type/example_index.f90!} +{!example/string_type/example_index.f90!} ``` @@ -671,7 +671,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!src/examples/string_type/example_scan.f90!} +{!example/string_type/example_scan.f90!} ``` @@ -711,7 +711,7 @@ The result is a default integer scalar value. #### Example ```fortran -{!src/examples/string_type/example_verify.f90!} +{!example/string_type/example_verify.f90!} ``` @@ -750,7 +750,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_lgt.f90!} +{!example/string_type/example_lgt.f90!} ``` @@ -789,7 +789,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_llt.f90!} +{!example/string_type/example_llt.f90!} ``` @@ -829,7 +829,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_lge.f90!} +{!example/string_type/example_lge.f90!} ``` @@ -869,7 +869,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_lle.f90!} +{!example/string_type/example_lle.f90!} ``` @@ -904,7 +904,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!src/examples/string_type/example_to_lower.f90!} +{!example/string_type/example_to_lower.f90!} ``` @@ -939,7 +939,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!src/examples/string_type/example_to_upper.f90!} +{!example/string_type/example_to_upper.f90!} ``` @@ -979,7 +979,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!src/examples/string_type/example_to_title.f90!} +{!example/string_type/example_to_title.f90!} ``` @@ -1016,7 +1016,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!src/examples/string_type/example_to_sentence.f90!} +{!example/string_type/example_to_sentence.f90!} ``` @@ -1050,7 +1050,7 @@ The result is a scalar `string_type` value. #### Example ```fortran -{!src/examples/string_type/example_reverse.f90!} +{!example/string_type/example_reverse.f90!} ``` @@ -1092,7 +1092,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_gt.f90!} +{!example/string_type/example_gt.f90!} ``` @@ -1134,7 +1134,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_lt.f90!} +{!example/string_type/example_lt.f90!} ``` @@ -1176,7 +1176,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_ge.f90!} +{!example/string_type/example_ge.f90!} ``` @@ -1218,7 +1218,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_le.f90!} +{!example/string_type/example_le.f90!} ``` @@ -1260,7 +1260,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_eq.f90!} +{!example/string_type/example_eq.f90!} ``` @@ -1302,7 +1302,7 @@ The result is a default logical scalar value. #### Example ```fortran -{!src/examples/string_type/example_ne.f90!} +{!example/string_type/example_ne.f90!} ``` @@ -1341,7 +1341,7 @@ The result is an instance of `string_type`. #### Example ```fortran -{!src/examples/string_type/example_cont.f90!} +{!example/string_type/example_cont.f90!} ``` @@ -1378,7 +1378,7 @@ Unformatted user defined derived type output. #### Example ```fortran -{!src/examples/string_type/example_uwrite.f90!} +{!example/string_type/example_uwrite.f90!} ``` @@ -1421,7 +1421,7 @@ Formatted user defined derived type output. #### Example ```fortran -{!src/examples/string_type/example_fwrite.f90!} +{!example/string_type/example_fwrite.f90!} ``` @@ -1460,7 +1460,7 @@ Unformatted derived type input. #### Example ```fortran -{!src/examples/string_type/example_uread.f90!} +{!example/string_type/example_uread.f90!} ``` @@ -1507,7 +1507,7 @@ Formatted derived type input. #### Example ```fortran -{!src/examples/string_type/example_fread.f90!} +{!example/string_type/example_fread.f90!} ``` @@ -1542,5 +1542,5 @@ Pure subroutine (Elemental subroutine, only when both `from` and `to` are `type( #### Example ```fortran -{!src/examples/string_type/example_move.f90!} +{!example/string_type/example_move.f90!} ``` diff --git a/doc/specs/stdlib_stringlist_type.md b/doc/specs/stdlib_stringlist_type.md index 74a9746eb..27f4f19c3 100644 --- a/doc/specs/stdlib_stringlist_type.md +++ b/doc/specs/stdlib_stringlist_type.md @@ -72,7 +72,7 @@ The result is of type `stringlist_index_type`. #### Example ```fortran -{!src/examples/stringlist_type/example_stringlist_type_fidx_bidx.f90!} +{!example/stringlist_type/example_stringlist_type_fidx_bidx.f90!} ``` @@ -108,7 +108,7 @@ The result is an instance of type `stringlist_type`. #### Example ```fortran -{!src/examples/stringlist_type/example_stringlist_type_constructor.f90!} +{!example/stringlist_type/example_stringlist_type_constructor.f90!} ``` @@ -142,7 +142,7 @@ Pure subroutine. #### Example ```fortran -{!src/examples/stringlist_type/example_stringlist_type_insert_at.f90!} +{!example/stringlist_type/example_stringlist_type_insert_at.f90!} ``` @@ -177,7 +177,7 @@ The result is a string of type `string_type`. #### Example ```fortran -{!src/examples/stringlist_type/example_stringlist_type_get.f90!} +{!example/stringlist_type/example_stringlist_type_get.f90!} ``` @@ -211,7 +211,7 @@ The result is of type `integer`. #### Example ```fortran -{!src/examples/stringlist_type/example_stringlist_type_len.f90!} +{!example/stringlist_type/example_stringlist_type_len.f90!} ``` @@ -241,7 +241,7 @@ No arguments. #### Example ```fortran -{!src/examples/stringlist_type/example_stringlist_type_clear.f90!} +{!example/stringlist_type/example_stringlist_type_clear.f90!} ``` @@ -283,7 +283,7 @@ The result is a default `logical` scalar value. #### Example ```fortran -{!src/examples/stringlist_type/example_stringlist_type_equality_operator.f90!} +{!example/stringlist_type/example_stringlist_type_equality_operator.f90!} ``` @@ -325,7 +325,7 @@ The result is a default `logical` scalar value. #### Example ```fortran -{!src/examples/stringlist_type/example_stringlist_type_inequality_operator.f90!} +{!example/stringlist_type/example_stringlist_type_inequality_operator.f90!} ``` @@ -365,5 +365,5 @@ The result is an instance of `[[stdlib_stringlist_type(module):stringlist_type(t #### Example ```fortran -{!src/examples/stringlist_type/example_stringlist_type_concatenate_operator.f90!} +{!example/stringlist_type/example_stringlist_type_concatenate_operator.f90!} ``` diff --git a/doc/specs/stdlib_strings.md b/doc/specs/stdlib_strings.md index e5af3bd1a..cb2c18c59 100644 --- a/doc/specs/stdlib_strings.md +++ b/doc/specs/stdlib_strings.md @@ -45,7 +45,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!src/examples/strings/example_strip.f90!} +{!example/strings/example_strip.f90!} ``` @@ -84,7 +84,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!src/examples/strings/example_chomp.f90!} +{!example/strings/example_chomp.f90!} ``` @@ -121,7 +121,7 @@ The result is of scalar logical type. #### Example ```fortran -{!src/examples/strings/example_starts_with.f90!} +{!example/strings/example_starts_with.f90!} ``` @@ -158,7 +158,7 @@ The result is of scalar logical type. #### Example ```fortran -{!src/examples/strings/example_ends_with.f90!} +{!example/strings/example_ends_with.f90!} ``` @@ -213,7 +213,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!src/examples/strings/example_slice.f90!} +{!example/strings/example_slice.f90!} ``` @@ -258,7 +258,7 @@ The result is a scalar of integer type or an integer array of rank equal to the #### Example ```fortran -{!src/examples/strings/example_find.f90!} +{!example/strings/example_find.f90!} ``` @@ -298,7 +298,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!src/examples/strings/example_replace_all.f90!} +{!example/strings/example_replace_all.f90!} ``` @@ -338,7 +338,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!src/examples/strings/example_padl.f90!} +{!example/strings/example_padl.f90!} ``` @@ -378,7 +378,7 @@ The result is of the same type as `string`. #### Example ```fortran -{!src/examples/strings/example_padr.f90!} +{!example/strings/example_padr.f90!} ``` @@ -418,7 +418,7 @@ The result is a scalar of integer type or an integer array of rank equal to the #### Example ```fortran -{!src/examples/strings/example_count.f90!} +{!example/strings/example_count.f90!} ``` @@ -457,5 +457,5 @@ The result is an `allocatable` length `character` scalar with up to `128` cached #### Example ```fortran -{!src/examples/strings/example_to_string.f90!} +{!example/strings/example_to_string.f90!} ``` diff --git a/doc/specs/stdlib_version.md b/doc/specs/stdlib_version.md index 25ede8a98..26ddc4927 100644 --- a/doc/specs/stdlib_version.md +++ b/doc/specs/stdlib_version.md @@ -54,5 +54,5 @@ Pure subroutine. #### Example ```fortran -{!src/examples/version/example_version.f90!} +{!example/version/example_version.f90!} ``` From d0aeb907e0bacb599c37aa1bce36579b25d537cb Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Sun, 31 Jul 2022 22:17:22 +0200 Subject: [PATCH 38/38] update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af54da6a8..a70d9f18f 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ cmake --build build --target test To test only the test suite, run ```sh -ctest --test-dir build/src/tests +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.