leetcode/tests/s0704_binary_search.cpp

22 lines
498 B
C++
Raw Normal View History

2022-11-24 08:44:36 +00:00
#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};
2022-11-30 10:20:36 +00:00
S0704 solution;
EXPECT_EQ(solution.binSearch1(nums, target), o);
EXPECT_EQ(solution.binSearch2(nums, target), o);
2022-11-24 08:44:36 +00:00
}
TEST(Problem704, Case2) {
vector<int> nums{-1, 0, 3, 5, 9, 12};
int target{2};
int o{-1};
2022-11-30 10:20:36 +00:00
S0704 solution;
EXPECT_EQ(solution.binSearch1(nums, target), o);
EXPECT_EQ(solution.binSearch2(nums, target), o);
2022-11-24 08:44:36 +00:00
}