leetcode/tests/s0704_binary_search.cpp
2022-11-24 16:44:36 +08:00

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);
}