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