summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fixture/fortran_unittests/test_1.f9022
-rw-r--r--test/fixture/fortran_unittests/test_2.f9024
-rw-r--r--test/fixture/fortran_unittests/test_submodules.f9012
3 files changed, 58 insertions, 0 deletions
diff --git a/test/fixture/fortran_unittests/test_1.f90 b/test/fixture/fortran_unittests/test_1.f90
index 25ba9d6..50ab99e 100644
--- a/test/fixture/fortran_unittests/test_1.f90
+++ b/test/fixture/fortran_unittests/test_1.f90
@@ -5,6 +5,8 @@ module test_1
contains
procedure :: set_n
procedure :: get_n
+ procedure :: increment_n
+ procedure :: decrement_n
end type test_type_1
@@ -20,6 +22,14 @@ interface
integer :: get_n
end function get_n
+ module pure subroutine increment_n ( this )
+ class(test_type_1), intent(inout) :: this
+ end subroutine increment_n
+
+ module elemental subroutine decrement_n ( this )
+ class(test_type_1), intent(inout) :: this
+ end subroutine decrement_n
+
end interface
end module test_1
@@ -43,4 +53,16 @@ contains
get_n = this%n
end procedure get_n
+ module pure subroutine increment_n ( this )
+ class(test_type_1), intent(inout) :: this
+
+ this%n = this%n+1
+ end subroutine increment_n
+
+ module elemental subroutine decrement_n ( this )
+ class(test_type_1), intent(inout) :: this
+
+ this%n = this%n-1
+ end subroutine decrement_n
+
end submodule test_1_impl
diff --git a/test/fixture/fortran_unittests/test_2.f90 b/test/fixture/fortran_unittests/test_2.f90
index 7a39b0d..e271953 100644
--- a/test/fixture/fortran_unittests/test_2.f90
+++ b/test/fixture/fortran_unittests/test_2.f90
@@ -5,6 +5,8 @@ module test_2
contains
procedure :: set_m
procedure :: get_m
+ procedure :: increment_m
+ procedure :: decrement_m
end type test_type_2
@@ -20,6 +22,14 @@ interface
integer :: get_m
end function get_m
+ module pure subroutine increment_m ( this )
+ class(test_type_2), intent(inout) :: this
+ end subroutine increment_m
+
+ module elemental subroutine decrement_m ( this )
+ class(test_type_2), intent(inout) :: this
+ end subroutine decrement_m
+
end interface
end module test_2
@@ -43,4 +53,18 @@ contains
get_m = this%m
end procedure get_m
+ module procedure increment_m
+
+ implicit none
+
+ this%m = this%m+1
+ end procedure increment_m
+
+ module procedure decrement_m
+
+ implicit none
+
+ this%m = this%m-1
+ end procedure decrement_m
+
end submodule test_2_impl
diff --git a/test/fixture/fortran_unittests/test_submodules.f90 b/test/fixture/fortran_unittests/test_submodules.f90
index 5deec37..08e472c 100644
--- a/test/fixture/fortran_unittests/test_submodules.f90
+++ b/test/fixture/fortran_unittests/test_submodules.f90
@@ -12,4 +12,16 @@ program test_submodules
print*,'var1%n = ', var1%get_n()
print*,'var2%m = ', var2%get_m()
+ call var1%increment_n()
+ call var2%increment_m()
+
+ print*,'var1%n = ', var1%get_n()
+ print*,'var2%m = ', var2%get_m()
+
+ call var1%decrement_n()
+ call var2%decrement_m()
+
+ print*,'var1%n = ', var1%get_n()
+ print*,'var2%m = ', var2%get_m()
+
end program test_submodules