File: country-test-sm.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 (37 lines) | stat: -rw-r--r-- 1,374 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
31
32
33
34
35
36
37
#!/usr/bin/perl -w

use strict;

use lib 't/inc';
use fatalwarnings;

use Number::Phone::Lib;
use Test::More;

END { done_testing(); }

{
    my $np = Number::Phone::Lib->new('SM', '912345');
    ok($np->is_fixed_line, '912345 is a fixed line without the 0549 prefix...');
    ok(!$np->is_mobile, '...it is not a mobile...');
    is($np->format, '+378 0549 912345', '...its international format is correct');
    is($np->format_using('National'), '0549 912345', '...as is its national format');
}
{
    my $np = Number::Phone::Lib->new('SM', '0549 912345');
    ok($np->is_fixed_line, '0549 912345 is a fixed line without the 0549 prefix...');
    ok(!$np->is_mobile, '...it is not a mobile...');
    is($np->format, '+378 0549 912345', '...its international format is correct');
    is($np->format_using('National'), '0549 912345', '...as is its national format');
}
{
    my $np = Number::Phone::Lib->new('SM', '66661212');
    ok($np->is_mobile, '044 81 1234 5678 is a mobile...');
    ok(!$np->is_fixed_line, '...it is not a fixed line...');
    is($np->format, '+378 66 66 12 12', '...its international format is correct');
    is($np->format_using('National'), '66 66 12 12', '...as is its national format');
}
{
    my $np = Number::Phone::Lib->new('SM', '0549 66661212');
    ok(!defined $np, '0549 66661212 is a mobile with the 0549 prefix, which is not valid');
}