leetcode/tests/s0035_search_insert_position.cpp

31 lines
715 B
C++
Raw Normal View History

2022-11-21 13:32:04 +00:00
#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};
2022-11-30 10:20:36 +00:00
S0035 solution;
EXPECT_EQ(solution.searchInsert1(nums, target), o);
EXPECT_EQ(solution.searchInsert2(nums, target), o);
2022-11-21 13:32:04 +00:00
}
TEST(Problem35, Case2) {
vector<int> nums{1, 3, 5, 6};
int target{2};
int o{1};
2022-11-30 10:20:36 +00:00
S0035 solution;
EXPECT_EQ(solution.searchInsert1(nums, target), o);
EXPECT_EQ(solution.searchInsert2(nums, target), o);
2022-11-21 13:32:04 +00:00
}
TEST(Problem35, Case3) {
vector<int> nums{1, 3, 5, 6};
int target{7};
int o{4};
2022-11-30 10:20:36 +00:00
S0035 solution;
EXPECT_EQ(solution.searchInsert1(nums, target), o);
EXPECT_EQ(solution.searchInsert2(nums, target), o);
2022-11-21 13:32:04 +00:00
}