-
Notifications
You must be signed in to change notification settings - Fork 481
/
Copy path0079-test.cpp
54 lines (45 loc) · 1.09 KB
/
0079-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
53
54
#include <iostream>
#include <gtest/gtest.h>
#include <string>
#include "../src/0079-Word-Search/0079.cpp"
TEST(test, test1)
{
std::vector<std::vector<char>> board = {
{'A', 'B', 'C', 'E'},
{'S', 'F', 'E', 'S'},
{'A', 'D', 'E', 'E'},
};
ASSERT_EQ(true, Solution().exist(board, "ABCEFSADEESE"));
}
TEST(test, test2)
{
std::vector<std::vector<char>> board = {
{'A', 'B', 'C', 'E'},
{'S', 'F', 'C', 'S'},
{'A', 'D', 'E', 'E'},
};
ASSERT_EQ(true, Solution().exist(board, "SEE"));
ASSERT_EQ(false, Solution().exist(board, "ABCD"));
}
TEST(test, test3)
{
std::vector<std::vector<char>> board = {
{'a'},
{'a'},
};
ASSERT_EQ(false, Solution().exist(board, "aaa"));
}
TEST(test, test4)
{
std::vector<std::vector<char>> board = {
{'A', 'B', 'H', 'I'},
{'K', 'E', 'H', 'S'},
{'A', 'D', 'E', 'E'},
};
ASSERT_EQ(true, Solution().exist(board, "ABHISHEK"));
}
GTEST_API_ int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}