From b718f78a6d531f101d7c83b8d56311b7d47abb7b Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sat, 13 Nov 2021 15:53:49 +0100 Subject: [PATCH 1/9] Make support for quadruple precision optional - use checks in CMake to automatically determine whether quadruple precision is available - default to values in kind we run from the manual makefile don't want to run checks - skip all tests explicitly referencing the quadruple precision kind parameter - add check for extended double precision (available with GCC) --- CMakeLists.txt | 1 - config/CMakeLists.txt | 18 +++++++ config/template.cmake | 3 ++ doc/specs/stdlib_kinds.md | 13 +++-- src/CMakeLists.txt | 6 +++ src/common.fypp | 26 ++++++++- src/stdlib_io.fypp | 4 +- src/stdlib_kinds.f90 | 36 ++++++++----- src/stdlib_linalg.fypp | 2 +- src/stdlib_math.fypp | 2 +- src/stdlib_optval.fypp | 2 +- src/stdlib_quadrature.fypp | 2 +- src/stdlib_sorting.fypp | 1 + src/stdlib_specialfunctions.f90 | 2 +- src/stdlib_stats.fypp | 2 +- src/stdlib_strings.fypp | 2 +- src/tests/CMakeLists.txt | 5 ++ src/tests/io/CMakeLists.txt | 7 +++ src/tests/io/Makefile.manual | 12 +++-- ...st_loadtxt_qp.f90 => test_loadtxt_qp.fypp} | 14 +++++ ...st_savetxt_qp.f90 => test_savetxt_qp.fypp} | 10 ++++ src/tests/linalg/CMakeLists.txt | 6 +++ src/tests/linalg/Makefile.manual | 8 ++- .../{test_linalg.f90 => test_linalg.fypp} | 30 ++++++++++- src/tests/math/CMakeLists.txt | 8 ++- src/tests/math/Makefile.manual | 11 +++- ..._stdlib_math.f90 => test_stdlib_math.fypp} | 10 +++- src/tests/optval/CMakeLists.txt | 6 +++ src/tests/optval/Makefile.manual | 7 ++- .../{test_optval.f90 => test_optval.fypp} | 26 +++++++++ src/tests/quadrature/CMakeLists.txt | 7 +++ src/tests/quadrature/Makefile.manual | 12 +++-- .../{test_simps.f90 => test_simps.fypp} | 37 +++++++++++-- .../{test_trapz.f90 => test_trapz.fypp} | 17 +++++- src/tests/stats/CMakeLists.txt | 9 ---- src/tests/stats/Makefile.manual | 4 +- src/tests/stats/common.fypp | 54 ------------------- .../stats/test_distribution_uniform.fypp | 2 +- src/tests/stats/test_mean.fypp | 7 ++- src/tests/stats/test_mean_f03.fypp | 7 ++- src/tests/stats/test_median.fypp | 7 ++- 41 files changed, 332 insertions(+), 113 deletions(-) rename src/tests/io/{test_loadtxt_qp.f90 => test_loadtxt_qp.fypp} (91%) rename src/tests/io/{test_savetxt_qp.f90 => test_savetxt_qp.fypp} (94%) rename src/tests/linalg/{test_linalg.f90 => test_linalg.fypp} (97%) rename src/tests/math/{test_stdlib_math.f90 => test_stdlib_math.fypp} (97%) rename src/tests/optval/{test_optval.f90 => test_optval.fypp} (96%) rename src/tests/quadrature/{test_simps.f90 => test_simps.fypp} (95%) rename src/tests/quadrature/{test_trapz.f90 => test_trapz.fypp} (95%) delete mode 100644 src/tests/stats/common.fypp diff --git a/CMakeLists.txt b/CMakeLists.txt index 93731f8b3..27c5058c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,6 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) add_compile_options(-Wall) add_compile_options(-Wextra) add_compile_options(-Wimplicit-procedure) - add_compile_options(-Wconversion-extra) # -pedantic-errors triggers a false positive for optional arguments of elemental functions, # see test_optval and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446 if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0) diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index f215d39b4..8c554c8db 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -13,6 +13,24 @@ endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE) +# Check for available features +# Note: users can overwrite the automatic check by setting the value at configure time +include(CheckFortranSourceRuns) +if (NOT DEFINED WITH_QP) + check_fortran_source_runs( + "if (selected_real_kind(33) == -1) stop 1; end" + WITH_QP + ) +endif() +if (NOT DEFINED WITH_XDP) + set(WITH_QP ${WITH_QP} PARENT_SCOPE) + check_fortran_source_runs( + "if (any(selected_real_kind(18) == [-1, selected_real_kind(33)])) stop 1; end" + WITH_XDP + ) + set(WITH_XDP ${WITH_XDP} PARENT_SCOPE) +endif() + # Export a pkg-config file configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/template.pc" diff --git a/config/template.cmake b/config/template.cmake index 4746fe4d1..d01dafcce 100644 --- a/config/template.cmake +++ b/config/template.cmake @@ -1,5 +1,8 @@ @PACKAGE_INIT@ +set("@PROJECT_NAME@_WITH_QP" @WITH_QP@) +set("@PROJECT_NAME@_WITH_XDP" @WITH_XDP@) + if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@") include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") endif() diff --git a/doc/specs/stdlib_kinds.md b/doc/specs/stdlib_kinds.md index bafc526df..ba6e73c7f 100644 --- a/doc/specs/stdlib_kinds.md +++ b/doc/specs/stdlib_kinds.md @@ -16,17 +16,24 @@ The `stdlib_kinds` module provides kind parameters for the Fortran intrinsic dat ### `sp` -Alias for intrinsic named constant `real32` imported from `iso_fortran_env`. +Provides real kind parameter for floating point numbers with a minimal precision of 6 significant digits. ### `dp` -Alias for intrinsic named constant `real64` imported from `iso_fortran_env`. +Provides real kind parameter for floating point numbers with a minimal precision of 15 significant digits. + + +### `xdp` + +Provides real kind parameter for floating point numbers with a minimal precision of 18 significant digits. +If not available it has value `-1`. ### `qp` -Alias for intrinsic named constant `real128` imported from `iso_fortran_env`. +Provides real kind parameter for floating point numbers with a minimal precision of 33 significant digits. +If not available it has value `-1`. ### `int8` diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb9fb4fd8..94ac6a770 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -50,6 +50,12 @@ else() set(fyppFlags "-DVERSION90") endif() +list( + APPEND fyppFlags + "-DWITH_QP=$" + "-DWITH_XDP=$" +) + fypp_f90("${fyppFlags}" "${fppFiles}" outFiles) set(SRC diff --git a/src/common.fypp b/src/common.fypp index 0c6e86840..936c9a485 100644 --- a/src/common.fypp +++ b/src/common.fypp @@ -1,7 +1,23 @@ #:mute +#! Support for quadruple precision floating point numbers +#:if not defined("WITH_QP") +#:set WITH_QP = 0 +#:endif + +#! Support for extended double precision floating point numbers +#:if not defined("WITH_XDP") +#:set WITH_XDP = 0 +#:endif + #! Real kinds to be considered during templating -#:set REAL_KINDS = ["sp", "dp", "qp"] +#:set REAL_KINDS = ["sp", "dp"] +#:if WITH_XDP +#:set REAL_KINDS = REAL_KINDS + ["xdp"] +#:endif +#:if WITH_QP +#:set REAL_KINDS = REAL_KINDS + ["qp"] +#:endif #! Real types to be considered during templating #:set REAL_TYPES = ["real({})".format(k) for k in REAL_KINDS] @@ -10,7 +26,13 @@ #:set REAL_KINDS_TYPES = list(zip(REAL_KINDS, REAL_TYPES)) #! Complex kinds to be considered during templating -#:set CMPLX_KINDS = ["sp", "dp", "qp"] +#:set CMPLX_KINDS = ["sp", "dp"] +#:if WITH_XDP +#:set CMPLX_KINDS = CMPLX_KINDS + ["xdp"] +#:endif +#:if WITH_QP +#:set CMPLX_KINDS = CMPLX_KINDS + ["qp"] +#:endif #! Complex types to be considered during templating #:set CMPLX_TYPES = ["complex({})".format(k) for k in CMPLX_KINDS] diff --git a/src/stdlib_io.fypp b/src/stdlib_io.fypp index e451b7c4d..3fc42b873 100644 --- a/src/stdlib_io.fypp +++ b/src/stdlib_io.fypp @@ -6,7 +6,7 @@ module stdlib_io !! Provides a support for file handling !! ([Specification](../page/specs/stdlib_io.html)) - use stdlib_kinds, only: sp, dp, qp, & + use stdlib_kinds, only: sp, dp, xdp, qp, & int8, int16, int32, int64 use stdlib_error, only: error_stop use stdlib_optval, only: optval @@ -24,9 +24,11 @@ module stdlib_io FMT_INT = '(*(i0,1x))', & FMT_REAL_SP = '(*(es15.8e2,1x))', & FMT_REAL_DP = '(*(es24.16e3,1x))', & + FMT_REAL_XDP = '(*(es26.18e3,1x))', & FMT_REAL_QP = '(*(es44.35e4,1x))', & FMT_COMPLEX_SP = '(*(es15.8e2,1x,es15.8e2))', & FMT_COMPLEX_DP = '(*(es24.16e3,1x,es24.16e3))', & + FMT_COMPLEX_XDP = '(*(es26.18e3,1x,es26.18e3))', & FMT_COMPLEX_QP = '(*(es44.35e4,1x,es44.35e4))' interface loadtxt diff --git a/src/stdlib_kinds.f90 b/src/stdlib_kinds.f90 index 0ef3bf899..7ab23a9eb 100644 --- a/src/stdlib_kinds.f90 +++ b/src/stdlib_kinds.f90 @@ -1,14 +1,26 @@ +!> Version: experimental +!> +!> The specification of this module is available [here](../page/specs/stdlib_kinds.html). module stdlib_kinds -!! version: experimental -use iso_fortran_env, only: sp=>real32, dp=>real64, qp=>real128 -use iso_fortran_env, only: int8, int16, int32, int64 -use iso_c_binding, only: c_bool -! If we decide later to use iso_c_binding instead of iso_fortran_env: -!use iso_c_binding, only: sp=>c_float, dp=>c_double, qp=>c_float128 -!use iso_c_binding, only: int8=>c_int8_t, int16=>c_int16_t, int32=>c_int32_t, int64=>c_int64_t -implicit none -private -public sp, dp, qp, int8, int16, int32, int64, lk, c_bool - -integer, parameter :: lk = kind(.true.) + use iso_fortran_env, only: int8, int16, int32, int64 + use iso_c_binding, only: c_bool + implicit none + private + public :: sp, dp, xdp, qp, int8, int16, int32, int64, lk, c_bool + + !> Single precision real numbers + integer, parameter :: sp = selected_real_kind(6) + + !> Double precision real numbers + integer, parameter :: dp = selected_real_kind(15) + + !> Extended double precision real numbers + integer, parameter :: xdp = selected_real_kind(18) + + !> Quadruple precision real numbers + integer, parameter :: qp = selected_real_kind(33) + + !> Default logical kind parameter + integer, parameter :: lk = kind(.true.) + end module stdlib_kinds diff --git a/src/stdlib_linalg.fypp b/src/stdlib_linalg.fypp index 3faaeb9af..c309b71a2 100644 --- a/src/stdlib_linalg.fypp +++ b/src/stdlib_linalg.fypp @@ -3,7 +3,7 @@ module stdlib_linalg !!Provides a support for various linear algebra procedures !! ([Specification](../page/specs/stdlib_linalg.html)) - use stdlib_kinds, only: sp, dp, qp, & + use stdlib_kinds, only: sp, dp, xdp, qp, & int8, int16, int32, int64 use stdlib_optval, only: optval implicit none diff --git a/src/stdlib_math.fypp b/src/stdlib_math.fypp index 498e224a1..5bab7d703 100644 --- a/src/stdlib_math.fypp +++ b/src/stdlib_math.fypp @@ -3,7 +3,7 @@ #:set RC_KINDS_TYPES = REAL_KINDS_TYPES + CMPLX_KINDS_TYPES module stdlib_math - use stdlib_kinds, only: int8, int16, int32, int64, sp, dp, qp + use stdlib_kinds, only: int8, int16, int32, int64, sp, dp, xdp, qp use stdlib_optval, only: optval implicit none diff --git a/src/stdlib_optval.fypp b/src/stdlib_optval.fypp index c5019d7b7..f559e1d98 100644 --- a/src/stdlib_optval.fypp +++ b/src/stdlib_optval.fypp @@ -16,7 +16,7 @@ module stdlib_optval !! !! It is an error to call `optval` with a single actual argument. !! - use stdlib_kinds, only: sp, dp, qp, int8, int16, int32, int64 + use stdlib_kinds, only: sp, dp, xdp, qp, int8, int16, int32, int64 implicit none diff --git a/src/stdlib_quadrature.fypp b/src/stdlib_quadrature.fypp index 3f9550062..af7bd2369 100644 --- a/src/stdlib_quadrature.fypp +++ b/src/stdlib_quadrature.fypp @@ -1,7 +1,7 @@ #:include "common.fypp" module stdlib_quadrature !! ([Specification](../page/specs/stdlib_quadrature.html#description)) - use stdlib_kinds, only: sp, dp, qp + use stdlib_kinds, only: sp, dp, xdp, qp implicit none diff --git a/src/stdlib_sorting.fypp b/src/stdlib_sorting.fypp index 1f85a54cf..3ef5ca9ae 100644 --- a/src/stdlib_sorting.fypp +++ b/src/stdlib_sorting.fypp @@ -121,6 +121,7 @@ module stdlib_sorting int64, & sp, & dp, & + xdp, & qp use stdlib_optval, only: optval diff --git a/src/stdlib_specialfunctions.f90 b/src/stdlib_specialfunctions.f90 index 32859fe6d..a8f37bfac 100644 --- a/src/stdlib_specialfunctions.f90 +++ b/src/stdlib_specialfunctions.f90 @@ -1,5 +1,5 @@ module stdlib_specialfunctions - use stdlib_kinds, only: sp, dp, qp + use stdlib_kinds, only: sp, dp, xdp, qp implicit none diff --git a/src/stdlib_stats.fypp b/src/stdlib_stats.fypp index 038f27752..adf373f0a 100644 --- a/src/stdlib_stats.fypp +++ b/src/stdlib_stats.fypp @@ -7,7 +7,7 @@ module stdlib_stats !! Provides support for various statistical methods. This includes currently !! descriptive statistics !! ([Specification](../page/specs/stdlib_stats.html)) - use stdlib_kinds, only: sp, dp, qp, & + use stdlib_kinds, only: sp, dp, xdp, qp, & int8, int16, int32, int64 implicit none private diff --git a/src/stdlib_strings.fypp b/src/stdlib_strings.fypp index fdce00d01..367c08159 100644 --- a/src/stdlib_strings.fypp +++ b/src/stdlib_strings.fypp @@ -7,7 +7,7 @@ module stdlib_strings use stdlib_ascii, only: whitespace use stdlib_string_type, only: string_type, char, verify, repeat, len use stdlib_optval, only: optval - use stdlib_kinds, only: sp, dp, qp, int8, int16, int32, int64, lk, c_bool + use stdlib_kinds, only: sp, dp, xdp, qp, int8, int16, int32, int64, lk, c_bool implicit none private diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 826a01b10..290980533 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -10,6 +10,11 @@ macro(ADDTEST name) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endmacro(ADDTEST) +list( + APPEND fyppFlags + "-I${PROJECT_SOURCE_DIR}/src" +) + add_subdirectory(ascii) add_subdirectory(bitsets) add_subdirectory(io) diff --git a/src/tests/io/CMakeLists.txt b/src/tests/io/CMakeLists.txt index 68388a5e5..d9a8bc5fc 100644 --- a/src/tests/io/CMakeLists.txt +++ b/src/tests/io/CMakeLists.txt @@ -1,3 +1,10 @@ +set( + fppFiles + "test_loadtxt_qp.fypp" + "test_savetxt_qp.fypp" +) +fypp_f90("${fyppFlags}" "${fppFiles}" outFiles) + ADDTEST(loadtxt) ADDTEST(savetxt) diff --git a/src/tests/io/Makefile.manual b/src/tests/io/Makefile.manual index c50a735aa..7fd209fd1 100644 --- a/src/tests/io/Makefile.manual +++ b/src/tests/io/Makefile.manual @@ -1,9 +1,15 @@ +SRCFYPP = \ + test_loadtxt_qp.fypp \ + test_savetxt_qp.fypp + PROGS_SRC = test_loadtxt.f90 \ test_savetxt.f90 \ - test_loadtxt_qp.f90 \ - test_savetxt_qp.f90 \ test_parse_mode.f90 \ - test_open.f90 + test_open.f90 \ + $(SRCFYPP:.fypp=.f90) + +$(SRCFYPP): %.f90: %.fypp ../../common.fypp + fypp -I../.. $(FYPPFLAGS) $< $@ CLEAN_FILES = tmp*.dat io_open.dat io_open.stream diff --git a/src/tests/io/test_loadtxt_qp.f90 b/src/tests/io/test_loadtxt_qp.fypp similarity index 91% rename from src/tests/io/test_loadtxt_qp.f90 rename to src/tests/io/test_loadtxt_qp.fypp index ade20b633..11810ca91 100644 --- a/src/tests/io/test_loadtxt_qp.f90 +++ b/src/tests/io/test_loadtxt_qp.fypp @@ -1,3 +1,5 @@ +#:include "common.fypp" + module test_loadtxt_qp use stdlib_kinds, only: qp use stdlib_io, only: loadtxt, savetxt @@ -25,6 +27,7 @@ end subroutine collect_loadtxt_qp subroutine test_loadtxt_qp_(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP real(qp), allocatable :: input(:,:), expected(:,:) integer :: n @@ -39,6 +42,9 @@ subroutine test_loadtxt_qp_(error) call check(error, all(input == expected)) if (allocated(error)) return end do +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_loadtxt_qp_ @@ -46,6 +52,7 @@ end subroutine test_loadtxt_qp_ subroutine test_loadtxt_qp_huge(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP real(qp), allocatable :: input(:,:), expected(:,:) integer :: n @@ -60,6 +67,9 @@ subroutine test_loadtxt_qp_huge(error) call check(error, all(input == expected)) if (allocated(error)) return end do +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_loadtxt_qp_huge @@ -67,6 +77,7 @@ end subroutine test_loadtxt_qp_huge subroutine test_loadtxt_qp_tiny(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP real(qp), allocatable :: input(:,:), expected(:,:) integer :: n @@ -81,6 +92,9 @@ subroutine test_loadtxt_qp_tiny(error) call check(error, all(input == expected)) if (allocated(error)) return end do +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_loadtxt_qp_tiny diff --git a/src/tests/io/test_savetxt_qp.f90 b/src/tests/io/test_savetxt_qp.fypp similarity index 94% rename from src/tests/io/test_savetxt_qp.f90 rename to src/tests/io/test_savetxt_qp.fypp index d21d63c96..7dc74a07e 100644 --- a/src/tests/io/test_savetxt_qp.f90 +++ b/src/tests/io/test_savetxt_qp.fypp @@ -1,3 +1,5 @@ +#:include "common.fypp" + module test_savetxt_qp use stdlib_kinds, only: qp use stdlib_io, only: loadtxt, savetxt @@ -38,6 +40,7 @@ end function get_outpath subroutine test_rqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP real(qp) :: d(3, 2), e(2, 3) real(qp), allocatable :: d2(:, :) character(:), allocatable :: outpath @@ -59,12 +62,16 @@ subroutine test_rqp(error) if (allocated(error)) return call check(error, all(e == d2)) if (allocated(error)) return +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_rqp subroutine test_cqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP complex(qp) :: d(3, 2), e(2, 3) complex(qp), allocatable :: d2(:, :) character(:), allocatable :: outpath @@ -86,6 +93,9 @@ subroutine test_cqp(error) if (allocated(error)) return call check(error, all(e == d2)) if (allocated(error)) return +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_cqp end module test_savetxt_qp diff --git a/src/tests/linalg/CMakeLists.txt b/src/tests/linalg/CMakeLists.txt index f1098405b..d13abb213 100644 --- a/src/tests/linalg/CMakeLists.txt +++ b/src/tests/linalg/CMakeLists.txt @@ -1,2 +1,8 @@ +set( + fppFiles + "test_linalg.fypp" +) +fypp_f90("${fyppFlags}" "${fppFiles}" outFiles) + ADDTEST(linalg) diff --git a/src/tests/linalg/Makefile.manual b/src/tests/linalg/Makefile.manual index a95f600c7..05d2d9ddf 100644 --- a/src/tests/linalg/Makefile.manual +++ b/src/tests/linalg/Makefile.manual @@ -1,4 +1,10 @@ -PROGS_SRC = test_linalg.f90 +SRCFYPP = \ + test_linalg.fypp +PROGS_SRC = \ + $(SRCFYPP:.fypp=.f90) + +$(SRCFYPP): %.f90: %.fypp ../../common.fypp + fypp -I../.. $(FYPPFLAGS) $< $@ include ../Makefile.manual.test.mk diff --git a/src/tests/linalg/test_linalg.f90 b/src/tests/linalg/test_linalg.fypp similarity index 97% rename from src/tests/linalg/test_linalg.f90 rename to src/tests/linalg/test_linalg.fypp index cb78c2e61..96a0e9eed 100644 --- a/src/tests/linalg/test_linalg.f90 +++ b/src/tests/linalg/test_linalg.fypp @@ -1,13 +1,17 @@ +#:include "common.fypp" + module test_linalg use testdrive, only : new_unittest, unittest_type, error_type, check - use stdlib_kinds, only: sp, dp, qp, int8, int16, int32, int64 + use stdlib_kinds, only: sp, dp, xdp, qp, int8, int16, int32, int64 use stdlib_linalg, only: diag, eye, trace, outer_product implicit none real(sp), parameter :: sptol = 1000 * epsilon(1._sp) real(dp), parameter :: dptol = 1000 * epsilon(1._dp) +#:if WITH_QP real(qp), parameter :: qptol = 1000 * epsilon(1._qp) +#:endif @@ -169,6 +173,7 @@ subroutine test_diag_rqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 3 real(qp) :: v(n), a(n,n), b(n,n) integer :: i,j @@ -182,6 +187,9 @@ subroutine test_diag_rqp(error) call check(error, all(diag(3*a) == 3*v), & "all(diag(3*a) == 3*v) failed.") +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_diag_rqp subroutine test_diag_csp(error) @@ -223,6 +231,7 @@ subroutine test_diag_cqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 3 complex(qp) :: a(n,n) complex(qp), parameter :: i_ = cmplx(0,1,kind=qp) @@ -230,6 +239,9 @@ subroutine test_diag_cqp(error) a = diag([i_,i_],-1) + diag([i_,i_],1) call check(error, all(diag(a,-1) == i_) .and. all(diag(a,1) == i_), & "all(diag(a,-1) == i_) .and. all(diag(a,1) == i_) failed.") +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_diag_cqp subroutine test_diag_int8(error) @@ -394,6 +406,7 @@ subroutine test_trace_rqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 3 real(qp) :: a(n,n) integer :: i @@ -401,6 +414,9 @@ subroutine test_trace_rqp(error) a = reshape([(i,i=1,n**2)],[n,n]) call check(error, abs(trace(a) - sum(diag(a))) < qptol, & "abs(trace(a) - sum(diag(a))) < qptol failed.") +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_trace_rqp @@ -447,6 +463,7 @@ subroutine test_trace_cqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 3 complex(qp) :: a(n,n) complex(qp), parameter :: i_ = cmplx(0,1,kind=qp) @@ -454,6 +471,9 @@ subroutine test_trace_cqp(error) a = 3*eye(n) + 4*eye(n)*i_ ! pythagorean triple call check(error, abs(trace(a)) - 3*5.0_qp < qptol, & "abs(trace(a)) - 3*5.0_qp < qptol failed.") +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_trace_cqp @@ -558,6 +578,7 @@ subroutine test_outer_product_rqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 2 real(qp) :: u(n), v(n), expected(n,n), diff(n,n) @@ -567,6 +588,9 @@ subroutine test_outer_product_rqp(error) diff = expected - outer_product(u,v) call check(error, all(abs(diff) < qptol), & "all(abs(diff) < qptol) failed.") +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_outer_product_rqp subroutine test_outer_product_csp(error) @@ -603,6 +627,7 @@ subroutine test_outer_product_cqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 2 complex(qp) :: u(n), v(n), expected(n,n), diff(n,n) @@ -612,6 +637,9 @@ subroutine test_outer_product_cqp(error) diff = expected - outer_product(u,v) call check(error, all(abs(diff) < qptol), & "all(abs(diff) < qptol) failed.") +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_outer_product_cqp subroutine test_outer_product_int8(error) diff --git a/src/tests/math/CMakeLists.txt b/src/tests/math/CMakeLists.txt index 0bcaf1e1a..9d11bf765 100644 --- a/src/tests/math/CMakeLists.txt +++ b/src/tests/math/CMakeLists.txt @@ -1,4 +1,10 @@ +set( + fppFiles + "test_stdlib_math.fypp" +) +fypp_f90("${fyppFlags}" "${fppFiles}" outFiles) + ADDTEST(stdlib_math) ADDTEST(linspace) ADDTEST(logspace) -ADDTEST(math_arange) \ No newline at end of file +ADDTEST(math_arange) diff --git a/src/tests/math/Makefile.manual b/src/tests/math/Makefile.manual index f11cbf7a4..bed97da0d 100644 --- a/src/tests/math/Makefile.manual +++ b/src/tests/math/Makefile.manual @@ -1,5 +1,12 @@ -PROGS_SRC = test_stdlib_math.f90 test_linspace.f90 test_logspace.f90 \ - test_math_arange.f90 +SRCFYPP = \ + test_stdlib_math.fypp + +PROGS_SRC = test_linspace.f90 test_logspace.f90 \ + test_math_arange.f90 \ + $(SRCFYPP:.fypp=.f90) + +$(SRCFYPP): %.f90: %.fypp ../../common.fypp + fypp -I../.. $(FYPPFLAGS) $< $@ include ../Makefile.manual.test.mk diff --git a/src/tests/math/test_stdlib_math.f90 b/src/tests/math/test_stdlib_math.fypp similarity index 97% rename from src/tests/math/test_stdlib_math.f90 rename to src/tests/math/test_stdlib_math.fypp index 39b632267..842cc6086 100644 --- a/src/tests/math/test_stdlib_math.f90 +++ b/src/tests/math/test_stdlib_math.fypp @@ -3,7 +3,7 @@ module test_stdlib_math use testdrive, only : new_unittest, unittest_type, error_type, check use stdlib_math, only: clip - use stdlib_kinds, only: int8, int16, int32, int64, sp, dp, qp + use stdlib_kinds, only: int8, int16, int32, int64, sp, dp, xdp, qp implicit none public :: collect_stdlib_math @@ -174,23 +174,31 @@ end subroutine test_clip_rdp_bounds subroutine test_clip_rqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP ! type: real(qp), kind: qp ! valid test case call check(error, clip(3.025_qp, -5.77_qp, 3.025_qp), 3.025_qp) if (allocated(error)) return call check(error, clip(-55891546.2_qp, -8958133457.23_qp, -689712245.23_qp), -689712245.23_qp) if (allocated(error)) return +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_clip_rqp subroutine test_clip_rqp_bounds(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP ! invalid test case call check(error, clip(3.025_qp, 3.025_qp, -5.77_qp), 3.025_qp) if (allocated(error)) return call check(error, clip(-55891546.2_qp, -689712245.23_qp, -8958133457.23_qp), -689712245.23_qp) if (allocated(error)) return +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_clip_rqp_bounds diff --git a/src/tests/optval/CMakeLists.txt b/src/tests/optval/CMakeLists.txt index bb8291c74..e3b1d2241 100644 --- a/src/tests/optval/CMakeLists.txt +++ b/src/tests/optval/CMakeLists.txt @@ -1,3 +1,9 @@ +set( + fppFiles + "test_optval.fypp" +) +fypp_f90("${fyppFlags}" "${fppFiles}" outFiles) + ADDTEST(optval) # prevent false positive (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446) if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) diff --git a/src/tests/optval/Makefile.manual b/src/tests/optval/Makefile.manual index 79b41b2c9..4f4d0d3dc 100644 --- a/src/tests/optval/Makefile.manual +++ b/src/tests/optval/Makefile.manual @@ -1,4 +1,9 @@ -PROGS_SRC = test_optval.f90 +SRCFYPP = \ + test_optval.fypp +PROGS_SRC = \ + $(SRCFYPP:.fypp=.f90) +$(SRCFYPP): %.f90: %.fypp ../../common.fypp + fypp -I../.. $(FYPPFLAGS) $< $@ include ../Makefile.manual.test.mk diff --git a/src/tests/optval/test_optval.f90 b/src/tests/optval/test_optval.fypp similarity index 96% rename from src/tests/optval/test_optval.f90 rename to src/tests/optval/test_optval.fypp index c5eed1c99..9759421d9 100644 --- a/src/tests/optval/test_optval.f90 +++ b/src/tests/optval/test_optval.fypp @@ -1,3 +1,5 @@ +#:include "common.fypp" + module test_optval use, intrinsic :: iso_fortran_env, only: & sp => real32, dp => real64, qp => real128, & @@ -79,17 +81,23 @@ subroutine test_optval_rqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP call check(error, foo_qp(1.0_qp) == 1.0_qp) if (allocated(error)) return call check(error, foo_qp() == 2.0_qp) +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_optval_rqp +#:if WITH_QP function foo_qp(x) result(z) real(qp), intent(in), optional :: x real(qp) :: z z = optval(x, 2.0_qp) endfunction foo_qp +#:endif subroutine test_optval_csp(error) @@ -132,18 +140,24 @@ subroutine test_optval_cqp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP complex(qp) :: z1 z1 = cmplx(1.0_qp, 2.0_qp, kind=qp) call check(error, foo_cqp(z1) == z1) if (allocated(error)) return call check(error, foo_cqp() == z1) +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_optval_cqp +#:if WITH_QP function foo_cqp(x) result(z) complex(qp), intent(in), optional :: x complex(qp) :: z z = optval(x, cmplx(1.0_qp, 2.0_qp, kind=qp)) endfunction foo_cqp +#:endif subroutine test_optval_iint8(error) @@ -286,17 +300,23 @@ subroutine test_optval_rqp_arr(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP call check(error, all(foo_qp_arr([1.0_qp, -1.0_qp]) == [1.0_qp, -1.0_qp])) if (allocated(error)) return call check(error, all(foo_qp_arr() == [2.0_qp, -2.0_qp])) +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_optval_rqp_arr +#:if WITH_QP function foo_qp_arr(x) result(z) real(qp), dimension(2), intent(in), optional :: x real(qp), dimension(2) :: z z = optval(x, [2.0_qp, -2.0_qp]) end function foo_qp_arr +#:endif subroutine test_optval_csp_arr(error) @@ -343,20 +363,26 @@ subroutine test_optval_cqp_arr(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP complex(qp), dimension(2) :: z1, z2 z1 = cmplx(1.0_qp, 2.0_qp, kind=qp)*[1.0_qp, -1.0_qp] z2 = cmplx(2.0_qp, 2.0_qp, kind=qp)*[1.0_qp, -1.0_qp] call check(error, all(foo_cqp_arr(z1) == z1)) if (allocated(error)) return call check(error, all(foo_cqp_arr() == z2)) +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_optval_cqp_arr +#:if WITH_QP function foo_cqp_arr(x) result(z) complex(qp), dimension(2), intent(in), optional :: x complex(qp), dimension(2) :: z z = optval(x, cmplx(2.0_qp, 2.0_qp, kind=qp)*[1.0_qp, -1.0_qp]) end function foo_cqp_arr +#:endif subroutine test_optval_iint8_arr(error) diff --git a/src/tests/quadrature/CMakeLists.txt b/src/tests/quadrature/CMakeLists.txt index c8fc618db..39b5e9dcf 100644 --- a/src/tests/quadrature/CMakeLists.txt +++ b/src/tests/quadrature/CMakeLists.txt @@ -1,3 +1,10 @@ +set( + fppFiles + "test_simps.fypp" + "test_trapz.fypp" +) +fypp_f90("${fyppFlags}" "${fppFiles}" outFiles) + ADDTEST(trapz) ADDTEST(simps) ADDTEST(gauss) diff --git a/src/tests/quadrature/Makefile.manual b/src/tests/quadrature/Makefile.manual index f8200913e..991a4b09c 100644 --- a/src/tests/quadrature/Makefile.manual +++ b/src/tests/quadrature/Makefile.manual @@ -1,5 +1,11 @@ -PROGS_SRC = test_trapz.f90 -PROGS_SRC += test_simps.f90 -PROGS_SRC += test_gauss.f90 +SRCFYPP = \ + test_simps.fypp \ + test_trapz.fypp +PROGS_SRC = \ + test_gauss.f90 \ + $(SRCFYPP:.fypp=.f90) + +$(SRCFYPP): %.f90: %.fypp ../../common.fypp + fypp -I../.. $(FYPPFLAGS) $< $@ include ../Makefile.manual.test.mk diff --git a/src/tests/quadrature/test_simps.f90 b/src/tests/quadrature/test_simps.fypp similarity index 95% rename from src/tests/quadrature/test_simps.f90 rename to src/tests/quadrature/test_simps.fypp index c261c8675..26814c1c1 100644 --- a/src/tests/quadrature/test_simps.f90 +++ b/src/tests/quadrature/test_simps.fypp @@ -1,13 +1,20 @@ +#:include "common.fypp" + module test_simps - use stdlib_kinds, only: sp, dp, qp - use testdrive, only : new_unittest, unittest_type, error_type, check + use stdlib_kinds, only: sp, dp, xdp, qp + use testdrive, only : new_unittest, unittest_type, error_type, check, skip_test use stdlib_quadrature, only: simps, simps_weights implicit none real(sp), parameter :: tol_sp = 1000 * epsilon(1.0_sp) real(dp), parameter :: tol_dp = 1000 * epsilon(1.0_dp) - real(qp), parameter :: tol_qp = 1000 *epsilon(1.0_sp) +#:if WITH_XDP + real(xdp), parameter :: tol_xdp = 1000 * epsilon(1.0_xdp) +#:endif +#:if WITH_QP + real(qp), parameter :: tol_qp = 1000 * epsilon(1.0_qp) +#:endif contains @@ -105,6 +112,7 @@ subroutine test_simps_qp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 13 real(qp), dimension(n) :: y real(qp), dimension(n) :: x @@ -129,6 +137,9 @@ subroutine test_simps_qp(error) val = simps(y, x) ans = 144.0_qp call check(error, val, ans, thr=tol_qp) +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_simps_qp @@ -182,6 +193,7 @@ subroutine test_simps_weights_qp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 17 real(qp), dimension(n) :: y real(qp), dimension(n) :: x @@ -198,6 +210,9 @@ subroutine test_simps_weights_qp(error) val = sum(w*y) ans = simps(y, x) call check(error, val, ans, thr=tol_qp) +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_simps_weights_qp @@ -239,6 +254,7 @@ subroutine test_simps_zero_qp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP real(qp), dimension(0) :: a @@ -249,6 +265,9 @@ subroutine test_simps_zero_qp(error) call check(error, abs(simps(a, a)) < epsilon(0.0_qp)) if (allocated(error)) return call check(error, abs(simps([1.0_qp], [1.0_qp])) < epsilon(0.0_qp)) +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_simps_zero_qp @@ -323,6 +342,7 @@ subroutine test_simps_even_qp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 11 real(qp), dimension(n) :: y real(qp), dimension(n) :: x @@ -352,6 +372,9 @@ subroutine test_simps_even_qp(error) call check(error, val, ans, thr=tol_qp) if (allocated(error)) return end do +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_simps_even_qp @@ -413,6 +436,7 @@ subroutine test_simps_weights_even_qp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 16 real(qp), dimension(n) :: y real(qp), dimension(n) :: x @@ -434,6 +458,9 @@ subroutine test_simps_weights_even_qp(error) call check(error, val, ans, thr=tol_qp) if (allocated(error)) return end do +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_simps_weights_even_qp @@ -508,6 +535,7 @@ subroutine test_simps_six_qp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 6 real(qp), dimension(n) :: y real(qp), dimension(n) :: x @@ -537,6 +565,9 @@ subroutine test_simps_six_qp(error) call check(error, val, ans, thr=tol_qp) if (allocated(error)) return end do +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_simps_six_qp end module diff --git a/src/tests/quadrature/test_trapz.f90 b/src/tests/quadrature/test_trapz.fypp similarity index 95% rename from src/tests/quadrature/test_trapz.f90 rename to src/tests/quadrature/test_trapz.fypp index 3c9c89ab7..2aa138f41 100644 --- a/src/tests/quadrature/test_trapz.f90 +++ b/src/tests/quadrature/test_trapz.fypp @@ -1,5 +1,7 @@ +#:include "common.fypp" + module test_trapz - use stdlib_kinds, only: sp, dp, qp + use stdlib_kinds, only: sp, dp, xdp, qp use testdrive, only : new_unittest, unittest_type, error_type, check use stdlib_quadrature, only: trapz, trapz_weights @@ -94,6 +96,7 @@ subroutine test_trapz_qp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 17 real(qp), dimension(n) :: y real(qp), dimension(n) :: x @@ -120,6 +123,9 @@ subroutine test_trapz_qp(error) val = trapz(y, x) ans = 2728.0_qp call check(error, abs(val - ans) < epsilon(ans)) +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_trapz_qp @@ -185,6 +191,7 @@ subroutine test_trapz_weights_qp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP integer, parameter :: n = 17 real(qp), dimension(n) :: y real(qp), dimension(n) :: x @@ -206,7 +213,9 @@ subroutine test_trapz_weights_qp(error) val = dot_product(w, y) ans = trapz(y, x) call check(error, abs(val - ans) < epsilon(ans)) - +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_trapz_weights_qp @@ -240,12 +249,16 @@ subroutine test_trapz_zero_qp(error) !> Error handling type(error_type), allocatable, intent(out) :: error +#:if WITH_QP real(qp), dimension(0) :: a call check(error, abs(trapz(a, 1.0_qp)) < epsilon(0.0_qp)) call check(error, abs(trapz([1.0_qp], 1.0_qp)) < epsilon(0.0_qp)) call check(error, abs(trapz(a, a)) < epsilon(0.0_qp)) call check(error, abs(trapz([1.0_qp], [1.0_qp])) < epsilon(0.0_qp)) +#:else + call skip_test(error, "Quadruple precision is not enabled") +#:endif end subroutine test_trapz_zero_qp end module test_trapz diff --git a/src/tests/stats/CMakeLists.txt b/src/tests/stats/CMakeLists.txt index b80772140..3df736de5 100644 --- a/src/tests/stats/CMakeLists.txt +++ b/src/tests/stats/CMakeLists.txt @@ -8,15 +8,6 @@ set(fppFiles test_distribution_uniform.fypp ) -# Custom preprocessor flags -if(DEFINED CMAKE_MAXIMUM_RANK) - set(fyppFlags "-DMAXRANK=${CMAKE_MAXIMUM_RANK}") -elseif(f03rank) - set(fyppFlags) -else() - set(fyppFlags "-DVERSION90") -endif() - fypp_f90("${fyppFlags}" "${fppFiles}" outFiles) ADDTEST(corr) diff --git a/src/tests/stats/Makefile.manual b/src/tests/stats/Makefile.manual index 61d523de4..181ba61c7 100644 --- a/src/tests/stats/Makefile.manual +++ b/src/tests/stats/Makefile.manual @@ -5,8 +5,8 @@ SRCFYPP = \ SRCGEN = $(SRCFYPP:.fypp=.f90) -$(SRCGEN): %.f90: %.fypp common.fypp - fypp $(FYPPFLAGS) $< $@ +$(SRCGEN): %.f90: %.fypp ../../common.fypp + fypp -I../.. $(FYPPFLAGS) $< $@ PROGS_SRC = $(SRCGEN) test_mean.f90 test_moment.f90 test_var.f90 test_random.f90 diff --git a/src/tests/stats/common.fypp b/src/tests/stats/common.fypp deleted file mode 100644 index d026979b1..000000000 --- a/src/tests/stats/common.fypp +++ /dev/null @@ -1,54 +0,0 @@ -#:mute - -#! Real kinds to be considered during templating -#:set REAL_KINDS = ["sp", "dp", "qp"] - -#! Real types to be considered during templating -#:set REAL_TYPES = ["real({})".format(k) for k in REAL_KINDS] - -#! Collected (kind, type) tuples for real types -#:set REAL_KINDS_TYPES = list(zip(REAL_KINDS, REAL_TYPES)) - -#! Complex kinds to be considered during templating -#:set CMPLX_KINDS = ["sp", "dp", "qp"] - -#! Complex types to be considered during templating -#:set CMPLX_TYPES = ["complex({})".format(k) for k in CMPLX_KINDS] - -#! Collected (kind, type) tuples for complex types -#:set CMPLX_KINDS_TYPES = list(zip(CMPLX_KINDS, CMPLX_TYPES)) - -#! Integer kinds to be considered during templating -#:set INT_KINDS = ["int8", "int16", "int32", "int64"] - -#! Integer types to be considered during templating -#:set INT_TYPES = ["integer({})".format(k) for k in INT_KINDS] - -#! Collected (kind, type) tuples for integer types -#:set INT_KINDS_TYPES = list(zip(INT_KINDS, INT_TYPES)) - -#! Complex kinds to be considered during templating -#:set CMPLX_KINDS = ["sp", "dp", "qp"] - -#! Complex types to be considered during templating -#:set CMPLX_TYPES = ["complex({})".format(k) for k in CMPLX_KINDS] - -#! Collected (kind, type) tuples for complex types -#:set CMPLX_KINDS_TYPES = list(zip(CMPLX_KINDS, CMPLX_TYPES)) - -#! Whether Fortran 90 compatible code should be generated -#:set VERSION90 = defined('VERSION90') - - -#! Ranks to be generated when templates are created -#:if not defined('MAXRANK') - #:if VERSION90 - #:set MAXRANK = 7 - #:else - #:set MAXRANK = 15 - #:endif -#:endif - - - -#:endmute diff --git a/src/tests/stats/test_distribution_uniform.fypp b/src/tests/stats/test_distribution_uniform.fypp index 738f89bfe..cfc4622fc 100644 --- a/src/tests/stats/test_distribution_uniform.fypp +++ b/src/tests/stats/test_distribution_uniform.fypp @@ -2,7 +2,7 @@ #:set ALL_KINDS_TYPES = INT_KINDS_TYPES + REAL_KINDS_TYPES + CMPLX_KINDS_TYPES program test_distribution_uniform use stdlib_error, only : check - use stdlib_kinds, only: int8, int16, int32, int64, sp, dp, qp + use stdlib_kinds, only: int8, int16, int32, int64, sp, dp, xdp, qp use stdlib_random, only : random_seed, dist_rand use stdlib_stats_distribution_uniform, uni_rvs => rvs_uniform, & uni_pdf => pdf_uniform, & diff --git a/src/tests/stats/test_mean.fypp b/src/tests/stats/test_mean.fypp index 2a1a4cf6c..ffa40bb05 100644 --- a/src/tests/stats/test_mean.fypp +++ b/src/tests/stats/test_mean.fypp @@ -6,7 +6,7 @@ module test_stats_mean use testdrive, only : new_unittest, unittest_type, error_type, check use stdlib_stats, only: mean - use stdlib_kinds, only : int8, int16, int32, int64, sp, dp, qp + use stdlib_kinds, only : int8, int16, int32, int64, sp, dp, xdp, qp use, intrinsic :: ieee_arithmetic, only : ieee_is_nan implicit none private @@ -15,7 +15,12 @@ module test_stats_mean real(sp), parameter :: sptol = 1000 * epsilon(1._sp) real(dp), parameter :: dptol = 2000 * epsilon(1._dp) +#:if WITH_XDP + real(xdp), parameter :: xdptol = 2000 * epsilon(1._xdp) +#:endif +#:if WITH_QP real(qp), parameter :: qptol = 2000 * epsilon(1._qp) +#:endif #:for k1,t1 in IR_KINDS_TYPES ${t1}$ , parameter :: d1_${k1}$(18) = [-10, 2, 3, 4, -6, 6, -7, 8, 9, 4, 1, -20, 9, 10, 14, 15, 40, 30] diff --git a/src/tests/stats/test_mean_f03.fypp b/src/tests/stats/test_mean_f03.fypp index fec210fb1..786438d98 100644 --- a/src/tests/stats/test_mean_f03.fypp +++ b/src/tests/stats/test_mean_f03.fypp @@ -6,7 +6,7 @@ module test_stats_meanf03 use testdrive, only : new_unittest, unittest_type, error_type, check use stdlib_stats, only: mean - use stdlib_kinds, only : int8, int16, int32, int64, sp, dp, qp + use stdlib_kinds, only : int8, int16, int32, int64, sp, dp, xdp, qp use, intrinsic :: ieee_arithmetic, only : ieee_is_nan implicit none private @@ -15,7 +15,12 @@ module test_stats_meanf03 real(sp), parameter :: sptol = 1000 * epsilon(1._sp) real(dp), parameter :: dptol = 2000 * epsilon(1._dp) +#:if WITH_XDP + real(xdp), parameter :: xdptol = 2000 * epsilon(1._xdp) +#:endif +#:if WITH_QP real(qp), parameter :: qptol = 2000 * epsilon(1._qp) +#:endif #:for k1,t1 in IR_KINDS_TYPES ${t1}$ , parameter :: d1_${k1}$(18) = [-10, 2, 3, 4, -6, 6, -7, 8, 9, 4, 1, -20, 9, 10, 14, 15, 40, 30] diff --git a/src/tests/stats/test_median.fypp b/src/tests/stats/test_median.fypp index 3cfd8e60b..d257c7485 100644 --- a/src/tests/stats/test_median.fypp +++ b/src/tests/stats/test_median.fypp @@ -6,7 +6,7 @@ module test_stats_median use testdrive, only : new_unittest, unittest_type, error_type, check use stdlib_stats, only: median - use stdlib_kinds, only : int8, int16, int32, int64, sp, dp, qp + use stdlib_kinds, only : int8, int16, int32, int64, sp, dp, xdp, qp use, intrinsic :: ieee_arithmetic, only : ieee_is_nan implicit none private @@ -15,7 +15,12 @@ module test_stats_median real(sp), parameter :: sptol = 1000 * epsilon(1._sp) real(dp), parameter :: dptol = 2000 * epsilon(1._dp) +#:if WITH_XDP + real(xdp), parameter :: xdptol = 2000 * epsilon(1._xdp) +#:endif +#:if WITH_QP real(qp), parameter :: qptol = 2000 * epsilon(1._qp) +#:endif #:for k1,t1 in IR_KINDS_TYPES ${t1}$ , parameter :: d1_${k1}$(12) = [${t1}$ :: 10, 2, -3, -4, 6, -6, 7, -8, 9, 0, 1, 20] From a862defd7f9316fdc124e0d2d48ed09ea3913d28 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sat, 13 Nov 2021 16:00:07 +0100 Subject: [PATCH 2/9] Add missing imports, fix scope in CMake check --- config/CMakeLists.txt | 2 +- src/tests/io/test_loadtxt_qp.fypp | 2 +- src/tests/io/test_savetxt_qp.fypp | 2 +- src/tests/linalg/test_linalg.fypp | 2 +- src/tests/math/test_stdlib_math.fypp | 2 +- src/tests/optval/test_optval.fypp | 2 +- src/tests/quadrature/test_trapz.fypp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 8c554c8db..f9a556966 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -21,9 +21,9 @@ if (NOT DEFINED WITH_QP) "if (selected_real_kind(33) == -1) stop 1; end" WITH_QP ) + set(WITH_QP ${WITH_QP} PARENT_SCOPE) endif() if (NOT DEFINED WITH_XDP) - set(WITH_QP ${WITH_QP} PARENT_SCOPE) check_fortran_source_runs( "if (any(selected_real_kind(18) == [-1, selected_real_kind(33)])) stop 1; end" WITH_XDP diff --git a/src/tests/io/test_loadtxt_qp.fypp b/src/tests/io/test_loadtxt_qp.fypp index 11810ca91..fc041a60a 100644 --- a/src/tests/io/test_loadtxt_qp.fypp +++ b/src/tests/io/test_loadtxt_qp.fypp @@ -3,7 +3,7 @@ module test_loadtxt_qp use stdlib_kinds, only: qp use stdlib_io, only: loadtxt, savetxt - use testdrive, only: new_unittest, unittest_type, error_type, check + use testdrive, only: new_unittest, unittest_type, error_type, check, skip_test implicit none private diff --git a/src/tests/io/test_savetxt_qp.fypp b/src/tests/io/test_savetxt_qp.fypp index 7dc74a07e..237d8e806 100644 --- a/src/tests/io/test_savetxt_qp.fypp +++ b/src/tests/io/test_savetxt_qp.fypp @@ -3,7 +3,7 @@ module test_savetxt_qp use stdlib_kinds, only: qp use stdlib_io, only: loadtxt, savetxt - use testdrive, only: new_unittest, unittest_type, error_type, check + use testdrive, only: new_unittest, unittest_type, error_type, check, skip_test implicit none private diff --git a/src/tests/linalg/test_linalg.fypp b/src/tests/linalg/test_linalg.fypp index 96a0e9eed..f74cbff6b 100644 --- a/src/tests/linalg/test_linalg.fypp +++ b/src/tests/linalg/test_linalg.fypp @@ -1,7 +1,7 @@ #:include "common.fypp" module test_linalg - use testdrive, only : new_unittest, unittest_type, error_type, check + use testdrive, only : new_unittest, unittest_type, error_type, check, skip_test use stdlib_kinds, only: sp, dp, xdp, qp, int8, int16, int32, int64 use stdlib_linalg, only: diag, eye, trace, outer_product diff --git a/src/tests/math/test_stdlib_math.fypp b/src/tests/math/test_stdlib_math.fypp index 842cc6086..4df7f82fa 100644 --- a/src/tests/math/test_stdlib_math.fypp +++ b/src/tests/math/test_stdlib_math.fypp @@ -1,7 +1,7 @@ ! SPDX-Identifier: MIT module test_stdlib_math - use testdrive, only : new_unittest, unittest_type, error_type, check + use testdrive, only : new_unittest, unittest_type, error_type, check, skip_test use stdlib_math, only: clip use stdlib_kinds, only: int8, int16, int32, int64, sp, dp, xdp, qp implicit none diff --git a/src/tests/optval/test_optval.fypp b/src/tests/optval/test_optval.fypp index 9759421d9..062e04c6d 100644 --- a/src/tests/optval/test_optval.fypp +++ b/src/tests/optval/test_optval.fypp @@ -4,7 +4,7 @@ module test_optval use, intrinsic :: iso_fortran_env, only: & sp => real32, dp => real64, qp => real128, & int8, int16, int32, int64 - use testdrive, only : new_unittest, unittest_type, error_type, check + use testdrive, only : new_unittest, unittest_type, error_type, check, skip_test use stdlib_optval, only: optval implicit none diff --git a/src/tests/quadrature/test_trapz.fypp b/src/tests/quadrature/test_trapz.fypp index 2aa138f41..621323746 100644 --- a/src/tests/quadrature/test_trapz.fypp +++ b/src/tests/quadrature/test_trapz.fypp @@ -2,7 +2,7 @@ module test_trapz use stdlib_kinds, only: sp, dp, xdp, qp - use testdrive, only : new_unittest, unittest_type, error_type, check + use testdrive, only : new_unittest, unittest_type, error_type, check, skip_test use stdlib_quadrature, only: trapz, trapz_weights implicit none From 2c4c9a494b656d79628d3c10f98e764d5ca68fe4 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sat, 13 Nov 2021 19:48:58 +0100 Subject: [PATCH 3/9] Fix logic for default values --- src/common.fypp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common.fypp b/src/common.fypp index 936c9a485..7ae5f70e1 100644 --- a/src/common.fypp +++ b/src/common.fypp @@ -2,12 +2,12 @@ #! Support for quadruple precision floating point numbers #:if not defined("WITH_QP") -#:set WITH_QP = 0 +#:set WITH_QP = False #:endif #! Support for extended double precision floating point numbers #:if not defined("WITH_XDP") -#:set WITH_XDP = 0 +#:set WITH_XDP = False #:endif #! Real kinds to be considered during templating From af00ae415f80e08e1232ea8871a4f17539b4082f Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sat, 13 Nov 2021 21:20:42 +0100 Subject: [PATCH 4/9] Split off workflow for inline CMake build and manual Makefile build --- .github/workflows/CI.yml | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6e023b90d..65ef3de7f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,9 +21,18 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] gcc_v: [9, 10, 11] # Version of GFortran we want to use. + build: [cmake] + include: + - os: ubuntu-latest + gcc_v: 10 + build: cmake-inline + - os: ubuntu-latest + gcc_v: 10 + build: make env: FC: gfortran-${{ matrix.gcc_v }} GCC_V: ${{ matrix.gcc_v }} + BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }} steps: - name: Checkout code @@ -58,35 +67,32 @@ jobs: brew link gcc@${GCC_V} - name: Configure with CMake + if: ${{ contains(matrix.build, 'cmake') }} run: >- cmake -Wdev -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAXIMUM_RANK:String=4 -DCMAKE_INSTALL_PREFIX=$PWD/_dist - -S . -B build + -S . -B ${{ env.BUILD_DIR }} - name: Build and compile - run: cmake --build build --parallel + if: ${{ contains(matrix.build, 'cmake') }} + run: cmake --build ${{ env.BUILD_DIR }} --parallel - name: catch build fail - run: cmake --build build --verbose --parallel 1 - if: failure() + run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1 + if: ${{ failure() && contains(matrix.build, 'cmake') }} - name: test - run: ctest --test-dir build --parallel --output-on-failure + if: ${{ contains(matrix.build, 'cmake') }} + run: ctest --test-dir ${{ env.BUILD_DIR }} --parallel --output-on-failure - name: Install project - run: cmake --install build - - - name: Test in-tree builds - if: contains( matrix.gcc_v, '10') # Only test one compiler on each platform - run: | - cmake -DCMAKE_MAXIMUM_RANK=4 . - cmake --build . - cmake --build . --target test + if: ${{ contains(matrix.build, 'cmake') }} + run: cmake --install ${{ env.BUILD_DIR }} - name: Test manual makefiles - if: contains(matrix.os, 'ubuntu') && contains(matrix.gcc_v, '10') + if: ${{ matrix.build == 'make' }} run: | make -f Makefile.manual FYPPFLAGS="-DMAXRANK=4" -j make -f Makefile.manual test From 3ed37f5f513a068681dcef4a33565ca0f5a1ec20 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sat, 13 Nov 2021 21:46:19 +0100 Subject: [PATCH 5/9] Makefile fixes --- src/tests/io/Makefile.manual | 8 +++++--- src/tests/linalg/Makefile.manual | 5 +++-- src/tests/math/Makefile.manual | 5 +++-- src/tests/math/test_stdlib_math.fypp | 2 ++ src/tests/optval/Makefile.manual | 6 ++++-- src/tests/quadrature/Makefile.manual | 5 +++-- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/tests/io/Makefile.manual b/src/tests/io/Makefile.manual index 7fd209fd1..e35beeccb 100644 --- a/src/tests/io/Makefile.manual +++ b/src/tests/io/Makefile.manual @@ -2,15 +2,17 @@ SRCFYPP = \ test_loadtxt_qp.fypp \ test_savetxt_qp.fypp +SRCGEN = $(SRCFYPP:.fypp=.f90) + PROGS_SRC = test_loadtxt.f90 \ test_savetxt.f90 \ test_parse_mode.f90 \ test_open.f90 \ - $(SRCFYPP:.fypp=.f90) + $(SRCGEN) -$(SRCFYPP): %.f90: %.fypp ../../common.fypp +$(SRCGEN): %.f90: %.fypp ../../common.fypp fypp -I../.. $(FYPPFLAGS) $< $@ -CLEAN_FILES = tmp*.dat io_open.dat io_open.stream +CLEAN_FILES = tmp*.dat io_open.dat io_open.stream $(SRCFYPP:.fypp=.f90) $(PROGS_SRC:.f90=.mod) include ../Makefile.manual.test.mk diff --git a/src/tests/linalg/Makefile.manual b/src/tests/linalg/Makefile.manual index 05d2d9ddf..89d905d89 100644 --- a/src/tests/linalg/Makefile.manual +++ b/src/tests/linalg/Makefile.manual @@ -1,9 +1,10 @@ SRCFYPP = \ test_linalg.fypp +SRCGEN = $(SRCFYPP:.fypp=.f90) PROGS_SRC = \ - $(SRCFYPP:.fypp=.f90) + $(SRCGEN) -$(SRCFYPP): %.f90: %.fypp ../../common.fypp +$(SRCGEN): %.f90: %.fypp ../../common.fypp fypp -I../.. $(FYPPFLAGS) $< $@ diff --git a/src/tests/math/Makefile.manual b/src/tests/math/Makefile.manual index bed97da0d..9063a376b 100644 --- a/src/tests/math/Makefile.manual +++ b/src/tests/math/Makefile.manual @@ -1,11 +1,12 @@ SRCFYPP = \ test_stdlib_math.fypp +SRCGEN = $(SRCFYPP:.fypp=.f90) PROGS_SRC = test_linspace.f90 test_logspace.f90 \ test_math_arange.f90 \ - $(SRCFYPP:.fypp=.f90) + $(SRCGEN) -$(SRCFYPP): %.f90: %.fypp ../../common.fypp +$(SRCGEN): %.f90: %.fypp ../../common.fypp fypp -I../.. $(FYPPFLAGS) $< $@ diff --git a/src/tests/math/test_stdlib_math.fypp b/src/tests/math/test_stdlib_math.fypp index 4df7f82fa..651fea610 100644 --- a/src/tests/math/test_stdlib_math.fypp +++ b/src/tests/math/test_stdlib_math.fypp @@ -1,5 +1,7 @@ ! SPDX-Identifier: MIT +#:include "common.fypp" + module test_stdlib_math use testdrive, only : new_unittest, unittest_type, error_type, check, skip_test use stdlib_math, only: clip diff --git a/src/tests/optval/Makefile.manual b/src/tests/optval/Makefile.manual index 4f4d0d3dc..37cd5f143 100644 --- a/src/tests/optval/Makefile.manual +++ b/src/tests/optval/Makefile.manual @@ -1,9 +1,11 @@ SRCFYPP = \ test_optval.fypp +SRCGEN = $(SRCFYPP:.fypp=.f90) + PROGS_SRC = \ - $(SRCFYPP:.fypp=.f90) + $(SRCGEN) -$(SRCFYPP): %.f90: %.fypp ../../common.fypp +$(SRCGEN): %.f90: %.fypp ../../common.fypp fypp -I../.. $(FYPPFLAGS) $< $@ include ../Makefile.manual.test.mk diff --git a/src/tests/quadrature/Makefile.manual b/src/tests/quadrature/Makefile.manual index 991a4b09c..1d0cb9502 100644 --- a/src/tests/quadrature/Makefile.manual +++ b/src/tests/quadrature/Makefile.manual @@ -1,11 +1,12 @@ SRCFYPP = \ test_simps.fypp \ test_trapz.fypp +SRCGEN = $(SRCFYPP:.fypp=.f90) PROGS_SRC = \ test_gauss.f90 \ - $(SRCFYPP:.fypp=.f90) + $(SRCGEN) -$(SRCFYPP): %.f90: %.fypp ../../common.fypp +$(SRCGEN): %.f90: %.fypp ../../common.fypp fypp -I../.. $(FYPPFLAGS) $< $@ include ../Makefile.manual.test.mk From 83ad8299b3d3b634882b25958aa2984be143309d Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sun, 14 Nov 2021 12:29:05 +0100 Subject: [PATCH 6/9] Use correct command to find number of cores on MacOS --- ci/fpm-deployment.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ci/fpm-deployment.sh b/ci/fpm-deployment.sh index 3da966677..3d9884345 100644 --- a/ci/fpm-deployment.sh +++ b/ci/fpm-deployment.sh @@ -12,7 +12,11 @@ fypp="${FYPP:-$(which fypp)}" fyflags="${FYFLAGS:--DMAXRANK=4}" # Number of parallel jobs for preprocessing -njob="$(nproc)" +if [ $(uname) = "Darwin" ]; then + njob="$(sysctl -n hw.ncpu)" +else + njob="$(nproc)" +fi # Additional files to include include=( From 7baf93f1983ab907f2c680005fc5a39ad5912d6d Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sun, 14 Nov 2021 14:37:09 +0100 Subject: [PATCH 7/9] Don't set kind parameters in case stdlib is not supporting them - remove EULERS_NUMBER_QP export if quadruple precision is not enabled --- src/CMakeLists.txt | 2 +- src/Makefile.manual | 2 +- src/{stdlib_kinds.f90 => stdlib_kinds.fypp} | 5 +++-- src/stdlib_math.fypp | 7 ++++++- 4 files changed, 11 insertions(+), 5 deletions(-) rename src/{stdlib_kinds.f90 => stdlib_kinds.fypp} (77%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 94ac6a770..bcb4931b3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,7 @@ set(fppFiles stdlib_bitsets_64.fypp stdlib_bitsets_large.fypp stdlib_io.fypp + stdlib_kinds.fypp stdlib_linalg.fypp stdlib_linalg_diag.fypp stdlib_linalg_outer_product.fypp @@ -60,7 +61,6 @@ fypp_f90("${fyppFlags}" "${fppFiles}" outFiles) set(SRC stdlib_error.f90 - stdlib_kinds.f90 stdlib_logger.f90 stdlib_system.F90 stdlib_specialfunctions.f90 diff --git a/src/Makefile.manual b/src/Makefile.manual index 179fc600f..f573fa6cf 100644 --- a/src/Makefile.manual +++ b/src/Makefile.manual @@ -4,6 +4,7 @@ SRCFYPP = \ stdlib_bitsets_large.fypp \ stdlib_bitsets.fypp \ stdlib_io.fypp \ + stdlib_kinds.fypp \ stdlib_linalg.fypp \ stdlib_linalg_diag.fypp \ stdlib_linalg_outer_product.fypp \ @@ -41,7 +42,6 @@ SRC = f18estop.f90 \ stdlib_specialfunctions.f90 \ stdlib_specialfunctions_legendre.f90 \ stdlib_io.f90 \ - stdlib_kinds.f90 \ stdlib_logger.f90 \ stdlib_quadrature_gauss.f90 \ stdlib_strings.f90 \ diff --git a/src/stdlib_kinds.f90 b/src/stdlib_kinds.fypp similarity index 77% rename from src/stdlib_kinds.f90 rename to src/stdlib_kinds.fypp index 7ab23a9eb..f6b7726c1 100644 --- a/src/stdlib_kinds.f90 +++ b/src/stdlib_kinds.fypp @@ -1,3 +1,4 @@ +#:include "common.fypp" !> Version: experimental !> !> The specification of this module is available [here](../page/specs/stdlib_kinds.html). @@ -15,10 +16,10 @@ module stdlib_kinds integer, parameter :: dp = selected_real_kind(15) !> Extended double precision real numbers - integer, parameter :: xdp = selected_real_kind(18) + integer, parameter :: xdp = #{if WITH_XDP}#selected_real_kind(18)#{else}#-1#{endif}# !> Quadruple precision real numbers - integer, parameter :: qp = selected_real_kind(33) + integer, parameter :: qp = #{if WITH_QP}#selected_real_kind(33)#{else}#-1#{endif}# !> Default logical kind parameter integer, parameter :: lk = kind(.true.) diff --git a/src/stdlib_math.fypp b/src/stdlib_math.fypp index 5bab7d703..89f412ff0 100644 --- a/src/stdlib_math.fypp +++ b/src/stdlib_math.fypp @@ -9,7 +9,10 @@ module stdlib_math implicit none private public :: clip, gcd, linspace, logspace - public :: EULERS_NUMBER_SP, EULERS_NUMBER_DP, EULERS_NUMBER_QP + public :: EULERS_NUMBER_SP, EULERS_NUMBER_DP +#:if WITH_QP + public :: EULERS_NUMBER_QP +#:endif public :: DEFAULT_LINSPACE_LENGTH, DEFAULT_LOGSPACE_BASE, DEFAULT_LOGSPACE_LENGTH public :: arange @@ -20,7 +23,9 @@ module stdlib_math ! Useful constants for lnspace real(sp), parameter :: EULERS_NUMBER_SP = exp(1.0_sp) real(dp), parameter :: EULERS_NUMBER_DP = exp(1.0_dp) +#:if WITH_QP real(qp), parameter :: EULERS_NUMBER_QP = exp(1.0_qp) +#:endif interface clip #:for k1, t1 in IR_KINDS_TYPES From 15c9f20fdc659449550eae8268e1f30d07a578ae Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sun, 14 Nov 2021 19:47:20 +0100 Subject: [PATCH 8/9] Write out names of kind parameters in specs --- doc/specs/stdlib_kinds.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/specs/stdlib_kinds.md b/doc/specs/stdlib_kinds.md index ba6e73c7f..4ccd6c250 100644 --- a/doc/specs/stdlib_kinds.md +++ b/doc/specs/stdlib_kinds.md @@ -16,22 +16,26 @@ The `stdlib_kinds` module provides kind parameters for the Fortran intrinsic dat ### `sp` +Single precision real kind parameter. Provides real kind parameter for floating point numbers with a minimal precision of 6 significant digits. ### `dp` +Double precision real kind parameter. Provides real kind parameter for floating point numbers with a minimal precision of 15 significant digits. ### `xdp` +Extended double precision real kind parameter. Provides real kind parameter for floating point numbers with a minimal precision of 18 significant digits. If not available it has value `-1`. ### `qp` +Quadruple precision real kind parameter. Provides real kind parameter for floating point numbers with a minimal precision of 33 significant digits. If not available it has value `-1`. From d09b639036929964bc3a5c0808f9c716e6985fc4 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Mon, 15 Nov 2021 23:00:37 +0100 Subject: [PATCH 9/9] Pin test-drive to version 0.4.0 --- ci/fpm.toml | 1 + config/cmake/Findtest-drive.cmake | 2 +- src/tests/Makefile.manual | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/fpm.toml b/ci/fpm.toml index 6e40ddbac..aeba3087c 100644 --- a/ci/fpm.toml +++ b/ci/fpm.toml @@ -7,3 +7,4 @@ copyright = "2019-2021 stdlib contributors" [dev-dependencies] test-drive.git = "https://github.com/fortran-lang/test-drive" +test-drive.tag = "v0.4.0" diff --git a/config/cmake/Findtest-drive.cmake b/config/cmake/Findtest-drive.cmake index 8caad743d..a736815ee 100644 --- a/config/cmake/Findtest-drive.cmake +++ b/config/cmake/Findtest-drive.cmake @@ -136,7 +136,7 @@ foreach(method ${${_pkg}_FIND_METHOD}) FetchContent_Declare( "${_lib}" GIT_REPOSITORY "${_url}" - GIT_TAG "HEAD" + GIT_TAG "v0.4.0" ) FetchContent_MakeAvailable("${_lib}") diff --git a/src/tests/Makefile.manual b/src/tests/Makefile.manual index c77e32b4f..d3594201e 100644 --- a/src/tests/Makefile.manual +++ b/src/tests/Makefile.manual @@ -9,7 +9,7 @@ FETCH = curl -L all test:: $(LIB) testdrive.F90: - $(FETCH) https://github.com/fortran-lang/test-drive/raw/main/src/testdrive.F90 > $@ + $(FETCH) https://github.com/fortran-lang/test-drive/raw/v0.4.0/src/testdrive.F90 > $@ all test clean:: $(MAKE) -f Makefile.manual --directory=ascii $@