Skip to content

Commit

Permalink
Simplify method
Browse files Browse the repository at this point in the history
  • Loading branch information
minhqdao committed Mar 10, 2024
1 parent 3960241 commit 58a8fef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
11 changes: 1 addition & 10 deletions src/version_f.f90
Original file line number Diff line number Diff line change
Expand Up @@ -661,23 +661,14 @@ subroutine try_satisfy(this, string, is_satisfied, error)
!> Error handling.
type(error_t), allocatable, intent(out) :: error

character(:), allocatable :: str
type(version_range_t) :: version_range
integer :: i

str = trim(adjustl(string))

if (len(str) == 0) then
error = error_t('Do not compare empty expressions.'); return
end if

call version_range%parse(str, error)
print *, 'parse error ', allocated(error)
call version_range%parse(string, error)
if (allocated(error)) return

do i = 1, size(version_range%comp_sets)
call this%satisfies_comp_set(version_range%comp_sets(i), is_satisfied, error)
print *, 'satisfy error ', error%msg
if (is_satisfied .or. allocated(error)) return
end do
end
Expand Down
4 changes: 2 additions & 2 deletions test/version_f_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ program test
logical :: is_satisfied
type(error_t), allocatable :: e

v1 = version_t(0, 1, 0)
v1 = version_t(0, 1, 0)

call v1%try_satisfy(' > 1.0.1 < 2.1.0 ', is_satisfied, e)
call v1%try_satisfy('> 1.0.1 < 2.1.0', is_satisfied, e)
if (is_satisfied) call fail('satisfy-36 should not satisfy.')
if (allocated(e)) call fail('satisfy-36 should not fail.')

Expand Down

0 comments on commit 58a8fef

Please sign in to comment.