File: uk_slurp.t

package info (click to toggle)
libnumber-phone-perl 3.6006-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 136,072 kB
  • sloc: perl: 2,719; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 808 bytes parent folder | download
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
#!perl

use strict;
use warnings;

use Test::More;

if(
    $ENV{CI} || !$ENV{AUTOMATED_TESTING}
) {
    eval 'use Test::More skip_all => "slurping is too slow so skipping under CI and for normal installs, set AUTOMATED_TESTING to run this"';
} else {
    eval 'use Number::Phone::UK::Data';
    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';
}