Check if a integer (32 bits) is positive.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(tester_t), | intent(inout) | :: | this | The tester. |
||
integer(kind=int32), | intent(in) | :: | i | Value to check. |
||
logical, | intent(in), | optional | :: | fail | Fail flag. |
subroutine assert_positive_i32(this, i, fail)
class(tester_t), intent(inout) :: this !< The tester.
integer(int32), intent(in) :: i !< Value to check.
logical, intent(in), optional :: fail !< Fail flag.
this% n_tests = this% n_tests + 1
if (i < 0) then
if (.not. present(fail) .or. (present(fail) .and. fail .eqv. .false.)) then
this% n_errors = this% n_errors + 1
end if
end if
end subroutine assert_positive_i32