2022-11-21 12:50:10 +00:00
|
|
|
#include "s0033_search_in_rotated_sorted_array.hpp"
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
TEST(Problem33, Case1) {
|
|
|
|
vector<int> nums{4, 5, 6, 7, 0, 1, 2};
|
|
|
|
int target{0};
|
|
|
|
int o{4};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0033 solution;
|
2022-11-21 12:50:10 +00:00
|
|
|
EXPECT_EQ(solution.search(nums, target), o);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem33, Case2) {
|
|
|
|
vector<int> nums{4, 5, 6, 7, 0, 1, 2};
|
|
|
|
int target{3};
|
|
|
|
int o{-1};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0033 solution;
|
2022-11-21 12:50:10 +00:00
|
|
|
EXPECT_EQ(solution.search(nums, target), o);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem33, Case3) {
|
|
|
|
vector<int> nums{1};
|
|
|
|
int target{0};
|
|
|
|
int o{-1};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0033 solution;
|
2022-11-21 12:50:10 +00:00
|
|
|
EXPECT_EQ(solution.search(nums, target), o);
|
|
|
|
}
|