File: superclass_and_uk_different_method_invocations.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 (63 lines) | stat: -rw-r--r-- 2,067 bytes parent folder | download | duplicates (3)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl -w

use strict;

use lib 't/inc';
use fatalwarnings;

use Number::Phone::UK;
use Test::More;

END { done_testing(); }

my $mobile = '+447979866975';
my $pager  = '+447679866975';
ok(1 == Number::Phone::UK->new($mobile)->is_mobile(), "true N::P::CC->new('+CC12345')->is_method()");
ok(1 == Number::Phone->new($mobile)->is_mobile(), "true N::P->new('+CC12345')->is_method()");

ok(0 == Number::Phone::UK->new($pager)->is_mobile(), "false N::P::CC->new('+CC12345')->is_method()");
ok(0 == Number::Phone->new($pager)->is_mobile(), "false N::P->new('+CC12345')->is_method()");

ok(!defined(Number::Phone::UK->new($pager)->is_government()), "undef N::P::CC->new('+CC12345')->is_method()");
ok(!defined(Number::Phone->new($pager)->is_government()), "undef N::P->new('+CC12345')->is_method()");

is_deeply(
    scalar(Number::Phone::UK->new($mobile)->type()),
    [qw(is_valid is_allocated is_mobile)],
    "scalar N::P::CC->new('+CC12345')->type()"
);
is_deeply(
    scalar(Number::Phone->new($mobile)->type()),
    [qw(is_valid is_allocated is_mobile)],
    "scalar N::P->new('+CC12345')->type()"
);

is_deeply(
    [(Number::Phone::UK->new($mobile)->type())],
    [qw(is_valid is_allocated is_mobile)],
    "list N::P::CC->new('+CC12345')->type()"
);
is_deeply(
    [(Number::Phone->new($mobile)->type())],
    [qw(is_valid is_allocated is_mobile)],
    "list N::P->new('+CC12345')->type()"
);

$mobile = '07979866975';
$pager  = '07679866975';
ok(1 == Number::Phone::UK->new($mobile)->is_mobile(), "true N::P::CC->new('12345')->is_method()");

ok(0 == Number::Phone::UK->new($pager)->is_mobile(), "false N::P::CC->new('12345')->is_method()");

ok(!defined(Number::Phone::UK->new($pager)->is_government()), "undef N::P::CC->new('12345')->is_method()");

is_deeply(
    scalar(Number::Phone::UK->new($mobile)->type()),
    [qw(is_valid is_allocated is_mobile)],
    "scalar N::P::CC->new('12345')->type()"
);
is_deeply(
    [(Number::Phone::UK->new($mobile)->type())],
    [qw(is_valid is_allocated is_mobile)],
    "list N::P::CC->new('12345')->type()"
);