-
Notifications
You must be signed in to change notification settings - Fork 481
/
Copy path0033-test.cpp
114 lines (100 loc) · 2.32 KB
/
0033-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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include <iostream>
#include <gtest/gtest.h>
#include <string>
#include "../src/0033-Search-in-Rotated-Sorted-Array/0033.cpp"
TEST(test, test1)
{
vector<int> nums = {4, 5, 6, 7, 0, 1, 2};
int expected = 3;
int target = 7;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test2)
{
vector<int> nums = {4, 5, 6, 7, 0, 1, 2};
int expected = 4;
int target = 0;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test3)
{
vector<int> nums = {4, 5, 6, 7, 0, 1, 2};
int expected = 1;
int target = 5;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test4)
{
vector<int> nums = {4, 5, 6, 7, 0, 1, 2};
int expected = -1;
int target = 3;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test5)
{
vector<int> nums = {1};
int expected = -1;
int target = 0;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test6)
{
vector<int> nums = {1, 3, 5};
int expected = -1;
int target = 4;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test7)
{
vector<int> nums = {1, 3, 5};
int expected = -1;
int target = 6;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test8)
{
vector<int> nums = {1, 3, 5};
int expected = -1;
int target = 2;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test9)
{
vector<int> nums = {5, 1, 3};
int expected = -1;
int target = 4;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test10)
{
vector<int> nums = {1, 2, 3, 4, 5, 6};
int expected = 3;
int target = 4;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test11)
{
vector<int> nums = {5, 1, 2, 3, 4};
int expected = 1;
int target = 1;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test12)
{
vector<int> nums = {8, 9, 2, 3, 4};
int expected = 1;
int target = 9;
ASSERT_EQ(expected, Solution().search(nums, target));
}
TEST(test, test13)
{
vector<int> nums = {4, 5, 6, 7, 8, 1, 2, 3};
int expected = 4;
int target = 8;
ASSERT_EQ(expected, Solution().search(nums, target));
}
GTEST_API_ int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}