File: pathological.t

package info (click to toggle)
libemail-address-list-perl 0.05-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 240 kB
  • sloc: perl: 1,582; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use strict; use warnings;
use Test::More tests => 1;
use Email::Address::List;
use Time::HiRes;

my $start = Time::HiRes::time();
my @addresses = Email::Address::List->parse("a" x 25);

# Realistic expected is ~0.0001s.  In the pathological case, however, it
# will take ~80s.  0.5s is thus unlikely to trip either false-positive
# of false-negative, being approximitely two orders of magnitude away
# from both.  We use actual elapsed time, rather than alarm(), for
# portability.
ok(Time::HiRes::time() - $start < 0.5,
   "Extracting from a long string should take finite time");