anchor.diff:                  print*, " "
                   EXIT MJDLOOP
               endif
  -            
  +
               ! this is the main test it is likely to fail
               if (abs(mjd_output-mjd_input)>MAX_ERROR) then
                   calendar_test=.False.
  
positive.code:         print*, "   Corresponding Last Date"
          call calendar_date(max_mjd, year, month, day, hour, minute, second)
          print*, year, month, day, hour, minute, second
          
          MJDLOOP: do mjd_input = min_mjd, max_mjd, mjd_step
              ! test that input and output Modified Julian Days stay the same
              call calendar_date(mjd_input, year, month, day, hour, minute, second)
  
negative.code:     logical function calendar_test(calendar_name,error)
          character(len=STRING_LENGTH), intent(in) :: calendar_name
          character(len=STRING_LENGTH), intent(out) :: error
  
          double precision :: mjd_input, mjd_output
          double precision :: min_mjd, max_mjd, mjd_step
          integer :: year, month, day, hour, minute, second
  
          error=""
          calendar_test=.True.
  
          call time_init(calendar_name)
          min_mjd=365.0*1.d0
          max_mjd=365.0*2100.d0
          mjd_step=0.1
  
          MJDLOOP: do mjd_input = min_mjd, max_mjd, mjd_step
              ! test that input and output Modified Julian Days stay the same
              call calendar_date(mjd_input, year, month, day, hour, minute, second)
              mjd_output=date_to_mjd(year, month, day, hour, minute, second)
  
              ! test that month and day values are at least realistic (rare to fail)
              if ((day<1).or.(day>31)) then
                  calendar_test=.False.
  