32 lines
819 B
C++
32 lines
819 B
C++
#include "s1_two_sum.hpp"
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <vector>
|
|
|
|
TEST(Problem1, Case1) {
|
|
std::vector<int> input1{ 2, 7, 11, 15 };
|
|
int input2{ 9 };
|
|
Solution solution;
|
|
std::vector<int> result = solution.twoSum(input1, input2);
|
|
std::vector<int> answer = std::vector<int>{ 0, 1 };
|
|
EXPECT_EQ(result, answer);
|
|
}
|
|
|
|
TEST(Problem1, Case2) {
|
|
std::vector<int> input1{ 3, 2, 4 };
|
|
int input2{ 6 };
|
|
Solution solution;
|
|
std::vector<int> result = solution.twoSum(input1, input2);
|
|
std::vector<int> answer = std::vector<int>{ 1, 2 };
|
|
EXPECT_EQ(result, answer);
|
|
}
|
|
|
|
TEST(Problem1, Case3) {
|
|
std::vector<int> input1{ 3, 3 };
|
|
int input2{ 6 };
|
|
Solution solution;
|
|
std::vector<int> result = solution.twoSum(input1, input2);
|
|
std::vector<int> answer = std::vector<int>{ 0, 1 };
|
|
EXPECT_EQ(result, answer);
|
|
}
|