File: date.t

package info (click to toggle)
libpdf-api2-perl 2.047-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,228 kB
  • sloc: perl: 42,227; makefile: 11
file content (120 lines) | stat: -rw-r--r-- 2,921 bytes parent folder | download
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
use Test::More;

use strict;
use warnings;

use PDF::API2;

my $value = 'D:2006';
ok(PDF::API2::_is_date($value), $value);

$value = 'D:200601';
ok(PDF::API2::_is_date($value), $value);

$value = 'D:20061';
ok(!PDF::API2::_is_date($value),
   qq{$value (missing leading zero)});

$value = 'D:200613';
ok(!PDF::API2::_is_date($value),
   qq{$value (invalid month)});

$value = 'D:20060102';
ok(PDF::API2::_is_date($value), $value);

$value = 'D:2006012';
ok(!PDF::API2::_is_date($value),
   qq{$value (missing leading zero)});

$value = 'D:20060132';
ok(!PDF::API2::_is_date($value),
   qq{$value (invalid day)});

$value = 'D:2006010215';
ok(PDF::API2::_is_date($value), $value);

$value = 'D:200601023';
ok(!PDF::API2::_is_date($value),
   qq{$value (missing leading zero)});

$value = 'D:2006010225';
ok(!PDF::API2::_is_date($value),
   qq{$value (invalid hour)});

$value = 'D:200601021504';
ok(PDF::API2::_is_date($value), $value);

$value = 'D:20060102154';
ok(!PDF::API2::_is_date($value),
   qq{$value (missing leading zero)});

$value = 'D:200601021561';
ok(!PDF::API2::_is_date($value),
   qq{$value (invalid minute)});

$value = 'D:20060102150405';
ok(PDF::API2::_is_date($value), $value);

$value = 'D:2006010215045';
ok(!PDF::API2::_is_date($value),
   qq{$value (missing leading zero)});

$value = 'D:20060102150461';
ok(!PDF::API2::_is_date($value),
   qq{$value (invalid second)});

$value = 'D:20060102150405Z';
ok(PDF::API2::_is_date($value), $value);

$value = 'D:20060102150405-07';
ok(PDF::API2::_is_date($value), $value);

$value = 'D:20060102150405+07';
ok(PDF::API2::_is_date($value), $value);

$value = q{D:20060102150405-07'};
ok(PDF::API2::_is_date($value), $value);

$value = q{D:20060102150405-7'};
ok(!PDF::API2::_is_date($value),
   qq{$value (missing leading zero)});

$value = q{D:20060102150405-25};
ok(!PDF::API2::_is_date($value),
   qq{$value (invalid offset hour)});

$value = q{D:20060102150405+25'};
ok(!PDF::API2::_is_date($value),
   qq{$value (invalid offset hour)});

$value = q{D:20060102150405-07'00};
ok(PDF::API2::_is_date($value), $value);

$value = q{D:20060102150405+07'00};
ok(PDF::API2::_is_date($value), $value);

$value = q{D:20060102150405-07'00'};
ok(PDF::API2::_is_date($value),
   qq{$value (Adobe specification compatibility)});

$value = q{D:20060102150405+07'00'};
ok(PDF::API2::_is_date($value),
   qq{$value (Adobe specification compatibility)});

$value = q{D:20060102150405-071'};
ok(!PDF::API2::_is_date($value),
   qq{$value (missing leading zero)});

$value = q{D:20060102150405-0761};
ok(!PDF::API2::_is_date($value),
   qq{$value (invalid offset second)});

$value = q{D:20060102150405-0700};
ok(!PDF::API2::_is_date($value),
   qq{$value (apostrophe required between offset hour and minute)});

$value = q{D:20060102150405-0700'};
ok(!PDF::API2::_is_date($value),
   qq{$value (apostrophe required between offset hour and minute)});

done_testing();