From a59eccb8c68ec45246d6c1af2a7b7f733093021d Mon Sep 17 00:00:00 2001 From: zeira42 Date: Tue, 12 Nov 2024 13:51:13 +0000 Subject: [PATCH 1/8] added myself to members_info, updated journal.md --- Members_info/jmoreira.jpeg | Bin 0 -> 12606 bytes Members_info/jmoreira.md | 12 ++++++++++++ Modules/Module00/JOURNAL.md | 7 +++++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100755 Members_info/jmoreira.jpeg create mode 100644 Members_info/jmoreira.md diff --git a/Members_info/jmoreira.jpeg b/Members_info/jmoreira.jpeg new file mode 100755 index 0000000000000000000000000000000000000000..21aebc2fc2576ed491d01ec41b022a49488cf865 GIT binary patch literal 12606 zcmbWdbx@o?81K7Cad#{36n8JBc!46tVR2jB9g25xC{Vn(6}HIY?oy;^afjlIFR;Mr z@7y!z&fLH5Io~8RnaPv9&nL;7ck(7Le_l2L1geTEiU1@eBtXT#0C?E~Fe>;t*a86R z>Htmv0D$qYj0k}8FNgFm{7=2C0OSG4NJ#(1|0R@HDE|o!6&2+bIvP6qe+dH<8xsQq z3j-Y;3l|Fu8|R_D9HbueT9np&pP;DIRKUL z6%hl!92&8f1v;ZUiNNQSLJX#Nb-kq8zhTURmLB1lSY+fBlvFINZ0sDILc$`VV&W3= z?-dl4lvPx9bU*3o8yFf{S=-p!**iFTdU^Z!`uPV$L`Fr&#C`#%rhQG%$o!U-T~u6B zT2@|BSykWA2yJR^X>IH49~c}O9vK~*nVp+oSp2iJytTcvySIPv_weZA^6L8L_6~mk z@E;cv0OkL|`rl;#A1=awT*&{%02Tc|E+k~%e+h*U^%Vm@8j+k9x`jJ2qrhhjl6NVE zb-kEOg4!@rOOM}JWXwWaEEoTw{ZF$0e_-MNS7iSi?EmFj2H>C|{TnKlKhfPS+j1GGxt|TDzXW zrXv+l`ZjE#sjMh1Tf;iAq-PKaX8g@NZ1J%zp5p{u`Ep;HZ*z#$nHcwJ^j!uACCvMvE=09DM@{oWieBhFBN}V zmG7q{GcT}?9=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*pPg5p8BGUZjzkim*n^@oCkNs7lC;fL}27KHz-TynXP?eMO zNwQOA$dYrRazal--2q}PGd!?7+2H<-F?v+AQ{4>vw4lVcXC&mX! z|AaB)quVQF*s*;I2~H1PsprfaU&l0p$ZvEAiKw!qn>pr-V^kTKY_9@u3e@!P+|~RLqW> zf`AqOkstDIMtdsGMGBOokDX|M8V)7BKZ(2R_igTM_9!?4ZW3O#R9soS2xVQIB7PIR zT-x+G(Jb0DhBf-vO0N~yp`SP5sitPO-cGKQ=W@%(3$aeP~GmPw|(T z! z`lN)*%bbKR2s{Q*Gu>F=+617 z86+d@q(dL(v`oC1?@NzBap2uJt_=;M-{A0H?rC9Yo~IwB;)HDZESHVZeRUK_+wEwq zoHbc565_j&LKvGmZOC)BI!(joEag&M*))alHHJD>)fIV(9r#R)E$wgjMLy!`H>iRf|H`9h)dTTAH4Eq{Te&X zmrW?N_lMZuH!v3}U!iBv0G1xFwTx8x9V)qA0Lr;i*+#TGwIKCEhYN?MODR1uJPWx< zB!LS4Kb+TPe~wY6KG}S9Bb3kAAfYYz=XsUd*Fmmv9Z_KX@OPze(f5-A-{X1Cpe|$F z1$O$Q_&oqOz%VPAV=$AwR>x{!&V3QGBFH_gi;aGQ_rvizQ~x5wxGk5wg1 z!3&d~`8P4&CGu1+e0G)CDVXxJioi2Dck=0ktA5E20iH+1r^-7jE-bbb7_spiF&bRh zxAt>3op3EsrAgApv4={~N{pSQ{xvd~%cyOrzpSw};ZgDUOT`krh}3y|%BbNJTVBaZ dlLCnrF#STUN%DCuX*ak`xqC^!TJ~k>e*hsD-Y) Date: Tue, 12 Nov 2024 16:08:16 +0000 Subject: [PATCH 2/8] journal update --- Modules/Module00/JOURNAL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/Module00/JOURNAL.md b/Modules/Module00/JOURNAL.md index d3caff8..9440514 100644 --- a/Modules/Module00/JOURNAL.md +++ b/Modules/Module00/JOURNAL.md @@ -7,6 +7,7 @@ - Learning how to manage git pull request and git branch rules - Experimenting with GitHub Actions - Linked Project Issues with pull request to be close on approval +- Research GitHub Labeling good practices ### ex02 - Github action with GTest - Using CMake for the first time @@ -16,3 +17,4 @@ - Github action for compile check ### Thoughts - Realizing one advantage of submodules: since filesystem changed in main branch, I will have to take extra steps to ensure the GitHub Action I setup will function +- There might be a need for new GitHub Label for Issues that are tasks From 54771e86833ff9e4468125b4ee60dc8b7863880c Mon Sep 17 00:00:00 2001 From: zeira42 Date: Thu, 14 Nov 2024 20:13:32 +0000 Subject: [PATCH 3/8] commit before merging main. explore more methods of testing, updated ex03 with try and catch blocks, error handling. testing commit to close issue: closes #9 --- .../{ex02_test.yml => m00ex02_test.yml} | 2 +- ...ex03_compilecheck.yml => m00ex03_test.yml} | 13 +- .vscode/settings.json | 50 ++++++ Modules/Module00/JOURNAL.md | 20 ++- Modules/Module00/ex03/CMakeLists.txt | 8 +- Modules/Module00/ex03/inc/Contact.hpp | 35 +++-- Modules/Module00/ex03/inc/Phonebook.hpp | 19 ++- Modules/Module00/ex03/src/Phonebook.cpp | 147 ++++++++++-------- Modules/Module00/ex03/src/main.cpp | 52 ++++--- Modules/Module00/ex03/test/CMakeLists.txt | 33 ++++ Modules/Module00/ex03/test/test_ex03.cpp | 42 +++++ 11 files changed, 307 insertions(+), 114 deletions(-) rename .github/workflows/{ex02_test.yml => m00ex02_test.yml} (94%) rename .github/workflows/{ex03_compilecheck.yml => m00ex03_test.yml} (70%) create mode 100644 .vscode/settings.json create mode 100644 Modules/Module00/ex03/test/CMakeLists.txt create mode 100644 Modules/Module00/ex03/test/test_ex03.cpp diff --git a/.github/workflows/ex02_test.yml b/.github/workflows/m00ex02_test.yml similarity index 94% rename from .github/workflows/ex02_test.yml rename to .github/workflows/m00ex02_test.yml index 8fcaf26..878d9a1 100644 --- a/.github/workflows/ex02_test.yml +++ b/.github/workflows/m00ex02_test.yml @@ -1,4 +1,4 @@ -name: C++ CI with GoogleTest +name: m00ex02 on: push: diff --git a/.github/workflows/ex03_compilecheck.yml b/.github/workflows/m00ex03_test.yml similarity index 70% rename from .github/workflows/ex03_compilecheck.yml rename to .github/workflows/m00ex03_test.yml index 5220520..92d0557 100644 --- a/.github/workflows/ex03_compilecheck.yml +++ b/.github/workflows/m00ex03_test.yml @@ -1,4 +1,5 @@ -name: C++ Compilation Check +# Missing tests (check JOURNAL.md) +name: m00ex03 on: push: @@ -23,8 +24,8 @@ jobs: # Compile the code - name: Compile run: | - cd Modules/Module00/ex03 - mkdir build - cd build - cmake .. - make + cd Modules/Module00/ex03 + mkdir build + cd build + cmake .. + make diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..eed699b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,50 @@ +{ + "files.associations": { + "*.tcc": "cpp", + "ostream": "cpp", + "iostream": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "concepts": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "initializer_list": "cpp", + "iosfwd": "cpp", + "istream": "cpp", + "limits": "cpp", + "new": "cpp", + "numbers": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "typeinfo": "cpp" + } +} diff --git a/Modules/Module00/JOURNAL.md b/Modules/Module00/JOURNAL.md index 9440514..a9628f0 100644 --- a/Modules/Module00/JOURNAL.md +++ b/Modules/Module00/JOURNAL.md @@ -1,6 +1,8 @@ # JOURNAL (jmoreira) ## Module00 +- Learning .md and installing Markdown extension - Learning about qt and installing it +- Learning how to make proper tests ### GitHub - Research about mono repos and git submodules - Setting up github projects and team @@ -8,6 +10,7 @@ - Experimenting with GitHub Actions - Linked Project Issues with pull request to be close on approval - Research GitHub Labeling good practices +- Link Action to Issue ### ex02 - Github action with GTest - Using CMake for the first time @@ -15,6 +18,21 @@ ### ex03 - Remembering C++ classes - Github action for compile check +- Replacing \n with std::endl, avoiding buffer not to flush. std::flush after \n is also an option +- Creating try and catch blocks to do a better job error handling and also makes life easier when using GTest ### Thoughts - Realizing one advantage of submodules: since filesystem changed in main branch, I will have to take extra steps to ensure the GitHub Action I setup will function -- There might be a need for new GitHub Label for Issues that are tasks +- There might be a need for new GitHub Label for Issues that are tasks and research +- Need to free myself from old 42 rules like using C++98 only +### Todo +- Module01 +- Gherkin and Cucumber research and implementation +- Working with Qt +### Difficulties +- When I started coding ex03 I did not manage exceptions the right way and the way the methods are built (very dependent on user input), isn't the best for testing, but still possible with mock user inputs. Think about testing before coding will be a priority from now on. +- Tried creating a friend class for testing in ex03 but still couldn't access private stuff. Will move on to m01 without implementing the test because of the time I've already spent on this. + + + + + diff --git a/Modules/Module00/ex03/CMakeLists.txt b/Modules/Module00/ex03/CMakeLists.txt index 7ca35ba..be9d2b7 100644 --- a/Modules/Module00/ex03/CMakeLists.txt +++ b/Modules/Module00/ex03/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.10) # Project name and version -project(convert VERSION 1.0) +project(phonebook VERSION 1.0) # Specify the C++ standard set(CMAKE_CXX_STANDARD 11) @@ -15,3 +15,9 @@ file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp) # Add the executable add_executable(phonebook ${SOURCES}) + +# # Enable testing +# enable_testing() + +# # Include test directory +# add_subdirectory(test) diff --git a/Modules/Module00/ex03/inc/Contact.hpp b/Modules/Module00/ex03/inc/Contact.hpp index 9ce810d..4912ded 100644 --- a/Modules/Module00/ex03/inc/Contact.hpp +++ b/Modules/Module00/ex03/inc/Contact.hpp @@ -5,24 +5,25 @@ using std::string; -class Contact { - public: - Contact(); - ~Contact(); - void setName(const string& name); - void setNumber(const string& number); - void setNickname(const string& nickname); - void setBookmarked(bool bookmarked); - string getName() const; - string getNumber() const; - string getNickname() const; - bool getBookmarked() const; +class Contact +{ +public: + Contact(); + ~Contact(); + void setName(const string& name); + void setNumber(const string& number); + void setNickname(const string& nickname); + void setBookmarked(bool bookmarked); + string getName() const; + string getNumber() const; + string getNickname() const; + bool getBookmarked() const; - private: - string _name; - string _number; - string _nickname; - bool _bookmarked; +private: + string _name; + string _number; + string _nickname; + bool _bookmarked; }; #endif diff --git a/Modules/Module00/ex03/inc/Phonebook.hpp b/Modules/Module00/ex03/inc/Phonebook.hpp index 130f6ed..a1ce8a0 100644 --- a/Modules/Module00/ex03/inc/Phonebook.hpp +++ b/Modules/Module00/ex03/inc/Phonebook.hpp @@ -10,14 +10,22 @@ using std::cin; using std::cout; +using std::endl; using std::getline; +using std::invalid_argument; using std::isspace; +using std::out_of_range; using std::string; using std::stringstream; using std::vector; +using std::cerr; +using std::flush; + +// class PhonebookTest; class Phonebook { + // friend class PhonebookTest; public: Phonebook(); ~Phonebook(); @@ -34,12 +42,13 @@ class Phonebook void removeContactByIndex(); bool hasContacts() const; void showContact(int &contactIndex); + }; -const string add_prompt(const string& s); -const string ft_trim_ws(string s); -bool ft_isspace(const string& s); -void pause(); -void clearScreen(const string& header = ""); +const string add_prompt(const string& s); +const string ft_trim_ws(string s); +bool ft_isspace(const string& s); +void screenPause(); +void clearScreen(const string& header = ""); #endif diff --git a/Modules/Module00/ex03/src/Phonebook.cpp b/Modules/Module00/ex03/src/Phonebook.cpp index bf2e5a3..57fda30 100644 --- a/Modules/Module00/ex03/src/Phonebook.cpp +++ b/Modules/Module00/ex03/src/Phonebook.cpp @@ -19,7 +19,7 @@ void Phonebook::addContact() { this->_contacts.push_back(newContact); clearScreen("ADD CONTACT"); cout << "Contact successfully added to Phonebook\n"; - pause(); + screenPause(); return; } @@ -27,6 +27,9 @@ void Phonebook::addContact() { * Displays selected contact (from index) information and allows user to bookmark or remove bookmark */ void Phonebook::showContact(int& contactIndex) { + if (!(contactIndex >= 0 && contactIndex < this->_contacts.size())) { + throw out_of_range("Invalid index"); + } clearScreen("SEARCH CONTACT"); cout << "Name: " << this->_contacts[contactIndex].getName() << '\n'; cout << "Number: " << this->_contacts[contactIndex].getNumber() << '\n'; @@ -43,8 +46,6 @@ void Phonebook::showContact(int& contactIndex) { this->_contacts[contactIndex].setBookmarked(false); break; default: - clearScreen("SEARCH CONTACT"); - cout << "Invalid option\n"; break; } } @@ -53,21 +54,24 @@ void Phonebook::showContact(int& contactIndex) { * Displays list of contacts saved in Phonebook and allows user to select a contact to view */ void Phonebook::searchContact() { - int contactIndex; - clearScreen("SEARCH CONTACT"); - if (!this->hasContacts()) { - cout << "No contacts in Phonebook\n"; - pause(); - return; - } - this->printContacts(); - string input = add_prompt("\nEnter the index of the contact you want to view: "); - stringstream ss(input); - ss >> contactIndex; - contactIndex -= 1; - if (contactIndex >= 0 && contactIndex < this->_contacts.size()){ - showContact(contactIndex); + try { + this->hasContacts(); + this->printContacts(); + string input = add_prompt("\nEnter the index of the contact you want to view: "); + stringstream ss(input); + int contactIndex; + ss >> contactIndex; + contactIndex -= 1; + this->showContact(contactIndex); + } catch (out_of_range &e) { + clearScreen("SEARCH CONTACT"); + cerr << e.what() << '\n'; + screenPause(); + } catch (invalid_argument &e) { + clearScreen("SEARCH CONTACT"); + cerr << e.what() << '\n'; + screenPause(); } return; } @@ -80,6 +84,7 @@ void Phonebook::printContacts() const { cout << i + 1 << ". "; cout << this->_contacts[i].getName(); cout << '\n'; + cout.flush(); } } @@ -87,24 +92,27 @@ void Phonebook::printContacts() const { * Option to remove contact by number or from the list */ void Phonebook::removeContact() { - int contactIndex; - clearScreen("REMOVE CONTACT"); - if (!this->hasContacts()) { - cout << "No contacts in Phonebook\n"; - pause(); - return; - } - cout << "1. Contact number\n"; - cout << "2. Show contact list\n"; - string input = add_prompt("\nEnter an option: "); - if (input == "1") { - this->removeContactByNumber(); - } else if (input == "2") { - this->removeContactByIndex(); - } else { + try { + this->hasContacts(); + cout << "1. Contact number\n"; + cout << "2. Show contact list\n"; + string input = add_prompt("\nEnter an option: "); + if (input == "1") { + this->removeContactByNumber(); + } else if (input == "2") { + this->removeContactByIndex(); + } else { + throw invalid_argument("Invalid option"); + } + } catch (invalid_argument &e) { clearScreen("REMOVE CONTACT"); - cout << "Invalid option\n"; + cerr << e.what() << '\n'; + screenPause(); + } catch (out_of_range &e) { + clearScreen("REMOVE CONTACT"); + cerr << e.what() << '\n'; + screenPause(); } return; } @@ -113,10 +121,8 @@ void Phonebook::removeContact() { * Removes all contacts with given number */ void Phonebook::removeContactByNumber() { - string number; - clearScreen("REMOVE CONTACT"); - number = add_prompt("Enter the number of the contact you want to remove: "); + string number = add_prompt("Enter the number of the contact you want to remove: "); int erased = 0; for (size_t i = 0; i < this->_contacts.size(); i++) { if (this->_contacts[i].getNumber() == number) { @@ -128,17 +134,16 @@ void Phonebook::removeContactByNumber() { if (erased == 1) { clearScreen("REMOVE CONTACT"); cout << "Contact successfully removed from Phonebook\n"; - pause(); + screenPause(); return; } else if (erased > 1) { clearScreen("REMOVE CONTACT"); cout << erased << " contacts successfully removed from Phonebook\n"; - pause(); + screenPause(); return; + } else { + throw invalid_argument("No contacts with that number"); } - clearScreen("REMOVE CONTACT"); - cout << "Contact not found\n"; - pause(); return; } @@ -146,23 +151,20 @@ void Phonebook::removeContactByNumber() { * Removes contact from list by index */ void Phonebook::removeContactByIndex() { - int contactIndex; - clearScreen("REMOVE CONTACT"); this->printContacts(); string input = add_prompt("Enter the index of the contact you want to remove: "); stringstream ss(input); + int contactIndex; ss >> contactIndex; contactIndex -= 1; if (contactIndex >= 0 && contactIndex < this->_contacts.size()) { this->_contacts.erase(this->_contacts.begin() + contactIndex); clearScreen("REMOVE CONTACT"); cout << "Contact successfully removed from Phonebook\n"; - pause(); + screenPause(); } else { - clearScreen("REMOVE CONTACT"); - cout << "Invalid index\n"; - pause(); + throw out_of_range("Invalid index"); } return; } @@ -180,12 +182,15 @@ void Phonebook::printBookmarked() const { cout << '\n'; } } - pause(); + screenPause(); return; } bool Phonebook::hasContacts() const { - return this->_contacts.size() > 0; + if (this->_contacts.size() > 0) + return true; + else + throw std::invalid_argument("No contacts in Phonebook"); } /* @@ -195,14 +200,25 @@ bool Phonebook::hasContacts() const { const string add_prompt(const string& s) { string str; - cout << s; - while (str.empty() || ft_isspace(str)) - { + cout << s << flush; + while (true) { getline(cin, str); - if (cin.eof() ||cin.fail()) - exit (1); + if (cin.eof()) { + throw std::runtime_error("Input terminated by user (EOF)."); + } + if (cin.fail()) { + cin.clear(); //clear error flags + cerr << "Invalid input. Please try again.\n"; + continue; + } + str = ft_trim_ws(str); + if (!str.empty() && !ft_isspace(str)) { + break; + } + cerr << "Can't be white spaces!\n"; + cout << s << flush; } - return (ft_trim_ws(str)); + return (str); } /* @@ -219,8 +235,7 @@ const string ft_trim_ws(string s) bool ft_isspace(const string& s) { - for(int i = 0; i < static_cast(s.length()); i++) - { + for(int i = 0; i < static_cast(s.length()); i++) { if(!isspace(s[i])) return false; } @@ -242,10 +257,20 @@ void clearScreen(const string& header) { /* * Pauses program until user presses ENTER */ -void pause(){ - cout << "\nPress ENTER to continue..."; - while(1) { - if (cin.get() == '\n') +void screenPause() { + cout << "\nPress ENTER to continue..." << flush; + + while (true) { + int ch = cin.get(); + + if (ch == '\n') { break; + } else if (cin.eof()) { + throw std::runtime_error("EOF encountered while waiting for ENTER."); + } else if (cin.fail()) { + cerr << "Input error detected. Clearing input stream...\n"; + cin.clear(); + cout << "\nPress ENTER to continue..." << flush; + } } } diff --git a/Modules/Module00/ex03/src/main.cpp b/Modules/Module00/ex03/src/main.cpp index 106e503..ddaca4f 100644 --- a/Modules/Module00/ex03/src/main.cpp +++ b/Modules/Module00/ex03/src/main.cpp @@ -1,29 +1,37 @@ #include "ex03.hpp" int main(int ac, char** av){ - Phonebook phonebook; - string cmd; + try { + Phonebook phonebook; + string cmd; - while (cmd != "EXIT" && !cin.eof() && !cin.fail()){ - clearScreen("PHONEBOOK"); - cout << "ADD\n"; - cout << "SEARCH\n"; - cout << "REMOVE\n"; - cout << "BOOKMARK\n"; - cout << "EXIT\n"; - cout << '\n'; - cout << "Enter a command: "; - getline(cin, cmd); - if (cmd == "ADD") - phonebook.addContact(); - else if (cmd == "SEARCH") - phonebook.searchContact(); - else if (cmd == "REMOVE") - phonebook.removeContact(); - else if (cmd == "BOOKMARK") - phonebook.printBookmarked(); - else if (cmd != "EXIT") - cout << "Invalid command\n"; + while (cmd != "EXIT" && !cin.eof() && !cin.fail()){ + clearScreen("PHONEBOOK"); + cout << "ADD\n"; + cout << "SEARCH\n"; + cout << "REMOVE\n"; + cout << "BOOKMARK\n"; + cout << "EXIT\n"; + cout << '\n'; + cout << "Enter a command: "; + cout.flush(); + getline(cin, cmd); + if (cmd == "ADD") + phonebook.addContact(); + else if (cmd == "SEARCH") + phonebook.searchContact(); + else if (cmd == "REMOVE") + phonebook.removeContact(); + else if (cmd == "BOOKMARK") + phonebook.printBookmarked(); + } + } catch (std::runtime_error &e) { + cerr << e.what() << '\n'; + return (1); + } catch (std::exception &e) { + cerr << e.what() << '\n'; + } catch (...) { + cerr << "An unknown error occurred\n"; } return (0); } diff --git a/Modules/Module00/ex03/test/CMakeLists.txt b/Modules/Module00/ex03/test/CMakeLists.txt new file mode 100644 index 0000000..e91c9ba --- /dev/null +++ b/Modules/Module00/ex03/test/CMakeLists.txt @@ -0,0 +1,33 @@ +# Specify the GoogleTest version and repository +include(ExternalProject) +ExternalProject_Add(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.12.1 + PREFIX "${CMAKE_BINARY_DIR}/googletest" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/googletest-install +) + +# Add the executable for the test +add_executable(test_ex03 + ${CMAKE_CURRENT_SOURCE_DIR}/test_ex03.cpp # Correct path to test_ex03.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/Phonebook.cpp # Correct path to ex03.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/Contact.cpp # Correct path to Contact.cpp +) + +# Include GoogleTest headers +target_include_directories(test_ex03 PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../inc + ${CMAKE_BINARY_DIR}/googletest-install/include +) + +# Link GoogleTest libraries +target_link_libraries(test_ex03 + ${CMAKE_BINARY_DIR}/googletest-install/lib/libgtest.a + ${CMAKE_BINARY_DIR}/googletest-install/lib/libgtest_main.a +) + +# Add dependencies to ensure Googletest is built before tests +add_dependencies(test_ex03 googletest) + +# Register the test with CTest +add_test(NAME test_ex03 COMMAND test_ex03) diff --git a/Modules/Module00/ex03/test/test_ex03.cpp b/Modules/Module00/ex03/test/test_ex03.cpp new file mode 100644 index 0000000..bed04a2 --- /dev/null +++ b/Modules/Module00/ex03/test/test_ex03.cpp @@ -0,0 +1,42 @@ +#include "Phonebook.hpp" +#include "Contact.hpp" +#include "gtest/gtest.h" + +class MockContact : public Contact { +public: + MockContact(const std::string &name, const std::string &number, const std::string &nickname, bool bookmarked) { + setName(name); + setNumber(number); + setNickname(nickname); + setBookmarked(bookmarked); + } +}; + +class PhonebookTest : public ::testing::Test { +protected: + Phonebook phonebook; + + void SetUp() override { + phonebook._contacts.push_back(MockContact("Alice", "12345", "Ally", false)); + phonebook._contacts.push_back(MockContact("Bob", "67890", "Bobby", true)); + } +}; + +TEST_F(PhonebookTest, AddContact) { + size_t initialSize = phonebook._contacts.size(); + phonebook._contacts.push_back(MockContact("Charlie", "112233", "Chuck", false)); + EXPECT_EQ(phonebook._contacts.size(), initialSize + 1); + EXPECT_EQ(phonebook._contacts.back().getName(), "Charlie"); +} + +TEST_F(PhonebookTest, RemoveContactByIndex) { + size_t initialSize = phonebook._contacts.size(); + ASSERT_NO_THROW(phonebook._contacts.erase(phonebook._contacts.begin() + 1)); // Remove Bob + EXPECT_EQ(phonebook._contacts.size(), initialSize - 1); + EXPECT_EQ(phonebook._contacts[0].getName(), "Alice"); +} + +TEST_F(PhonebookTest, EmptyPhonebookThrows) { + Phonebook emptyPhonebook; + EXPECT_THROW(emptyPhonebook.hasContacts(), std::invalid_argument); +} From df5a8af712377e3edb2656927b8f0d12236872ec Mon Sep 17 00:00:00 2001 From: zeira42 Date: Thu, 14 Nov 2024 20:16:10 +0000 Subject: [PATCH 4/8] updating journal.md --- Modules/Module00/JOURNAL.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Modules/Module00/JOURNAL.md b/Modules/Module00/JOURNAL.md index a9628f0..226b60a 100644 --- a/Modules/Module00/JOURNAL.md +++ b/Modules/Module00/JOURNAL.md @@ -30,9 +30,7 @@ - Working with Qt ### Difficulties - When I started coding ex03 I did not manage exceptions the right way and the way the methods are built (very dependent on user input), isn't the best for testing, but still possible with mock user inputs. Think about testing before coding will be a priority from now on. -- Tried creating a friend class for testing in ex03 but still couldn't access private stuff. Will move on to m01 without implementing the test because of the time I've already spent on this. - - +- Tried creating a friend class for testing in ex03 but still couldn't access private stuff. Will move on to m01 without implementing the test because of the time I've already spent on this. Might be CMake issue with linking or compiler issue... From 7af4828fc8c17c2080742895065060a3a938c07f Mon Sep 17 00:00:00 2001 From: zeira Date: Fri, 15 Nov 2024 14:32:26 +0000 Subject: [PATCH 5/8] m01ex01, m01ex02cd --- Modules/Module01/.vscode/settings.json | 5 ++ Modules/Module01/JOURNAL.md | 16 +++++++ Modules/Module01/ex00/.vscode/settings.json | 6 +++ Modules/Module01/ex00/CMakeLists.txt | 23 +++++++++ Modules/Module01/ex00/inc/Car.hpp | 30 ++++++++++++ Modules/Module01/ex00/src/Car.cpp | 46 ++++++++++++++++++ Modules/Module01/ex00/src/main.cpp | 16 +++++++ Modules/Module01/ex00/test/CMakeLists.txt | 32 +++++++++++++ Modules/Module01/ex00/test/test_ex00.cpp | 53 +++++++++++++++++++++ Modules/Module01/ex01/.vscode/settings.json | 6 +++ Modules/Module01/ex01/CMakeLists.txt | 23 +++++++++ Modules/Module01/ex01/inc/Car.hpp | 31 ++++++++++++ Modules/Module01/ex01/inc/Sportscar.hpp | 22 +++++++++ Modules/Module01/ex01/src/Car.cpp | 51 ++++++++++++++++++++ Modules/Module01/ex01/src/Sportscar.cpp | 38 +++++++++++++++ Modules/Module01/ex01/src/main.cpp | 18 +++++++ Modules/Module01/ex01/test/CMakeLists.txt | 33 +++++++++++++ Modules/Module01/ex01/test/test_ex01.cpp | 46 ++++++++++++++++++ 18 files changed, 495 insertions(+) create mode 100644 Modules/Module01/.vscode/settings.json create mode 100644 Modules/Module01/JOURNAL.md create mode 100644 Modules/Module01/ex00/.vscode/settings.json create mode 100644 Modules/Module01/ex00/CMakeLists.txt create mode 100644 Modules/Module01/ex00/inc/Car.hpp create mode 100644 Modules/Module01/ex00/src/Car.cpp create mode 100644 Modules/Module01/ex00/src/main.cpp create mode 100644 Modules/Module01/ex00/test/CMakeLists.txt create mode 100644 Modules/Module01/ex00/test/test_ex00.cpp create mode 100644 Modules/Module01/ex01/.vscode/settings.json create mode 100644 Modules/Module01/ex01/CMakeLists.txt create mode 100644 Modules/Module01/ex01/inc/Car.hpp create mode 100644 Modules/Module01/ex01/inc/Sportscar.hpp create mode 100644 Modules/Module01/ex01/src/Car.cpp create mode 100644 Modules/Module01/ex01/src/Sportscar.cpp create mode 100644 Modules/Module01/ex01/src/main.cpp create mode 100644 Modules/Module01/ex01/test/CMakeLists.txt create mode 100644 Modules/Module01/ex01/test/test_ex01.cpp diff --git a/Modules/Module01/.vscode/settings.json b/Modules/Module01/.vscode/settings.json new file mode 100644 index 0000000..0032ea3 --- /dev/null +++ b/Modules/Module01/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "string": "cpp" + } +} diff --git a/Modules/Module01/JOURNAL.md b/Modules/Module01/JOURNAL.md new file mode 100644 index 0000000..ffc57b5 --- /dev/null +++ b/Modules/Module01/JOURNAL.md @@ -0,0 +1,16 @@ +# JOURNAL (jmoreira) +## Module01 +- Remembering basic C++ class and OOP concepts +- Improving on testing +### GitHub +- Workflow has improved a lot +### Thoughts +- Didn't spend the time to research further and implement Gherkin/Cucumber because it made more sense to work on other stuff, since it is more of a team working tool and as a team we aren't that confortable with testing methodologies yet. Will pick it up in the future +### Todo +- Complete the other warm-up modules +- Dive into Qt +- Keep making tests +### Difficulties +- Still a lot to improving testing wise +- Found my C++ to be very rusty, syntax mainly, but it is coming back +- Didn't get to learn/do everything I wanted in these 2 weeks diff --git a/Modules/Module01/ex00/.vscode/settings.json b/Modules/Module01/ex00/.vscode/settings.json new file mode 100644 index 0000000..d0b2228 --- /dev/null +++ b/Modules/Module01/ex00/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "iostream": "cpp", + "ostream": "cpp" + } +} diff --git a/Modules/Module01/ex00/CMakeLists.txt b/Modules/Module01/ex00/CMakeLists.txt new file mode 100644 index 0000000..bf734c8 --- /dev/null +++ b/Modules/Module01/ex00/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.10) + +# Project name and version +project(ex00 VERSION 1.0) + +# Specify the C++ standard +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# Specify include directories +include_directories(${PROJECT_SOURCE_DIR}/inc) + +# Collect all source files +file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp) + +# Add the executable +add_executable(ex00 ${SOURCES}) + +# Enable testing +enable_testing() + +# Include test directory +add_subdirectory(test) diff --git a/Modules/Module01/ex00/inc/Car.hpp b/Modules/Module01/ex00/inc/Car.hpp new file mode 100644 index 0000000..0dd492b --- /dev/null +++ b/Modules/Module01/ex00/inc/Car.hpp @@ -0,0 +1,30 @@ +#ifndef _CAR_HPP_ +#define _CAR_HPP_ + +#include +#include + +using std::string; +using std::cout; +using std::endl; + +class Car { +public: + Car(); + Car(const Car&); + Car(const string&, int); + ~Car(); + + Car& operator=(const Car &); + + string getName() const; + int getSpeed() const; + void setName(const string&); + void setSpeed(int); + +private: + string _name; + int _speed; +}; + +#endif diff --git a/Modules/Module01/ex00/src/Car.cpp b/Modules/Module01/ex00/src/Car.cpp new file mode 100644 index 0000000..cf4d11d --- /dev/null +++ b/Modules/Module01/ex00/src/Car.cpp @@ -0,0 +1,46 @@ +#include "../inc/Car.hpp" + +Car::Car() { + _name = "Prototype"; + _speed = 0; +} + +Car::Car(const string& name, int speed) : _name(name), _speed(speed) { + cout << _name << " is going at " << _speed << " kph" << endl; +} + +Car::Car(const Car &other) { + _name = other._name; + _speed = other._speed; + cout << _name << " was copied going at " << _speed << " kph" << endl; +} + +Car::~Car() { + cout << _name << " was destroyed going at " << _speed << " kph" << endl; +} + +Car& Car::operator=(const Car &other) { + cout << _name << " was assigned to " << other._name << " going at " << other._speed << " kph" << endl; + if (this == &other) + return *this; + _name = other._name; + _speed = other._speed; + return *this; +} + +string Car::getName() const { + return _name; +} + +int Car::getSpeed() const { + return _speed; +} + +void Car::setName(const string& name) { + _name = name; +} + +void Car::setSpeed(int speed) { + _speed = speed; + cout << _name << " is now going at " << _speed << " kph" << endl; +} diff --git a/Modules/Module01/ex00/src/main.cpp b/Modules/Module01/ex00/src/main.cpp new file mode 100644 index 0000000..6e43a20 --- /dev/null +++ b/Modules/Module01/ex00/src/main.cpp @@ -0,0 +1,16 @@ +#include "../inc/Car.hpp" + +int main() { + Car porsche("Porsche", 69); + Car panda(porsche); + Car twingo("Renault", 11); + twingo = panda; + + panda.setName("Porsche Panda"); + panda.setSpeed(42); + twingo.setName("Renault Twingo"); + twingo.setSpeed(299); + + + return 0; +} diff --git a/Modules/Module01/ex00/test/CMakeLists.txt b/Modules/Module01/ex00/test/CMakeLists.txt new file mode 100644 index 0000000..46ff3d0 --- /dev/null +++ b/Modules/Module01/ex00/test/CMakeLists.txt @@ -0,0 +1,32 @@ +# Specify the GoogleTest version and repository +include(ExternalProject) +ExternalProject_Add(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.12.1 + PREFIX "${CMAKE_BINARY_DIR}/googletest" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/googletest-install +) + +# Add the executable for the test +add_executable(test_ex00 + ${CMAKE_CURRENT_SOURCE_DIR}/test_ex00.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/Car.cpp +) + +# Include GoogleTest headers +target_include_directories(test_ex00 PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../inc + ${CMAKE_BINARY_DIR}/googletest-install/include +) + +# Link GoogleTest libraries +target_link_libraries(test_ex00 + ${CMAKE_BINARY_DIR}/googletest-install/lib/libgtest.a + ${CMAKE_BINARY_DIR}/googletest-install/lib/libgtest_main.a +) + +# Add dependencies to ensure Googletest is built before tests +add_dependencies(test_ex00 googletest) + +# Register the test with CTest +add_test(NAME test_ex00 COMMAND test_ex00) diff --git a/Modules/Module01/ex00/test/test_ex00.cpp b/Modules/Module01/ex00/test/test_ex00.cpp new file mode 100644 index 0000000..ff6989e --- /dev/null +++ b/Modules/Module01/ex00/test/test_ex00.cpp @@ -0,0 +1,53 @@ +#include +#include "../inc/Car.hpp" + +// Test default constructor +TEST(CarTest, DefaultConstructor) { + Car car; + EXPECT_EQ(car.getName(), "Prototype"); + EXPECT_EQ(car.getSpeed(), 0); +} + +// Test parameterized constructor +TEST(CarTest, ParameterizedConstructor) { + Car car("Porsche Panda", 69); + EXPECT_EQ(car.getName(), "Porsche Panda"); + EXPECT_EQ(car.getSpeed(), 69); +} + +// Test copy constructor +TEST(CarTest, CopyConstructor) { + Car original("Ferrari", 100); + Car copy(original); + + EXPECT_EQ(copy.getName(), original.getName()); + EXPECT_EQ(copy.getSpeed(), original.getSpeed()); +} + +// Test assignment operator +TEST(CarTest, AssignmentOperator) { + Car car1("Lambo", 200); + Car car2; + car2 = car1; + + EXPECT_EQ(car2.getName(), "Lambo"); + EXPECT_EQ(car2.getSpeed(), 200); +} + +// Test setName and setSpeed methods +TEST(CarTest, SetMethods) { + Car car; + car.setName("BMW"); + car.setSpeed(150); + + EXPECT_EQ(car.getName(), "BMW"); + EXPECT_EQ(car.getSpeed(), 150); +} + +// Test getName and getSpeed methods +TEST(CarTest, GetMethods) { + Car car("Toyota", 120); + + EXPECT_EQ(car.getName(), "Toyota"); + EXPECT_EQ(car.getSpeed(), 120); +} diff --git a/Modules/Module01/ex01/.vscode/settings.json b/Modules/Module01/ex01/.vscode/settings.json new file mode 100644 index 0000000..d0b2228 --- /dev/null +++ b/Modules/Module01/ex01/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "iostream": "cpp", + "ostream": "cpp" + } +} diff --git a/Modules/Module01/ex01/CMakeLists.txt b/Modules/Module01/ex01/CMakeLists.txt new file mode 100644 index 0000000..9bd63c0 --- /dev/null +++ b/Modules/Module01/ex01/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.10) + +# Project name and version +project(ex00 VERSION 1.0) + +# Specify the C++ standard +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# Specify include directories +include_directories(${PROJECT_SOURCE_DIR}/inc) + +# Collect all source files +file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp) + +# Add the executable +add_executable(ex01 ${SOURCES}) + +# Enable testing +enable_testing() + +# Include test directory +add_subdirectory(test) diff --git a/Modules/Module01/ex01/inc/Car.hpp b/Modules/Module01/ex01/inc/Car.hpp new file mode 100644 index 0000000..382bafc --- /dev/null +++ b/Modules/Module01/ex01/inc/Car.hpp @@ -0,0 +1,31 @@ +#ifndef _CAR_HPP_ +#define _CAR_HPP_ + +#include +#include + +using std::string; +using std::cout; +using std::endl; + +class Car { +public: + Car(); + Car(const Car&); + Car(const string&, const string&, int); + virtual ~Car(); + + Car& operator=(const Car &); + + string getMake() const; + string getModel() const; + int getYear() const; + virtual void drive(); + +private: + string _make; + string _model; + int _year; +}; + +#endif diff --git a/Modules/Module01/ex01/inc/Sportscar.hpp b/Modules/Module01/ex01/inc/Sportscar.hpp new file mode 100644 index 0000000..67059cb --- /dev/null +++ b/Modules/Module01/ex01/inc/Sportscar.hpp @@ -0,0 +1,22 @@ +#ifndef _SPORTSCAR_HPP_ +#define _SPORTSCAR_HPP_ + +#include "Car.hpp" + +class Sportscar : public Car { +public: + Sportscar(); + Sportscar(const string&, const string&, int, int); + Sportscar(const Sportscar&); + ~Sportscar(); + + Sportscar& operator=(const Sportscar &); + + void drive() override; + int getTopSpeed() const; + +private: + int _topSpeed; +}; + +#endif diff --git a/Modules/Module01/ex01/src/Car.cpp b/Modules/Module01/ex01/src/Car.cpp new file mode 100644 index 0000000..3df8807 --- /dev/null +++ b/Modules/Module01/ex01/src/Car.cpp @@ -0,0 +1,51 @@ +#include "../inc/Car.hpp" + +Car::Car() { + _make = "Toyota"; + _model = "Prototype"; + _year = 2024; + cout << _make << " " << _model << " (" << _year << ") was created" << endl; +} + +Car::Car(const string& make, const string& model, int year) : _make(make), _model(model), _year(year) { + cout << _make << " " << _model << " (" << _year << ") was created" << endl; +} + +Car::Car(const Car &other) { + _make = other._make; + _model = other._model; + _year = other._year; + cout << _make << " " << _model << " (" << _year << ") was cloned" << endl; +} + +Car::~Car() { + cout << _make << " " << _model << " (" << _year << ") was destroyed" << endl; +} + +Car& Car::operator=(const Car &other) { + if(this == &other) + return *this; + _make = other._make; + _model = other._model; + _year = other._year; + cout << _make << " " << _model << " (" << _year << ") was assigned" << endl; + return *this; +} + +string Car::getMake() const { + return _make; +} + +string Car::getModel() const { + return _model; +} + +int Car::getYear() const { + return _year; +} + +void Car::drive() { + cout << _make << " " << _model << " (" << _year << ") is driving" << endl; +} + + diff --git a/Modules/Module01/ex01/src/Sportscar.cpp b/Modules/Module01/ex01/src/Sportscar.cpp new file mode 100644 index 0000000..6a11726 --- /dev/null +++ b/Modules/Module01/ex01/src/Sportscar.cpp @@ -0,0 +1,38 @@ +#include "../inc/Sportscar.hpp" + +Sportscar::Sportscar() : Car() { + _topSpeed = 200; + cout << "Sportscar with top speed of " << _topSpeed << " was created" << endl; +} + +Sportscar::Sportscar(const string& make, const string& model, int year, int topSpeed) : Car(make, model, year), _topSpeed(topSpeed) { + cout << "Sportscar with top speed of " << _topSpeed << " was created" << endl; +} + +Sportscar::Sportscar(const Sportscar &other) : Car(other) { + _topSpeed = other._topSpeed; + cout << "Sportscar with top speed of " << _topSpeed << " was cloned" << endl; +} + +Sportscar::~Sportscar() { + cout << "Sportscar with top speed of " << _topSpeed << " was destroyed" << endl; +} + +Sportscar& Sportscar::operator=(const Sportscar &other) { + if(this == &other) + return *this; + Car::operator=(other); + _topSpeed = other._topSpeed; + cout << "Sportscar with top speed of " << _topSpeed << " was assigned" << endl; + return *this; +} + +int Sportscar::getTopSpeed() const { + return _topSpeed; +} + +void Sportscar::drive() { + Car::drive(); + cout << "Speed: " << _topSpeed << endl; +} + diff --git a/Modules/Module01/ex01/src/main.cpp b/Modules/Module01/ex01/src/main.cpp new file mode 100644 index 0000000..8d092a8 --- /dev/null +++ b/Modules/Module01/ex01/src/main.cpp @@ -0,0 +1,18 @@ +#include "../inc/Car.hpp" +#include "../inc/Sportscar.hpp" + +int main() { + Car myCar("Toyota", "Corolla", 2020); + Sportscar mySportscar("Porsche", "911 Turbo", 2024, 320); + + myCar.drive(); + mySportscar.drive(); + + Sportscar anotherSportscar(mySportscar); + Sportscar thirdSportscar; + + thirdSportscar = mySportscar; + thirdSportscar.drive(); + + return 0; +} diff --git a/Modules/Module01/ex01/test/CMakeLists.txt b/Modules/Module01/ex01/test/CMakeLists.txt new file mode 100644 index 0000000..91abefb --- /dev/null +++ b/Modules/Module01/ex01/test/CMakeLists.txt @@ -0,0 +1,33 @@ +# Specify the GoogleTest version and repository +include(ExternalProject) +ExternalProject_Add(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.12.1 + PREFIX "${CMAKE_BINARY_DIR}/googletest" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/googletest-install +) + +# Add the executable for the test +add_executable(test_ex01 + ${CMAKE_CURRENT_SOURCE_DIR}/test_ex01.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/Car.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/Sportscar.cpp +) + +# Include GoogleTest headers +target_include_directories(test_ex01 PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../inc + ${CMAKE_BINARY_DIR}/googletest-install/include +) + +# Link GoogleTest libraries +target_link_libraries(test_ex01 + ${CMAKE_BINARY_DIR}/googletest-install/lib/libgtest.a + ${CMAKE_BINARY_DIR}/googletest-install/lib/libgtest_main.a +) + +# Add dependencies to ensure Googletest is built before tests +add_dependencies(test_ex01 googletest) + +# Register the test with CTest +add_test(NAME test_ex01 COMMAND test_ex01) diff --git a/Modules/Module01/ex01/test/test_ex01.cpp b/Modules/Module01/ex01/test/test_ex01.cpp new file mode 100644 index 0000000..4cb443a --- /dev/null +++ b/Modules/Module01/ex01/test/test_ex01.cpp @@ -0,0 +1,46 @@ +#include +#include "../inc/Sportscar.hpp" + +TEST(SportscarTest, DefaultConstructor) { + Sportscar car; + EXPECT_EQ(car.getMake(), "Toyota"); + EXPECT_EQ(car.getModel(), "Prototype"); + EXPECT_EQ(car.getYear(), 2024); + EXPECT_EQ(car.getTopSpeed(), 200); +} + +TEST(SportscarTest, ParameterizedConstructor) { + Sportscar car("Porsche", "911", 2021, 320); + EXPECT_EQ(car.getMake(), "Porsche"); + EXPECT_EQ(car.getModel(), "911"); + EXPECT_EQ(car.getYear(), 2021); + EXPECT_EQ(car.getTopSpeed(), 320); +} + +TEST(SportscarTest, CopyConstructor) { + Sportscar car("Porsche", "911", 2021, 320); + Sportscar car2(car); + EXPECT_EQ(car2.getMake(), "Porsche"); + EXPECT_EQ(car2.getModel(), "911"); + EXPECT_EQ(car2.getYear(), 2021); + EXPECT_EQ(car2.getTopSpeed(), 320); +} + +TEST(SportscarTest, AssignmentOperator) { + Sportscar car("Porsche", "911", 2021, 320); + Sportscar car2; + car2 = car; + EXPECT_EQ(car2.getMake(), "Porsche"); + EXPECT_EQ(car2.getModel(), "911"); + EXPECT_EQ(car2.getYear(), 2021); + EXPECT_EQ(car2.getTopSpeed(), 320); +} + +TEST(SportscarTest, Drive) { + Sportscar car("Porsche", "911", 2021, 320); + testing::internal::CaptureStdout(); + car.drive(); + std::string output = testing::internal::GetCapturedStdout(); + EXPECT_EQ(output, "Porsche 911 (2021) is driving\nSpeed: 320\n"); +} + From 9c2bf20ef3a7ad9d3ee140b08bf33fab45309452 Mon Sep 17 00:00:00 2001 From: zeira Date: Fri, 15 Nov 2024 14:34:53 +0000 Subject: [PATCH 6/8] workflows files added --- .github/workflows/m01ex00_test.yml | 31 ++++++++++++++++++++++++++++++ .github/workflows/m01ex01_test.yml | 31 ++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/m01ex00_test.yml create mode 100644 .github/workflows/m01ex01_test.yml diff --git a/.github/workflows/m01ex00_test.yml b/.github/workflows/m01ex00_test.yml new file mode 100644 index 0000000..43d47b6 --- /dev/null +++ b/.github/workflows/m01ex00_test.yml @@ -0,0 +1,31 @@ +name: m01ex00 + +on: + push: + branches: + - jmoreira01 + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake g++ make + + - name: Build and run tests + run: | + cd Modules/Module01/ex00 + mkdir build + cd build + cmake .. + make + ctest --output-on-failure diff --git a/.github/workflows/m01ex01_test.yml b/.github/workflows/m01ex01_test.yml new file mode 100644 index 0000000..ba00eea --- /dev/null +++ b/.github/workflows/m01ex01_test.yml @@ -0,0 +1,31 @@ +name: m01ex01 + +on: + push: + branches: + - jmoreira01 + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake g++ make + + - name: Build and run tests + run: | + cd Modules/Module01/ex01 + mkdir build + cd build + cmake .. + make + ctest --output-on-failure From ae0fb6b6cad1db0ac3b9f5b1bf08ecb08da6ad44 Mon Sep 17 00:00:00 2001 From: zeira Date: Fri, 15 Nov 2024 15:33:22 +0000 Subject: [PATCH 7/8] m01ex02 was missing --- .github/workflows/m01ex02_test.yml | 31 +++++++++ Modules/Module01/.vscode/settings.json | 3 +- Modules/Module01/JOURNAL.md | 2 +- Modules/Module01/ex02/.vscode/settings.json | 6 ++ Modules/Module01/ex02/CMakeLists.txt | 23 +++++++ Modules/Module01/ex02/inc/AVehicle.hpp | 24 +++++++ Modules/Module01/ex02/inc/Car.hpp | 25 ++++++++ Modules/Module01/ex02/src/AVehicle.cpp | 34 ++++++++++ Modules/Module01/ex02/src/Car.cpp | 45 ++++++++++++++ Modules/Module01/ex02/src/main.cpp | 24 +++++++ Modules/Module01/ex02/test/CMakeLists.txt | 33 ++++++++++ Modules/Module01/ex02/test/test_ex02.cpp | 69 +++++++++++++++++++++ 12 files changed, 317 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/m01ex02_test.yml create mode 100644 Modules/Module01/ex02/.vscode/settings.json create mode 100644 Modules/Module01/ex02/CMakeLists.txt create mode 100644 Modules/Module01/ex02/inc/AVehicle.hpp create mode 100644 Modules/Module01/ex02/inc/Car.hpp create mode 100644 Modules/Module01/ex02/src/AVehicle.cpp create mode 100644 Modules/Module01/ex02/src/Car.cpp create mode 100644 Modules/Module01/ex02/src/main.cpp create mode 100644 Modules/Module01/ex02/test/CMakeLists.txt create mode 100644 Modules/Module01/ex02/test/test_ex02.cpp diff --git a/.github/workflows/m01ex02_test.yml b/.github/workflows/m01ex02_test.yml new file mode 100644 index 0000000..206547b --- /dev/null +++ b/.github/workflows/m01ex02_test.yml @@ -0,0 +1,31 @@ +name: m01ex02 + +on: + push: + branches: + - jmoreira01 + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake g++ make + + - name: Build and run tests + run: | + cd Modules/Module01/ex02 + mkdir build + cd build + cmake .. + make + ctest --output-on-failure diff --git a/Modules/Module01/.vscode/settings.json b/Modules/Module01/.vscode/settings.json index 0032ea3..0ba5e7e 100644 --- a/Modules/Module01/.vscode/settings.json +++ b/Modules/Module01/.vscode/settings.json @@ -1,5 +1,6 @@ { "files.associations": { - "string": "cpp" + "string": "cpp", + "functional": "cpp" } } diff --git a/Modules/Module01/JOURNAL.md b/Modules/Module01/JOURNAL.md index ffc57b5..3bfd478 100644 --- a/Modules/Module01/JOURNAL.md +++ b/Modules/Module01/JOURNAL.md @@ -13,4 +13,4 @@ ### Difficulties - Still a lot to improving testing wise - Found my C++ to be very rusty, syntax mainly, but it is coming back -- Didn't get to learn/do everything I wanted in these 2 weeks +- Didn't get to learn/do everything I wanted in these 2 weeks, and I wish I didn't have to rush so much diff --git a/Modules/Module01/ex02/.vscode/settings.json b/Modules/Module01/ex02/.vscode/settings.json new file mode 100644 index 0000000..d0b2228 --- /dev/null +++ b/Modules/Module01/ex02/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "iostream": "cpp", + "ostream": "cpp" + } +} diff --git a/Modules/Module01/ex02/CMakeLists.txt b/Modules/Module01/ex02/CMakeLists.txt new file mode 100644 index 0000000..fb6108b --- /dev/null +++ b/Modules/Module01/ex02/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.10) + +# Project name and version +project(ex00 VERSION 1.0) + +# Specify the C++ standard +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# Specify include directories +include_directories(${PROJECT_SOURCE_DIR}/inc) + +# Collect all source files +file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp) + +# Add the executable +add_executable(ex02 ${SOURCES}) + +# Enable testing +enable_testing() + +# Include test directory +add_subdirectory(test) diff --git a/Modules/Module01/ex02/inc/AVehicle.hpp b/Modules/Module01/ex02/inc/AVehicle.hpp new file mode 100644 index 0000000..9a7e9d2 --- /dev/null +++ b/Modules/Module01/ex02/inc/AVehicle.hpp @@ -0,0 +1,24 @@ +#ifndef _AVEHICLE_HPP_ +#define _AVEHICLE_HPP_ + +#include + +class AVehicle +{ +public: + AVehicle(); + AVehicle(const std::string& type); + AVehicle(const AVehicle& ref); + virtual ~AVehicle(); + + AVehicle& operator=(const AVehicle& ref); + + const std::string& getType() const; + + virtual AVehicle* build() const = 0; + +protected: + std::string _type; +}; + +#endif diff --git a/Modules/Module01/ex02/inc/Car.hpp b/Modules/Module01/ex02/inc/Car.hpp new file mode 100644 index 0000000..55ad569 --- /dev/null +++ b/Modules/Module01/ex02/inc/Car.hpp @@ -0,0 +1,25 @@ +#ifndef _CAR_HPP_ +#define _CAR_HPP_ + +#include "AVehicle.hpp" + +class Car : public AVehicle +{ +public: + Car(); + Car(const Car& other); + ~Car(); + + Car& operator=(const Car& other); + + virtual AVehicle* build() const; + void setSpeed(int speed); + int getSpeed() const; + + +private: + int _topSpeed; + +}; + +#endif diff --git a/Modules/Module01/ex02/src/AVehicle.cpp b/Modules/Module01/ex02/src/AVehicle.cpp new file mode 100644 index 0000000..8293e59 --- /dev/null +++ b/Modules/Module01/ex02/src/AVehicle.cpp @@ -0,0 +1,34 @@ +#include "../inc/AVehicle.hpp" + +AVehicle::AVehicle() : _type("default") +{ + std::cout << "AVehicle default constructor called\n"; +} + +AVehicle::AVehicle(const std::string& type) : _type(type) +{ + std::cout << "AVehicle parameter constructor called\n"; +} + +AVehicle::AVehicle(const AVehicle& other) +{ + std::cout << "AVehicle copy constructor called\n"; + *this = other; +} + +AVehicle::~AVehicle() +{ + std::cout << "AVehicle destructor called\n"; +} + +AVehicle& AVehicle::operator=(const AVehicle& other) +{ + if (this != &other) + this->_type = other.getType(); + return *this; +} + +const std::string& AVehicle::getType() const +{ + return this->_type; +} diff --git a/Modules/Module01/ex02/src/Car.cpp b/Modules/Module01/ex02/src/Car.cpp new file mode 100644 index 0000000..3cef9f8 --- /dev/null +++ b/Modules/Module01/ex02/src/Car.cpp @@ -0,0 +1,45 @@ +#include "../inc/Car.hpp" + +Car::Car() : AVehicle("car") +{ + std::cout << "Car default constructor called\n"; +} + +Car::Car(const Car& other) : AVehicle(other), _topSpeed(other._topSpeed) +{ + std::cout << "Car copy constructor called\n"; + *this = other; +} + +Car::~Car() +{ + std::cout << "Car destructor called\n"; +} + +Car& Car::operator=(const Car& other) +{ + if (this != &other) { + AVehicle::operator=(other); + _topSpeed = other._topSpeed; + } + return *this; +} + +AVehicle* Car::build() const +{ + std::cout << "New car built\n"; + return new Car(); +} + +void Car::setSpeed(int speed) +{ + if (speed < 0) + this->_topSpeed = 0; + else + this->_topSpeed = speed; +} + +int Car::getSpeed() const +{ + return this->_topSpeed; +} diff --git a/Modules/Module01/ex02/src/main.cpp b/Modules/Module01/ex02/src/main.cpp new file mode 100644 index 0000000..bd6cace --- /dev/null +++ b/Modules/Module01/ex02/src/main.cpp @@ -0,0 +1,24 @@ +#include "../inc/AVehicle.hpp" +#include "../inc/Car.hpp" +#include +#include + +int main() { + Car myCar; + + // Encapsulation: Setting the speed using setter method + myCar.setSpeed(120); + + // Access the speed using getter method (encapsulation in action) + std::cout << "The top speed of my car is: " << myCar.getSpeed() << " km/h" << std::endl; + + // Polymorphism and Abstraction: Calling the virtual 'build' method + AVehicle* builtCar = myCar.build(); + + // Display the type of vehicle (demonstrates polymorphism) + std::cout << "Vehicle type: " << builtCar->getType() << std::endl; + + delete builtCar; + + return 0; +} diff --git a/Modules/Module01/ex02/test/CMakeLists.txt b/Modules/Module01/ex02/test/CMakeLists.txt new file mode 100644 index 0000000..1d0ac1b --- /dev/null +++ b/Modules/Module01/ex02/test/CMakeLists.txt @@ -0,0 +1,33 @@ +# Specify the GoogleTest version and repository +include(ExternalProject) +ExternalProject_Add(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.12.1 + PREFIX "${CMAKE_BINARY_DIR}/googletest" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/googletest-install +) + +# Add the executable for the test +add_executable(test_ex02 + ${CMAKE_CURRENT_SOURCE_DIR}/test_ex02.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/AVehicle.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/Car.cpp +) + +# Include GoogleTest headers +target_include_directories(test_ex02 PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../inc + ${CMAKE_BINARY_DIR}/googletest-install/include +) + +# Link GoogleTest libraries +target_link_libraries(test_ex02 + ${CMAKE_BINARY_DIR}/googletest-install/lib/libgtest.a + ${CMAKE_BINARY_DIR}/googletest-install/lib/libgtest_main.a +) + +# Add dependencies to ensure Googletest is built before tests +add_dependencies(test_ex02 googletest) + +# Register the test with CTest +add_test(NAME test_ex02 COMMAND test_ex02) diff --git a/Modules/Module01/ex02/test/test_ex02.cpp b/Modules/Module01/ex02/test/test_ex02.cpp new file mode 100644 index 0000000..050ffc7 --- /dev/null +++ b/Modules/Module01/ex02/test/test_ex02.cpp @@ -0,0 +1,69 @@ +#include +#include "../inc/AVehicle.hpp" +#include "../inc/Car.hpp" + +// Test for the Car class +class CarTest : public ::testing::Test { +protected: + // You can initialize common objects in the SetUp() function + CarTest() { + car = new Car(); + } + + // You can clean up the resources in the TearDown() function + ~CarTest() override { + delete car; + } + + void SetUp() override { + // Initialize the car with a specific speed before each test + car->setSpeed(150); + } + + void TearDown() override { + // Reset or clean up anything needed after each test + } + + Car* car; // A pointer to the Car object for testing +}; + +// Test that the car has the correct speed set using the getter +TEST_F(CarTest, TestGetSpeed) { + EXPECT_EQ(car->getSpeed(), 150); +} + +// Test the build method that should return a new Car object +TEST_F(CarTest, TestBuild) { + AVehicle* builtCar = car->build(); + + // Verify that the built car is of type "car" + EXPECT_EQ(builtCar->getType(), "car"); + + // Clean up the dynamically created object + delete builtCar; +} + +// Test the type of the car (which should be "car") +TEST_F(CarTest, TestCarType) { + EXPECT_EQ(car->getType(), "car"); +} + +// Test that the assignment operator works correctly +TEST_F(CarTest, TestAssignmentOperator) { + Car anotherCar; + anotherCar = *car; + + // Ensure the assignment works correctly + EXPECT_EQ(anotherCar.getSpeed(), car->getSpeed()); + EXPECT_EQ(anotherCar.getType(), car->getType()); +} + +// Test the copy constructor +TEST_F(CarTest, TestCopyConstructor) { + Car copiedCar(*car); + + // Ensure the copy constructor works as expected + EXPECT_EQ(copiedCar.getSpeed(), car->getSpeed()); + EXPECT_EQ(copiedCar.getType(), car->getType()); +} + From dbfd1bebc5a3a9371a85e506933ae8a58749a5e8 Mon Sep 17 00:00:00 2001 From: zeira Date: Fri, 15 Nov 2024 17:56:55 +0000 Subject: [PATCH 8/8] journal update. closes #7 --- Modules/Module00/{JOURNAL.md => JOURNAL00.md} | 0 Modules/Module01/{JOURNAL.md => JOURNAL01.md} | 10 +++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) rename Modules/Module00/{JOURNAL.md => JOURNAL00.md} (100%) rename Modules/Module01/{JOURNAL.md => JOURNAL01.md} (54%) diff --git a/Modules/Module00/JOURNAL.md b/Modules/Module00/JOURNAL00.md similarity index 100% rename from Modules/Module00/JOURNAL.md rename to Modules/Module00/JOURNAL00.md diff --git a/Modules/Module01/JOURNAL.md b/Modules/Module01/JOURNAL01.md similarity index 54% rename from Modules/Module01/JOURNAL.md rename to Modules/Module01/JOURNAL01.md index 3bfd478..bf11e5d 100644 --- a/Modules/Module01/JOURNAL.md +++ b/Modules/Module01/JOURNAL01.md @@ -1,6 +1,6 @@ # JOURNAL (jmoreira) ## Module01 -- Remembering basic C++ class and OOP concepts +- Remembering basic C++ class and OOP concepts - Improving on testing ### GitHub - Workflow has improved a lot @@ -9,8 +9,12 @@ ### Todo - Complete the other warm-up modules - Dive into Qt -- Keep making tests +- Keep improving tests and find other ways of testing, and test different stuff as well like format and tidy +- Not sure how it will be going foward, but tests specific to a section of code should only run if it was changed... +- Research Gherkin/Cucumber further +- Research MISRA ### Difficulties - Still a lot to improving testing wise -- Found my C++ to be very rusty, syntax mainly, but it is coming back +- Found my C++ to be rusty, syntax mostly, but it is coming back - Didn't get to learn/do everything I wanted in these 2 weeks, and I wish I didn't have to rush so much +- Not having defined timelines for each task resulted in spending too much time on stuff that wasn't essential