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

31 lines
715 B
C++

#include "s0035_search_insert_position.hpp"
#include <gtest/gtest.h>
TEST(Problem35, Case1) {
vector<int> nums{1, 3, 5, 6};
int target{5};
int o{2};
S0035 solution;
EXPECT_EQ(solution.searchInsert1(nums, target), o);
EXPECT_EQ(solution.searchInsert2(nums, target), o);
}
TEST(Problem35, Case2) {
vector<int> nums{1, 3, 5, 6};
int target{2};
int o{1};
S0035 solution;
EXPECT_EQ(solution.searchInsert1(nums, target), o);
EXPECT_EQ(solution.searchInsert2(nums, target), o);
}
TEST(Problem35, Case3) {
vector<int> nums{1, 3, 5, 6};
int target{7};
int o{4};
S0035 solution;
EXPECT_EQ(solution.searchInsert1(nums, target), o);
EXPECT_EQ(solution.searchInsert2(nums, target), o);
}