TestSuite Derived Type

type, public :: TestSuite

Holds tests and manages their executtion. Represents a set of procedures to test a certain feature. First node of the test linked list.


Contents

Source Code


Components

TypeVisibility AttributesNameInitial
class(Test), public, pointer:: test

Current test whose attributes are available to be set.


Constructor

public interface TestSuite

Constructor interface for a TestSuite object.

  • public function newTestSuite(ts_name) result(new_ts)

    Construct a new test suite.

    Arguments

    Type IntentOptional AttributesName
    character(len=*), intent(in) :: ts_name

    Name of the test suite.

    Return Value type(TestSuite)

    Return the new test suite.


Finalization Procedures

final :: deleteTestSuite

  • public subroutine deleteTestSuite(self)

    Destruct a test suite by deallocating its test pointer attribute.

    Arguments

    Type IntentOptional AttributesName
    type(TestSuite), intent(inout) :: self

Type-Bound Procedures

generic, public :: add => addUnitTest, addTestRealVal, addTestRealArrVal

  • public subroutine addUnitTest(self, ut)

    Add a Test object to the test suite and make it available for setup.

    Arguments

    Type IntentOptional AttributesName
    class(TestSuite), intent(inout) :: self
    class(Test), intent(inout), target:: ut

    Object derived from the Test abstract type.

  • public subroutine addTestRealVal(self, ut, res, tgt)

    Compact alternative to add a TestRealVal object to the test suite.

    Arguments

    Type IntentOptional AttributesName
    class(TestSuite), intent(inout) :: self
    type(TestRealVal), intent(in) :: ut

    An initialized TestRealVal object with the desired name.

    real(kind=wp), intent(in) :: res

    See TestRealVal.

    real(kind=wp), intent(in) :: tgt

    See TestRealVal.

  • public subroutine addTestRealArrVal(self, ut, res, tgt)

    Compact alternative to add a TestRealArrVal object to the test suite.

    Arguments

    Type IntentOptional AttributesName
    class(TestSuite), intent(inout) :: self
    type(TestRealArrVal), intent(in) :: ut

    An initialized TestRealArrVal object with the desired name.

    real(kind=wp), allocatable, dimension(:):: res

    See TestRealArrVal.

    real(kind=wp), allocatable, dimension(:):: tgt

    See TestRealArrVal.

procedure, public, pass :: addUnitTest

  • public subroutine addUnitTest(self, ut)

    Add a Test object to the test suite and make it available for setup.

    Arguments

    Type IntentOptional AttributesName
    class(TestSuite), intent(inout) :: self
    class(Test), intent(inout), target:: ut

    Object derived from the Test abstract type.

procedure, public, pass :: runTests

  • public subroutine runTests(self)

    Run all tests contained in a test suite.

    Arguments

    Type IntentOptional AttributesName
    class(TestSuite), intent(in) :: self

Source Code

type, public :: TestSuite
    !! Holds tests and manages their executtion.
    !! Represents a set of procedures to test a certain feature.
    !! First node of the test linked list.

    integer, private :: n_tests
        !! Number of tests in a test suite.
    character(len=NAME_LENGTH), private :: test_suite_name
        !! Name of the test suite.
    class(Test), public, pointer :: test
        !! Current test whose attributes are available to be set.

contains

    procedure, public, pass :: addUnitTest
    procedure, private, pass :: addTestRealVal
    procedure, private, pass :: addTestRealArrVal
    generic, public :: add => addUnitTest, addTestRealVal, addTestRealArrVal

    procedure, public, pass :: runTests
    final :: deleteTestSuite

end type TestSuite