Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / ACE / ASNMP / tests / Address_Test.cpp
blobf1662556f3463e4a0089bb68d95ea591881e4324
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( void);
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));
358 MacAddress( void);
360 MacAddress( const char *inaddr);
361 MacAddress( const MacAddress &macaddr);
362 MacAddress( const GenAddress &genaddr);
363 ~MacAddress();
364 * SmiUINT32 get_syntax();
365 * SnmpSyntax& operator=( SnmpSyntax &val);
366 MacAddress& operator=( const MacAddress &macaddress);
367 * SnmpSyntax *clone() const;
368 virtual char *to_string();
369 virtual operator const char *() const;
370 virtual addr_type get_type() const;
371 unsigned int hashFunction() const;
373 // MAC address format
375 // MAC ADDRESS
376 // 01 02 03 04 05 06
377 // XX:XX:XX:XX:XX:XX
378 // Valid input format
380 // XXXXXXXXXXXX
381 // Total length must be 17
382 // Each char must take on value 0-F
387 static void TestMacAddress()
390 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress: Tests\n"));
392 MacAddress ma1;
393 ACE_ASSERT(ma1.valid() == 0);
394 ACE_ASSERT(ma1.get_type() == type_mac);
395 MacAddress ma2("01:23:45:67:89:AB");
396 ACE_ASSERT(ma2.valid() == 1);
397 ACE_ASSERT(ma2.get_type() == type_mac);
398 MacAddress ma3("0123456789ABCEFGHI"); // invalid string
399 ACE_ASSERT(ma3.valid() == 0);
400 ACE_ASSERT(ma3.get_type() == type_mac);
401 GenAddress ga("01:23:45:67:89:AB"); // mac address
402 MacAddress ma4(ma2);
403 ACE_ASSERT(ma4.valid() == 1);
404 ACE_ASSERT(ma4.get_type() == type_mac);
405 MacAddress ma5(ga);
406 ACE_ASSERT(ma5.valid() == 0);
407 ACE_ASSERT(ma5.get_type() == type_mac);
409 ma1 = ma2;
411 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma1(\"01:23:45:67:89:AB\") [%s]\n",
412 ma1.to_string()));
413 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma2(\"01:23:45:67:89:AB\") [%s]\n",
414 ma2.to_string()));
415 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma3(\"\") [%s]\n",
416 ma3.to_string()));
417 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma4(\"01:23:45:67:89:AB\") [%s]\n",
418 ma4.to_string()));
419 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma5(\"\") [%s]\n",
420 ma5.to_string()));
421 const char * ptr = (const char *)ma5;
422 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma5(\"\") [%s]\n",
423 ptr));
425 // hashFunction crashes if not usedwith valid fn
426 int x = ma2.hashFunction();
428 ACE_DEBUG ((LM_DEBUG, "(%P|%t) MacAddress:ma2.hashFunction(\"483201\") [%d]\n",
429 x));
433 UdpAddress( void);
434 UdpAddress( const char *inaddr);
435 UdpAddress( const UdpAddress &udpaddr);
436 UdpAddress( const GenAddress &genaddr);
437 UdpAddress( const IpAddress &ipaddr);
438 ~UdpAddress();
439 SmiUINT32 get_syntax();
440 SnmpSyntax& operator=( SnmpSyntax &val);
441 UdpAddress& operator=( const UdpAddress &udpaddr);
442 SnmpSyntax *clone() const;
443 virtual char *to_string() ;
444 virtual operator const char *() const;
445 void set_port( const unsigned short p);
446 unsigned short get_port() const;
447 virtual addr_type get_type() const;
449 // look for port info @ the end of the string
450 // port can be delineated by a ':' or a '/'
451 // if neither are present then just treat it
452 // like a normal IpAddress
456 static void TestUdpAddress()
458 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress: Tests\n"));
460 UdpAddress ua1;
461 ACE_ASSERT(ua1.valid() == 0);
462 ACE_ASSERT(ua1.get_type() == type_udp);
464 // semantics of not setting the port here are bizzare?
465 UdpAddress ua2("127.0.0.1:161");
466 ACE_ASSERT(ua2.valid() == 1);
467 ACE_ASSERT(ua2.get_type() == type_udp);
469 UdpAddress ua3(ua2);
470 ACE_ASSERT(ua3.valid() == 1);
471 ACE_ASSERT(ua3.get_type() == type_udp);
473 GenAddress ga("localhost");
474 UdpAddress ua4(ga);
475 ACE_ASSERT(ua4.valid() == 1);
476 ACE_ASSERT(ua4.get_type() == type_udp);
478 IpAddress ia("localhost");
479 UdpAddress ua5(ga);
480 ACE_ASSERT(ua5.valid() == 1);
481 ACE_ASSERT(ua5.get_type() == type_udp);
483 UdpAddress *ua6 = new UdpAddress("localhost:161");
484 ACE_ASSERT(ua6->valid() == 1);
485 ACE_ASSERT(ua6->get_type() == type_udp);
487 UdpAddress ua7 = UdpAddress("localhost/162");
488 ACE_ASSERT(ua7.valid() == 1);
489 ACE_ASSERT(ua7.get_type() == type_udp);
492 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua1(\"\") [%s]\n",
493 ua1.to_string()));
494 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua2(\"127.0.0.1:161\") [%s]\n",
495 ua2.to_string()));
496 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua3(ua2)(\"127.0.0.1:161\") [%s]\n",
497 ua3.to_string()));
498 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua4(GenAddress)(\"127.0.0.1\") [%s]\n",
499 ua4.to_string()));
500 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua5(IpAddress)(\"127.0.0.1\") [%s]\n",
501 ua5.to_string()));
502 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua6()(\"localhost:161\") [%s]\n",
503 ua6->to_string()));
504 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua7()(\"localhost/162\") [%s]\n",
505 ua7.to_string()));
507 delete ua6; // destructor
509 // assignement tests.
510 ua1 = ua2;
511 ACE_ASSERT(ua1 == ua2);
512 ACE_ASSERT(ua1.valid() == 1);
513 ua1 = ua1;
514 ACE_ASSERT(ua1 == ua1);
515 ACE_ASSERT(ua1.valid() == 1);
517 // set/get port
518 ua1.set_port(333);
519 ACE_ASSERT(ua1.get_port() == 333);
520 ACE_DEBUG ((LM_DEBUG, "(%P|%t) UdpAddress:ua1.set_port()(\"333\") [%s]\n",
521 (const char *)ua1));
526 ACE_TMAIN (int, ACE_TCHAR *[])
528 ACE_START_TEST (ACE_TEXT ("Address_Test"));
530 TestGenAddr();
531 TestIpAddress();
532 TestUdpAddress();
533 TestMacAddress();
534 TestNetbiosAddress();
535 TestIpxAddress();
537 ACE_END_TEST;
538 return 0;