24 lines
554 B
C++
24 lines
554 B
C++
#include "s0704_binary_search.hpp"
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
TEST(Problem704, Case1) {
|
|
vector<int> nums{-1, 0, 3, 5, 9, 12};
|
|
int target{9};
|
|
int o{4};
|
|
Solution1 solution1;
|
|
Solution2 solution2;
|
|
EXPECT_EQ(solution1.binSearch(nums, target), o);
|
|
EXPECT_EQ(solution2.binSearch(nums, target), o);
|
|
}
|
|
|
|
TEST(Problem704, Case2) {
|
|
vector<int> nums{-1, 0, 3, 5, 9, 12};
|
|
int target{2};
|
|
int o{-1};
|
|
Solution1 solution1;
|
|
Solution2 solution2;
|
|
EXPECT_EQ(solution1.binSearch(nums, target), o);
|
|
EXPECT_EQ(solution2.binSearch(nums, target), o);
|
|
}
|