From b3481fb38fcadc201a0c8fc0826cc01833d5b41e Mon Sep 17 00:00:00 2001 From: Nicolette Date: Tue, 13 Nov 2018 18:02:18 +0100 Subject: [PATCH 1/2] Solve exercise 01 --- exercise/01/app/app.cpp | Bin 0 -> 1402 bytes exercise/01/app/app.vcxproj | 194 ++++++++++++++++++++++++++++ exercise/01/app/app.vcxproj.filters | 30 +++++ exercise/01/app/pch.cpp | Bin 0 -> 430 bytes exercise/01/app/pch.h | Bin 0 -> 1348 bytes 5 files changed, 224 insertions(+) create mode 100644 exercise/01/app/app.cpp create mode 100644 exercise/01/app/app.vcxproj create mode 100644 exercise/01/app/app.vcxproj.filters create mode 100644 exercise/01/app/pch.cpp create mode 100644 exercise/01/app/pch.h diff --git a/exercise/01/app/app.cpp b/exercise/01/app/app.cpp new file mode 100644 index 0000000000000000000000000000000000000000..847137838d7c4e7a765348e1d6cd6744b52003e8 GIT binary patch literal 1402 zcmbVMO;5r=6rAgt_#bM$w8r4a5%EBR%AqQW=*ff>T9t&aK+zE6UsvYsb}i5rjA{D0 z^XAQ)_qIRZhv;L39tM~rLJS8kCVYQGg{O;s?4bx#;rcV9`sngLVRTo&_5KtW5j((n zX{2NoT?zFJ5$b0TzE<<8uZkMSM9ehCVn@_5q>>m@w0Rvd{*vbzPH~~*gjwN)hofUd z#`no(z6)D~Di2|wYwj9q#JYIkn?*Zm z^~sR&7!^{1c$L>4VZpVK)n@9OxWzphctn6JvKg0~L>U(8uDB7fwvejiD&9`1DBfX@dyOFp~lpMve6qALr|PE6KVvqai;nIzHb z;RrW;O7KLD#<_MH;d9k=JyW7e(N5ZfjHgA`DRYP)R=KT6ZAE*fS^RXRMdmRlsLr|~ zKF6Gl8TIBJIc9dZU_Ms;EqB<=)n-lBWyLw)HqVW + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {843D77A9-6E04-4515-91D5-A010A5CDF8E0} + Win32Proj + app + 10.0.17134.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + Use + Level3 + Disabled + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + ..\lib\$(Platform)\$(Configuration)\static_library.lib;..\dll2\$(Platform)\$(Configuration)\dynamic_library_with_implib.lib + + + copy $(SolutionDir)dll1\$(Platform)\$(Configuration)\dynamic_library.dll $(OutDir) +copy $(SolutionDir)dll2\$(Platform)\$(Configuration)\dynamic_library_with_implib.dll $(OutDir) + + + + + Use + Level3 + Disabled + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + ..\lib\$(Platform)\$(Configuration)\static_library.lib;..\dll2\$(Platform)\$(Configuration)\dynamic_library_with_implib.lib + + + copy $(SolutionDir)dll1\$(Platform)\$(Configuration)\dynamic_library.dll $(OutDir) +copy $(SolutionDir)dll2\$(Platform)\$(Configuration)\dynamic_library_with_implib.dll $(OutDir) + + + + + Use + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + ..\lib\$(Platform)\$(Configuration)\static_library.lib;..\dll2\$(Platform)\$(Configuration)\dynamic_library_with_implib.lib + + + copy $(SolutionDir)dll1\$(Platform)\$(Configuration)\dynamic_library.dll $(OutDir) +copy $(SolutionDir)dll2\$(Platform)\$(Configuration)\dynamic_library_with_implib.dll $(OutDir) + + + + + Use + Level3 + MaxSpeed + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + ..\lib\$(Platform)\$(Configuration)\static_library.lib;..\dll2\$(Platform)\$(Configuration)\dynamic_library_with_implib.lib + + + copy $(SolutionDir)dll1\$(Platform)\$(Configuration)\dynamic_library.dll $(OutDir) +copy $(SolutionDir)dll2\$(Platform)\$(Configuration)\dynamic_library_with_implib.dll $(OutDir) + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/exercise/01/app/app.vcxproj.filters b/exercise/01/app/app.vcxproj.filters new file mode 100644 index 0000000..45e6ae5 --- /dev/null +++ b/exercise/01/app/app.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/exercise/01/app/pch.cpp b/exercise/01/app/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a38f8a37da858b0e7a4a577210e923c883ac97f3 GIT binary patch literal 430 zcma)(OAdlS5JYQj;vFWsRoUwaJO;ubLXfO} ziM!*RK?b#&)PqF4LX~Q_GVq=g$>^{f<-{7@$r|ykmqm|MwtC_%l{t|TJS9Jpalvn} ztpC7C!Dg_+`-h+El+KlNtsDc|GOvyF+iK(A-j!r1ot!0T2mdlziM{46Ghg8k=#H+V zM?tLvNCnoo3Y&aHb%nm~4lL&e!^rD~jrW;l>$n!y*qrYx)>C#m?3Ep3d2Ek}RkW_> zcEIzR9GQ1#xBk8&+tRk4XHBMLC-wuRrK4m=+BrsrW#^G=o>MR?a<5o5+;h)XCo;E}Z?wp9zN2v(HtE zNwY8bh+oB8m>oLlDK!)$Yv`)}tcYp3LYtu?FGp)Rp>9>K_)lQ9o_(yQ@9bvphk6t- zLyT9BaYnwP)unrWB{CFz%g#G0SM8tg@|}a3y(^*bj2QJv*5vAI3Z!%8mVM8kVvpMY zg`@cjW@U1Rh%sA<>_g8n)WWSy^rpwLKLM{@k#kt=PeAQG)C6S{gJ8X;xB1>r^(HLR zd9R*2JB3T*aq|Z{pJLTHNG63Z?sMsDs7;w2O_^fKY{&UL0D0+k6rIIL_Y*K`cGQL1 z^S-x_cEcUJVOMpk@M#-cnZmPxcdzTi!dq8@Gg7QYPCo zpNbW13wveKPN}!SLw}o?oHxDG*3z3>^!l6c0&Ja!n8wweXLzeqmFtoGkJo4W2W4X1 Ax&QzG literal 0 HcmV?d00001 From 6df1a8d6f3ab91361bd27c6176cb28c0986c979c Mon Sep 17 00:00:00 2001 From: Nicolette Date: Tue, 13 Nov 2018 18:03:11 +0100 Subject: [PATCH 2/2] Solve exercise 02 --- exercise/02/code.cpp | 10 ++++++++++ exercise/02/code.h | 4 ++++ exercise/02/stdafx.h | 2 ++ exercise/02/test1.cpp | 6 +++--- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/exercise/02/code.cpp b/exercise/02/code.cpp index 85e778c..51d7e34 100644 --- a/exercise/02/code.cpp +++ b/exercise/02/code.cpp @@ -1,2 +1,12 @@ #include "stdafx.h" #include "code.h" + +void f1(int & a, int & b) +{ + std::swap(a, b); +} + +void f2(int * arr, int * end) +{ + std::transform(arr, end, arr, [](int num) -> int { return ++num; }); +} \ No newline at end of file diff --git a/exercise/02/code.h b/exercise/02/code.h index e69de29..9f1d650 100644 --- a/exercise/02/code.h +++ b/exercise/02/code.h @@ -0,0 +1,4 @@ +#pragma once + +void f1(int& a, int& b); +void f2(int* arr, int* end); \ No newline at end of file diff --git a/exercise/02/stdafx.h b/exercise/02/stdafx.h index 6027cdf..2c3b418 100644 --- a/exercise/02/stdafx.h +++ b/exercise/02/stdafx.h @@ -2,3 +2,5 @@ #include #include "CppUnitTest.h" +#include +#include \ No newline at end of file diff --git a/exercise/02/test1.cpp b/exercise/02/test1.cpp index 33dfab7..29b52ae 100644 --- a/exercise/02/test1.cpp +++ b/exercise/02/test1.cpp @@ -14,14 +14,14 @@ namespace simple_test TEST_METHOD(f1_changes_values) { int a=1, b=2; - //f1(a, b); + f1(a, b); Assert::AreEqual(2, a); Assert::AreEqual(1, b); } TEST_METHOD(f2_increases_all_values_by_one) { int arr[] = { 1, 2, 3 }; - //f2(arr, arr+3); + f2(arr, arr+3); Assert::AreEqual(2, arr[0]); Assert::AreEqual(3, arr[1]); Assert::AreEqual(4, arr[2]); @@ -29,7 +29,7 @@ namespace simple_test TEST_METHOD(f2_works_for_different_number_of_values) { int arr[] = { 2, 4, 6, 8, 10 }; - //f2(arr, arr+5); + f2(arr, arr+5); Assert::AreEqual(3, arr[0]); Assert::AreEqual(5, arr[1]); Assert::AreEqual(7, arr[2]);