-
Notifications
You must be signed in to change notification settings - Fork 0
/
split_str_4_test.cpp
52 lines (44 loc) · 1.42 KB
/
split_str_4_test.cpp
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
#include <gtest/gtest.h>
#include "split_str_4_lib.h"
TEST(SplitStr4Test, GetTokensSingleWord) {
string str("hello");
vector<string> tokens = getTokens(str);
vector<string> expected = { "hello" };
EXPECT_TRUE(expected == tokens);
}
TEST(SplitStr4Test, GetTokensSingleWordSpaceBefore) {
string str(" hello");
vector<string> tokens = getTokens(str);
vector<string> expected = { "hello" };
EXPECT_TRUE(expected == tokens);
}
TEST(SplitStr4Test, GetTokensSingleWordSpaceAfter) {
string str("hello ");
vector<string> tokens = getTokens(str);
vector<string> expected = { "hello" };
EXPECT_TRUE(expected == tokens);
}
TEST(SplitStr4Test, GetTokensTwoWords) {
string str("hello world");
vector<string> tokens = getTokens(str);
vector<string> expected = { "hello", "world" };
EXPECT_TRUE(expected == tokens);
}
TEST(SplitStr4Test, GetTokensTwoWordsDoubleSpaceBetween) {
string str("hello world");
vector<string> tokens = getTokens(str);
vector<string> expected = { "hello", "world" };
EXPECT_TRUE(expected == tokens);
}
TEST(SplitStr4Test, GetOutputSingleToken) {
vector<string> tokens = { "hello" };
string output = getOutput(tokens);
string expected("hello\n");
EXPECT_TRUE(expected == output);
}
TEST(SplitStr4Test, GetOutputTwoTokens) {
vector<string> tokens = { "hello", "world" };
string output = getOutput(tokens);
string expected("hello\nworld\n");
EXPECT_TRUE(expected == output);
}