File: 02parse.t

package info (click to toggle)
libdatetime-format-db2-perl 0.05-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 72 kB
  • ctags: 5
  • sloc: perl: 65; makefile: 2
file content (53 lines) | stat: -rwxr-xr-x 1,051 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use strict;

use Test::More tests => 21;

use DateTime::Format::DB2;

my $db2 = 'DateTime::Format::DB2';

{
    my $dt = $db2->parse_date( '2003-02-15' );
    is( $dt->year, 2003 );
    is( $dt->month, 2 );
    is( $dt->day, 15 );
}

# {
#     my $dt = $db2->parse_time( '10:09:08' );
#     is( $dt->hour, 10 );
#     is( $dt->minute, 9 );
#     is( $dt->second, 8 );
# }

{
    my $dt = $db2->parse_timestamp( '2003-02-15-10.09.08.200000' );
    is( $dt->year, 2003 );
    is( $dt->month, 2 );
    is( $dt->day, 15 );
    is( $dt->hour, 10 );
    is( $dt->minute, 9 );
    is( $dt->second, 8 );
}

{
    my $dt = $db2->parse_timestamp( '2003-02-15 10:09:08.200000' );
    is( $dt->year, 2003 );
    is( $dt->month, 2 );
    is( $dt->day, 15 );
    is( $dt->hour, 10 );
    is( $dt->minute, 9 );
    is( $dt->second, 8 );
}

{
    my $dt = $db2->parse_datetime( '2003-02-15 10:09:08.200000' );
    is( $dt->year, 2003 );
    is( $dt->month, 2 );
    is( $dt->day, 15 );
    is( $dt->hour, 10 );
    is( $dt->minute, 9 );
    is( $dt->second, 8 );
}