From a5645f8dc580ec51c75e296e53b484440f40683e Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Wed, 15 Oct 2014 11:26:54 +0200 Subject: added a test for stringutils split --- tests/utils/GNUmakefile | 8 ++++++-- tests/utils/Makefile.W32 | 7 ++++++- tests/utils/test4.MUST | 5 +++++ tests/utils/test4.cpp | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 tests/utils/test4.MUST create mode 100755 tests/utils/test4.cpp 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 +#include +#include + +using namespace std; + +int main( void ) +{ + vector parts = split( "this.is.a..test", ".", true ); + + for( size_t i = 0; i < parts.size( ); i++ ) { + cout << i << ". '" << parts[i] << "'" << endl; + } + + return 0; +} -- cgit v1.2.3-54-g00ecf