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

Contents of /main/resip/stack/test/testParseUtil.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: 4318 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 "resip/stack/ParseUtil.hxx"
5 #include "rutil/Logger.hxx"
6
7 using namespace resip;
8 using namespace std;
9
10 #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
11
12 int
13 main(int argc, char* argv[])
14 {
15 Log::Level l = Log::Debug;
16 Log::initialize(Log::Cout, l, argv[0]);
17
18 {
19 Data addr("1:1");
20 cerr << "!! "<< addr << endl;
21 assert(ParseUtil::isIpV6Address(addr));
22 }
23
24 {
25 Data addr("1:1:192.168.2.233");
26 cerr << "!! "<< addr << endl;
27 assert(ParseUtil::isIpV6Address(addr));
28 }
29
30 {
31 Data addr("1:1:::::");
32 cerr << "!! "<< addr << endl;
33 assert(ParseUtil::isIpV6Address(addr));
34 }
35
36 {
37 Data addr("1:1::::::168.192.2.233");
38 cerr << "!! "<< addr << endl;
39 assert(ParseUtil::isIpV6Address(addr));
40 }
41
42 {
43 Data addr("5f1b:df00:ce3e:e200:20:800:2b37:6426");
44 cerr << "!! "<< addr << endl;
45 assert(ParseUtil::isIpV6Address(addr));
46 }
47
48 {
49 Data addr("5f1b:df00:ce3e:e200:20:800:2b37:6426:121.12.131.12");
50 cerr << "!! "<< addr << endl;
51 assert(ParseUtil::isIpV6Address(addr));
52 }
53
54 {
55 Data addr("192.168.2.233");
56 cerr << "!! "<< addr << endl;
57 assert(!ParseUtil::isIpV6Address(addr));
58 }
59
60 {
61 Data addr("u@a.tv:1290");
62 cerr << "!! "<< addr << endl;
63 assert(!ParseUtil::isIpV6Address(addr));
64 }
65
66 {
67 Data addr("::1");
68 cerr << "!! "<< addr << endl;
69 assert(ParseUtil::isIpV6Address(addr));
70 }
71
72 {
73 Data addr("::");
74 cerr << "!! "<< addr << endl;
75 assert(ParseUtil::isIpV6Address(addr));
76 }
77
78 {
79 Data addr("FF01::43");
80 cerr << "!! "<< addr << endl;
81 assert(ParseUtil::isIpV6Address(addr));
82 }
83
84 {
85 Data c("apple:5060");
86 Data addr(Data::Share, c.c_str(), 5);
87 cerr << "!! " << addr << endl;
88 assert(!ParseUtil::isIpV6Address(addr));
89 }
90
91 cerr << "All OK" << endl;
92 }
93 /* ====================================================================
94 * The Vovida Software License, Version 1.0
95 *
96 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
97 *
98 * Redistribution and use in source and binary forms, with or without
99 * modification, are permitted provided that the following conditions
100 * are met:
101 *
102 * 1. Redistributions of source code must retain the above copyright
103 * notice, this list of conditions and the following disclaimer.
104 *
105 * 2. Redistributions in binary form must reproduce the above copyright
106 * notice, this list of conditions and the following disclaimer in
107 * the documentation and/or other materials provided with the
108 * distribution.
109 *
110 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
111 * and "Vovida Open Communication Application Library (VOCAL)" must
112 * not be used to endorse or promote products derived from this
113 * software without prior written permission. For written
114 * permission, please contact vocal@vovida.org.
115 *
116 * 4. Products derived from this software may not be called "VOCAL", nor
117 * may "VOCAL" appear in their name, without prior written
118 * permission of Vovida Networks, Inc.
119 *
120 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
121 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
122 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
123 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
124 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
125 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
126 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
127 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
128 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
129 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
130 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
131 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
132 * DAMAGE.
133 *
134 * ====================================================================
135 *
136 * This software consists of voluntary contributions made by Vovida
137 * Networks, Inc. and many individuals on behalf of Vovida Networks,
138 * Inc. For more information on Vovida Networks, Inc., please see
139 * <http://www.vovida.org/>.
140 *
141 */

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