utestDate.pas
上传用户:yjb1804
上传日期:2021-01-30
资源大小:3105k
文件大小:1k
源码类别:

Email服务器

开发平台:

Delphi

  1. unit utestDate;
  2. interface
  3. uses Classes,DateUtils,SysUtils,StrUtils,TestFramework;
  4. type
  5.   TTestDate=class(TTestCase)
  6.   published
  7.     procedure TestDayOfTheMonth;
  8.     procedure TestDaysInMonth;
  9.     procedure TestDaysInAMonth;
  10.     procedure TestDayInYear;
  11.     procedure TestTimeOf;
  12.     procedure TestDayOf;
  13.     procedure TestMonthOf;
  14.   end;
  15. implementation
  16. { TTestDate }
  17. procedure TTestDate.TestDayInYear;
  18. begin
  19.   Status('DaysInYear(Now): '+inttostr(DaysInYear(Now)));
  20. end;
  21. procedure TTestDate.TestDaysInAMonth;
  22. begin
  23.   Status('YearOf(Now):'+inttostr(YearOf(Now))+'  DaysInAMonth:'+inttostr( DaysInAMonth(YearOf(Now),MonthOf(Now))));
  24. end;
  25. procedure TTestDate.TestDaysInMonth;
  26. begin
  27.   Status('DaysInMonth(Now):'+inttostr(DaysInMonth(Now)));
  28. end;
  29. procedure TTestDate.TestDayOfTheMonth;
  30. begin
  31.   Status('DayOfTheMonth(now):'+inttostr(DayOfTheMonth(now)));
  32. end;
  33. procedure TTestDate.TestDayOf;
  34. begin
  35.   Status('DayOf(Now):'+IntToStr(DayOf(Now)));
  36. end;
  37. procedure TTestDate.TestMonthOf;
  38. begin
  39.   Status('MonthOf(Now):'+IntToStr(MonthOf(Now)));
  40. end;
  41. procedure TTestDate.TestTimeOf;
  42. begin
  43.   Status('TimeOf(Now):'+TimeToStr(TimeOf(Now)));
  44. end;
  45. initialization
  46.   TestFramework.RegisterTest(TTestDate.Suite );
  47. end.