Project

General

Profile

assert_equal Subroutine

public subroutine assert_equal(a, b, message, verbose)

Arguments

Type IntentOptional AttributesName
class(*), intent(in) :: a
class(*), intent(in) :: b
character(len=*) , optional :: message
logical , optional :: verbose

Calls

proc~~assert_equal~~CallsGraph proc~assert_equal assert_equal proc~assert assert proc~assert_equal->proc~assert object_string object_string proc~assert_equal->object_string proc~print_verbose print_verbose proc~assert_equal->proc~print_verbose object_equal object_equal proc~assert_equal->object_equal proc~print_error print_error proc~assert->proc~print_error proc~print_mode print_mode proc~print_verbose->proc~print_mode proc~print_error->proc~print_mode

Variables

TypeVisibility AttributesNameInitial
character(len=:), public, allocatable:: buffer

Source Code

    subroutine assert_equal(a, b, message, verbose)
        class(*), intent(in)   :: a
        class(*), intent(in)   :: b
        character(*), optional :: message
        logical, optional      :: verbose

        character(:), allocatable :: buffer

        if(present(message)) then
            buffer = message
        else
            buffer = &
                'found non-equal objects:' // NL // &
                '-- LEFT --------------------------------' // NL // &
                object_string(a) // NL // &
                '-- RIGHT -------------------------------' // NL // &
                object_string(b)
        end if

        call assert(object_equal(a, b), buffer)

        if(present(verbose)) then
            if(verbose) then
                call print_verbose( &
                    '== ASSERT SUCCESSFUL ===================' // NL // &
                    ' got      : ' // NL // &
                    object_string(a) // NL // &
                    ' expected: ' // NL // &
                    object_string(b) // NL // &
                    '== END ASSERT ==========================' &
                )
            end if
        end if
    end subroutine assert_equal


© 2016
self was developed by
Documentation generated by FORD