Hello community, here is the log from the commit of package libfilezilla for openSUSE:Factory checked in at 2018-10-15 09:47:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libfilezilla (Old) and /work/SRC/openSUSE:Factory/.libfilezilla.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libfilezilla" Mon Oct 15 09:47:07 2018 rev:20 rq:641965 version:0.14.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libfilezilla/libfilezilla.changes 2018-08-07 09:43:44.321378997 +0200 +++ /work/SRC/openSUSE:Factory/.libfilezilla.new/libfilezilla.changes 2018-10-15 09:48:06.123059274 +0200 @@ -1,0 +2,24 @@ +Sat Oct 13 21:52:55 UTC 2018 - [email protected] + +- update to 0.14.0 + * New features: + - Added fz::equal_insensitive_ascii + - Added insensitive_ascii parameter to fz::starts_with + and fz::ends_with + * Bugfixes and minor changes: + - Fixed namespace of to_wstring in wx glue + +------------------------------------------------------------------- +Mon Sep 24 14:48:37 UTC 2018 - [email protected] + +- update to 0.13.2 + * Bugfixes and minor changes: + - Fix regression in fz::shared_value::clear + - Fix parsing of URIs without path +- changes from 0.13.1 + * New features: + - Made fz::scoped_lock movable + * Bugfixes and minor changes: + - Fix a few compiler warnings + +------------------------------------------------------------------- Old: ---- libfilezilla-0.13.0.tar.bz2 New: ---- libfilezilla-0.14.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libfilezilla.spec ++++++ --- /var/tmp/diff_new_pack.5QsYYh/_old 2018-10-15 09:48:06.807058514 +0200 +++ /var/tmp/diff_new_pack.5QsYYh/_new 2018-10-15 09:48:06.811058509 +0200 @@ -20,13 +20,13 @@ %define libname %{name}%{major} %define develname %{name}-devel Name: libfilezilla -Version: 0.13.0 +Version: 0.14.0 Release: 0 Summary: C++ library for filezilla License: GPL-2.0-or-later Group: Development/Libraries/C and C++ Url: https://lib.filezilla-project.org/ -Source0: http://download.filezilla-project.org/libfilezilla/%{name}-%{version}.tar.bz2 +Source0: https://download.filezilla-project.org/libfilezilla/%{name}-%{version}.tar.bz2 Source1: COPYING Patch0: %{name}-date-time.patch BuildRequires: autoconf ++++++ libfilezilla-0.13.0.tar.bz2 -> libfilezilla-0.14.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/NEWS new/libfilezilla-0.14.0/NEWS --- old/libfilezilla-0.13.0/NEWS 2018-07-16 09:25:57.000000000 +0200 +++ new/libfilezilla-0.14.0/NEWS 2018-10-04 13:17:12.000000000 +0200 @@ -1,3 +1,19 @@ +0.14.0 (2018-10-04) + ++ Added fz::equal_insensitive_ascii ++ Added insensitive_ascii parameter to fz::starts_with and fz::ends_with +- Fixed namespace of to_wstring in wx glue + +0.13.2 (2018-09-21) + +- Fix regression in fz::shared_value::clear +- Fix parsing of URIs without path + +0.13.1 (2018-09-10) + ++ Made fz::scoped_lock movable +- Fix a few compiler warnings + 0.13.0 (2018-07-16) + Add bool return value to replace_substrings to indicate whether something has been replaced. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/configure new/libfilezilla-0.14.0/configure --- old/libfilezilla-0.13.0/configure 2018-07-16 10:17:49.000000000 +0200 +++ new/libfilezilla-0.14.0/configure 2018-10-04 13:17:18.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libfilezilla 0.13.0. +# Generated by GNU Autoconf 2.69 for libfilezilla 0.14.0. # # Report bugs to <[email protected]>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libfilezilla' PACKAGE_TARNAME='libfilezilla' -PACKAGE_VERSION='0.13.0' -PACKAGE_STRING='libfilezilla 0.13.0' +PACKAGE_VERSION='0.14.0' +PACKAGE_STRING='libfilezilla 0.14.0' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='https://lib.filezilla-project.org/' @@ -1413,7 +1413,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libfilezilla 0.13.0 to adapt to many kinds of systems. +\`configure' configures libfilezilla 0.14.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1484,7 +1484,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libfilezilla 0.13.0:";; + short | recursive ) echo "Configuration of libfilezilla 0.14.0:";; esac cat <<\_ACEOF @@ -1621,7 +1621,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libfilezilla configure 0.13.0 +libfilezilla configure 0.14.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2066,7 +2066,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libfilezilla $as_me 0.13.0, which was +It was created by libfilezilla $as_me 0.14.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2932,7 +2932,7 @@ # Define the identity of the package. PACKAGE='libfilezilla' - VERSION='0.13.0' + VERSION='0.14.0' cat >>confdefs.h <<_ACEOF @@ -20908,7 +20908,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libfilezilla $as_me 0.13.0, which was +This file was extended by libfilezilla $as_me 0.14.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20975,7 +20975,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libfilezilla config.status 0.13.0 +libfilezilla config.status 0.14.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/configure.ac new/libfilezilla-0.14.0/configure.ac --- old/libfilezilla-0.13.0/configure.ac 2018-07-16 09:26:14.000000000 +0200 +++ new/libfilezilla-0.14.0/configure.ac 2018-10-04 13:17:12.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([libfilezilla],[0.13.0],[[email protected]],[],[https://lib.filezilla-project.org/]) +AC_INIT([libfilezilla],[0.14.0],[[email protected]],[],[https://lib.filezilla-project.org/]) AC_CONFIG_HEADERS([lib/libfilezilla/private/config.hpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR(config) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/event.cpp new/libfilezilla-0.14.0/lib/event.cpp --- old/libfilezilla-0.13.0/lib/event.cpp 2018-07-16 09:23:45.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/event.cpp 2018-09-10 15:32:15.000000000 +0200 @@ -1,7 +1,7 @@ #include "libfilezilla/event.hpp" +#include "libfilezilla/mutex.hpp" #include <map> -#include <libfilezilla/mutex.hpp> namespace fz { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/libfilezilla/event.hpp new/libfilezilla-0.14.0/lib/libfilezilla/event.hpp --- old/libfilezilla-0.13.0/lib/libfilezilla/event.hpp 2018-07-16 09:23:45.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/libfilezilla/event.hpp 2018-09-10 15:32:15.000000000 +0200 @@ -81,7 +81,7 @@ inline static size_t type() { // Exporting templates from DLLs is problematic to say the least. It breaks // ODR, so we use this trick that goes over the type name. - static int const v = get_unique_type_id(typeid(UniqueType*)); + static size_t const v = get_unique_type_id(typeid(UniqueType*)); return v; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/libfilezilla/format.hpp new/libfilezilla-0.14.0/lib/libfilezilla/format.hpp --- old/libfilezilla-0.13.0/lib/libfilezilla/format.hpp 2018-07-16 09:23:45.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/libfilezilla/format.hpp 2018-09-10 15:32:15.000000000 +0200 @@ -29,7 +29,7 @@ // Converts integral type to desired string type... // ... basic case: simple unsigned value template<typename String, bool Unsigned, typename Arg> -typename std::enable_if_t<std::is_integral<std::decay_t<Arg>>::value && !std::is_enum<std::decay_t<Arg>>::value, String> integral_to_string(char flags, int width, Arg && arg) +typename std::enable_if_t<std::is_integral<std::decay_t<Arg>>::value && !std::is_enum<std::decay_t<Arg>>::value, String> integral_to_string(char flags, size_t width, Arg && arg) { std::decay_t<Arg> v = arg; @@ -69,20 +69,20 @@ if (lead) { ret += lead; } - if (end - p < width) { + if (static_cast<size_t>(end - p) < width) { ret.append(width - (end - p), '0'); } ret.append(p, end); } else { - if (end - p < width && !(flags & left_align)) { + if (static_cast<size_t>(end - p) < width && !(flags & left_align)) { ret.append(width - (end - p), ' '); } if (lead) { ret += lead; } ret.append(p, end); - if (end - p < width && flags & left_align) { + if (static_cast<size_t>(end - p) < width && flags & left_align) { ret.append(width - (end - p), ' '); } } @@ -99,14 +99,14 @@ // ... for strongly typed enums template<typename String, bool Unsigned, typename Arg> -typename std::enable_if_t<std::is_enum<std::decay_t<Arg>>::value, String> integral_to_string(char flags, int width, Arg && arg) +typename std::enable_if_t<std::is_enum<std::decay_t<Arg>>::value, String> integral_to_string(char flags, size_t width, Arg && arg) { return integral_to_string<String, Unsigned>(flags, width, static_cast<std::underlying_type_t<std::decay_t<Arg>>>(arg)); } // ... assert otherwise template<typename String, bool Unsigned, typename Arg> -typename std::enable_if_t<!std::is_integral<std::decay_t<Arg>>::value && !std::is_enum<std::decay_t<Arg>>::value, String> integral_to_string(char, int, Arg &&) +typename std::enable_if_t<!std::is_integral<std::decay_t<Arg>>::value && !std::is_enum<std::decay_t<Arg>>::value, String> integral_to_string(char, size_t, Arg &&) { assert(0); return String(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/libfilezilla/glue/wx.hpp new/libfilezilla-0.14.0/lib/libfilezilla/glue/wx.hpp --- old/libfilezilla-0.13.0/lib/libfilezilla/glue/wx.hpp 2016-07-20 10:41:55.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/libfilezilla/glue/wx.hpp 2018-10-04 13:17:12.000000000 +0200 @@ -6,9 +6,9 @@ #include "../format.hpp" #include "../string.hpp" +namespace fz { inline std::wstring to_wstring(wxString const& s) { return s.ToStdWstring(); } -namespace fz { template<> inline wxString str_tolower_ascii(wxString const& s) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/libfilezilla/mutex.hpp new/libfilezilla-0.14.0/lib/libfilezilla/mutex.hpp --- old/libfilezilla-0.13.0/lib/libfilezilla/mutex.hpp 2015-11-02 14:47:31.000000000 +0100 +++ new/libfilezilla-0.14.0/lib/libfilezilla/mutex.hpp 2018-09-10 15:32:15.000000000 +0200 @@ -86,6 +86,25 @@ scoped_lock(scoped_lock const&) = delete; scoped_lock& operator=(scoped_lock const&) = delete; + scoped_lock(scoped_lock && op) + { + m_ = op.m_; + op.m_ = 0; + locked_ = op.locked_; + op.locked_ = false; + } + + scoped_lock& operator=(scoped_lock && op) + { + if (this != &op) { + m_ = op.m_; + op.m_ = 0; + locked_ = op.locked_; + op.locked_ = false; + } + return *this; + } + /** \brief Obtains the mutex. * * Locking an already locked scoped_lock results in undefined behavior. @@ -118,9 +137,9 @@ friend class condition; #ifdef FZ_WINDOWS - CRITICAL_SECTION * const m_; + CRITICAL_SECTION * m_; #else - pthread_mutex_t * const m_; + pthread_mutex_t * m_; #endif bool locked_{true}; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/libfilezilla/shared.hpp new/libfilezilla-0.14.0/lib/libfilezilla/shared.hpp --- old/libfilezilla-0.13.0/lib/libfilezilla/shared.hpp 2017-09-29 10:41:58.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/libfilezilla/shared.hpp 2018-09-21 10:18:48.000000000 +0200 @@ -123,7 +123,7 @@ if (!Init && !data_) { data_ = std::make_shared<T>(); } - if (!data_.unique()) { + if (data_.use_count() > 1) { data_ = std::make_shared<T>(*data_); } @@ -132,8 +132,9 @@ template<typename T, bool Init> bool shared_optional<T, Init>::operator<(shared_optional<T, Init> const& cmp) const { - if (data_ == cmp.data_) + if (data_ == cmp.data_) { return false; + } else if (!Init && !data_) { return static_cast<bool>(cmp.data_); } @@ -156,7 +157,7 @@ if (!Init) { data_.reset(); } - else if (data_.unique()) { + else if (data_.use_count() <= 1) { *data_ = T(); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/libfilezilla/string.hpp new/libfilezilla-0.14.0/lib/libfilezilla/string.hpp --- old/libfilezilla-0.13.0/lib/libfilezilla/string.hpp 2018-07-16 09:23:45.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/libfilezilla/string.hpp 2018-10-04 13:17:12.000000000 +0200 @@ -49,7 +49,7 @@ /** \brief Locale-sensitive stricmp * - * Like std::string::strcmp but case-insensitive, respecting locale. + * Like std::string::compare but case-insensitive, respecting locale. * * \note does not handle embedded null */ @@ -136,6 +136,20 @@ } }; +/** \brief Locale-insensitive stricmp + * + * Equivalent to str_tolower_ascii(a).compare(str_tolower_ascii(b)); + */ +template<typename String> +bool equal_insensitive_ascii(String const& a, String const& b) +{ + return std::equal(a.cbegin(), a.cend(), b.cbegin(), b.cend(), + [](typename String::value_type const& a, typename String::value_type const& b) { + return tolower_ascii(a) == tolower_ascii(b); + } + ); +} + /** \brief Converts from std::string in system encoding into std::wstring * * \return the converted string on success. On failure an empty string is returned. @@ -374,24 +388,45 @@ s = trimmed(s, chars, false, true); } -// Remove once C++20 is minimum required standard to build libfilezilla -template<typename String> +/** \brief Tests whether the first string starts with the second string + * + * \param insensitive_ascii If true, comparison is case-insensitive + */ +template<bool insensitive_ascii = false, typename String> bool starts_with(String const& s, String const& beginning) { if (beginning.size() > s.size()) { return false; } - return std::equal(beginning.begin(), beginning.end(), s.begin()); + if (insensitive_ascii) { + return std::equal(beginning.begin(), beginning.end(), s.begin(), [](typename String::value_type const& a, typename String::value_type const& b) { + return tolower_ascii(a) == tolower_ascii(b); + }); + } + else { + return std::equal(beginning.begin(), beginning.end(), s.begin()); + } } -// Remove once C++20 is minimum required standard to build libfilezilla -template<typename String> +/** \brief Tests whether the first string ends with the second string + * + * \param insensitive_ascii If true, comparison is case-insensitive + */ +template<bool insensitive_ascii = false, typename String> bool ends_with(String const& s, String const& ending) { if (ending.size() > s.size()) { return false; } - return std::equal(ending.rbegin(), ending.rend(), s.rbegin()); + + if (insensitive_ascii) { + return std::equal(ending.rbegin(), ending.rend(), s.rbegin(), [](typename String::value_type const& a, typename String::value_type const& b) { + return tolower_ascii(a) == tolower_ascii(b); + }); + } + else { + return std::equal(ending.rbegin(), ending.rend(), s.rbegin()); + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/libfilezilla/thread.hpp new/libfilezilla-0.14.0/lib/libfilezilla/thread.hpp --- old/libfilezilla-0.13.0/lib/libfilezilla/thread.hpp 2018-06-08 17:43:23.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/libfilezilla/thread.hpp 2018-09-10 15:32:15.000000000 +0200 @@ -3,7 +3,7 @@ #include "libfilezilla.hpp" -#ifndef FZ_WINDOWS +#if !defined(FZ_WINDOWS) || !(defined(__MINGW32__) || defined(__MINGW64__)) #include <thread> #endif @@ -29,7 +29,7 @@ class FZ_PUBLIC_SYMBOL thread { public: -#ifdef FZ_WINDOWS +#if defined(FZ_WINDOWS) && (defined(__MINGW32__) || defined(__MINGW64__)) typedef uint32_t id; #else typedef std::thread::id id; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/libfilezilla/uri.hpp new/libfilezilla-0.14.0/lib/libfilezilla/uri.hpp --- old/libfilezilla-0.13.0/lib/libfilezilla/uri.hpp 2018-06-08 17:43:23.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/libfilezilla/uri.hpp 2018-10-04 13:17:12.000000000 +0200 @@ -108,6 +108,8 @@ std::map<std::string, std::string, fz::less_insensitive_ascii> const& pairs() const { return segments_; } + bool empty() const { return segments_.empty(); } + private: std::map<std::string, std::string, fz::less_insensitive_ascii> segments_; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/libfilezilla/version.hpp new/libfilezilla-0.14.0/lib/libfilezilla/version.hpp --- old/libfilezilla-0.13.0/lib/libfilezilla/version.hpp 2018-07-16 10:17:51.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/libfilezilla/version.hpp 2018-10-04 13:17:21.000000000 +0200 @@ -9,15 +9,15 @@ #include <tuple> /// \brief Version string of the libfilezilla headers -#define LIBFILEZILLA_VERSION "0.13.0" +#define LIBFILEZILLA_VERSION "0.14.0" #define LIBFILEZILLA_VERSION_MAJOR 0 -#define LIBFILEZILLA_VERSION_MINOR 13 +#define LIBFILEZILLA_VERSION_MINOR 14 #define LIBFILEZILLA_VERSION_MICRO 0 #define LIBFILEZILLA_VERSION_NANO 0 /// \brief Suffix string, e.g. "rc1" -#define LIBFILEZILLA_VERSION_SUFFIX "0.13.0" +#define LIBFILEZILLA_VERSION_SUFFIX "0.14.0" namespace fz { /// \brief Get version string of libfilezilla diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/lib/uri.cpp new/libfilezilla-0.14.0/lib/uri.cpp --- old/libfilezilla-0.13.0/lib/uri.cpp 2017-07-10 19:43:37.000000000 +0200 +++ new/libfilezilla-0.14.0/lib/uri.cpp 2018-09-21 10:18:48.000000000 +0200 @@ -56,7 +56,7 @@ in = in.substr(auth_delim); } else { - authority = in; + authority = in.substr(2); in.clear(); } if (!parse_authority(std::move(authority))) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/tests/smart_pointer.cpp new/libfilezilla-0.14.0/tests/smart_pointer.cpp --- old/libfilezilla-0.13.0/tests/smart_pointer.cpp 2018-02-23 09:29:01.000000000 +0100 +++ new/libfilezilla-0.14.0/tests/smart_pointer.cpp 2018-09-21 10:18:48.000000000 +0200 @@ -98,4 +98,19 @@ fz::shared_value<int> v; CPPUNIT_ASSERT(static_cast<bool>(v)); CPPUNIT_ASSERT(v == int()); + + { + fz::shared_optional<int> a(7); + fz::shared_optional<int> b = a; + b.clear(); + CPPUNIT_ASSERT_EQUAL(7, *a); + } + + { + fz::shared_value<int> a(7); + fz::shared_value<int> b = a; + b.clear(); + CPPUNIT_ASSERT_EQUAL(7, *a); + } + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfilezilla-0.13.0/tests/string.cpp new/libfilezilla-0.14.0/tests/string.cpp --- old/libfilezilla-0.13.0/tests/string.cpp 2018-05-06 11:22:43.000000000 +0200 +++ new/libfilezilla-0.14.0/tests/string.cpp 2018-10-04 13:17:12.000000000 +0200 @@ -16,6 +16,7 @@ CPPUNIT_TEST(test_base64); CPPUNIT_TEST(test_trim); CPPUNIT_TEST(test_strtok); + CPPUNIT_TEST(test_startsendswith); CPPUNIT_TEST_SUITE_END(); public: @@ -28,6 +29,7 @@ void test_base64(); void test_trim(); void test_strtok(); + void test_startsendswith(); }; CPPUNIT_TEST_SUITE_REGISTRATION(string_test); @@ -161,3 +163,26 @@ CPPUNIT_ASSERT_EQUAL(std::string("b"), tokens[1]); CPPUNIT_ASSERT_EQUAL(std::string("c"), tokens[2]); } + +void string_test::test_startsendswith() +{ + CPPUNIT_ASSERT_EQUAL(false, fz::starts_with(std::string("hello"), std::string("world"))); + CPPUNIT_ASSERT_EQUAL(true, fz::starts_with(std::string("hello"), std::string("hell"))); + CPPUNIT_ASSERT_EQUAL(false, fz::starts_with(std::string("hell"), std::string("hello"))); + CPPUNIT_ASSERT_EQUAL(false, fz::starts_with(std::string("hello"), std::string("HELL"))); + + CPPUNIT_ASSERT_EQUAL(false, fz::starts_with<true>(std::string("hello"), std::string("world"))); + CPPUNIT_ASSERT_EQUAL(true, fz::starts_with<true>(std::string("hello"), std::string("hell"))); + CPPUNIT_ASSERT_EQUAL(false, fz::starts_with<true>(std::string("hell"), std::string("hello"))); + CPPUNIT_ASSERT_EQUAL(true, fz::starts_with<true>(std::string("hello"), std::string("HELL"))); + + CPPUNIT_ASSERT_EQUAL(false, fz::ends_with(std::string("hello"), std::string("world"))); + CPPUNIT_ASSERT_EQUAL(true, fz::ends_with(std::string("hello"), std::string("ello"))); + CPPUNIT_ASSERT_EQUAL(false, fz::ends_with(std::string("ello"), std::string("HELLO"))); + CPPUNIT_ASSERT_EQUAL(false, fz::ends_with(std::string("hello"), std::string("ELLO"))); + + CPPUNIT_ASSERT_EQUAL(false, fz::ends_with<true>(std::string("hello"), std::string("world"))); + CPPUNIT_ASSERT_EQUAL(true, fz::ends_with<true>(std::string("hello"), std::string("ello"))); + CPPUNIT_ASSERT_EQUAL(false, fz::ends_with<true>(std::string("ello"), std::string("HELLO"))); + CPPUNIT_ASSERT_EQUAL(true, fz::ends_with<true>(std::string("hello"), std::string("ELLO"))); +}
