From a29cbfd809313d9edb33f9b71747e020ebb3f4eb Mon Sep 17 00:00:00 2001 From: Charles Ferenbaugh Date: Mon, 20 May 2024 11:57:10 -0700 Subject: [PATCH 1/2] Update pFUnit to use v2 template interfaces --- ChangeLog.md | 1 + extern/fArgParse | 2 +- src/funit/CMakeLists.txt | 6 +++--- src/funit/core/AbstractPattern.F90 | 10 +++++----- src/funit/core/ExceptionList.F90 | 7 ++++--- src/funit/core/ExceptionVector.F90 | 10 +++++----- src/funit/core/TestAnnotation.F90 | 15 +++++++------- src/funit/core/TestFailureVector.F90 | 13 ++++++++---- src/funit/core/TestListenerVector.F90 | 10 +++++----- src/funit/core/TestSuite.F90 | 2 +- src/funit/core/TestVector.F90 | 10 +++++----- src/funit/fhamcrest/AllOf.F90 | 4 ++-- src/funit/fhamcrest/AnyOf.F90 | 4 ++-- src/funit/fhamcrest/BaseDescription.F90 | 2 +- src/funit/fhamcrest/MatcherVector.F90 | 21 ++++++++++---------- src/funit/fhamcrest/SelfDescribingVector.F90 | 20 +++++++++---------- 16 files changed, 72 insertions(+), 65 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index c10be89f..e283ae3a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Updated pFUnit to use v2 template interfaces - Added `-quiet` flag for NAG Fortran ### Added diff --git a/extern/fArgParse b/extern/fArgParse index 82442c77..4d40653b 160000 --- a/extern/fArgParse +++ b/extern/fArgParse @@ -1 +1 @@ -Subproject commit 82442c77a9a4f19fa3777aeb5c54bac4b8dac2fa +Subproject commit 4d40653bd0e6ac0e3547e4840fe3ad2147b15921 diff --git a/src/funit/CMakeLists.txt b/src/funit/CMakeLists.txt index cecc0746..d6878873 100644 --- a/src/funit/CMakeLists.txt +++ b/src/funit/CMakeLists.txt @@ -22,15 +22,15 @@ function(funit_target_link_pfunit funit_target) target_link_libraries (${funit_target} PUBLIC OpenMP::OpenMP_Fortran) endif () - if (NOT TARGET GFTL::gftl) + if (NOT TARGET GFTL::gftl-v2) message(FATAL_ERROR "Could not find gFTL. This should not happen.") endif () - if (NOT TARGET GFTL_SHARED::gftl-shared) + if (NOT TARGET GFTL_SHARED::gftl-shared-v2) message(FATAL_ERROR "Could not find gFTL-shared. This should not happen.") endif () - target_link_libraries (${funit_target} PUBLIC GFTL::gftl GFTL_SHARED::gftl-shared FARGPARSE::fargparse) + target_link_libraries (${funit_target} PUBLIC GFTL::gftl-v2 GFTL_SHARED::gftl-shared-v2 GFTL_SHARED::gftl-shared-v2-as-default FARGPARSE::fargparse) target_include_directories(${funit_target} PUBLIC $ ) diff --git a/src/funit/core/AbstractPattern.F90 b/src/funit/core/AbstractPattern.F90 index a0945ec2..25a5eeb3 100644 --- a/src/funit/core/AbstractPattern.F90 +++ b/src/funit/core/AbstractPattern.F90 @@ -25,11 +25,11 @@ end module PF_AbstractPattern module PF_AbstractPatternVector use PF_AbstractPattern -#define _type class (AbstractPattern) -#define _allocatable -#define _vector AbstractPatternVector -#define _iterator AbstractPatternVectorIterator +#define T AbstractPattern +#define T_polymorphic +#define Vector AbstractPatternVector +#define VectorIterator AbstractPatternVectorIterator -#include "templates/vector.inc" +#include "vector/template.inc" end module PF_AbstractPatternVector diff --git a/src/funit/core/ExceptionList.F90 b/src/funit/core/ExceptionList.F90 index 952b1ca2..6ecd30d5 100644 --- a/src/funit/core/ExceptionList.F90 +++ b/src/funit/core/ExceptionList.F90 @@ -102,10 +102,10 @@ logical function catch_message(this, message, preserve) result(found) iter = this%begin() do while (iter /= this%end()) - e => iter%get() + e => iter%of() if (e%getMessage() == message) then found = .true. - if (.not. preserveMessage(preserve)) call this%erase(iter) + if (.not. preserveMessage(preserve)) iter = this%erase(iter) return end if call iter%next() @@ -119,6 +119,7 @@ function catch_next(this, preserve) result(anException) class (ExceptionList), intent(inOut) :: this logical, optional, intent(in) :: preserve type (Exception) :: anException + type (ExceptionVectorIterator) :: iter if (.not. this%empty()) then @@ -134,7 +135,7 @@ function catch_next(this, preserve) result(anException) #endif if (preserveMessage(preserve)) return - call this%erase(this%begin()) + iter = this%erase(this%begin()) end if end function catch_next diff --git a/src/funit/core/ExceptionVector.F90 b/src/funit/core/ExceptionVector.F90 index 35753d2b..45ef67df 100644 --- a/src/funit/core/ExceptionVector.F90 +++ b/src/funit/core/ExceptionVector.F90 @@ -1,10 +1,10 @@ module PF_ExceptionVector use PF_Exception -#define _type class(Exception) -#define _allocatable -#define _vector ExceptionVector -#define _iterator ExceptionVectorIterator -#include "templates/vector.inc" +#define T Exception +#define T_polymorphic +#define Vector ExceptionVector +#define VectorIterator ExceptionVectorIterator +#include "vector/template.inc" end module PF_ExceptionVector diff --git a/src/funit/core/TestAnnotation.F90 b/src/funit/core/TestAnnotation.F90 index 399fa4a7..a5f90918 100644 --- a/src/funit/core/TestAnnotation.F90 +++ b/src/funit/core/TestAnnotation.F90 @@ -24,13 +24,12 @@ end module pf_TestAnnotation module pf_StringTestAnnotationMap use pf_TestAnnotation -#define _map StringTestAnnotationMap -#define _iterator StringTestAnnotationMapIterator -#define _pair StringTestAnnotationPair -#include "types/key_deferredLengthString.inc" -#define _value_allocatable -#define _value class(TestAnnotation) -#define _alt -#include "templates/map.inc" +#define Map StringTestAnnotationMap +#define MapIterator StringTestAnnotationMapIterator +#define Pair StringTestAnnotationPair +#define Key __CHARACTER_DEFERRED +#define T TestAnnotation +#define T_polymorphic +#include "map/template.inc" end module pf_StringTestAnnotationMap diff --git a/src/funit/core/TestFailureVector.F90 b/src/funit/core/TestFailureVector.F90 index 804d8d46..1f23037c 100644 --- a/src/funit/core/TestFailureVector.F90 +++ b/src/funit/core/TestFailureVector.F90 @@ -1,8 +1,13 @@ module PF_TestFailureVector use PF_TestFailure -#define _type type (TestFailure) -#define _vector TestFailureVector -#define _iterator TestFailureVectorIterator -#include "templates/vector.inc" +!#define _type type (TestFailure) +!#define _vector TestFailureVector +!#define _iterator TestFailureVectorIterator +!#include "templates/vector.inc" + +#define T TestFailure +#define Vector TestFailureVector +#define VectorIterator TestFailureVectorIterator +#include "vector/template.inc" end module PF_TestFailureVector diff --git a/src/funit/core/TestListenerVector.F90 b/src/funit/core/TestListenerVector.F90 index 88e3b63a..d9cb602b 100644 --- a/src/funit/core/TestListenerVector.F90 +++ b/src/funit/core/TestListenerVector.F90 @@ -1,9 +1,9 @@ module PF_TestListenerVector use PF_TestListener -#define _type class (TestListener) -#define _allocatable -#define _vector TestListenerVector -#define _iterator TestListenerVectorIterator -#include "templates/vector.inc" +#define T TestListener +#define T_polymorphic +#define Vector TestListenerVector +#define VectorIterator TestListenerVectorIterator +#include "vector/template.inc" end module PF_TestListenerVector diff --git a/src/funit/core/TestSuite.F90 b/src/funit/core/TestSuite.F90 index 1660bf56..9e956aed 100644 --- a/src/funit/core/TestSuite.F90 +++ b/src/funit/core/TestSuite.F90 @@ -189,7 +189,7 @@ recursive function filter(this, a_filter) result(new_suite) iter = this%tests%begin() do while (iter /= this%tests%end()) - t => iter%get() + t => iter%of() select type (t) class is (TestSuite) diff --git a/src/funit/core/TestVector.F90 b/src/funit/core/TestVector.F90 index 900ad648..a569a6ee 100644 --- a/src/funit/core/TestVector.F90 +++ b/src/funit/core/TestVector.F90 @@ -1,9 +1,9 @@ module PF_TestVector use PF_Test -#define _type class (Test) -#define _allocatable -#define _vector TestVector -#define _iterator TestVectorIterator -#include "templates/vector.inc" +#define T Test +#define T_polymorphic +#define Vector TestVector +#define VectorIterator TestVectorIterator +#include "vector/template.inc" end module PF_TestVector diff --git a/src/funit/fhamcrest/AllOf.F90 b/src/funit/fhamcrest/AllOf.F90 index 4ef2e067..760b3969 100644 --- a/src/funit/fhamcrest/AllOf.F90 +++ b/src/funit/fhamcrest/AllOf.F90 @@ -89,7 +89,7 @@ logical function matches(this, actual_value) iter = this%matchers%begin() do while (iter /= this%matchers%end()) - matcher => iter%get() + matcher => iter%of() if (.not. matcher%matches(actual_value)) then matches = .false. return @@ -120,7 +120,7 @@ subroutine describe_to_op(this, description, operator) allocate(matchers_as_SelfDescribing) ! ensure empty at each iteration iter = this%matchers%begin() do while (iter /= this%matchers%end()) - call matchers_as_SelfDescribing%push_back(iter%get()) + call matchers_as_SelfDescribing%push_back(iter%of()) call iter%next() end do diff --git a/src/funit/fhamcrest/AnyOf.F90 b/src/funit/fhamcrest/AnyOf.F90 index 52fbb36c..0b2b5ddb 100644 --- a/src/funit/fhamcrest/AnyOf.F90 +++ b/src/funit/fhamcrest/AnyOf.F90 @@ -93,7 +93,7 @@ logical function matches(this, actual_value) iter = this%matchers%begin() do while (iter /= this%matchers%end()) - matcher => iter%get() + matcher => iter%of() if (matcher%matches(actual_value)) then matches = .true. return @@ -125,7 +125,7 @@ subroutine describe_to_op(this, description, operator) allocate(matchers_as_SelfDescribing) ! ensure empty at each iteration iter = this%matchers%begin() do while (iter /= this%matchers%end()) - call matchers_as_SelfDescribing%push_back(iter%get()) + call matchers_as_SelfDescribing%push_back(iter%of()) call iter%next() end do diff --git a/src/funit/fhamcrest/BaseDescription.F90 b/src/funit/fhamcrest/BaseDescription.F90 index acc72857..bcf5b8e4 100644 --- a/src/funit/fhamcrest/BaseDescription.F90 +++ b/src/funit/fhamcrest/BaseDescription.F90 @@ -246,7 +246,7 @@ subroutine append_list_vector(this, start, separator, end, values) iter = values%begin() do while (iter /= values%end()) if (separate) call this%append(separator) - call this%append_description_of(iter%get()) + call this%append_description_of(iter%of()) separate = .true. call iter%next() end do diff --git a/src/funit/fhamcrest/MatcherVector.F90 b/src/funit/fhamcrest/MatcherVector.F90 index b5da84ed..999ab6f7 100644 --- a/src/funit/fhamcrest/MatcherVector.F90 +++ b/src/funit/fhamcrest/MatcherVector.F90 @@ -1,16 +1,17 @@ module pf_MatcherVector use pf_AbstractMatcher -#define _type class(AbstractMatcher) -#define _vector MatcherVector -#define _vectorIterator MatcherVectorIterator -#define _allocatable +#define T AbstractMatcher +#define T_polymorphic +#define Vector MatcherVector +#define VectorIterator MatcherVectorIterator + +#include "vector/template.inc" + +#undef VectorIterator +#undef Vector +#undef T_polymorphic +#undef T -#include "templates/vector.inc" -#undef _allocatable -#undef _vectorIterator -#undef _vector -#undef _type - end module pf_MatcherVector diff --git a/src/funit/fhamcrest/SelfDescribingVector.F90 b/src/funit/fhamcrest/SelfDescribingVector.F90 index 7ffaa339..ae961aeb 100644 --- a/src/funit/fhamcrest/SelfDescribingVector.F90 +++ b/src/funit/fhamcrest/SelfDescribingVector.F90 @@ -1,16 +1,16 @@ module pf_SelfDescribingVector use pf_SelfDescribing -#define _type class(SelfDescribing) -#define _vector SelfDescribingVector -#define _vectorIterator SelfDescribingVectorIterator -#define _allocatable +#define T SelfDescribing +#define T_polymorphic +#define Vector SelfDescribingVector +#define VectorIterator SelfDescribingVectorIterator -#include "templates/vector.inc" +#include "vector/template.inc" + +#undef VectorIterator +#undef Vector +#undef T_polymorphic +#undef T -#undef _allocatable -#undef _vectorIterator -#undef _vector -#undef _type - end module pf_SelfDescribingVector From 5713a08dd4fc2445ee9d8f1afd64c5085a821653 Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Tue, 9 Jul 2024 14:09:55 -0400 Subject: [PATCH 2/2] Updated submodule to CI can work. --- ChangeLog.md | 1 + extern/fArgParse | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 04d075ca..0a72fc0f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated pFUnit to use v2 template interfaces - Added `-quiet` flag for NAG Fortran - Remove `macos-11` from GitHub Actions, add `macos-12` and `gfortran-14` to Ubuntu 24.04 +- Updated fArgParse to v1.8.0 ### Added diff --git a/extern/fArgParse b/extern/fArgParse index 4d40653b..fd52a2e2 160000 --- a/extern/fArgParse +++ b/extern/fArgParse @@ -1 +1 @@ -Subproject commit 4d40653bd0e6ac0e3547e4840fe3ad2147b15921 +Subproject commit fd52a2e229b415701372b8ced99eb8162af1c404