aboutsummaryrefslogtreecommitdiff
path: root/src/tests/url.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/url.cpp')
-rw-r--r--src/tests/url.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/tests/url.cpp b/src/tests/url.cpp
new file mode 100644
index 0000000..c9af676
--- /dev/null
+++ b/src/tests/url.cpp
@@ -0,0 +1,32 @@
1#include "bu/url.h"
2
3#include <stdio.h>
4
5int main( int argc, char *argv[] )
6{
7 printf("encodede: %s\n", Bu::Url::encode( argv[1] ).getStr() );
8 printf("decodede: %s\n", Bu::Url::decode( argv[1] ).getStr() );
9 Bu::Url u( argv[1] );
10
11 printf("Protocol: %s\n", u.getProtocol().getStr() );
12 printf("User: %s\n", u.getUser().getStr() );
13 printf("Pass: %s\n", u.getPass().getStr() );
14 printf("Host: %s\n", u.getHost().getStr() );
15 printf("Path: %s\n", u.getPath().getStr() );
16 try
17 {
18 printf("Port: %d\n", u.getPort() );
19 } catch( Bu::ExceptionBase &e )
20 {
21 printf("Port: not set.\n");
22 }
23 printf("Parameters:\n");
24 for( Bu::Url::ParamList::const_iterator i = u.getParamBegin(); i; i++ )
25 {
26 printf(" \"%s\" = \"%s\"\n",
27 (*i).sName.getStr(), (*i).sValue.getStr()
28 );
29 }
30
31 return 0;
32}