File: f033.t

package info (click to toggle)
libdate-pcalc-perl 1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 428 kB
  • ctags: 80
  • sloc: perl: 4,738; makefile: 42; sh: 18
file content (37 lines) | stat: -rw-r--r-- 966 bytes parent folder | download | duplicates (2)
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
#!perl -w

use strict;
no strict "vars";

use Date::Pcalc qw( Standard_to_Business Business_to_Standard Add_Delta_Days );

# ======================================================================
#   ($year,$week,$dow) = Standard_to_Business($year,$month,$day);
#   ($year,$month,$day) = Business_to_Standard($year,$week,$dow);
# ======================================================================

$y1 = 1964;
$y2 = 2000;
$d1 = -8;
$d2 = +8;

print "1..", ($y2-$y1+1) * ($d2-$d1+1), "\n";

$n = 1;
for ( $year = $y1; $year <= $y2; $year++ )
{
    for ( $delta = $d1; $delta <= $d2; $delta++ )
    {
        @date = Add_Delta_Days($year,1,1,$delta);
        @business = Standard_to_Business(@date);
        @standard = Business_to_Standard(@business);
        if (($standard[0] == $date[0]) &&
            ($standard[1] == $date[1]) &&
            ($standard[2] == $date[2]))
        {print "ok $n\n";} else {print "not ok $n\n";}
        $n++;
    }
}

__END__