summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2014-10-15 11:26:54 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2014-10-15 11:26:54 +0200
commita5645f8dc580ec51c75e296e53b484440f40683e (patch)
treef7b050035fb4296398652944c5b33c4625df7d7a
parente2f8ce69fdaf9da19eb0adb9595d8daa18668137 (diff)
downloadcrawler-a5645f8dc580ec51c75e296e53b484440f40683e.tar.gz
crawler-a5645f8dc580ec51c75e296e53b484440f40683e.tar.bz2
added a test for stringutils split
-rwxr-xr-xtests/utils/GNUmakefile8
-rwxr-xr-xtests/utils/Makefile.W327
-rw-r--r--tests/utils/test4.MUST5
-rwxr-xr-xtests/utils/test4.cpp18
4 files changed, 35 insertions, 3 deletions
diff --git a/tests/utils/GNUmakefile b/tests/utils/GNUmakefile
index 98526e7..1ab17e8 100755
--- a/tests/utils/GNUmakefile
+++ b/tests/utils/GNUmakefile
@@ -4,16 +4,19 @@ SUBDIRS =
INCLUDE_DIRS = \
-I. -I$(TOPDIR)/src \
+ -I$(TOPDIR)/include \
-I$(TOPDIR)/include/util
INCLUDE_LDFLAGS =
-INCLUDE_LIBS =
+INCLUDE_LIBS = \
+ $(TOPDIR)/src/libutil/libutil.a
TEST_CPP_BINS = \
test1$(EXE) \
test2$(EXE) \
- test3$(EXE)
+ test3$(EXE) \
+ test4$(EXE)
OBJS =
@@ -30,3 +33,4 @@ local_test:
@./exec_test test1 "TypeList and TypeTraits"
@./exec_test test2 "TypeInfo C++ demangle"
@./exec_test test3 "Singleton"
+ @./exec_test test4 "StringUtils split"
diff --git a/tests/utils/Makefile.W32 b/tests/utils/Makefile.W32
index ec6f9e7..6e1bb56 100755
--- a/tests/utils/Makefile.W32
+++ b/tests/utils/Makefile.W32
@@ -10,16 +10,19 @@ INCLUDE_CXXFLAGS = \
INCLUDE_DIRS = \
/I. \
/I$(TOPDIR)\src \
+ /I$(TOPDIR)\include \
/I$(TOPDIR)\include\util
INCLUDE_LDFLAGS = \
INCLUDE_LIBS = \
+ $(TOPDIR)/src/libutil/utilstatic.lib
TEST_CPP_BINS = \
test1.exe \
test2.exe \
- test3.exe
+ test3.exe \
+ test4.exe
OBJS =
@@ -28,6 +31,7 @@ OBJS =
test1.exe: test1.obj
test2.exe: test2.obj
test3.exe: test3.obj
+test4.exe: test4.obj
local_all:
@@ -40,3 +44,4 @@ local_test:
@-exec_test test1 "TypeList and TypeTraits"
@-exec_test test2 "TypeInfo C++ demangle"
@-exec_test test3 "Singleton"
+ @-exec_test test4 "StringUtils split"
diff --git a/tests/utils/test4.MUST b/tests/utils/test4.MUST
new file mode 100644
index 0000000..69b62cb
--- /dev/null
+++ b/tests/utils/test4.MUST
@@ -0,0 +1,5 @@
+0. 'this'
+1. 'is'
+2. 'a'
+3. ''
+4. 'test'
diff --git a/tests/utils/test4.cpp b/tests/utils/test4.cpp
new file mode 100755
index 0000000..efc5b34
--- /dev/null
+++ b/tests/utils/test4.cpp
@@ -0,0 +1,18 @@
+#include "StringUtils.hpp"
+
+#include <vector>
+#include <string>
+#include <iostream>
+
+using namespace std;
+
+int main( void )
+{
+ vector<string> parts = split( "this.is.a..test", ".", true );
+
+ for( size_t i = 0; i < parts.size( ); i++ ) {
+ cout << i << ". '" << parts[i] << "'" << endl;
+ }
+
+ return 0;
+}