-
Notifications
You must be signed in to change notification settings - Fork 481
/
Copy path0014-test.cpp
46 lines (39 loc) · 996 Bytes
/
0014-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
#include <iostream>
#include <gtest/gtest.h>
#include <string>
#include "../src/0014-Longest-Common-Prefix/0014.cpp"
TEST(test, test1)
{
std::vector<std::string> strs = {"a", "b"};
ASSERT_EQ("", Solution().longestCommonPrefix(strs));
}
TEST(test, test2)
{
std::vector<std::string> strs = {"leetcode", "lead"};
ASSERT_EQ("le", Solution().longestCommonPrefix(strs));
}
TEST(test, test3)
{
std::vector<std::string> strs = {"flower", "flow", "flight"};
ASSERT_EQ("fl", Solution().longestCommonPrefix(strs));
}
TEST(test, test4)
{
std::vector<std::string> strs = {};
ASSERT_EQ("", Solution().longestCommonPrefix(strs));
}
TEST(test, test5)
{
std::vector<std::string> strs = {"a"};
ASSERT_EQ("a", Solution().longestCommonPrefix(strs));
}
TEST(test, test6)
{
std::vector<std::string> strs = {"c", "c"};
ASSERT_EQ("c", Solution().longestCommonPrefix(strs));
}
GTEST_API_ int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}