Calendar-List
view release on metacpan or search on metacpan
t/11datetime.t view on Meta::CPAN
# desc: Functionality check with DateTime
###########################################################################
foreach my $test (@datetest) {
my $date = encode_date(@{$test->{array}});
if($test->{invalid}) {
is($date,undef,"date failed to encode [@{$test->{array}}] correctly");
} else {
ok($date,"date encoded [@{$test->{array}}]");
my @date = decode_date($date);
is_deeply(\@date,$test->{array},"date decoded [@{$test->{array}}]");
}
}
foreach my $test (@diffs) {
my ($date1,$date2);
$date1 = encode_date(@{$test->{from}}) if(@{$test->{from}});
$date2 = encode_date(@{$test->{to}}) if(@{$test->{to}});
is(compare_dates($date1,$date2),$test->{compare},
sprintf ".. [%02d/%02d/%04d] => [%02d/%02d/%04d]",
$test->{from}[0]||'-1',$test->{from}[1]||'-1',$test->{from}[2]||'-1',
t/12dateical.t view on Meta::CPAN
# switch off DateTime, if loaded
_caltest(0,1,0);
foreach my $test (@datetest) {
my $date = encode_date(@{$test->{array}});
if($test->{invalid}) {
is($date,undef,"date failed to encode [@{$test->{array}}] correctly");
} else {
ok($date,"date encoded [@{$test->{array}}]");
my @date = decode_date($date);
is_deeply(\@date,$test->{array},"date decoded [@{$test->{array}}]");
}
}
foreach my $test (@diffs) {
my ($date1,$date2);
$date1 = encode_date(@{$test->{from}}) if(@{$test->{from}});
$date2 = encode_date(@{$test->{to}}) if(@{$test->{to}});
is(compare_dates($date1,$date2),$test->{compare},
sprintf ".. [%02d/%02d/%04d] => [%02d/%02d/%04d]",
$test->{from}[0]||'-1',$test->{from}[1]||'-1',$test->{from}[2]||'-1',
t/13timelocal.t view on Meta::CPAN
foreach my $test (@datetest) {
# before the epoch, skipping
next if(!$on_unix && $test->{tl} == 2);
# should have real values
if($test->{tl}) {
my $date = encode_date(@{$test->{array}});
ok($date,"date encoded [@{$test->{array}}]");
my @date = decode_date($date);
is_deeply(\@date,$test->{array},"date decoded [@{$test->{array}}]");
# expecting undef values
} else {
my $date = encode_date(@{$test->{array}});
is($date,undef,"date not encoded [@{$test->{array}}]");
is(decode_date(undef),undef,"date not decoded [@{$test->{array}}]");
}
}
foreach my $test (@diffs) {
# outside the epoch range, skipping
next if(!$on_unix && $test->{tl} == 2);
next if($test->{tl} == 0);
my ($date1,$date2);
$date1 = encode_date(@{$test->{from}}) if(@{$test->{from}});
( run in 0.673 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )