20 lines
467 B
C++
20 lines
467 B
C++
#include "s0018_4sum.hpp"
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
TEST(Problem18, Case1) {
|
|
vector<int> nums{1, 0, -1, 0, -2, 2};
|
|
int target{0};
|
|
vector<vector<int>> sum{{-2, -1, 1, 2}, {-2, 0, 0, 2}, {-1, 0, 0, 1}};
|
|
S0018 solution;
|
|
EXPECT_EQ(solution.fourSum(nums, target), sum);
|
|
}
|
|
|
|
TEST(Problem18, Case2) {
|
|
vector<int> nums{2, 2, 2, 2, 2};
|
|
int target{8};
|
|
vector<vector<int>> sum{{2, 2, 2, 2}};
|
|
S0018 solution;
|
|
EXPECT_EQ(solution.fourSum(nums, target), sum);
|
|
}
|