1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
#!perl -w
BEGIN { eval { require bytes; }; }
use strict;
no strict "vars";
use Date::Calc qw( Day_of_Week_to_Text Language_to_Text Language );
# ======================================================================
# $day = Day_of_Week_to_Text($weekday);
# ======================================================================
print "1..38\n";
$n = 1;
eval { Day_of_Week_to_Text(0); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(1) eq "Monday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(2) eq "Tuesday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(3) eq "Wednesday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(4) eq "Thursday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(5) eq "Friday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(6) eq "Saturday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(7) eq "Sunday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (($t = Day_of_Week_to_Text(1,0)) eq "Monday")
{print "ok $n\n";} else {print "not ok $n ($t)\n";}
$n++;
if (Day_of_Week_to_Text(2,0) eq "Tuesday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(3,0) eq "Wednesday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(4,0) eq "Thursday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(5,0) eq "Friday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(6,0) eq "Saturday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(7,0) eq "Sunday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(1,1) eq "Monday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(2,1) eq "Tuesday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(3,1) eq "Wednesday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(4,1) eq "Thursday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(5,1) eq "Friday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(6,1) eq "Saturday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(7,1) eq "Sunday")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(1,3) eq "Montag")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(2,3) eq "Dienstag")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(3,3) eq "Mittwoch")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(4,3) eq "Donnerstag")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(5,3) eq "Freitag")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(6,3) eq "Samstag")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (Day_of_Week_to_Text(7,3) eq "Sonntag")
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Day_of_Week_to_Text(8); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Day_of_Week_to_Text(9,0); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Day_of_Week_to_Text(10,1); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Day_of_Week_to_Text(11,()); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Day_of_Week_to_Text(12,()); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Day_of_Week_to_Text(13); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Day_of_Week_to_Text(14); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Day_of_Week_to_Text(15); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Day_of_Week_to_Text(16); };
if ($@ =~ /day of week out of range/)
{print "ok $n\n";} else {print "not ok $n\n";}
__END__
|