diff --git a/API-doc-FORD-file.md b/API-doc-FORD-file.md index 0db3e0a21..8aa447b3a 100644 --- a/API-doc-FORD-file.md +++ b/API-doc-FORD-file.md @@ -3,6 +3,7 @@ project: Fortran-lang/stdlib summary: A community driven standard library for (modern) Fortran src_dir: src include: src + include exclude_dir: src/tests output_dir: API-doc page_dir: doc diff --git a/CMakeLists.txt b/CMakeLists.txt index 26f49a428..4d3d2a1f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ list( "-DPROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}" "-DPROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR}" "-DPROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH}" + "-I${PROJECT_SOURCE_DIR}/include" ) add_subdirectory(src) diff --git a/README.md b/README.md index a70d9f18f..46c04fff9 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,21 @@ To use `stdlib` within your `fpm` project, add the following lines to your `fpm. stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm" } ``` +### Build with [fypp-script](https://github.com/fortran-lang/fpm/pull/729) + +Fortran Package Manager has a compiler wrapper `fypp-script` that can be used to compile stdlib without +switching to `stdlib-fpm` branch. + +```sh +git clone https://github.com/fortran-lang/fpm.git +``` + +``` +fpm run -- build --compiler "$PWD/fypp-gfortran.py" -C stdlib +``` + +**Note** : At this stage, building using `stdlib-fpm` branch should be the preferred way of using `stdlib` with `fpm`. + ## Using stdlib in your project The stdlib project exports CMake package files and pkg-config files to make stdlib usable for other projects. diff --git a/ci/fpm-deployment.sh b/ci/fpm-deployment.sh old mode 100644 new mode 100755 index bdd3c2b6e..a89ac41a4 --- a/ci/fpm-deployment.sh +++ b/ci/fpm-deployment.sh @@ -27,17 +27,14 @@ include=( # Files to remove from collection prune=( - "$destdir/test/test_always_fail.f90" - "$destdir/test/test_always_skip.f90" "$destdir/test/test_hash_functions.f90" - "$destdir/src/common.f90" "$destdir/src/f18estop.f90" ) major=$(cut -d. -f1 VERSION) minor=$(cut -d. -f2 VERSION) patch=$(cut -d. -f3 VERSION) -fyflags="${fyflags} -DPROJECT_VERSION_MAJOR=${major} -DPROJECT_VERSION_MINOR=${minor} -DPROJECT_VERSION_PATCH=${patch}" +fyflags="${fyflags} -DPROJECT_VERSION_MAJOR=${major} -DPROJECT_VERSION_MINOR=${minor} -DPROJECT_VERSION_PATCH=${patch} -I include" mkdir -p "$destdir/src" "$destdir/test" "$destdir/example" diff --git a/fpm.toml b/fpm.toml new file mode 100644 index 000000000..3960950af --- /dev/null +++ b/fpm.toml @@ -0,0 +1,16 @@ +name = "stdlib" + +[dev-dependencies] +test-drive.git = "https://github.com/fortran-lang/test-drive.git" + +[build] +auto-examples = false +auto-tests = true + +[preprocess.cpp] +macros = [ + "PROJECT_VERSION_MAJOR=0", + "PROJECT_VERSION_MINOR=1", + "PROJECT_VERSION_PATCH=0", + "MAXRANK=4", +] \ No newline at end of file diff --git a/src/common.fypp b/include/common.fypp similarity index 100% rename from src/common.fypp rename to include/common.fypp diff --git a/src/f08estop.f90 b/src/f08estop.f90 index 81c77f4a9..3fb044000 100644 --- a/src/f08estop.f90 +++ b/src/f08estop.f90 @@ -1,4 +1,4 @@ -submodule (stdlib_error) estop +submodule (stdlib_error) f08estop implicit none diff --git a/src/f18estop.f90 b/src/f18estop.f90 index 59fd0c97f..241665a36 100644 --- a/src/f18estop.f90 +++ b/src/f18estop.f90 @@ -1,4 +1,4 @@ -submodule (stdlib_error) estop +submodule (stdlib_error) f18estop implicit none @@ -26,4 +26,4 @@ endif end procedure -end submodule estop +end submodule f18estop diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index de332abb3..3519432a3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -10,11 +10,6 @@ macro(ADDTEST name) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endmacro(ADDTEST) -list( - APPEND fyppFlags - "-I${PROJECT_SOURCE_DIR}/src" -) - add_subdirectory(array) add_subdirectory(ascii) add_subdirectory(bitsets) @@ -34,8 +29,3 @@ add_subdirectory(system) add_subdirectory(quadrature) add_subdirectory(math) add_subdirectory(stringlist) - -ADDTEST(always_skip) -set_tests_properties(always_skip PROPERTIES SKIP_RETURN_CODE 77) -ADDTEST(always_fail) -set_tests_properties(always_fail PROPERTIES WILL_FAIL true) diff --git a/test/hash_functions/nmhash.c b/test/hash_functions/nmhash.c deleted file mode 100644 index 987bc568c..000000000 --- a/test/hash_functions/nmhash.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "nmhash.h" -int32_t nmhash32_test ( const void * key, size_t len, uint32_t seed ) { - return NMHASH32 (key, (const size_t) len, seed); -} - -int32_t nmhash32x_test ( const void * key, size_t len, uint32_t seed ) { - return NMHASH32X (key, (const size_t) len, seed); -} diff --git a/test/stats/test_mean_f03.fypp b/test/stats/test_mean_f03.fypp index 786438d98..0919572b8 100644 --- a/test/stats/test_mean_f03.fypp +++ b/test/stats/test_mean_f03.fypp @@ -4,7 +4,7 @@ #:set NRANK = 4 module test_stats_meanf03 - use testdrive, only : new_unittest, unittest_type, error_type, check + use testdrive, only : new_unittest, unittest_type, error_type, check, skip_test use stdlib_stats, only: mean use stdlib_kinds, only : int8, int16, int32, int64, sp, dp, xdp, qp use, intrinsic :: ieee_arithmetic, only : ieee_is_nan @@ -65,25 +65,36 @@ contains !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 call check(error, mean(d8_${k1}$), sum(real(d8_${k1}$, dp))/real(size(d8_${k1}$), dp)& , 'mean(d8_${k1}$): uncorrect answer'& , thr = dptol) if (allocated(error)) return + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_all_optmask_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 call check(error, ieee_is_nan(mean(d8_${k1}$, .false.))& , 'mean(d8_${k1}$, .false.): uncorrect answer') if (allocated(error)) return + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 #:for dim in range(1, 9) call check(error& , sum(abs(mean(d8_${k1}$, ${dim}$) -& @@ -92,12 +103,17 @@ contains ) if (allocated(error)) return #:endfor + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_optmask_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error - + + #:if MAXRANK > 7 call check(error, ieee_is_nan(mean(d1_${k1}$, 1, .false.))& , 'mean(d1_${k1}$, 1, .false.): uncorrect answer'& ) @@ -108,23 +124,33 @@ contains , 'mean(d8_${k1}$, ${dim}$, .false.): uncorrect answer') if (allocated(error)) return #:endfor + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_mask_all_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 call check(error, mean(d8_${k1}$, d8_${k1}$ > 0)& , sum(real(d8_${k1}$, dp), d8_${k1}$ > 0)/real(count(d8_${k1}$ > 0), dp)& , 'mean(d8_${k1}$, d8_${k1}$ > 0): uncorrect answer'& , thr = dptol) if (allocated(error)) return + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_mask_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 #:for dim in range(1, 9) call check(error& , sum(abs(mean(d8_${k1}$, ${dim}$, d8_${k1}$ > 0) -& @@ -133,6 +159,10 @@ contains ) if (allocated(error)) return #:endfor + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine #:endfor @@ -141,25 +171,36 @@ contains !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 call check(error, mean(d8_${k1}$), sum(d8_${k1}$)/real(size(d8_${k1}$), ${k1}$)& , 'mean(d8_${k1}$): uncorrect answer'& , thr = ${k1}$tol) if (allocated(error)) return + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_all_optmask_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 call check(error, ieee_is_nan(mean(d8_${k1}$, .false.))& , 'mean(d8_${k1}$, .false.): uncorrect answer') if (allocated(error)) return + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 #:for dim in range(1, 9) call check(error& , sum(abs(mean(d8_${k1}$, ${dim}$) -& @@ -168,34 +209,49 @@ contains ) if (allocated(error)) return #:endfor + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_optmask_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 #:for dim in range(1, 9) call check(error, any(ieee_is_nan(mean(d8_${k1}$, ${dim}$, .false.)))& , 'mean(d8_${k1}$, ${dim}$, .false.): uncorrect answer') if (allocated(error)) return #:endfor + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_mask_all_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error - + + #:if MAXRANK > 7 call check(error, mean(d8_${k1}$, d8_${k1}$ > 0)& , sum(d8_${k1}$, d8_${k1}$ > 0)/real(count(d8_${k1}$ > 0), ${k1}$)& , 'mean(d8_${k1}$, d8_${k1}$ > 0): uncorrect answer'& , thr = ${k1}$tol) if (allocated(error)) return + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_mask_${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 #:for dim in range(1, 9) call check(error& , sum(abs(mean(d8_${k1}$, ${dim}$, d8_${k1}$ > 0) -& @@ -204,6 +260,10 @@ contains ) if (allocated(error)) return #:endfor + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine #:endfor @@ -212,25 +272,36 @@ contains !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 call check(error, mean(d8_c${k1}$), sum(d8_c${k1}$)/real(size(d8_c${k1}$), ${k1}$)& , 'mean(d8_c${k1}$): uncorrect answer'& , thr = ${k1}$tol) if (allocated(error)) return + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_all_optmask_c${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 call check(error, ieee_is_nan(real(mean(d8_c${k1}$, .false.)))& , 'mean(d8_c${k1}$, .false.): uncorrect answer') if (allocated(error)) return + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_c${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 #:for dim in range(1, 9) call check(error& , sum(abs(mean(d8_c${k1}$, ${dim}$) -& @@ -239,34 +310,49 @@ contains ) if (allocated(error)) return #:endfor + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_optmask_c${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 #:for dim in range(1, 9) call check(error, any(ieee_is_nan(real(mean(d8_c${k1}$, ${dim}$, .false.))))& , 'mean(d8_c${k1}$, ${dim}$, .false.): uncorrect answer') if (allocated(error)) return #:endfor + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_mask_all_c${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 call check(error, mean(d8_c${k1}$, d8_c${k1}$%re > 0)& , sum(d8_c${k1}$, d8_c${k1}$%re > 0)/real(count(d8_c${k1}$%re > 0), ${k1}$)& , 'mean(d8_c${k1}$, d8_c${k1}$%re > 0): uncorrect answer'& , thr = ${k1}$tol) if (allocated(error)) return + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine subroutine test_stats_meanf03_mask_c${k1}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error + #:if MAXRANK > 7 #:for dim in range(1, 9) call check(error& , sum(abs(mean(d8_c${k1}$, ${dim}$, d8_c${k1}$%re > 0) -& @@ -275,6 +361,10 @@ contains ) if (allocated(error)) return #:endfor + + #:else + call skip_test(error, "Rank > 7 is not supported") + #:endif end subroutine #:endfor diff --git a/test/test_always_fail.f90 b/test/test_always_fail.f90 deleted file mode 100644 index c52b5788d..000000000 --- a/test/test_always_fail.f90 +++ /dev/null @@ -1,8 +0,0 @@ -program test_always_fail - -use stdlib_error, only: check -implicit none - -call check(.false.) - -end program diff --git a/test/test_always_skip.f90 b/test/test_always_skip.f90 deleted file mode 100644 index 2d10c3daa..000000000 --- a/test/test_always_skip.f90 +++ /dev/null @@ -1,8 +0,0 @@ -program test_always_skip - -use stdlib_error, only: check -implicit none - -call check(.false., code=77) - -end program