Skip to content

Commit

Permalink
Merge branch 'main' into add-dependabot
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwinters5000 committed May 26, 2023
2 parents 8565678 + e28b234 commit f83b401
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 70 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,30 @@ jobs:
- os: ubuntu-latest
compiler: gfortran-10
cmake_generator: Unix Makefiles
shell: bash
- os: macos-latest
compiler: gfortran-10
compiler: gfortran-11
cmake_generator: Unix Makefiles
shell: bash
- os: windows-latest
compiler: gfortran
cmake_generator: MinGW Makefiles
shell: 'msys2 {0}'
# Set default shell as suggested here: https://github.community/t/setting-default-shell-or-other-step-metadata-conditionally-in-workflows/154055
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
# - name: Add msbuild to PATH
# if: ${{ matrix.os == 'windows-latest' }}
# uses: microsoft/setup-msbuild@v1.0.2
- uses: msys2/setup-msys2@v2
if: ${{ matrix.os == 'windows-latest' }}
with:
update: true
install: git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
- name: Verify CMake build
run: |
mkdir build && cd build
Expand All @@ -52,19 +64,19 @@ jobs:
make -j 2 FC=${{ matrix.compiler }}
- name: Build test suite
run: |
cd TestSuiteBuild
cd TestSuiteBuild
make -j 2 FC=${{ matrix.compiler }}
- name: Run tests
run: |
cd TestSuiteBuild
cd TestSuiteBuild
./runSuite
- name: Run tests for coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install -y lcov
cd TestSuiteBuild
FC=${{ matrix.compiler }} ./createcoverage
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
files: ./TestSuiteBuild/lcov.info
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
#set(FTOBJ_AR "/usr/bin/gcc-ar" CACHE STRING "Static archive command")
#set(FTOBJ_RANLIB "/usr/bin/gcc-ranlib" CACHE STRING "ranlib used to create Static archive")
INCLUDE(CMakePackageConfigHelpers)
SET(FFLAGS "-cpp -O -std=f2008 -pedantic -Werror -fimplicit-none -Wall -Wextra -Wcharacter-truncation -Wimplicit-interface -Wimplicit-procedure -Wno-compare-reals -Wno-unused-dummy-argument -Wno-intrinsic-shadow -Wno-implicit-interface -Wno-implicit-procedure" CACHE STRING "Fortran compiler flags")
SET(FFLAGS "-cpp -O -std=f2018 -pedantic -Werror -fimplicit-none -Wall -Wextra -Wcharacter-truncation -Wimplicit-interface -Wimplicit-procedure -Wno-compare-reals -Wno-unused-dummy-argument -Wno-intrinsic-shadow -Wno-implicit-interface -Wno-implicit-procedure" CACHE STRING "Fortran compiler flags")

MESSAGE("-- FTOBJ ------------- cmake START -------------------")
MESSAGE("-- FFLAGS: ${FFLAGS}")
Expand Down
4 changes: 2 additions & 2 deletions Docs/FTObjectLibrary.tex
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ \subsection{FTObject}
CLASS(Subclass) :: self
call self % initPointWithXYZ(0.0,0.0,0.0)
END SUBROUTINE initPointWithXYZ
END SUBROUTINE initPoint
\end{verbatim}}

The array initializer is
Expand Down Expand Up @@ -706,7 +706,7 @@ \subsubsection{FTLinkedListIterator}
\item Destruction

{\color{blue}\begin{verbatim}
CALL releaseFTLibnkedListIterator(iterator) ! If a pointer
CALL releaseFTLinkedListIterator(iterator) ! If a pointer
\end{verbatim}}
\end{itemize}

Expand Down
2 changes: 1 addition & 1 deletion Examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FC = gfortran

FFLAGS = -cpp
FFLAGS += -std=f2008 # Enforce Fortran 2008 standard
FFLAGS += -std=f2018 # Enforce Fortran 2018 standard
FFLAGS += -pedantic # Be very pendatic
FFLAGS += -Werror # All warnings should be treated as errors
FFLAGS += -fimplicit-none # For implicit none everywhere to detect errors
Expand Down
69 changes: 33 additions & 36 deletions Source/FTObjects/FTDictionaryClass.f90
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,44 @@ FUNCTION objectForKey(self,key)
CHARACTER(LEN=*) :: key
CLASS(FTObject) , POINTER :: objectForKey
INTEGER :: h
CLASS(FTLinkedListRecord) , POINTER :: listRecordPtr => NULL()
CHARACTER(LEN=FTDICT_KWD_STRING_LENGTH) :: keyString

objectForKey => NULL()
IF(self % COUNT() == 0) RETURN

!
! -------------
! Find the hash
! -------------
!
h = b3hs_hash_key_jenkins(key,SIZE(self % entries))

IF ( self % entries(h) % COUNT() > 0 ) THEN
objectForKey => objectForKeyInList(key,self % entries(h))
!
! -----------------------
! Search through the list
! -----------------------
!
listRecordPtr => self % entries(h) % head
DO WHILE(ASSOCIATED(listRecordPtr))
!
! --------------------------------------------
! The list's recordObject is a FTKeyObjectPair
! --------------------------------------------
!
SELECT TYPE (pair => listRecordPtr % recordObject)
TYPE is (FTKeyObjectPair)
keyString = pair % keyString
IF ( TRIM(keyString) == TRIM(key) .AND. &
ASSOCIATED( pair % valueObject) ) THEN
objectForKey => pair % valueObject
EXIT
END IF
CLASS DEFAULT
END SELECT
listRecordPtr => listRecordPtr % next
END DO

END IF

END FUNCTION ObjectForKey
Expand All @@ -392,40 +423,6 @@ FUNCTION containsKey(self,key) RESULT(r)
END FUNCTION containsKey
!
!////////////////////////////////////////////////////////////////////////
!
FUNCTION objectForKeyInList(key,list)
IMPLICIT NONE
CHARACTER(LEN=*) :: key
CLASS(FTLinkedList) :: list
CLASS(FTObject), POINTER :: objectForKeyInList

CLASS(FTLinkedListRecord) , POINTER :: listRecordPtr => NULL()
CHARACTER(LEN=FTDICT_KWD_STRING_LENGTH) :: keyString

objectForKeyInList => NULL()

listRecordPtr => list % head
DO WHILE(ASSOCIATED(listRecordPtr))
!
! --------------------------------------------
! The list's recordObject is a FTKeyObjectPair
! --------------------------------------------
!
SELECT TYPE (pair => listRecordPtr % recordObject)
TYPE is (FTKeyObjectPair)
keyString = pair % key()
IF ( TRIM(keyString) == TRIM(key) ) THEN
objectForKeyInList => pair % object()
EXIT
END IF
CLASS DEFAULT
END SELECT
listRecordPtr => listRecordPtr % next
END DO

END FUNCTION objectForKeyInList
!
!////////////////////////////////////////////////////////////////////////
!
CHARACTER(LEN=DESCRIPTION_CHARACTER_LENGTH) FUNCTION FTDictionaryDescription(self)
IMPLICIT NONE
Expand Down
2 changes: 1 addition & 1 deletion TestSuiteBuild/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FTOLibPath = ../Source
FTTestsPath = ../Testing

FFLAGS = -cpp -O
FFLAGS += -std=f2008 # Enforce Fortran 2008 standard
FFLAGS += -std=f2018 # Enforce Fortran 2018 standard
FFLAGS += -pedantic # Be very pendatic
FFLAGS += -Werror # All warnings should be treated as errors
FFLAGS += -fimplicit-none # For implicit none everywhere to detect errors
Expand Down
53 changes: 30 additions & 23 deletions Testing/Tests/MutableArrayTests.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
!
! Copyright (c) 2010-present David A. Kopriva and other contributors: AUTHORS.md
!
! Permission is hereby granted, free of charge, to any person obtaining a copy
! of this software and associated documentation files (the "Software"), to deal
! in the Software without restriction, including without limitation the rights
! to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
! copies of the Software, and to permit persons to whom the Software is
! Permission is hereby granted, free of charge, to any person obtaining a copy
! of this software and associated documentation files (the "Software"), to deal
! in the Software without restriction, including without limitation the rights
! to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
! copies of the Software, and to permit persons to whom the Software is
! furnished to do so, subject to the following conditions:
!
! The above copyright notice and this permission notice shall be included in all
! The above copyright notice and this permission notice shall be included in all
! copies or substantial portions of the Software.
!
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
! SOFTWARE.
!
! FTObjectLibrary contains code that, to the best of our knowledge, has been released as
! public domain software:
! * `b3hs_hash_key_jenkins`: originally by Rich Townsend,
! * `b3hs_hash_key_jenkins`: originally by Rich Townsend,
! https://groups.google.com/forum/#!topic/comp.lang.fortran/RWoHZFt39ng, 2005
!
! --- End License
Expand All @@ -31,8 +31,8 @@
!////////////////////////////////////////////////////////////////////////
!
! MutableArrayTests.f90
! Created: June 12, 2013 10:46 AM
! By: David Kopriva
! Created: June 12, 2013 10:46 AM
! By: David Kopriva
!
! This subroutine tests and shows how to use the FTMutableObjectArray
! class.
Expand All @@ -42,15 +42,15 @@
SUBROUTINE MutableArrayClassTests
USE FTAssertions
USE FTMutableObjectArrayClass
USE FTValueClass
USE FTValueClass
IMPLICIT NONE
!
! ------------
! Declarations
! ------------
!
TYPE (FTMutableObjectArray), POINTER :: array

INTEGER :: i
INTEGER, DIMENSION(10) :: values = [(i,i=1,10)]
INTEGER, DIMENSION(10) :: modifiedValues = [1,2,3,4,22,6,7,9,10,11]
Expand Down Expand Up @@ -84,18 +84,25 @@ SUBROUTINE MutableArrayClassTests
END DO
CALL FTAssertEqual(10, array % COUNT(), "Number of objects in array is equal to number of objects added")
!
! ---------------------------------------
! Exercise output routine to a dummy file
! ---------------------------------------
!
OPEN(UNIT = 7, STATUS = 'SCRATCH')
CALL array % printDescription(7) ! To print the array, if desired.
CLOSE(7)
!
! -----------------------------
! Check the values in the array
! -----------------------------
!
! CALL array % printDescription(6) ! To print the array, if desired.
DO i = 1, 10
obj => array % objectAtIndex(i) ! Get the object
v => valueFromObject(obj) ! Convert it to a value.
CALL FTAssert(test = ASSOCIATED(v),msg = "Object not found at index")
IF ( ASSOCIATED(v) ) THEN
CALL FTAssertEqual(values(i),v % integerValue(),"Object values")
END IF
END IF
END DO
!
! ---------------------------------------------------
Expand Down Expand Up @@ -145,10 +152,10 @@ SUBROUTINE MutableArrayClassTests
CALL FTAssertEqual(1, obj % refcount(), "Refcount after removal")
CALL releaseFTObject(obj)
IF ( .NOT. ASSOCIATED(obj) ) THEN
CALL FTAssert(.true., "Object properly deallocated")
CALL FTAssert(.true., "Object properly deallocated")
ELSE
CALL FTAssert(.FALSE., "Object properly deallocated")
END IF
CALL FTAssert(.FALSE., "Object properly deallocated")
END IF
!
! -----------------------------------
! Check the values in the array again
Expand All @@ -165,5 +172,5 @@ SUBROUTINE MutableArrayClassTests
! -------------------------------------------------------------
!
CALL releaseFTMutableObjectArray(array)

END SUBROUTINE MutableArrayClassTests
2 changes: 1 addition & 1 deletion makeLibrary/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FC = gfortran
FTOLibPath = ../Source

FFLAGS = -cpp -O
FFLAGS += -std=f2008 # Enforce Fortran 2008 standard
FFLAGS += -std=f2018 # Enforce Fortran 2018 standard
FFLAGS += -pedantic # Be very pendatic
FFLAGS += -Werror # All warnings should be treated as errors
FFLAGS += -fimplicit-none # For implicit none everywhere to detect errors
Expand Down

0 comments on commit f83b401

Please sign in to comment.