      program test_week
      
c     ***************************************************************0**
c *   Test_Week: test procedures concerning date and week in the year
c     P. Robert, Dec 2006
c     ***************************************************************0**      

      character*9 cday,cday1,cday2

      do iy=1998,2018

      iyear=iy

      print 200, '------------'
      print 200, 'annee ',iyear
      print 200, '------------'

      call cv_date_to_dotw(iyear,1,1,idow1)
      call cp_fr_day_name(idow1,cday,nbcha)
      call cv_date_to_weekn(iyear,1,1,iweek1)
      call cv_date_to_weekn(iyear,2,1,iweek2)
c
      print 100, 'Le premier jour de l''annee est un ',cday(1:nbcha)
      print 200, 'Le premier janvier est la semaine ',iweek1
      print 200, 'Le premier fevrier est la semaine ',iweek2
 
  100 FORMAT(2a)
  200 format(a,i4,a,i5,i3,i3)
  300 format(a,i5,i3,i3,2a)
  400 format(a,i5,i3,i3,a,i3)

c
      iyear1=iyear
      iyear2=iyear

      call cv_weekn_to_date(iweek1,iyear1,imon1,iday1)
      call cv_weekn_to_date(iweek2,iyear2,imon2,iday2)

      print 200,'la semaine ',iweek1,' correspondant a',
     &           iyear1,imon1,iday1
      print 200,'la semaine ',iweek2,' correspondant a',
     &           iyear2,imon2,iday2

      call cv_date_to_doty(iyear,1,1,idoty1)
      call cv_date_to_doty(iyear,2,1,idoty2)

      print 200, 'Le premier janvier est le jour num. ',idoty1
      print 200, 'Le premier fevrier est le jour num. ',idoty2

      call cv_doty_to_date(idoty1,iyear,imon1,iday1)
      call cv_doty_to_date(idoty2,iyear,imon2,iday2)

      print 200, 'et le jour ',idoty1,' est le ',iyear,imon1,iday1
      print 200, 'et le jour ',idoty2,' est le ',iyear,imon2,iday2

      call cv_date_to_dotw(iyear,imon1,iday1,idow1)
      call cv_date_to_dotw(iyear,imon2,iday2,idow2)
      call cp_fr_day_name(idow1,cday1,nbcha)
      call cp_fr_day_name(idow2,cday2,nbcha)

      print 300, 'et ',iyear,imon1,iday1,' est un ',cday1
      print 300, 'et ',iyear,imon2,iday2,' est un ',cday2

      call cv_date_to_weekn(iyear,imon1,iday1,iweek1)
      call cv_date_to_weekn(iyear,imon2,iday2,iweek2)

      print 400, 'et le ',iyear,imon1,iday1,' donne la semaine ',iweek1
      print 400, 'et le ',iyear,imon2,iday2,' donne la semaine ',iweek2

      enddo

      stop 'test_week.exe: normal termination'
      end     
