You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
924 B
44 lines
924 B
use strict; |
|
use warnings; |
|
|
|
use Test::More tests => 11; |
|
|
|
use Subtitle::Utils qw(:timing); |
|
|
|
my ($timing, $time); |
|
|
|
$timing = "123:11:15.459"; |
|
$time = parse_timing($timing); |
|
is($time, (123 * 3600 + 11 * 60 + 15 + 0.459)); |
|
|
|
$timing = "123:11:15.45"; |
|
$time = parse_timing($timing); |
|
is($time, (123 * 3600 + 11 * 60 + 15 + 0.450)); |
|
|
|
$timing = "123:11:15.4"; |
|
$time = parse_timing($timing); |
|
is($time, (123 * 3600 + 11 * 60 + 15 + 0.400)); |
|
|
|
$timing = "123:11:15,4"; |
|
$time = parse_timing($timing); |
|
is($time, (123 * 3600 + 11 * 60 + 15 + 0.400)); |
|
|
|
$timing = "123:60:15.45"; |
|
$time = parse_timing($timing); |
|
is($time, -1); |
|
|
|
$timing = "123:11:65.45"; |
|
$time = parse_timing($timing); |
|
is($time, -1); |
|
|
|
$timing = "123:11:15.4500"; |
|
$time = parse_timing($timing); |
|
is($time, -1); |
|
|
|
my ($hrs, $min, $sec, $msec); |
|
|
|
($hrs, $min, $sec, $msec) = make_timing(8 * 3600 + 11 * 60 + 15 + 0.46); |
|
is($hrs, 8); |
|
is($min, 11); |
|
is($sec, 15); |
|
is($msec, 460);
|
|
|