28 lines
559 B
C++
28 lines
559 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};
|
||
|
Solution solution;
|
||
|
EXPECT_EQ(solution.searchInsert(nums, target), o);
|
||
|
}
|
||
|
|
||
|
TEST(Problem35, Case2) {
|
||
|
vector<int> nums{1, 3, 5, 6};
|
||
|
int target{2};
|
||
|
int o{1};
|
||
|
Solution solution;
|
||
|
EXPECT_EQ(solution.searchInsert(nums, target), o);
|
||
|
}
|
||
|
|
||
|
TEST(Problem35, Case3) {
|
||
|
vector<int> nums{1, 3, 5, 6};
|
||
|
int target{7};
|
||
|
int o{4};
|
||
|
Solution solution;
|
||
|
EXPECT_EQ(solution.searchInsert(nums, target), o);
|
||
|
}
|