-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
49 lines (43 loc) · 1.36 KB
/
test.cpp
File metadata and controls
49 lines (43 loc) · 1.36 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
#include "c-echo.h"
#include "c-count.h"
#include "gtest/gtest.h"
TEST(EchoTest, HelloWorld) {
char* test_val[3]; test_val[0] = "./c-echo"; test_val[1] = "hello"; test_val[2] = "world";
EXPECT_EQ("hello world", echo(3,test_val));
}
TEST(EchoTest, EmptyString) {
char* test_val[1]; test_val[0] = "./c-echo";
EXPECT_EQ("", echo(1,test_val));
}
TEST(EchoTest, SpecialCharacter) {
char* test_val[2]; test_val[0] = "./c-echo"; test_val[1] = "=-+$6@";
EXPECT_EQ("=-+$6@", echo(2,test_val));
}
TEST(EchoTest, TabCharacter) {
char* test_val[2]; test_val[0] = "./c-echo"; test_val[1] = "\t";
EXPECT_EQ("\t", echo(2,test_val));
}
TEST(EchoTest, EnterCharacter) {
char* test_val[2]; test_val[0] = "./c-echo"; test_val[1] = "\n";
EXPECT_EQ("\n", echo(2,test_val));
}
TEST(EchoTest, SingleSpace) {
char* test_val[2]; test_val[0] = "./c-echo"; test_val[1] = " ";
EXPECT_EQ(" ", echo(2,test_val));
}
TEST(CountTest, HelloWorld) {
std::string test_str = "hello world";
EXPECT_EQ(2, count(test_str));
}
TEST(CountTest, EmptyString) {
std::string test_str = "";
EXPECT_EQ(0, count(test_str));
}
TEST(CountTest, ManySpaces) {
std::string test_str = " this string has weird spacing";
EXPECT_EQ(5, count(test_str));
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}