include more unit tests for Fortran

This commit is contained in:
Martin Diehl 2023-07-31 11:04:58 +02:00
parent 39f4bc44e1
commit efeed13d8f
7 changed files with 83 additions and 9 deletions

View File

@ -26,6 +26,7 @@ module IO
public :: &
IO_init, &
IO_selfTest, &
IO_read, &
IO_readlines, &
IO_isBlank, &
@ -55,7 +56,7 @@ subroutine IO_init()
print'(/,1x,a)', '<<<+- IO init -+>>>'; flush(IO_STDOUT)
call selfTest()
call IO_selfTest()
end subroutine IO_init
@ -763,7 +764,7 @@ end subroutine panel
!--------------------------------------------------------------------------------------------------
!> @brief Check correctness of some IO functions.
!--------------------------------------------------------------------------------------------------
subroutine selfTest()
subroutine IO_selfTest()
integer, dimension(:), allocatable :: chunkPos
character(len=:), allocatable :: str,out
@ -846,6 +847,6 @@ subroutine selfTest()
if ('abc,'//IO_EOL//'xxdefg,'//IO_EOL//'xxhij' /= IO_wrapLines('abc,defg, hij',filler='xx',length=4)) &
error stop 'IO_wrapLines/7'
end subroutine selfTest
end subroutine IO_selfTest
end module IO

View File

@ -19,6 +19,7 @@ module misc
public :: &
misc_init, &
misc_selfTest, &
misc_optional, &
misc_prefixOptions

View File

@ -92,6 +92,7 @@ module rotations
public :: &
rotations_init, &
rotations_selfTest, &
eu2om
contains
@ -99,14 +100,14 @@ contains
!--------------------------------------------------------------------------------------------------
!> @brief Do self test.
!--------------------------------------------------------------------------------------------------
subroutine rotations_init
subroutine rotations_init()
print'(/,1x,a)', '<<<+- rotations init -+>>>'; flush(IO_STDOUT)
print'(/,1x,a)', 'D. Rowenhorst et al., Modelling and Simulation in Materials Science and Engineering 23:083501, 2015'
print'( 1x,a)', 'https://doi.org/10.1088/0965-0393/23/8/083501'
call selfTest()
call rotations_selfTest()
end subroutine rotations_init
@ -757,7 +758,7 @@ end function conjugateQuaternion
!--------------------------------------------------------------------------------------------------
!> @brief Check correctness of some rotations functions.
!--------------------------------------------------------------------------------------------------
subroutine selfTest()
subroutine rotations_selfTest()
type(tRotation) :: R
real(pREAL), dimension(4) :: qu
@ -841,7 +842,7 @@ subroutine selfTest()
end function quaternion_equal
end subroutine selfTest
end subroutine rotations_selfTest
end module rotations

View File

@ -4,10 +4,17 @@ program DAMASK_test
use HDF5_utilities
use test_prec
use test_tables
use test_crystal
use test_IO
use test_rotations
use test_misc
use test_tables
use test_HDF5_utilities
external :: quit
call parallelization_init()
print('(/,a)'), 'begin test prec'
call test_prec_run()
print('(a)'), 'begin test prec'
@ -20,11 +27,24 @@ program DAMASK_test
call test_crystal_run()
print('(a)'), 'end test crystal'
call parallelization_init()
print('(/,a)'), 'begin test rotations'
call test_rotations_run()
print('(a)'), 'end test rotations'
print('(/,a)'), 'begin test IO'
call test_IO_run()
print('(a)'), 'end test IO'
print('(/,a)'), 'begin test misc'
call test_misc_run()
print('(a)'), 'end test misc'
call HDF5_utilities_init()
print('(/,a)'), 'begin test HDF5_utilities'
call test_HDF5_utilities_run()
print('(a)'), 'begin test HDF5_utilities'
call quit(0)
end program DAMASK_test

17
src/test/test_IO.f90 Normal file
View File

@ -0,0 +1,17 @@
module test_IO
use IO
implicit none(type,external)
private
public :: test_IO_run
contains
subroutine test_IO_run()
call IO_selfTest()
end subroutine test_IO_run
end module test_IO

17
src/test/test_misc.f90 Normal file
View File

@ -0,0 +1,17 @@
module test_misc
use misc
implicit none(type,external)
private
public :: test_misc_run
contains
subroutine test_misc_run()
call misc_selfTest()
end subroutine test_misc_run
end module test_misc

View File

@ -0,0 +1,17 @@
module test_rotations
use rotations
implicit none(type,external)
private
public :: test_rotations_run
contains
subroutine test_rotations_run()
call rotations_selfTest()
end subroutine test_rotations_run
end module test_rotations