leetcode/tests/s0704_binary_search.cpp
2022-11-30 18:20:36 +08:00

22 lines
498 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};
S0704 solution;
EXPECT_EQ(solution.binSearch1(nums, target), o);
EXPECT_EQ(solution.binSearch2(nums, target), o);
}
TEST(Problem704, Case2) {
vector<int> nums{-1, 0, 3, 5, 9, 12};
int target{2};
int o{-1};
S0704 solution;
EXPECT_EQ(solution.binSearch1(nums, target), o);
EXPECT_EQ(solution.binSearch2(nums, target), o);
}