File: str2seconds.t

package info (click to toggle)
libcgi-session-perl 4.48-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 616 kB
  • sloc: perl: 1,920; makefile: 5
file content (28 lines) | stat: -r--r--r-- 517 bytes parent folder | download | duplicates (4)
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
# $Id$

use strict;


use Test::More qw/no_plan/;
use CGI::Session;

my %tests = (
    '1m'     => '60',
    '+1m'    => '60',
    '-1m'    => '-60',
    '1h'    => '3600',
    '1h'    => '3600',
    '1s'      => 1,
    '1m'      => 60,
    '1h'      => 3600,
    '1d'      => 86400,
    '1w'      => 604800,
    '1M'      => 2592000,
    '1y'      => 31536000,
);

while (my ($in, $out) = each %tests) {
    is( CGI::Session::_str2seconds(undef,$in), $out, "got expected result when converting $in to seconds");
}