cafut Module



Contents


Interfaces

public interface TestRealArrVal

Constructor interface for a TestRealArrVal object.

  • public function newTestRealArrVal_name(ts_name) result(new_ts)

    Construct new TestRealArrVal given a name.

    Arguments

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

    Name of the new TestRealArrVal object.

    Return Value type(TestRealArrVal)

    Return new TestRealArrVal object.

public interface TestRealVal

Constructor interface for a TestRealVal object.

  • public function newTestRealVal_name(ts_name) result(new_ts)

    Construct new TestRealVal given a name.

    Arguments

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

    Name of the new TestRealVal object.

    Return Value type(TestRealVal)

    Return new TestRealVal object.

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.

interface

  • public function realArrCompInterface(res, tgt) result(comp)

    Abstract function interface for an array comparisson function.

    Arguments

    Type IntentOptional AttributesName
    real(kind=wp), intent(in), dimension(:):: res

    See res and tgt in TestRealArrVal class.

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

    See res and tgt in TestRealArrVal class.

    Return Value logical

    Return whether or not the test succeeded based on a comparrison.

interface

  • public function realCompInterface(res, tgt) result(comp)

    Abstract function interface for a value comparisson function.

    Arguments

    Type IntentOptional AttributesName
    real(kind=wp), intent(in) :: res

    Result being tested.

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

    Target value used to compare result to.

    Return Value logical

    Return whether or not the test succeeded based on a comparrison.


Abstract Interfaces

abstract interface

  • public function runInterface(self) result(tests_passed)

    Abstract function interface for running a test.

    Arguments

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

    The test itself. The Test object should contain all information needed to run the test.

    Return Value integer

    Return total number of tests which passed in the linked list up to and including this test.


Derived Types

type, public, extends(Test) :: TestRealArrVal

Test performed on an array of real values.

Components

TypeVisibility AttributesNameInitial
procedure(realArrCompInterface), public, nopass, pointer:: compare

Pointer to a comparisson function used to perform the test.

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

Real array result from some process.

character(len=NAME_LENGTH), public :: test_name

Name of the test case.

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

Target real array result for some process.

Constructor

Constructor interface for a TestRealArrVal object.

public function newTestRealArrVal_name(ts_name)

Construct new TestRealArrVal given a name.

Finalizations Procedures

final :: deleteTestRealArrVal

Type-Bound Procedures

procedure, public, pass :: run => runTestRealArrVal

type, public, extends(Test) :: TestRealVal

Test performed on single real values.

Components

TypeVisibility AttributesNameInitial
procedure(realCompInterface), public, nopass, pointer:: compare

Pointer to a comparisson function used to perform the test.

real(kind=wp), public :: res

Real value result from some process.

character(len=NAME_LENGTH), public :: test_name

Name of the test case.

real(kind=wp), public :: tgt

Target real value result for some process.

Constructor

Constructor interface for a TestRealVal object.

public function newTestRealVal_name(ts_name)

Construct new TestRealVal given a name.

Finalizations Procedures

final :: deleteTestRealVal

Type-Bound Procedures

procedure, public, pass :: run => runTestRealVal

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.

Components

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

Current test whose attributes are available to be set.

Constructor

Constructor interface for a TestSuite object.

public function newTestSuite(ts_name)

Construct a new test suite.

Finalizations Procedures

final :: deleteTestSuite

Type-Bound Procedures

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

Functions

public function newTestRealArrVal_name(ts_name) result(new_ts)

Construct new TestRealArrVal given a name.

Arguments

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

Name of the new TestRealArrVal object.

Return Value type(TestRealArrVal)

Return new TestRealArrVal object.

public function newTestRealVal_name(ts_name) result(new_ts)

Construct new TestRealVal given a name.

Arguments

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

Name of the new TestRealVal object.

Return Value type(TestRealVal)

Return new TestRealVal 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.

public function realArrEq(res, tgt) result(comp)

Test if two real arrays are exactly equal. Arrays must be of the same length and have the same values in the same positions. Uses epsilon value to account for floating point error.

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in), dimension(:):: res

Real value result being tested.

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

Target real value to compare result to.

Return Value logical

public function realEq(res, tgt) result(comp)

Test if two real values are equal. Uses an epsilon value to account for floating point error.

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in) :: res

Real value result being tested.

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

Target real value to compare result to.

Return Value logical

Return whether both values are equal.

public function runTestRealArrVal(self) result(tests_passed)

Run test on real arrays and print summary report for images.

Arguments

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

Return Value integer

Return the tests that passed up to and including this one in the linked list.

public function runTestRealVal(self) result(tests_passed)

Run test on real values and print summary report for images.

Arguments

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

Return Value integer

Return the tests that passed up to and including this one in the linked list.


Subroutines

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.

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 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 deleteTestRealArrVal(self)

Destruct TestRealVal object by deallocating its next object pointer as well as its res and tgt arrays.

Arguments

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

public subroutine deleteTestRealVal(self)

Destruct TestRealVal object by deallocating its next object pointer.

Arguments

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

public subroutine deleteTestSuite(self)

Destruct a test suite by deallocating its test pointer attribute.

Arguments

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

public subroutine printFailTestRealArrVal(img, res, tgt)

Print failure message of a real array comparrison.

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: img

Image where the failure occured.

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

(Incorrect) result array of some procedure.

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

(Correct) target result array of some procedure.

public subroutine printFailTestRealVal(img, res, tgt)

Print failure message of a real value comparrison.

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: img

Image where the failure occured.

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

(Incorrect) result value of some procedure.

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

(Correct) target result value of some procedure.

public subroutine runTests(self)

Run all tests contained in a test suite.

Arguments

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