/[resiprocate]/main/resip/stack/test/testParseNameAddr.cxx
ViewVC logotype

Contents of /main/resip/stack/test/testParseNameAddr.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5948 - (show annotations) (download)
Fri Feb 17 15:30:16 2006 UTC (13 years, 9 months ago) by dworley
File MIME type: text/plain
File size: 3935 byte(s)
Setting more svn: properties, and adding EOLs to the ends of files
that need it.

1 #include <iostream>
2
3 #include "TestSupport.hxx"
4 #include "rutil/Logger.hxx"
5 #include "resip/stack/ParserCategories.hxx"
6 using namespace resip;
7 using namespace std;
8
9 #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
10 class TR
11 {
12 private:
13 ostream& os;
14 Data label;
15
16 TR(const TR&);
17
18 void show(const char * s)
19 {
20 os << s << ' ' << label << endl;
21 }
22
23 void start()
24 {
25 show(">>-");
26 }
27
28 void end()
29 {
30 show("<<-");
31 }
32
33 public:
34 TR(Data s,ostream& o = cerr ):os(o),label(s) { start(); }
35 TR(const char* l,ostream& o = cerr):os(o),label(l) { start(); }
36 ~TR() { end();}
37 };
38
39 int
40 main(int argc, char* argv[])
41 {
42 Log::Level l = Log::Debug;
43 Log::initialize(Log::Cout, l, argv[0]);
44
45 {
46 TR _tr("Test odd name-addr from odd vendor");
47 Data data(
48 "~U90vw09jlMMs0OY7IIHzdD72c3<sip:~U90vw09jlMMs0OY7IIHzdD72c3@7.8.4.9:5066>");
49 Data alt ("alternate");
50
51 NameAddr illegal(data);
52 cerr<< "++ host: " << illegal.uri().host() << endl;
53 cerr<< "++ display-name: " << illegal.displayName() << endl;
54 cerr<< "++ user-info: " << illegal.uri().user() << endl;
55 assert( illegal.uri().host() == "7.8.4.9");
56 assert( illegal.displayName() == "~U90vw09jlMMs0OY7IIHzdD72c3");
57 assert( illegal.uri().port() == 5066 );
58 cerr << "++ " << illegal << endl;
59 illegal.displayName() = alt;
60 cerr << "++ " << illegal << endl;
61 assert( illegal.displayName() == alt);
62
63 }
64 return 0;
65 cerr << "All OK" << endl;
66 }
67 /* ====================================================================
68 * The Vovida Software License, Version 1.0
69 *
70 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
71 *
72 * Redistribution and use in source and binary forms, with or without
73 * modification, are permitted provided that the following conditions
74 * are met:
75 *
76 * 1. Redistributions of source code must retain the above copyright
77 * notice, this list of conditions and the following disclaimer.
78 *
79 * 2. Redistributions in binary form must reproduce the above copyright
80 * notice, this list of conditions and the following disclaimer in
81 * the documentation and/or other materials provided with the
82 * distribution.
83 *
84 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
85 * and "Vovida Open Communication Application Library (VOCAL)" must
86 * not be used to endorse or promote products derived from this
87 * software without prior written permission. For written
88 * permission, please contact vocal@vovida.org.
89 *
90 * 4. Products derived from this software may not be called "VOCAL", nor
91 * may "VOCAL" appear in their name, without prior written
92 * permission of Vovida Networks, Inc.
93 *
94 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
95 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
96 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
97 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
98 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
99 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
100 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
101 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
102 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
103 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
104 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
105 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
106 * DAMAGE.
107 *
108 * ====================================================================
109 *
110 * This software consists of voluntary contributions made by Vovida
111 * Networks, Inc. and many individuals on behalf of Vovida Networks,
112 * Inc. For more information on Vovida Networks, Inc., please see
113 * <http://www.vovida.org/>.
114 *
115 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27