X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Fdali-test-suite-utils.h;h=c6e63e7e47116861c3c9f1664c1e64201590530c;hb=41c8e6862c377913d579544ee6103a6c8aa482d1;hp=b8de978d83bf55ae51ea506231293de72407d08a;hpb=b5fd027f5e549d74c70508d1734b36e9d91042e8;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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..c6e63e7 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 @@ -2,7 +2,7 @@ #define DALI_TEST_SUITE_UTILS_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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 @@ -385,25 +417,25 @@ inline void DALI_TEST_PRINT_ASSERT(DaliException& e) * @param expressions code to execute * @param except the exception expected in the assert */ -#define DALI_TEST_THROWS(expressions, except) \ - try \ - { \ - TestApplication::EnableLogging(false); \ - expressions; \ - TestApplication::EnableLogging(true); \ - fprintf(stderr, "Test failed in %s, expected exception: '%s' didn't occur\n", __FILELINE__, #except); \ - tet_result(TET_FAIL); \ - throw("TET_FAIL"); \ - } \ - catch(except &) \ - { \ - tet_result(TET_PASS); \ - } \ - catch(...) \ - { \ - fprintf(stderr, "Test failed in %s, unexpected exception\n", __FILELINE__); \ - tet_result(TET_FAIL); \ - throw; \ +#define DALI_TEST_THROWS(expressions, except) \ + try \ + { \ + TestApplication::EnableLogging(false); \ + expressions; \ + TestApplication::EnableLogging(true); \ + fprintf(stderr, "Test failed in %s, expected exception: '%s' didn't occur\n", __FILELINE__, #except); \ + tet_result(TET_FAIL); \ + throw("TET_FAIL"); \ + } \ + catch(except&) \ + { \ + tet_result(TET_PASS); \ + } \ + catch(...) \ + { \ + fprintf(stderr, "Test failed in %s, unexpected exception\n", __FILELINE__); \ + tet_result(TET_FAIL); \ + throw; \ } // Functor to test whether an Applied signal is emitted