Commit eb58b347 authored by ulrich_y's avatar ulrich_y

Improved reading of integers

parent cd88f721
...@@ -26,9 +26,7 @@ PROGRAM TEST ...@@ -26,9 +26,7 @@ PROGRAM TEST
select case(trim(arg)) select case(trim(arg))
case('-verb') case('-verb')
#ifdef DEBUG #ifdef DEBUG
i=i+1 verb = readint(trim(arg),i)
call get_command_argument(i,arg)
read(arg,*) verb ! str to int
#else #else
call errprint("Argument -verb is not available, compile with --debug") call errprint("Argument -verb is not available, compile with --debug")
#endif #endif
...@@ -47,10 +45,7 @@ PROGRAM TEST ...@@ -47,10 +45,7 @@ PROGRAM TEST
tol = 8.0e-7 tol = 8.0e-7
call do_ginac_tests call do_ginac_tests
case ('-speed-tests') case ('-speed-tests')
i=i+1 call do_timing_tests(readint(trim(arg),i))
call get_command_argument(i,arg)
read(arg,*) verb
call do_timing_tests(i)
case ('-hw-tests') case ('-hw-tests')
tol = 8.0e-7 tol = 8.0e-7
call do_high_weight_tests call do_high_weight_tests
...@@ -105,6 +100,17 @@ CONTAINS ...@@ -105,6 +100,17 @@ CONTAINS
stop 1 stop 1
end subroutine end subroutine
function readint(prev,i)
integer i, readint, st
character(len=32) :: arg
character(len=*) :: prev
i=i+1
call get_command_argument(i,arg)
if (len_trim(arg) == 0) call errprint("Argument "//prev//" requires a number")
read(arg,*,iostat=st) readint
if (st .ne. 0) call errprint("For argument "//prev//": "//trim(arg)//" is not a number")
end function
subroutine check(res, ref) subroutine check(res, ref)
complex(kind=prec) :: res, ref complex(kind=prec) :: res, ref
real(kind=prec) :: delta real(kind=prec) :: delta
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment