From: Subhransu Mohanty Date: Thu, 3 Dec 2020 07:49:41 +0000 (+0900) Subject: support string_view in DALI_TEST_EQUALS X-Git-Tag: dali_2.0.4~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=6b38c6c213808ada74270118045e7e23d8b4910d support string_view in DALI_TEST_EQUALS Change-Id: Ie7ba0149c936bd02b50253c136642ac7fe9f2728 --- diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h index b8de978..a4b45c9 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h @@ -306,6 +306,38 @@ void DALI_TEST_EQUALS(const std::string& str1, const char* str2, const char* loc void DALI_TEST_EQUALS(const char* str1, const std::string& str2, const char* location); /** + * Test whether two strings are equal. + * @param[in] str1 The first string + * @param[in] str2 The second string + * @param[in] location The TEST_LOCATION macro should be used here + */ +template<> +inline void DALI_TEST_EQUALS(std::string_view str1, std::string_view str2, const char* location) +{ + DALI_TEST_EQUALS(str1.data(), str2.data(), location); +} + +inline void DALI_TEST_EQUALS(std::string_view str1, const char* str2, const char* location) +{ + DALI_TEST_EQUALS(str1.data(), str2, location); +} + +inline void DALI_TEST_EQUALS(std::string_view str1, const std::string& str2, const char* location) +{ + DALI_TEST_EQUALS(str1.data(), str2.c_str(), location); +} + +inline void DALI_TEST_EQUALS(const std::string& str2, std::string_view str1, const char* location) +{ + DALI_TEST_EQUALS(str2.c_str(), str1.data(), location); +} + +inline void DALI_TEST_EQUALS(const char* str1, std::string_view str2, const char* location) +{ + DALI_TEST_EQUALS(str1, str2.data(), location); +} + +/** * Test if a property value type is equal to a trivial type. */ template