File: uk_slurp.t

package info (click to toggle)
libnumber-phone-perl 4.0008-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 41,772 kB
  • sloc: perl: 1,954; makefile: 6
file content (30 lines) | stat: -rw-r--r-- 794 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
#!perl

use strict;
use warnings;
use lib 't/inc';
use nptestutils;

use Test::More;

if(!$ENV{AUTOMATED_TESTING}) {
    plan skip_all => "slurping is too slow so skipping, set AUTOMATED_TESTING to run this";
} else {
    eval 'use Number::Phone::UK::Data';
    die($@) if($@);
    diag("NB: this test takes a few minutes and lots of memory");

    my $time = time();
    Number::Phone::UK::Data::slurp();
    my $first_db = Number::Phone::UK::Data::db();
    ok(time() - $time > 2, "the first slurp took ages");

    $time = time();
    Number::Phone::UK::Data::slurp();
    ok(time() - $time < 2, "trying to slurp again is fast cos it does nothing");

    is($first_db, Number::Phone::UK::Data::db(), "both slurps returned the same reference");

    use lib '.';
    require 't/uk_data.t';
}