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