runTestRealArrVal Function

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.


Contents

Source Code


Variables

TypeVisibility AttributesNameInitial
integer, public :: i
integer, public :: img_passed
integer, public :: max_res_n
integer, public :: max_tgt_n
real(kind=wp), public, allocatable, dimension(:), codimension[:]:: res
integer, public, allocatable, codimension[:]:: res_n
real(kind=wp), public, allocatable, dimension(:), codimension[:]:: tgt
integer, public, allocatable, codimension[:]:: tgt_n

Source Code

function runTestRealArrVal(self) result(tests_passed)
    !! Run test on real arrays and print summary report for images.

    class(TestRealArrVal), intent(in) :: self
    integer :: tests_passed
        !! Return the tests that passed up to and including this one in
        !! the linked list.

    real(kind=wp), allocatable, dimension(:), codimension[:] :: res, tgt
    integer, allocatable, codimension[:] :: res_n, tgt_n

    integer :: max_res_n, max_tgt_n
    integer :: img_passed, i

    if (associated(self%next)) then
        tests_passed = self%next%run()
    else
        tests_passed = 0
    end if

    allocate(res_n[*], tgt_n[*])
    res_n = size(self%res)
    tgt_n = size(self%tgt)

    max_res_n = maxToAll(res_n)
    max_tgt_n = maxToAll(tgt_n)

    allocate(res(max_res_n)[*], tgt(max_tgt_n)[*])
    res(:res_n) = self%res
    tgt(:res_n) = self%tgt

    sync all
    img_passed = 0
    if (this_image() == 1) then
        print SUBTEST_START, self%test_name
        do i=1, num_images()
            if (self%compare(res(:res_n[i])[i], tgt(:tgt_n[i])[i])) then
                img_passed = img_passed + 1
            else
                call self%printFail(i, res(:res_n[i])[i], tgt(:tgt_n[i])[i])
            end if
        end do
        print SUBTEST_END, img_passed, num_images()
    end if

    if (img_passed == num_images()) tests_passed = tests_passed + 1

    deallocate(res_n, tgt_n, res, tgt)
end function runTestRealArrVal