Add the original source packages to maemo, source lenny
[dh-make-perl] / dev / i386 / liburi-perl / liburi-perl-1.35.dfsg.1 / t / sip.t
1 #!perl -w
2
3 print "1..11\n";
4
5 use URI;
6 use strict;
7
8 my $u = URI->new('sip:phone@domain.ext');
9 print "not " unless $u->user eq 'phone' &&
10                     $u->host eq 'domain.ext' &&
11                     $u->port eq '5060' &&
12                     $u eq 'sip:phone@domain.ext';
13 print "ok 1\n";
14
15 $u->host_port('otherdomain.int:9999');
16 print "not " unless $u->host eq 'otherdomain.int' &&
17                     $u->port eq '9999' &&
18                     $u eq 'sip:phone@otherdomain.int:9999';
19 print "ok 2\n";
20
21 $u->port('5060');
22 $u = $u->canonical;
23 print "not " unless $u->host eq 'otherdomain.int' &&
24                     $u->port eq '5060' &&
25                     $u eq 'sip:phone@otherdomain.int';
26 print "ok 3\n";
27
28 $u->user('voicemail');
29 print "not " unless $u->user eq 'voicemail' &&
30                     $u eq 'sip:voicemail@otherdomain.int';
31 print "ok 4\n";
32
33 $u = URI->new('sip:phone@domain.ext?Subject=Meeting&Priority=Urgent');
34 print "not " unless $u->host eq 'domain.ext' &&
35                     $u->query eq 'Subject=Meeting&Priority=Urgent';
36 print "ok 5\n";
37
38 $u->query_form(Subject => 'Lunch', Priority => 'Low');
39 my @q = $u->query_form;
40 print "not " unless $u->host eq 'domain.ext' &&
41                     $u->query eq 'Subject=Lunch&Priority=Low' &&
42                     @q == 4 && "@q" eq "Subject Lunch Priority Low";
43 print "ok 6\n";
44
45 $u = URI->new('sip:phone@domain.ext;maddr=127.0.0.1;ttl=16');
46 print "not " unless $u->host eq 'domain.ext' &&
47                     $u->params eq 'maddr=127.0.0.1;ttl=16';
48 print "ok 7\n";
49
50 $u = URI->new('sip:phone@domain.ext?Subject=Meeting&Priority=Urgent');
51 $u->params_form(maddr => '127.0.0.1', ttl => '16');
52 my @p = $u->params_form;
53 print "not " unless $u->host eq 'domain.ext' &&
54                     $u->query eq 'Subject=Meeting&Priority=Urgent' &&
55                     $u->params eq 'maddr=127.0.0.1;ttl=16' &&
56                     @p == 4 && "@p" eq "maddr 127.0.0.1 ttl 16";
57
58 print "ok 8\n";
59
60 $u = URI->new_abs('sip:phone@domain.ext', 'sip:foo@domain2.ext');
61 print "not " unless $u eq 'sip:phone@domain.ext';
62 print "ok 9\n";
63
64 $u = URI->new('sip:phone@domain.ext');
65 print "not " unless $u eq $u->abs('http://www.cpan.org/');
66 print "ok 10\n";
67
68 print "not " unless $u eq $u->rel('http://www.cpan.org/');
69 print "ok 11\n";