summaryrefslogtreecommitdiffstats
path: root/test/util/string.cpp
blob: 8ab4e811987268e500906aa11f8fa2b27264f5b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <gtest/gtest.h>
#include <stdplus/util/string.hpp>
#include <string>
#include <string_view>

namespace stdplus
{
namespace util
{
namespace
{

using namespace std::string_literals;
using namespace std::string_view_literals;

TEST(StrCat, NoStr)
{
    EXPECT_EQ("", strCat());
}

TEST(StrCat, SingleStr)
{
    EXPECT_EQ("func", strCat("func"));
}

TEST(StrCat, Multi)
{
    EXPECT_EQ("func world test", strCat("func", " world"sv, " test"s));
}

TEST(StrCat, MoveStr)
{
    EXPECT_EQ("func", strCat("func"s));
    EXPECT_EQ("func world", strCat("func"s, " world"));
}

} // namespace
} // namespace util
} // namespace stdplus
OpenPOWER on IntegriCloud