From 07c23602741766b95a0c6310563cc3e0eb899a73 Mon Sep 17 00:00:00 2001 From: hirfgqiurgqi Date: Fri, 19 Apr 2024 22:33:38 +0300 Subject: [PATCH] 123 Signed-off-by: hirfgqiurgqi --- 123.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 123.cpp 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