Initial commit of files
This commit is contained in:
12
tests/uri/CMakeLists.txt
Normal file
12
tests/uri/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
set(NAME uri)
|
||||
project(Cnomicon-Test)
|
||||
set(TARGET ${NAME}_test)
|
||||
|
||||
# includes
|
||||
include_directories(../include/libgps++ ../include/libnet++ ../include)
|
||||
link_directories(../lib)
|
||||
link_libraries(gps++ net++ net kmlbase kmldom kmlengine pthread rt)
|
||||
|
||||
# executables
|
||||
add_executable(${TARGET} ${TARGET}.cpp)
|
||||
35
tests/uri/uri_test.cpp
Normal file
35
tests/uri/uri_test.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "UriParse.h"
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
for ( int i=1 ; i<argc ; i++ )
|
||||
{
|
||||
UriParse uri;
|
||||
|
||||
printf( "Parsing: %s\n", argv[i] );
|
||||
|
||||
int n = uri.setUri( argv[i] );
|
||||
|
||||
if ( n > 0 )
|
||||
{
|
||||
printf( "\tparsed out %d fields\n", n );
|
||||
printf( "\tproto: %s\n", uri.getProto() ); // scheme
|
||||
printf( "\tuser: %s\n", uri.getUser() );
|
||||
printf( "\tpass: %s\n", uri.getPassword() );
|
||||
printf( "\thost: %s\n", uri.getHost() );
|
||||
printf( "\tport: %s\n", uri.getService() );
|
||||
printf( "\tpath: %s\n", uri.getPath() );
|
||||
printf( "\trate: %d\n", uri.getRate() );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "\tfailed!\n" );
|
||||
}
|
||||
printf( "\n" );
|
||||
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user