1 #include "websvcs/lib/URL_Addr.h"
2 #include "ace/Log_Msg.h"
5 void test_http_addr ();
7 void test_mailto_addr ();
10 int ACE_TMAIN (int, ACE_TCHAR
*[])
19 #define HTTP_TEST_ARRAY \
20 ACE_TEXT("http://www.cs.wustl.edu/"), \
21 ACE_TEXT("http://www.cs.wustl.edu/index.html"), \
22 ACE_TEXT("http://www.cs.wustl.edu/form?var=foo"), \
23 ACE_TEXT("http://www.notexist.com:8080/index.html"), \
24 ACE_TEXT("http://www.notexist.com:80/index.html"), \
25 ACE_TEXT("ftp://foo"), \
26 ACE_TEXT("http://www/?kkk//")
28 #define FTP_TEST_ARRAY \
29 ACE_TEXT("ftp://www.cs.wustl.edu/"), \
30 ACE_TEXT("ftp://user@www.cs.wustl.edu/"), \
31 ACE_TEXT("ftp://user:pass@www.cs.wustl.edu/"), \
32 ACE_TEXT("ftp://user:pass@www.cs.wustl.edu/path"), \
33 ACE_TEXT("ftp://www.cs.wustl.edu"), \
34 ACE_TEXT("http://www.cs.wustl.edu/index.html")
36 #define MAILTO_TEST_ARRAY \
37 ACE_TEXT("mailto:ace-users@cs.wustl.edu"), \
38 ACE_TEXT("mailto:majordomo@cs.wustl.edu?Subject: subscribe ace-users"), \
39 ACE_TEXT("mailto:nobody"), \
40 ACE_TEXT("http://www.cs.wustl.edu")
42 #define URL_TEST_ARRAY \
43 ACE_TEXT("file:/etc/passwd")
45 void test_http_addr ()
47 static const ACE_TCHAR
*addresses
[] = {
50 static int naddresses
= sizeof(addresses
)/sizeof(addresses
[0]);
51 for (int i
= 0; i
< naddresses
; ++i
)
54 if (addr
.string_to_addr (addresses
[i
]) != 0)
63 ACE_TCHAR buffer
[BUFSIZ
];
64 if (addr
.addr_to_string (buffer
, BUFSIZ
, i
%2) == 0)
87 static const ACE_TCHAR
*addresses
[] = {
90 static int naddresses
= sizeof(addresses
)/sizeof(addresses
[0]);
91 for (int i
= 0; i
< naddresses
; ++i
)
94 if (addr
.string_to_addr (addresses
[i
]) != 0)
103 ACE_TCHAR buffer
[BUFSIZ
];
104 if (addr
.addr_to_string (buffer
, BUFSIZ
, i
%2) == 0)
106 ACE_DEBUG ((LM_DEBUG
,
117 ACE_ERROR ((LM_ERROR
,
125 void test_mailto_addr ()
127 static const ACE_TCHAR
*addresses
[] = {
130 static int naddresses
= sizeof(addresses
)/sizeof(addresses
[0]);
131 for (int i
= 0; i
< naddresses
; ++i
)
133 ACE_Mailto_Addr addr
;
134 if (addr
.string_to_addr (addresses
[i
]) != 0)
136 ACE_ERROR ((LM_ERROR
,
143 ACE_TCHAR buffer
[BUFSIZ
];
144 if (addr
.addr_to_string (buffer
, BUFSIZ
, i
%2) == 0)
146 ACE_DEBUG ((LM_DEBUG
,
157 ACE_ERROR ((LM_ERROR
,
165 void test_url_addr ()
167 static const ACE_TCHAR
*addresses
[] = {
173 static int naddresses
= sizeof(addresses
)/sizeof(addresses
[0]);
174 for (int i
= 0; i
< naddresses
; ++i
)
177 ACE_URL_Addr::create_address (addresses
[i
]);
180 ACE_ERROR ((LM_ERROR
,
187 ACE_TCHAR buffer
[BUFSIZ
];
188 if (addr
->addr_to_string (buffer
, BUFSIZ
, i
%2) == 0)
190 ACE_DEBUG ((LM_DEBUG
,
201 ACE_ERROR ((LM_ERROR
,