summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2012-08-04 17:50:20 +0200
committerAndreas Baumann <abaumann@yahoo.com>2012-08-04 17:50:20 +0200
commit79abc6b0891223fa1c9c0f57769cd58e562f22f1 (patch)
tree5576aecfafaa1e5a8c92529916bd3cb0ab98c62d
parent39d78b3dd658db518740c561f0b4e80a43987a38 (diff)
downloadcrawler-79abc6b0891223fa1c9c0f57769cd58e562f22f1.tar.gz
crawler-79abc6b0891223fa1c9c0f57769cd58e562f22f1.tar.bz2
first working google url test1
-rw-r--r--googleurl/GNUmakefile4
-rw-r--r--googleurl/base/logging.cpp (renamed from googleurl/base/logging.cc)0
-rw-r--r--googleurl/base/string16.cpp (renamed from googleurl/base/string16.cc)4
-rw-r--r--tests/googleurl/GNUmakefile3
-rw-r--r--tests/googleurl/test1.cpp49
5 files changed, 57 insertions, 3 deletions
diff --git a/googleurl/GNUmakefile b/googleurl/GNUmakefile
index 0971a4a..b73d9da 100644
--- a/googleurl/GNUmakefile
+++ b/googleurl/GNUmakefile
@@ -4,7 +4,8 @@ SUBDIRS =
-include $(TOPDIR)/makefiles/gmake/platform.mk
-INCLUDE_CFLAGS = \
+INCLUDE_CXXFLAGS = \
+ -DNDEBUG
INCLUDE_LDFLAGS = \
@@ -14,6 +15,7 @@ INCLUDE_DIRS = \
INCLUDE_LIBS = \
CPP_OBJS = \
+ base/string16.o \
url_canon_etc.o \
url_canon_filesystemurl.o \
url_canon_fileurl.o \
diff --git a/googleurl/base/logging.cc b/googleurl/base/logging.cpp
index ab03150..ab03150 100644
--- a/googleurl/base/logging.cc
+++ b/googleurl/base/logging.cpp
diff --git a/googleurl/base/string16.cc b/googleurl/base/string16.cpp
index fc25809..844d79d 100644
--- a/googleurl/base/string16.cc
+++ b/googleurl/base/string16.cpp
@@ -28,6 +28,8 @@
#include "base/string16.h"
+#include <string.h>
+
#ifdef WIN32
#error This file should not be used on 2-byte wchar_t systems
@@ -89,6 +91,6 @@ char16* c16memset(char16* s, char16 c, size_t n) {
} // namespace base
-template class std::basic_string<char16, base::string16_char_traits>;
+//template class std::basic_string<char16, base::string16_char_traits>;
#endif // WIN32
diff --git a/tests/googleurl/GNUmakefile b/tests/googleurl/GNUmakefile
index 6e573aa..387a9f2 100644
--- a/tests/googleurl/GNUmakefile
+++ b/tests/googleurl/GNUmakefile
@@ -3,10 +3,13 @@ TOPDIR = ../..
SUBDIRS =
INCLUDE_DIRS = \
+ -I$(TOPDIR)/googleurl
INCLUDE_LDFLAGS =
INCLUDE_LIBS = \
+ $(TOPDIR)/googleurl/libgoogleurl.a \
+ -licui18n -licuuc
TEST_CPP_BINS = \
test1$(EXE)
diff --git a/tests/googleurl/test1.cpp b/tests/googleurl/test1.cpp
index 703f81f..a5b069d 100644
--- a/tests/googleurl/test1.cpp
+++ b/tests/googleurl/test1.cpp
@@ -1,4 +1,51 @@
-int main( void )
+#include "url_util.h"
+#include "url_canon_stdstring.h"
+#include "url_parse.h"
+
+#include <iostream>
+#include <string>
+
+using namespace url_util;
+using namespace url_canon;
+using namespace url_parse;
+using namespace std;
+
+int main( int argc, char *argv[] )
{
+ Initialize( );
+
+ if( argc != 2 ) {
+ cerr << "usage: test1 <url>\n" << endl;
+ return 1;
+ }
+
+ string urlstring = argv[1];
+ string canonical;
+ canonical.reserve( urlstring.size( ) + 32 );
+ StdStringCanonOutput output( &canonical );
+ Parsed parsed;
+ bool success = Canonicalize(
+ urlstring.data( ), static_cast<int>( urlstring.length( ) ),
+ NULL, &output, &parsed );
+ if( !success ) {
+ cerr << "Illegal URL!" << endl;
+ return 1;
+ }
+ output.Complete( );
+
+ cout << "URL: " << canonical << endl;
+
+ Shutdown( );
+
+/* cout << "protocol: " << url.protocol( ) << endl
+ << "host: " << url.host( ) << endl
+ << "port: " << url.port( ) << endl
+ << "path: " << url.path( ) << endl
+ << "query: " << url.query( ) << endl
+ << "fragment: " << url.fragment( ) << endl;
+
+ cout << "URL: " << url << endl;
+*/
+
return 0;
}