"Fossies" - the Fresh Open Source Software Archive

Member "Date-Calc-6.4/t/f016.t" (7 Mar 2015, 4385 Bytes) of package /linux/privat/Date-Calc-6.4.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "f016.t": 6.3_vs_6.4.

    1 #!perl -w
    2 
    3 BEGIN { eval { require bytes; }; }
    4 use strict;
    5 no strict "vars";
    6 
    7 BEGIN { $Date::Calc::XS_DISABLE = $Date::Calc::XS_DISABLE = 1; }
    8 
    9 use Date::Calc qw( Decode_Date_EU Decode_Date_US );
   10 
   11 # ======================================================================
   12 #   ($year,$mm,$dd) = Decode_Date_EU($buffer);
   13 #   ($year,$mm,$dd) = Decode_Date_US($buffer);
   14 # ======================================================================
   15 
   16 print "1..25\n";
   17 
   18 $n = 1;
   19 if ((($year,$mm,$dd) = Decode_Date_EU("3.1.64")) &&
   20 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   21 {print "ok $n\n";} else {print "not ok $n\n";}
   22 $n++;
   23 if ((($year,$mm,$dd) = Decode_Date_EU("3 1 64")) &&
   24 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   25 {print "ok $n\n";} else {print "not ok $n\n";}
   26 $n++;
   27 if ((($year,$mm,$dd) = Decode_Date_EU("03.01.64")) &&
   28 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   29 {print "ok $n\n";} else {print "not ok $n\n";}
   30 $n++;
   31 if ((($year,$mm,$dd) = Decode_Date_EU("03/01/64")) &&
   32 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   33 {print "ok $n\n";} else {print "not ok $n\n";}
   34 $n++;
   35 if ((($year,$mm,$dd) = Decode_Date_EU("3. Ene 1964",4)) &&
   36 ($year==1964)&&($mm==1)&&($dd==3))
   37 {print "ok $n\n";} else {print "not ok $n\n";}
   38 $n++;
   39 if ((($year,$mm,$dd) = Decode_Date_EU("Geburtstag: 3. Januar '64 in Backnang/Württemberg",3)) &&
   40 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   41 {print "ok $n\n";} else {print "not ok $n\n";}
   42 $n++;
   43 if ((($year,$mm,$dd) = Decode_Date_EU("03-Jan-64")) &&
   44 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   45 {print "ok $n\n";} else {print "not ok $n\n";}
   46 $n++;
   47 if ((($year,$mm,$dd) = Decode_Date_EU("3.Jan1964",6)) &&
   48 ($year==1964)&&($mm==1)&&($dd==3))
   49 {print "ok $n\n";} else {print "not ok $n\n";}
   50 $n++;
   51 if ((($year,$mm,$dd) = Decode_Date_EU("3Jan64",0)) &&
   52 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   53 {print "ok $n\n";} else {print "not ok $n\n";}
   54 $n++;
   55 if ((($year,$mm,$dd) = Decode_Date_EU("030164")) &&
   56 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   57 {print "ok $n\n";} else {print "not ok $n\n";}
   58 $n++;
   59 if ((($year,$mm,$dd) = Decode_Date_EU("3ja64")) &&
   60 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   61 {print "ok $n\n";} else {print "not ok $n\n";}
   62 $n++;
   63 if ((($year,$mm,$dd) = Decode_Date_EU("3164")) &&
   64 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   65 {print "ok $n\n";} else {print "not ok $n\n";}
   66 $n++;
   67 
   68 if ((($year,$mm,$dd) = Decode_Date_EU("28.2.1995")) &&
   69 ($year==1995)&&($mm==2)&&($dd==28))
   70 {print "ok $n\n";} else {print "not ok $n\n";}
   71 $n++;
   72 unless (($year,$mm,$dd) = Decode_Date_EU("29.2.1995"))
   73 {print "ok $n\n";} else {print "not ok $n\n";}
   74 $n++;
   75 
   76 if ((($year,$mm,$dd) = Decode_Date_US("1 3 64")) &&
   77 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   78 {print "ok $n\n";} else {print "not ok $n\n";}
   79 $n++;
   80 if ((($year,$mm,$dd) = Decode_Date_US("01/03/64")) &&
   81 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   82 {print "ok $n\n";} else {print "not ok $n\n";}
   83 $n++;
   84 if ((($year,$mm,$dd) = Decode_Date_US("Jan 3 '64")) &&
   85 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
   86 {print "ok $n\n";} else {print "not ok $n\n";}
   87 $n++;
   88 if ((($year,$mm,$dd) = Decode_Date_US("Jan 3 1964")) &&
   89 ($year==1964)&&($mm==1)&&($dd==3))
   90 {print "ok $n\n";} else {print "not ok $n\n";}
   91 $n++;
   92 if ((($year,$mm,$dd) = Decode_Date_US("===> January 3rd 1964 (birthday)")) &&
   93 ($year==1964)&&($mm==1)&&($dd==3))
   94 {print "ok $n\n";} else {print "not ok $n\n";}
   95 $n++;
   96 if ((($year,$mm,$dd) = Decode_Date_US("Jan31964")) &&
   97 ($year==1964)&&($mm==1)&&($dd==3))
   98 {print "ok $n\n";} else {print "not ok $n\n";}
   99 $n++;
  100 if ((($year,$mm,$dd) = Decode_Date_US("Jan364")) &&
  101 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
  102 {print "ok $n\n";} else {print "not ok $n\n";}
  103 $n++;
  104 if ((($year,$mm,$dd) = Decode_Date_US("ja364")) &&
  105 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
  106 {print "ok $n\n";} else {print "not ok $n\n";}
  107 $n++;
  108 if ((($year,$mm,$dd) = Decode_Date_US("1364")) &&
  109 (int($year/100)>19)&&($year%100==64)&&($mm==1)&&($dd==3))
  110 {print "ok $n\n";} else {print "not ok $n\n";}
  111 $n++;
  112 
  113 if ((($year,$mm,$dd) = Decode_Date_US("2.28.1995")) &&
  114 ($year==1995)&&($mm==2)&&($dd==28))
  115 {print "ok $n\n";} else {print "not ok $n\n";}
  116 $n++;
  117 unless (($year,$mm,$dd) = Decode_Date_US("2.29.1995"))
  118 {print "ok $n\n";} else {print "not ok $n\n";}
  119 $n++;
  120 
  121 __END__
  122