Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ASNMP / tests / Address_Test.cpp
blobdb1c047bbe41fe807ca932a5516f6fd56f1014ba
2 //=============================================================================
3 /**
4 * @file Address_Test.cpp
6 * Test all the member functions of the Address family:
7 * GenAddress, MacAddress, IpxAddress, IpAddress, UdpAddress
8 * all which derive from abstract base class Address.
10 * @author Michael R. MacFaden <mrm@cisco.com>
12 //=============================================================================
14 /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
15 Copyright 1997 Cisco Systems, Inc.
17 Permission to use, copy, modify, and distribute this software for any
18 purpose and without fee is hereby granted, provided that this
19 copyright and permission notice appear on all copies of the software and
20 supporting documentation, the name of Cisco Systems, Inc. not be used
21 in advertising or publicity pertaining to distribution of the
22 program without specific prior permission, and notice be given
23 in supporting documentation that modification, copying and distribution is by
24 permission of Cisco Systems, Inc.
26 Cisco Systems, Inc. makes no representations about the suitability of this
27 software for any purpose. THIS SOFTWARE IS PROVIDED ``AS IS''
28 AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
29 LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGMENT AND
30 FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL CISCO SYSTEMS, INC. BE
31 LIABLE FOR ANY DAMAGES ARISING OUT OF THIS LICENSE OR YOUR USE OF THE
32 SOFTWARE INCLUDING WITHOUT LIMITATION, DIRECT, INDIRECT OR CONSEQUENTIAL
33 DAMAGES.
34 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
36 #include "ace/OS_main.h"
37 #include "ace/OS_NS_string.h"
38 #include "asnmp/address.h"
39 #include "test_config.h"
41 // test the GenAddress interface
42 static void TestGenAddr()
44 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress: Tests: var(expected) [actual]\n"));
46 // the constructors and destructors
47 GenAddress *ga1 = new GenAddress("1.2.3.4"); // use ipv4 address
48 ACE_ASSERT(ga1->valid() == 1);
49 GenAddress ga2(*ga1); // copy constructor;
50 ACE_ASSERT(ga2.valid() == 1);
51 GenAddress ga3("localhost");
52 ACE_ASSERT(ga3.valid() == 1);
53 GenAddress ga4; // default constructor
54 ACE_ASSERT(ga4.valid() == 0);
55 GenAddress ga5; // default constructor
56 ACE_ASSERT(ga5.valid() == 0);
57 GenAddress ga6("127.0.0.1:7"); // udp address
58 ACE_ASSERT(ga6.valid() == 1);
59 GenAddress ga7("01234567.89ABcDeF0123"); // ipx address
60 ACE_ASSERT(ga7.valid() == 1);
61 IpAddress ip("1.2.3.4");
62 ACE_ASSERT(ip.valid() == 1);
63 GenAddress ga8(ip); // Address conversion
64 ACE_ASSERT(ga8.valid() == 1);
66 const char *ptr = (const char *)ga8;
68 ACE_ASSERT(ga1 != 0);
69 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga1(\"1.2.3.4\") [%s]\n",
70 ga1->to_string()));
71 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga2(ga1) [%s]\n",
72 ga2.to_string()));
73 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga3(\"localhost\") [%s]\n",
74 ga3.to_string()));
75 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga4(\"\") [%s]\n",
76 ga4.to_string()));
77 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga6(\"127.0.0.1:7\") [%s]\n",
78 ga6.to_string()));
80 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga7(\"01234567.89ABcDeF0123\") [%s]\n",
81 ga7.to_string()));
82 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga8(\"1.2.3.4\") [%s]\n",
83 ga8.to_string()));
84 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga8(\"1.2.3.4\") [%s]\n",
85 ptr));
87 // Test Assignment x = y, y = x
88 ga5 = ga3; // regular assignment
89 ga3 = ga3; // self assignment
90 ACE_ASSERT(ga5 == ga3);
92 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga5=ga3(\"localhost\") [%s]\n",
93 ga5.to_string()));
95 addr_type a = ga2.get_type();
96 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga2.get_type(\"0\") [%d]\n",
97 a));
98 // udp address string
99 a = ga6.get_type();
100 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga2.get_type(\"2\") [%d]\n",
101 a));
103 // udp address string
104 a = ga7.get_type();
105 ACE_DEBUG ((LM_DEBUG, "(%P|%t) GenAddress:ga2.get_type(\"1\") [%d]\n",
106 a));
108 delete ga1, ga1 = 0;
111 /* public methods
112 IpAddress( const char *inaddr = "");
113 IpAddress( const IpAddress &ipaddr);
114 IpAddress( const GenAddress &genaddr);
115 ~IpAddress();
116 SnmpSyntax& operator=( SnmpSyntax &val);
117 IpAddress& operator=( const IpAddress &ipaddress);
118 SnmpSyntax *clone() const;
119 char *resolve_hostname(int &status);
120 virtual char *to_string() ;
121 virtual operator const char *() const;
122 void mask( const IpAddress& ipaddr);
123 virtual addr_type get_type() const;
124 virtual SmiUINT32 get_syntax();
125 int is_loopback() const;
126 int is_multicast() const;
127 int is_broadcast() const;
128 int is_arpanet() const;
130 static void TestIpAddress()
132 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpAddress: Tests\n"));
134 // constructors
135 GenAddress ga("255.255.255.255");
136 IpAddress ia1;
137 IpAddress ia2("224.2.3.4");
138 ACE_ASSERT(ia2.is_multicast());
139 ACE_ASSERT(!ia2.is_loopback());
140 IpAddress ia3("localhost");
141 ACE_ASSERT(ia3.is_loopback());
142 ACE_ASSERT(!ia3.is_multicast());
143 IpAddress ia4(ia3);
144 ACE_ASSERT(ia4.is_loopback());
145 ACE_ASSERT(!ia4.is_multicast());
146 IpAddress ia5(ga);
147 ACE_ASSERT(ia5.is_broadcast());
148 IpAddress ia6 = IpAddress("10.0.0.2");
149 ACE_ASSERT(ia6.is_private());
150 ACE_ASSERT(!ia6.is_multicast());
151 ACE_ASSERT(!ia6.is_loopback());
153 IpAddress ia7("172.16.0.1");
154 ACE_ASSERT(ia7.is_private());
156 IpAddress ia8("192.168.0.1");
157 ACE_ASSERT(ia8.is_private());
159 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpAddress:ia1(\"\") [%s]\n",
160 ia1.to_string()));
161 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpAddress:ia2(\"1.2.3.4\") [%s]\n",
162 ia2.to_string()));
163 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpAddress:ia3(\"127.0.0.1\") [%s]\n",
164 ia3.to_string()));
165 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpAddress:ia4(\"ia3\") [%s]\n",
166 ia4.to_string()));
167 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpAddress:ia5(\"255.255.255.255\") [%s]\n",
168 ia5.to_string()));
170 // other routines
171 int status = 1;
172 const char *ptr = ia5.resolve_hostname(status);
173 ACE_ASSERT(status == 0);
174 ACE_ASSERT(ptr != 0);
175 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpAddress:ia5.resolve_hostname():(\"\") [%s]\n",
176 ptr));
178 // now lets try one we setup with a hostname
179 ptr = ia3.resolve_hostname(status);
180 ACE_ASSERT(status == 0);
181 ACE_ASSERT(ptr != 0);
182 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpAddress:ia3.resolve_hostname()(\"localhost\") [%s]\n",
183 ptr));
185 ptr = (const char *)ia5;
186 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpAddress:(const char *)(\"255.255.255.255\") [%s]\n",
187 ptr));
189 ia2 = ia3;
190 ACE_ASSERT(ia2 == ia3);
192 ia4.mask(ia3); // mask with equal value should return same
193 ACE_ASSERT(ia2 == ia3);
195 ACE_ASSERT(ia1.get_type() == type_ip);
196 ACE_ASSERT(ia1.valid() == 0);
197 ACE_ASSERT(ia2.get_type() == type_ip);
198 ACE_ASSERT(ia2.valid() == 1);
199 ACE_ASSERT(ia3.get_type() == type_ip);
200 ACE_ASSERT(ia3.valid() == 1);
201 ACE_ASSERT(ia4.get_type() == type_ip);
202 ACE_ASSERT(ia4.valid() == 1);
203 ACE_ASSERT(ia5.get_type() == type_ip);
204 ACE_ASSERT(ia5.valid() == 1);
208 // --------------- Netbios ---------------
210 NetbiosAddress( const char *inaddr = "");
211 NetbiosAddress( const NetbiosAddress& nbaddr);
212 NetbiosAddress( const GenAddress& genaddr);
213 ~NetbiosAddress();
214 virtual char *to_string();
215 NetbiosAddress& operator=( const NetbiosAddress &nbaddr);
216 nb_service get_service_type() const;
217 void set_service_type(nb_service nbservice);
218 virtual operator const char *() const;
219 virtual SmiUINT32 get_syntax();
220 SnmpSyntax& operator=( SnmpSyntax &val);
221 SnmpSyntax *clone() const;
223 static void TestNetbiosAddress()
225 NetbiosAddress n1;
226 ACE_ASSERT(n1.valid() == 0);
227 ACE_DEBUG ((LM_DEBUG, "(%P|%t) NetbiosAddress:n1(\"\") [%s]\n",
228 n1.to_string()));
230 NetbiosAddress n2(n1);
231 ACE_ASSERT(n2.valid() == 0);
232 ACE_DEBUG ((LM_DEBUG, "(%P|%t) NetbiosAddress:n2(n1) [%s]\n",
233 n2.to_string()));
235 NetbiosAddress n3("pcname");
236 ACE_ASSERT(n3.valid() == 1);
237 ACE_DEBUG ((LM_DEBUG, "(%P|%t) NetbiosAddress:n3(\"pcname\") [%s]\n",
238 n3.to_string()));
240 NetbiosAddress n4("abcdefghigjklmn");
241 n4.set_service_type(nb_workstation);
242 ACE_ASSERT(n4.valid() == 1);
243 ACE_ASSERT(n4.get_service_type() == nb_workstation);
244 ACE_DEBUG ((LM_DEBUG, "(%P|%t) NetbiosAddress:n4(\"abcdefghigjklmn\") [%s]\n",
245 n4.to_string()));
247 NetbiosAddress n5("abcdefghigjklmno0xx");
248 ACE_ASSERT(n5.valid() == 0);
249 ACE_DEBUG ((LM_DEBUG, "(%P|%t) NetbiosAddress:n4(\"abcdefghigjklmno0xx\") [%s]\n",
250 n5.to_string()));
252 n1 = n4;
253 ACE_ASSERT(n1 == n4);
254 ACE_ASSERT(ACE_OS::strcmp((const char *)n1, (const char *)n4) == 0);
256 n1.set_service_type(nb_server);
257 ACE_ASSERT(nb_server == n1.get_service_type());
260 // --------------- IPX ---------------
262 IpxAddress();
263 IpxAddress( const char *inaddr);
264 IpxAddress( const IpxAddress &ipxaddr);
265 IpxAddress( const GenAddress &genaddr);
266 ~IpxAddress();
267 virtual SmiUINT32 get_syntax();
268 SnmpSyntax& operator=( SnmpSyntax &val);
269 IpxAddress& operator=( const IpxAddress &ipxaddress);
270 int get_hostid( MacAddress& mac);
271 SnmpSyntax *clone() const;
272 virtual operator const char *() const;
273 virtual addr_type get_type() const;
275 Ipx Address semantics: Total length must be 21
276 // Must have a separator in it
277 // First string length must be 8
278 // Second string length must be 12
279 // Each char must take on value 0-F
281 // Input formats recognized
283 // XXXXXXXX.XXXXXXXXXXXX
284 // XXXXXXXX:XXXXXXXXXXXX
285 // XXXXXXXX-XXXXXXXXXXXX
286 // XXXXXXXX.XXXXXX-XXXXXX
287 // XXXXXXXX:XXXXXX-XXXXXX
288 // XXXXXXXX-XXXXXX-XXXXXX
292 static void TestIpxAddress()
294 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress: Tests\n"));
295 IpxAddress xa1;
296 ACE_ASSERT(xa1.valid() == 0);
297 ACE_ASSERT(xa1.get_type() == type_ipx);
298 GenAddress gen("01234567.0123456789AB");
299 ACE_ASSERT(gen.valid() == 1);
300 IpxAddress xa2("01234567.0123456789AB");
301 ACE_ASSERT(xa2.get_type() == type_ipx);
302 ACE_ASSERT(xa2.valid() == 1);
303 IpxAddress xa3("01234567:0123456789AB");
304 ACE_ASSERT(xa3.get_type() == type_ipx);
305 ACE_ASSERT(xa3.valid() == 1);
306 IpxAddress xa4("01234567-0123456789AB");
307 ACE_ASSERT(xa4.get_type() == type_ipx);
308 ACE_ASSERT(xa4.valid() == 1);
309 IpxAddress xa5("01234567.012345-6789AB");
310 ACE_ASSERT(xa5.get_type() == type_ipx);
311 ACE_ASSERT(xa5.valid() == 1);
312 IpxAddress xa6("01234567:012345-6789AB");
313 ACE_ASSERT(xa6.get_type() == type_ipx);
314 ACE_ASSERT(xa6.valid() == 1);
315 IpxAddress xa7("01234567-012345-6789AB");
316 ACE_ASSERT(xa7.get_type() == type_ipx);
317 ACE_ASSERT(xa7.valid() == 1);
318 IpxAddress xa8("01234567.");
319 ACE_ASSERT(xa8.get_type() == type_ipx);
320 ACE_ASSERT(xa8.valid() == 0);
321 IpxAddress xa9(gen);
322 ACE_ASSERT(xa9.valid() == 1);
323 IpxAddress *xa10 = new IpxAddress(xa9);
324 ACE_ASSERT(xa10->get_type() == type_ipx);
325 ACE_ASSERT(xa10->valid() == 1);
326 delete xa10;
328 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress:xa1(\"\") [%s]\n",
329 xa1.to_string()));
330 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress:xa2(\"01234567.0123456789AB\") [%s]\n",
331 xa2.to_string()));
332 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress:xa3(\"01234567:0123456789A\") [%s]\n",
333 xa3.to_string()));
334 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress:xa4(\"01234567-0123456789AB\") [%s]\n",
335 xa4.to_string()));
337 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress:xa5(\"01234567.012345-6789AB\") [%s]\n",
338 xa5.to_string()));
339 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress:xa6(\"01234567:012345-6789AB\") [%s]\n",
340 xa6.to_string()));
341 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress:xa7(\"01234567-012345-6789AB\") [%s]\n",
342 xa7.to_string()));
344 // assignment
345 xa1 = xa3;
346 ACE_ASSERT(xa1 == xa3);
347 MacAddress mac;
348 ACE_ASSERT(xa4.get_hostid(mac) == 1);
349 ACE_ASSERT(mac.valid() == 1);
350 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress:xa4:get_hostid(\"01:23:45:67:89:ab\") [%s]\n", mac.to_string()));
352 const char *ptr = (const char *)xa7;
353 ACE_DEBUG ((LM_DEBUG, "(%P|%t) IpxAddress:xa7-ptr(\"01234567-012345-6789AB\") [%s]\n", ptr));
357 MacAddress();
359 MacAddress( const char *inaddr);
360 MacAddress( const MacAddress &macaddr);
361 MacAddress( const GenAddress &genaddr);
362 ~MacAddress();
363 * SmiUINT32 get_syntax();
364 * SnmpSyntax& operator=( SnmpSyntax &val);
365 MacAddress& operator=( const MacAddress &macaddress);
366 * SnmpSyntax *clone() const;
367 virtual char *to_string();
368 virtual operator const char *() const;
369 virtual addr_type get_type() const;
370 unsigned int hashFunction() const;
372 // MAC address format
374 // MAC ADDRESS
375 // 01 02 03 04 05 06
376 // XX:XX:XX:XX:XX:XX
377 // Valid input format
379 // XXXXXXXXXXXX
380 // Total length must be 17
381 // Each char must take on value 0-F
386 static void TestMacAddress()
388 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress: Tests\n"));
390 MacAddress ma1;
391 ACE_ASSERT(ma1.valid() == 0);
392 ACE_ASSERT(ma1.get_type() == type_mac);
393 MacAddress ma2("01:23:45:67:89:AB");
394 ACE_ASSERT(ma2.valid() == 1);
395 ACE_ASSERT(ma2.get_type() == type_mac);
396 MacAddress ma3("0123456789ABCEFGHI"); // invalid string
397 ACE_ASSERT(ma3.valid() == 0);
398 ACE_ASSERT(ma3.get_type() == type_mac);
399 GenAddress ga("01:23:45:67:89:AB"); // mac address
400 MacAddress ma4(ma2);
401 ACE_ASSERT(ma4.valid() == 1);
402 ACE_ASSERT(ma4.get_type() == type_mac);
403 MacAddress ma5(ga);
404 ACE_ASSERT(ma5.valid() == 0);
405 ACE_ASSERT(ma5.get_type() == type_mac);
407 ma1 = ma2;
409 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma1(\"01:23:45:67:89:AB\") [%s]\n",
410 ma1.to_string()));
411 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma2(\"01:23:45:67:89:AB\") [%s]\n",
412 ma2.to_string()));
413 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma3(\"\") [%s]\n",
414 ma3.to_string()));
415 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma4(\"01:23:45:67:89:AB\") [%s]\n",
416 ma4.to_string()));
417 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma5(\"\") [%s]\n",
418 ma5.to_string()));
419 const char * ptr = (const char *)ma5;
420 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma5(\"\") [%s]\n",
421 ptr));
423 // hashFunction crashes if not usedwith valid fn
424 int x = ma2.hashFunction();
426 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma2.hashFunction(\"483201\") [%d]\n",
427 x));
431 UdpAddress();
432 UdpAddress( const char *inaddr);
433 UdpAddress( const UdpAddress &udpaddr);
434 UdpAddress( const GenAddress &genaddr);
435 UdpAddress( const IpAddress &ipaddr);
436 ~UdpAddress();
437 SmiUINT32 get_syntax();
438 SnmpSyntax& operator=( SnmpSyntax &val);
439 UdpAddress& operator=( const UdpAddress &udpaddr);
440 SnmpSyntax *clone() const;
441 virtual char *to_string() ;
442 virtual operator const char *() const;
443 void set_port( const unsigned short p);
444 unsigned short get_port() const;
445 virtual addr_type get_type() const;
447 // look for port info @ the end of the string
448 // port can be delineated by a ':' or a '/'
449 // if neither are present then just treat it
450 // like a normal IpAddress
454 static void TestUdpAddress()
456 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress: Tests\n"));
458 UdpAddress ua1;
459 ACE_ASSERT(ua1.valid() == 0);
460 ACE_ASSERT(ua1.get_type() == type_udp);
462 // semantics of not setting the port here are bizzare?
463 UdpAddress ua2("127.0.0.1:161");
464 ACE_ASSERT(ua2.valid() == 1);
465 ACE_ASSERT(ua2.get_type() == type_udp);
467 UdpAddress ua3(ua2);
468 ACE_ASSERT(ua3.valid() == 1);
469 ACE_ASSERT(ua3.get_type() == type_udp);
471 GenAddress ga("localhost");
472 UdpAddress ua4(ga);
473 ACE_ASSERT(ua4.valid() == 1);
474 ACE_ASSERT(ua4.get_type() == type_udp);
476 IpAddress ia("localhost");
477 UdpAddress ua5(ga);
478 ACE_ASSERT(ua5.valid() == 1);
479 ACE_ASSERT(ua5.get_type() == type_udp);
481 UdpAddress *ua6 = new UdpAddress("localhost:161");
482 ACE_ASSERT(ua6->valid() == 1);
483 ACE_ASSERT(ua6->get_type() == type_udp);
485 UdpAddress ua7 = UdpAddress("localhost/162");
486 ACE_ASSERT(ua7.valid() == 1);
487 ACE_ASSERT(ua7.get_type() == type_udp);
490 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua1(\"\") [%s]\n",
491 ua1.to_string()));
492 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua2(\"127.0.0.1:161\") [%s]\n",
493 ua2.to_string()));
494 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua3(ua2)(\"127.0.0.1:161\") [%s]\n",
495 ua3.to_string()));
496 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua4(GenAddress)(\"127.0.0.1\") [%s]\n",
497 ua4.to_string()));
498 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua5(IpAddress)(\"127.0.0.1\") [%s]\n",
499 ua5.to_string()));
500 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua6()(\"localhost:161\") [%s]\n",
501 ua6->to_string()));
502 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua7()(\"localhost/162\") [%s]\n",
503 ua7.to_string()));
505 delete ua6; // destructor
507 // assignement tests.
508 ua1 = ua2;
509 ACE_ASSERT(ua1 == ua2);
510 ACE_ASSERT(ua1.valid() == 1);
511 ua1 = ua1;
512 ACE_ASSERT(ua1 == ua1);
513 ACE_ASSERT(ua1.valid() == 1);
515 // set/get port
516 ua1.set_port(333);
517 ACE_ASSERT(ua1.get_port() == 333);
518 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua1.set_port()(\"333\") [%s]\n",
519 (const char *)ua1));
523 ACE_TMAIN (int, ACE_TCHAR *[])
525 ACE_START_TEST (ACE_TEXT ("Address_Test"));
527 TestGenAddr();
528 TestIpAddress();
529 TestUdpAddress();
530 TestMacAddress();
531 TestNetbiosAddress();
532 TestIpxAddress();
534 ACE_END_TEST;
535 return 0;