Initial commit
[number-phone-ro.git] / t / Number-Phone-RO.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use utf8;
5
6 use Test::More tests => 22;
7 BEGIN { use_ok('Number::Phone::RO') };
8
9 my $nr;
10
11 sub num {
12 my ($num) = @_;
13 note "Now working with the number $num";
14 $nr = Number::Phone::RO->new($num);
15 }
16
17 num '0';
18 ok !defined $nr, 'Constructor returns undef';
19
20 num '0350123456';
21 ok $nr->is_geographic, 'is_geographic';
22 ok $nr->is_fixed_line, 'is_fixed_line';
23 ok !$nr->is_mobile, '!is_mobile';
24 ok !$nr->is_tollfree, 'is_tollfree';
25 ok !$nr->is_specialrate, 'is_specialrate';
26 is $nr->areacode, '350', 'areacode';
27 is $nr->areaname, 'Vâlcea', 'areaname';
28 is $nr->subscriber, '123456', 'subscriber';
29 is $nr->format, '+40 350 123 456', 'format';
30
31 num '0211234567';
32 is $nr->areacode, '21', 'areacode';
33 is $nr->subscriber, '1234567', 'subscriber';
34 is $nr->format, '+40 21 123 4567', 'format';
35
36 num '0800123123';
37 is $nr->intra_country_dial_to, '0800123123', 'intra_country_dial_to';
38 ok $nr->is_tollfree, 'is_tollfree';
39 is $nr->country_code, 40, 'country_code';
40 like $nr->regulator, qr/ANCOM/, 'regulator';
41 ok !defined $nr->areaname, 'areaname is undef';
42
43 num '0906123456';
44 ok $nr->is_adult, 'is_adult';
45
46 num '0731123456';
47 ok $nr->is_mobile, 'is_mobile';
48 ok !$nr->is_fixed_line, 'is_fixed_line';
This page took 0.025032 seconds and 4 git commands to generate.