-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.cpp
More file actions
68 lines (56 loc) · 1.81 KB
/
test.cpp
File metadata and controls
68 lines (56 loc) · 1.81 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "strcat.h"
#include "gtest/gtest.h"
TEST(StringLiteral, Two) {
EXPECT_EQ("foobar", minimal::strcat("foo", "bar"));
}
TEST(StringLiteral, Three) {
EXPECT_EQ("foobarbat", minimal::strcat("foo", "bar", "bat"));
}
TEST(CharPointer, Two) {
const char * const foo{"foo"};
const char * const bar{"bar"};
EXPECT_EQ("foobar", minimal::strcat(foo, bar));
}
TEST(CharPointer, Three) {
const char * const foo{"foo"};
const char * const bar{"bar"};
const char * const bat{"bat"};
EXPECT_EQ("foobarbat", minimal::strcat(foo, bar, bat));
}
TEST(CharPointerLength, Two) {
const char * const foo{"foo"};
const char * const bar{"bar"};
const minimal::StringLike s0{foo, 3};
EXPECT_EQ("foobar", minimal::strcat(s0, minimal::StringLike{bar, 3}));
}
TEST(CharPointerLength, Three) {
const char * const foo{"foo"};
const char * const bar{"bar"};
const char * const bat{"bat"};
const minimal::StringLike s0{foo, 3};
const minimal::StringLike s1{bar, 3};
const minimal::StringLike s2{bat, 3};
EXPECT_EQ("foobarbat", minimal::strcat(s0, s1, s2));
}
TEST(STLString, Two) {
EXPECT_EQ("foobar", minimal::strcat(std::string{"foo"}, std::string{"bar"}));
}
TEST(STLString, Three) {
EXPECT_EQ("foobarbat",
minimal::strcat(std::string{"foo"}, std::string{"bar"}, std::string{"bat"}));
}
TEST(Mix, Permutation1) {
const char * const bar{"bar"};
const std::string bat{"bat"};
EXPECT_EQ("foobarbat", minimal::strcat("foo", bar, bat));
}
TEST(Mix, Permutation2) {
const char * const bar{"bar"};
const std::string bat{"bat"};
EXPECT_EQ("barbatfoo", minimal::strcat(bar, bat, "foo"));
}
TEST(Mix, Permutation3) {
const char * const bar{"bar"};
const std::string bat{"bat"};
EXPECT_EQ("batfoobar", minimal::strcat(bat, "foo", bar));
}