You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
801 B
35 lines
801 B
#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();
|
|
}
|