diff options
author | David Robillard <d@drobilla.net> | 2006-12-13 07:09:22 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-12-13 07:09:22 +0000 |
commit | d1f1ec4015acee8afce7d72056427a22f589ff4a (patch) | |
tree | 6105ca6af7599208fb08f930dbeebb6c9658c4b3 | |
parent | 72c69be4a65be3afd9f5299f106b8903c2b84957 (diff) | |
download | raul-d1f1ec4015acee8afce7d72056427a22f589ff4a.tar.gz raul-d1f1ec4015acee8afce7d72056427a22f589ff4a.tar.bz2 raul-d1f1ec4015acee8afce7d72056427a22f589ff4a.zip |
Path parent/child bug fixes, added unit tests.
Breadcrumb/browsing/subsubpatch bug fixes.
Fixed about window icon and glade error messages.
git-svn-id: http://svn.drobilla.net/lad/raul@223 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | raul/Path.h | 6 | ||||
-rw-r--r-- | tests/Makefile.am | 8 | ||||
-rw-r--r-- | tests/path_test.cpp | 16 |
5 files changed, 46 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am index 025d68b..ce16387 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,8 @@ SUBDIRS = raul doc +if BUILD_TESTS +SUBDIRS += tests +endif + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = raul.pc diff --git a/configure.ac b/configure.ac index 635c127..6b9302a 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,13 @@ AC_CHECK_FUNCS([strdup strerror]) AC_CHECK_HEADER([pthread.h], [], AC_MSG_ERROR([Raul requires POSIX threads.])) +# Build unit tests? +build_unit_tests="no" +AC_ARG_ENABLE(unit-tests, + [AS_HELP_STRING(--enable-unit-tests, [Build unit tests (no) - Developers only])], + [build_unit_tests="$enableval"]) +AM_CONDITIONAL(BUILD_TESTS, [test "$build_unit_tests" = "yes"]) + build_smart_pointers="yes" AC_ARG_ENABLE(smart_pointers, [AS_HELP_STRING(--enable-smart_pointers, [Include smart pointers - requires boost (yes)])], @@ -63,6 +70,7 @@ AM_CONDITIONAL(WITH_LIBLO, [test "$build_liblo" = "yes"]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([raul/Makefile]) +AC_CONFIG_FILES([tests/Makefile]) AC_CONFIG_FILES([doc/Makefile]) AC_CONFIG_FILES([doc/reference.doxygen]) AC_CONFIG_FILES([raul.pc]) @@ -73,9 +81,11 @@ AC_MSG_RESULT([]) AC_MSG_RESULT([**********************************************************************]) AC_MSG_RESULT([Raul build configuration:]) AC_MSG_RESULT([]) -AC_MSG_RESULT([OSC supprt: $build_liblo]) -AC_MSG_RESULT([RDF supprt: $build_raptor]) -AC_MSG_RESULT([Smart Pointers: $build_smart_pointers]) +AC_MSG_RESULT([Building unit tests: $build_unit_tests]) +AC_MSG_RESULT([]) +AC_MSG_RESULT([OSC supprt: $build_liblo]) +AC_MSG_RESULT([RDF supprt: $build_raptor]) +AC_MSG_RESULT([Smart Pointers: $build_smart_pointers]) AC_MSG_RESULT([**********************************************************************]) AC_MSG_RESULT([]) diff --git a/raul/Path.h b/raul/Path.h index d4db163..e79e111 100644 --- a/raul/Path.h +++ b/raul/Path.h @@ -240,7 +240,11 @@ public: inline bool is_child_of(const Path& parent) const { - return (length() > parent.length() && substr(0, parent.length()) == parent); + /*return (length() > parent.length() + && substr(0, parent.length()) == parent + && (*this)[parent.length()] == '/');*/ + const string parent_base = parent.base(); + return (substr(0, parent_base.length()) == parent_base); } inline bool is_parent_of(const Path& child) const diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..0732d07 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,8 @@ +if BUILD_TESTS + +AM_CXXFLAGS = -I.. +bin_PROGRAMS = path_test + +path_test_SOURCES = path_test.cpp + +endif diff --git a/tests/path_test.cpp b/tests/path_test.cpp new file mode 100644 index 0000000..1620703 --- /dev/null +++ b/tests/path_test.cpp @@ -0,0 +1,16 @@ +#include <iostream> +#include <raul/Path.h> + +using namespace std; + +int +main() +{ + cerr << "1's are good..." << endl << endl; + + cerr << (Path("/").is_parent_of(Path("/foo"))) << endl; + cerr << (Path("/foo").is_parent_of(Path("/foo/bar"))) << endl; + cerr << !(Path("/foo").is_parent_of(Path("/foo2"))) << endl; + + return 0; +} |