summaryrefslogtreecommitdiff
path: root/tests/url
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2012-08-10 21:14:37 +0200
committerAndreas Baumann <abaumann@yahoo.com>2012-08-10 21:14:37 +0200
commitba3db8e7a1d9b05687cb96e2d7b671c08f97c922 (patch)
tree2152d776b9523bea29553323587cae49f389deda /tests/url
parent2b15ea93c0afd872b60cea94fa3c9e585919305c (diff)
downloadcrawler-ba3db8e7a1d9b05687cb96e2d7b671c08f97c922.tar.gz
crawler-ba3db8e7a1d9b05687cb96e2d7b671c08f97c922.tar.bz2
fixed simle url normalizer and it's tests
Diffstat (limited to 'tests/url')
-rwxr-xr-xtests/url/Makefile.W3216
-rwxr-xr-xtests/url/exec_test.cmd20
-rwxr-xr-xtests/url/test1.cpp6
3 files changed, 36 insertions, 6 deletions
diff --git a/tests/url/Makefile.W32 b/tests/url/Makefile.W32
index 573f636..c65000f 100755
--- a/tests/url/Makefile.W32
+++ b/tests/url/Makefile.W32
@@ -6,7 +6,7 @@ SUBDIRS =
INCLUDE_CXXFLAGS = \
/D_WIN32_WINNT=0x504 \
- /DUSE_MODULELOADER
+# /DUSE_MODULELOADER
INCLUDE_DIRS = \
/I. \
@@ -36,5 +36,15 @@ local_clean:
local_distclean:
local_test:
-# @-exec_test test1 "TypeList and TypeTraits"
-# @-exec_test test2 "TypeInfo C++ demangle"
+ @-exec_test test1 test1 "parse illegal protocol" simple parse www.andreasbaumann.cc
+ @-exec_test test1 test2 "parse normal start URL without slash" simple parse http://www.andreasbaumann.cc
+ @-exec_test test1 test3 "parse normal start URL with slash" simple parse http://www.andreasbaumann.cc/
+ @-exec_test test1 test4 "parse normal URL" simple parse http://www.andreasbaumann.cc/index.html
+ @-exec_test test1 test5 "parse normal URL with default port" simple parse http://www.andreasbaumann.cc:80/index.html
+ @-exec_test test1 test6 "parse normal URL with non-standard port" simple parse http://www.andreasbaumann.cc:8080/index.html
+ @-exec_test test1 test100 "normalize a relative URL" simple normalize http://www.andreasbaumann.cc/index.html /software.html
+ @-exec_test test1 test101 "absolute URL in HTML content" simple normalize http://www.andreasbaumann.cc/index.html http://www.yahoo.com/page.html
+ @-exec_test test1 test102 "path normalization, relative path" simple normalize http://www.andreasbaumann.cc/adir/index.html bdir/page.html
+ @-exec_test test1 test103 "path normalization, absolute path" simple normalize http://www.andreasbaumann.cc/adir/index.html /bdir/page.html
+ @-exec_test test1 test104 "path normalization, current dir" simple normalize http://www.andreasbaumann.cc/adir/index.html ./bdir/page.html
+ @-exec_test test1 test105 "path normalization, previous dir" simple normalize http://www.andreasbaumann.cc/adir/index.html ../bdir/page.html
diff --git a/tests/url/exec_test.cmd b/tests/url/exec_test.cmd
new file mode 100755
index 0000000..8f29552
--- /dev/null
+++ b/tests/url/exec_test.cmd
@@ -0,0 +1,20 @@
+@echo off
+
+set BINARY=%1
+shift
+set ID=%1
+shift
+set TITLE=%1
+shift
+
+%BINARY% %1 %2 %3 %4 >%ID%.OUT 2>%ID%.ERR
+type %ID%.ERR >> %ID%.OUT
+..\..\utils\win32\dos2unix <%ID%.OUT >%ID%.RES
+erase /q %ID%.OUT
+echo n | comp %ID%.MUST %ID%.RES > %ID%.DIFF 2>NUL
+if ERRORLEVEL 1 GOTO FAIL
+echo %ID%: %TITLE%.. OK
+goto END
+:FAIL
+echo %ID%: %TITLE% .. ERROR
+:END
diff --git a/tests/url/test1.cpp b/tests/url/test1.cpp
index 095de24..2512e79 100755
--- a/tests/url/test1.cpp
+++ b/tests/url/test1.cpp
@@ -29,9 +29,9 @@ int main( int argc, char *argv[] )
#ifdef USE_MODULELOADER
vector<string> modules;
- // modules.push_back( "../../src/modules/urlnormalizer/simpleurl/mod_urlnormalizer_simple" MODULE_EXT );
- modules.push_back( "..\\..\\src\\modules\\urlnormalizer\\simpleurl\\mod_urlnormalizer_simple" MODULE_EXT );
- // modules.push_back( "../../src/modules/urlnormalizer/googleurl/mod_urlnormalizer_googleurl" MODULE_EXT );
+ // modules.push_back( "../../src/modules/urlnormalizer/simpleurl/mod_urlnormalizer_simple.so" );
+ modules.push_back( "..\\..\\src\\modules\\urlnormalizer\\simpleurl\\mod_urlnormalizer_simple.dll" );
+ // modules.push_back( "../../src/modules/urlnormalizer/googleurl/mod_urlnormalizer_googleurl.so" );
ModuleLoader<URLNormalizer> urlNormalizers( modules );
URLNormalizer *normalizer = urlNormalizers.create( method );