William A. Kennington III | 4ef36e7 | 2019-06-27 12:48:59 -0700 | [diff] [blame] | 1 | #include <gtest/gtest.h> |
William A. Kennington III | 6047970 | 2022-12-07 02:55:24 -0800 | [diff] [blame^] | 2 | #include <stdplus/str/cat.hpp> |
William A. Kennington III | 4ef36e7 | 2019-06-27 12:48:59 -0700 | [diff] [blame] | 3 | #include <string> |
| 4 | #include <string_view> |
| 5 | |
| 6 | namespace stdplus |
| 7 | { |
William A. Kennington III | 4ef36e7 | 2019-06-27 12:48:59 -0700 | [diff] [blame] | 8 | |
| 9 | using namespace std::string_literals; |
| 10 | using namespace std::string_view_literals; |
| 11 | |
William A. Kennington III | 4ef36e7 | 2019-06-27 12:48:59 -0700 | [diff] [blame] | 12 | TEST(StrCat, NoStr) |
| 13 | { |
| 14 | EXPECT_EQ("", strCat()); |
| 15 | } |
| 16 | |
| 17 | TEST(StrCat, SingleStr) |
| 18 | { |
| 19 | EXPECT_EQ("func", strCat("func")); |
| 20 | } |
| 21 | |
| 22 | TEST(StrCat, Multi) |
| 23 | { |
| 24 | EXPECT_EQ("func world test", strCat("func", " world"sv, " test"s)); |
| 25 | } |
| 26 | |
| 27 | TEST(StrCat, MoveStr) |
| 28 | { |
| 29 | EXPECT_EQ("func", strCat("func"s)); |
| 30 | EXPECT_EQ("func world", strCat("func"s, " world")); |
| 31 | } |
| 32 | |
William A. Kennington III | 4ef36e7 | 2019-06-27 12:48:59 -0700 | [diff] [blame] | 33 | } // namespace stdplus |