Mon, 26 Oct 2015 14:09:45 +0100
added important test case to sstrsplit and fixed bug with consecutively occurring delimiters + fixed build system not linking test binary with newest library build
Makefile | file | annotate | diff | comparison | revisions | |
test/Makefile | file | annotate | diff | comparison | revisions | |
test/string_tests.c | file | annotate | diff | comparison | revisions | |
ucx/string.c | file | annotate | diff | comparison | revisions |
--- a/Makefile Thu Oct 22 11:35:40 2015 +0200 +++ b/Makefile Mon Oct 26 14:09:45 2015 +0100 @@ -49,16 +49,16 @@ ucx-debug: FORCE cd ucx; $(MAKE) CONF=$(CONF) debug -test: FORCE ucx +test: ucx cd test; $(MAKE) CONF=$(CONF) -test-debug: FORCE ucx-debug +test-debug: ucx-debug cd test; $(MAKE) CONF=$(CONF) debug -run: FORCE test +run: test ./build/release/test/ucxtest$(APP_EXT) -run-debug: FORCE test-debug +run-debug: test-debug ./build/debug/test/ucxtest$(APP_EXT) debug: ucx-debug test-debug
--- a/test/Makefile Thu Oct 22 11:35:40 2015 +0200 +++ b/test/Makefile Mon Oct 26 14:09:45 2015 +0100 @@ -47,7 +47,7 @@ all: ../build/release/test ../build/release/test/ucxtest$(APP_EXT) debug: ../build/debug/test ../build/debug/test/ucxtest$(APP_EXT) -../build/release/test/ucxtest$(APP_EXT): $(OBJ) +../build/release/test/ucxtest$(APP_EXT): FORCE $(OBJ) $(LD) $(LDFLAGS) -o ../build/release/test/ucxtest$(APP_EXT) \ $(OBJ) ../build/release/libucx$(LIB_EXT) @@ -57,7 +57,7 @@ ../build/release/test: $(MKDIR) $(MKDIRFLAGS) ../build/release/test -../build/debug/test/ucxtest$(APP_EXT): $(OBJ_D) +../build/debug/test/ucxtest$(APP_EXT): FORCE $(OBJ_D) $(LD) $(LDFLAGS) -o ../build/debug/test/ucxtest$(APP_EXT) \ $(OBJ_D) ../build/debug/libucx$(LIB_EXT) @@ -66,3 +66,7 @@ ../build/debug/test: $(MKDIR) $(MKDIRFLAGS) ../build/debug/test + +# force rebuild of test binary (library might have been changed) +FORCE: +
--- a/test/string_tests.c Thu Oct 22 11:35:40 2015 +0200 +++ b/test/string_tests.c Mon Oct 26 14:09:45 2015 +0100 @@ -293,6 +293,19 @@ free(list[i].ptr); } free(list); + + /* double encounter delimiter (ded) */ + n = 0; + list = sstrsplit(test, S("is,"), &n); + UCX_TEST_ASSERT(n == 3, "ded, list length must be 3"); + UCX_TEST_ASSERT(strcmp(list[0].ptr, "th") == 0, "ded, item 0 mismatch"); + UCX_TEST_ASSERT(list[1].length == 0, "ded, item 1 not empty!"); + UCX_TEST_ASSERT(strcmp(list[2].ptr, "a,csv,string") == 0, + "ded, item 2 mismatch"); + for(int i=0;i<n;i++) { + free(list[i].ptr); + } + free(list); UCX_TEST_END }