diff --git a/123.cpp b/123.cpp new file mode 100644 index 0000000..d854559 --- /dev/null +++ b/123.cpp @@ -0,0 +1,35 @@ +#include +#include +#include +using namespace std; +vector vecc(vector vec, int n) { + for (int i = 0; i < vec.size(); i++) { + vec[i] += n; + } + return vec; +} + + + +TEST(VecTest, test1) { + vector input = {1, 2, 3, 4, 5}; + vector expected = {6, 7, 8, 9, 10}; + ASSERT_EQ(vecc(input, 5), expected); +} + +TEST(VecTest, test2) { + vector input = {5, -3, 7, 2, 0}; + vector expected = {2, -6, 2, -3, -5}; + ASSERT_EQ(vecc(input, -3), expected); +} + +TEST(VecTest, test3) { + vector input = {10000, 20000, 30000}; + vector expected = {20000, 30000, 40000}; + ASSERT_EQ(vecc(input, 10000), expected); +} + +int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file