-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
34 lines (26 loc) · 1.05 KB
/
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
#include "header/c-echo.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, IndentedString){
char* test_val[4]; test_val[0] = "./c-echo"; test_val[1] = "\t"; test_val[2] = "hello"; test_val[3] = "world";
EXPECT_EQ("\t hello world", echo(4, test_val));
}
TEST(EchoTest, MultiLineString){
char* test_val[4]; test_val[0] = "./c-echo"; test_val[1] = "hello"; test_val[2] = "\n"; test_val[3] = "world";
EXPECT_EQ("hello \n world", echo(4, test_val));
}
TEST(EchoTest, SpecialCharacters){
char* test_val[2]; test_val[0] = "./c-echo"; test_val[1] = "~!@#$%^&*()_+{}`=-/[]<>";
EXPECT_EQ("~!@#$%^&*()_+{}`=-/[]<>", echo(2, test_val));
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}