hirfgqiurgqi
8 months ago
1 changed files with 35 additions and 0 deletions
@ -0,0 +1,35 @@ |
|||
#include <iostream> |
|||
#include <vector> |
|||
#include <gtest/gtest.h> |
|||
using namespace std; |
|||
vector<int> vecc(vector<int> vec, int n) { |
|||
for (int i = 0; i < vec.size(); i++) { |
|||
vec[i] += n; |
|||
} |
|||
return vec; |
|||
} |
|||
|
|||
|
|||
|
|||
TEST(VecTest, test1) { |
|||
vector<int> input = {1, 2, 3, 4, 5}; |
|||
vector<int> expected = {6, 7, 8, 9, 10}; |
|||
ASSERT_EQ(vecc(input, 5), expected); |
|||
} |
|||
|
|||
TEST(VecTest, test2) { |
|||
vector<int> input = {5, -3, 7, 2, 0}; |
|||
vector<int> expected = {2, -6, 2, -3, -5}; |
|||
ASSERT_EQ(vecc(input, -3), expected); |
|||
} |
|||
|
|||
TEST(VecTest, test3) { |
|||
vector<int> input = {10000, 20000, 30000}; |
|||
vector<int> expected = {20000, 30000, 40000}; |
|||
ASSERT_EQ(vecc(input, 10000), expected); |
|||
} |
|||
|
|||
int main(int argc, char **argv) { |
|||
testing::InitGoogleTest(&argc, argv); |
|||
return RUN_ALL_TESTS(); |
|||
} |
Loading…
Reference in new issue