Check if two logical arrays (rank 1) are equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(tester_t), | intent(inout) | :: | this | The tester. |
||
logical, | intent(in), | dimension(:) | :: | l1 | Value to compare. |
|
logical, | intent(in), | dimension(:) | :: | l2 | Value to compare. |
|
logical, | intent(in), | optional | :: | fail | Fail flag. |
subroutine assert_equal_l_1(this, l1, l2, fail)
class(tester_t), intent(inout) :: this !< The tester.
logical, intent(in), dimension(:) :: l1 !< Value to compare.
logical, intent(in), dimension(:) :: l2 !< Value to compare.
logical, intent(in), optional :: fail !< Fail flag.
integer :: k
this% n_tests = this% n_tests + 1
if ( size(l1) .ne. size(l2) ) then
if (.not. present(fail) .or. (present(fail) .and. fail .eqv. .false.)) then
this% n_errors = this% n_errors + 1
end if
else
do k = 1, size(l1)
if (l1(k) .neqv. l2(k)) then
if (.not. present(fail) .or. (present(fail) .and. fail .eqv. .false.)) then
this% n_errors = this% n_errors + 1
end if
exit
end if
end do
end if
end subroutine assert_equal_l_1