leetcode/tests/s0039_combination_sum.cpp

28 lines
663 B
C++
Raw Normal View History

2022-11-22 13:31:25 +00:00
#include "s0039_combination_sum.hpp"
#include <gtest/gtest.h>
TEST(Problem39, Case1) {
vector<int> candidates{2, 3, 6, 7};
int target{7};
vector<vector<int>> o{{7}, {2, 2, 3}};
2022-11-30 10:20:36 +00:00
S0039 solution;
2022-11-22 13:31:25 +00:00
EXPECT_EQ(solution.combinationSum(candidates, target), o);
}
TEST(Problem39, Case2) {
vector<int> candidates{2, 3, 5};
int target{8};
vector<vector<int>> o{{3, 5}, {2, 3, 3}, {2, 2, 2, 2}};
2022-11-30 10:20:36 +00:00
S0039 solution;
2022-11-22 13:31:25 +00:00
EXPECT_EQ(solution.combinationSum(candidates, target), o);
}
TEST(Problem39, Case3) {
vector<int> candidates{2};
int target{1};
vector<vector<int>> o{};
2022-11-30 10:20:36 +00:00
S0039 solution;
2022-11-22 13:31:25 +00:00
EXPECT_EQ(solution.combinationSum(candidates, target), o);
}