Using a fixture in a separate module will give a linker error (see below). Using a fixture in a separate module would allow reuse for several tests in different files/modules. If I put the fixture in the same module, the code compiles. I have also seen errors with access to private variable tree when I moved the fixture module to a separate file, but currently cannot reproduce that.
Code:
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! fixtures for adios tests
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
module fixture
! load unit test
use funit
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! fixture to set exception handling
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@TestCase
type, extends(TestCase) :: basic_setup
contains
! setup routine
procedure :: setup
! finalize routine
procedure :: teardown
end type basic_setup
contains
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! basic setup routine
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine setUp(this)
! variable declaration
implicit none
! object
class(basic_setup), intent(inout) :: this
end subroutine setUp
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! basic finalize routine
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine tearDown(this)
! variable declaration
implicit none
! object
class(basic_setup), intent(inout) :: this
end subroutine tearDown
end module fixture
module test_fixture
! load unit test
use funit
use fixture
contains
@Test
subroutine test_procedure(self)
class(basic_setup), intent(inout) :: self
end subroutine test_procedure
end module test_fixture
CMake (unit_test links in pfunit and the application)
Using a fixture in a separate module will give a linker error (see below). Using a fixture in a separate module would allow reuse for several tests in different files/modules. If I put the fixture in the same module, the code compiles. I have also seen errors with access to private variable
tree
when I moved the fixture module to a separate file, but currently cannot reproduce that.Code:
CMake (unit_test links in pfunit and the application)
Error message