blob: ef958eaecff6aec0398f401af9458964793d2619 [file] [log] [blame]
William A. Kennington III60479702022-12-07 02:55:24 -08001#include <stdplus/str/cat.hpp>
William A. Kennington III178cfda2023-07-24 17:08:14 -07002#include <stdplus/zstring_view.hpp>
Patrick Williamsd1984dd2023-05-10 16:12:44 -05003
William A. Kennington III4ef36e72019-06-27 12:48:59 -07004#include <string>
5#include <string_view>
6
Patrick Williamsd1984dd2023-05-10 16:12:44 -05007#include <gtest/gtest.h>
8
William A. Kennington III4ef36e72019-06-27 12:48:59 -07009namespace stdplus
10{
William A. Kennington III4ef36e72019-06-27 12:48:59 -070011
12using namespace std::string_literals;
13using namespace std::string_view_literals;
14
William A. Kennington III4ef36e72019-06-27 12:48:59 -070015TEST(StrCat, NoStr)
16{
17 EXPECT_EQ("", strCat());
18}
19
20TEST(StrCat, SingleStr)
21{
22 EXPECT_EQ("func", strCat("func"));
23}
24
25TEST(StrCat, Multi)
26{
William A. Kennington III178cfda2023-07-24 17:08:14 -070027 EXPECT_EQ("func world test ff",
28 strCat("func", " world"sv, " test"s, " ff"_zsv));
William A. Kennington III4ef36e72019-06-27 12:48:59 -070029}
30
31TEST(StrCat, MoveStr)
32{
33 EXPECT_EQ("func", strCat("func"s));
34 EXPECT_EQ("func world", strCat("func"s, " world"));
35}
36
William A. Kennington III4ef36e72019-06-27 12:48:59 -070037} // namespace stdplus