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

34 lines
799 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};
Solution1 solution1;
Solution2 solution2;
EXPECT_EQ(solution1.searchInsert(nums, target), o);
EXPECT_EQ(solution2.searchInsert(nums, target), o);
}
TEST(Problem35, Case2) {
vector<int> nums{1, 3, 5, 6};
int target{2};
int o{1};
Solution1 solution1;
Solution2 solution2;
EXPECT_EQ(solution1.searchInsert(nums, target), o);
EXPECT_EQ(solution2.searchInsert(nums, target), o);
}
TEST(Problem35, Case3) {
vector<int> nums{1, 3, 5, 6};
int target{7};
int o{4};
Solution1 solution1;
Solution2 solution2;
EXPECT_EQ(solution1.searchInsert(nums, target), o);
EXPECT_EQ(solution2.searchInsert(nums, target), o);
}