home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxdate.zip / REXXTEST.cmd < prev   
OS/2 REXX Batch file  |  1994-03-05  |  2KB  |  59 lines

  1. /*
  2. This command tests the Rexx functions.
  3. */
  4.  
  5. /*=============================================================================
  6. Test the RexxDate functions.
  7. */
  8. say 'Testing RexxDate functions.'
  9. /*
  10. signal on failure name RexxDate_cleanup
  11. signal on halt name RexxDate_cleanup
  12. signal on syntax name RexxDate_cleanup
  13. */
  14. if RxFuncQuery('RexxDate_Init')
  15.   then
  16.     do
  17.       say 'Registering RexxDate_Init.'
  18.       retcode = RxFuncAdd(RexxDate_Init, 'REXXDATE', 'RexxDate_Init')
  19.       retcode = RexxDate_Init()
  20.     end /* end do */
  21. /******************************************************************************/
  22.  
  23.   say 'Testing date difference routine.'
  24.  
  25.   parse value DATE('U') with mon'/'day'/'yr
  26.   
  27.   say 'Calling RexxDate_Diff with both arguments.'
  28.   date1 = '2/28/94'
  29.   date2 = '2/18/94'
  30.   diff = RexxDate_Diff(date1,date2)
  31.   say 'Difference in days between' date1 'and' date2 'is' diff
  32.  
  33.   say 'Calling RexxDate_Diff with first argument omitted.'
  34.   date2 = '1/1/'yr
  35.   diff = RexxDate_Diff( ,date2)
  36.   say 'Difference in days between' DATE('U') 'and' date2 'is' diff
  37.  
  38.   say 'Calling RexxDate_Diff with second argument omitted.'
  39.   date1 = DATE(U)
  40.   diff = RexxDate_Diff(date1, )
  41.   say 'Difference in days between' date1 'and' DATE(U) 'is' diff
  42.  
  43. /******************************************************************************/
  44.  
  45.   say "Testing leap year routine."
  46.  
  47.   parse value DATE('U') with mon'/'day'/'yr
  48.   say 'Test with no arguments:' RexxDate_Isleap('96')
  49.  
  50.   Do year = 1900 + yr to 2010
  51.      say year // 100  RexxDate_Isleap(year // 100 ) year RexxDate_Isleap(year)
  52.   end /* do */
  53. /*
  54. Exits.
  55. */
  56. RexxDate_cleanup:
  57.   retcode = RexxDate_Drop()
  58.   say 'Exiting.'
  59.