Jim Cownie | 18d8473 | 2014-05-10 17:02:09 +0000 | [diff] [blame] | 1 | subroutine print_result(s,crossfailed,M,name) |
| 2 | implicit none |
| 3 | character (len=*)::name |
| 4 | real cert |
| 5 | integer M,crossfailed |
| 6 | integer s |
| 7 | character (len=11) :: c |
| 8 | character (len=18) :: c2 |
| 9 | cert=100.0*crossfailed/M |
| 10 | ! print *, "cert", cert, "cross ", crossfailed |
| 11 | ! test1=hundred*crossfailed |
| 12 | c="% certainty" |
| 13 | c2=" ... verified with " |
| 14 | if(s.eq.1) then |
| 15 | write (*,"(A, A, F7.2, A)") name, c2, cert, c |
| 16 | else |
| 17 | write (*,"(A,A)") name," ... FAILED" |
| 18 | endif |
| 19 | end |
| 20 | |
| 21 | subroutine do_test(test_func,cross_test_func,name,N,failed, |
| 22 | x num_tests,crosschecked) |
| 23 | implicit none |
| 24 | integer succeed |
| 25 | integer crossfail |
| 26 | integer failed |
| 27 | integer, external::test_func |
| 28 | integer, external::cross_test_func |
| 29 | character (len=*)::name |
| 30 | integer fail |
| 31 | integer N,i |
| 32 | integer num_tests,crosschecked |
| 33 | num_tests=num_tests+1 |
| 34 | succeed=1 |
| 35 | crossfail=0 |
| 36 | fail=0 |
| 37 | do i=1,N |
| 38 | if(test_func().eq.0) then |
| 39 | succeed=0 |
| 40 | fail=fail+1 |
| 41 | exit |
| 42 | end if |
| 43 | if(cross_test_func().eq.0) then |
| 44 | ! print *, crossfail |
| 45 | crossfail=crossfail+1.0 |
| 46 | end if |
| 47 | enddo |
| 48 | |
| 49 | if (fail .ne. 0) then |
| 50 | failed=failed+1 |
| 51 | else |
| 52 | if(crossfail .ne. 0) then |
| 53 | crosschecked=crosschecked+1 |
| 54 | end if |
| 55 | endif |
| 56 | call print_result(succeed,crossfail,N,name) |
| 57 | end |