Bin search
This commit is contained in:
@@ -6,22 +6,28 @@ TEST(Problem34, Case1) {
|
||||
vector<int> nums{5, 7, 7, 8, 8, 10};
|
||||
int target{8};
|
||||
vector<int> o{3, 4};
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.searchRange(nums, target), o);
|
||||
Solution1 solution1;
|
||||
Solution2 solution2;
|
||||
EXPECT_EQ(solution1.searchRange(nums, target), o);
|
||||
EXPECT_EQ(solution2.searchRange(nums, target), o);
|
||||
}
|
||||
|
||||
TEST(Problem34, Case2) {
|
||||
vector<int> nums{5, 7, 7, 8, 8, 10};
|
||||
int target{6};
|
||||
vector<int> o{-1, -1};
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.searchRange(nums, target), o);
|
||||
Solution1 solution1;
|
||||
Solution2 solution2;
|
||||
EXPECT_EQ(solution1.searchRange(nums, target), o);
|
||||
EXPECT_EQ(solution2.searchRange(nums, target), o);
|
||||
}
|
||||
|
||||
TEST(Problem34, Case3) {
|
||||
vector<int> nums{};
|
||||
int target{0};
|
||||
vector<int> o{-1, -1};
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.searchRange(nums, target), o);
|
||||
Solution1 solution1;
|
||||
Solution2 solution2;
|
||||
EXPECT_EQ(solution1.searchRange(nums, target), o);
|
||||
EXPECT_EQ(solution2.searchRange(nums, target), o);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user