diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f84d3c9cc50d9f4fe7554a865d7a76e52a71995f..869eb2f4e18c93ba8e08ad89c46d2db71cee88ac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,38 +94,38 @@ code_coverage: expire_in: 7 days -# deploy_prod: -# stage: deploy -# before_script: -# - apt-get update -qq -# - apt-get install -qq curl -# - 'which ssh-agent || ( apt-get install -qq openssh-client )' -# - eval $(ssh-agent -s) -# - ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d -w 0) -# - mkdir -p ~/.ssh -# - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' -# script: -# - ELF_NAME="${CI_PROJECT_NAMESPACE}-quotes" -# - SSH_COMMAND_STRING="if pgrep ${ELF_NAME}; then pkill ${ELF_NAME}; fi && " -# # Double quotes around everything needed as it has a colon in it -# - "SSH_COMMAND_STRING+=\"curl --location --header 'PRIVATE-TOKEN: ${API_TOKEN}' '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_BUILD_REF_NAME}/raw/build/quotes?job=build_programs' --output ${ELF_NAME} &&\" " -# # Make sure the file is executable -# - SSH_COMMAND_STRING+="chmod +x ${ELF_NAME} && " -# # Start it in the background in such a way that SSH will not hang when we exit -# - SSH_COMMAND_STRING+="(nohup ./${ELF_NAME} ${RUN_PORT} > /dev/null 2>&1 &) && " -# # Make sure the program is running, if it is, we exit gracefully -# - SSH_COMMAND_STRING+="if pgrep ${ELF_NAME}; then exit; fi && " -# # If the program is not running, exit with an error code to say something went wrong -# - SSH_COMMAND_STRING+="exit 1" -# # Print it out so we can see what happened for debugging purposes. -# - echo "$SSH_COMMAND_STRING" -# # Execute the deploy -# - ssh $SSH_USER@$SSH_HOST "${SSH_COMMAND_STRING}" -# # Make sure it is running -# - "curl --location http://${SSH_HOST}:${RUN_PORT} | grep \"Go to /quote/# or /random to get a quote.\"" -# when: manual -# only: -# - master +deploy_prod: + stage: deploy + before_script: + - apt-get update -qq + - apt-get install -qq curl + - 'which ssh-agent || ( apt-get install -qq openssh-client )' + - eval $(ssh-agent -s) + - ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d -w 0) + - mkdir -p ~/.ssh + - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + script: + - ELF_NAME="${CI_PROJECT_NAMESPACE}-quotes" + - SSH_COMMAND_STRING="if pgrep ${ELF_NAME}; then pkill ${ELF_NAME}; fi && " + # Double quotes around everything needed as it has a colon in it + - "SSH_COMMAND_STRING+=\"curl --location --header 'PRIVATE-TOKEN: ${API_TOKEN}' '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_BUILD_REF_NAME}/raw/build/quotes?job=build_programs' --output ${ELF_NAME} &&\" " + # Make sure the file is executable + - SSH_COMMAND_STRING+="chmod +x ${ELF_NAME} && " + # Start it in the background in such a way that SSH will not hang when we exit + - SSH_COMMAND_STRING+="(nohup ./${ELF_NAME} ${RUN_PORT} > /dev/null 2>&1 &) && " + # Make sure the program is running, if it is, we exit gracefully + - SSH_COMMAND_STRING+="if pgrep ${ELF_NAME}; then exit; fi && " + # If the program is not running, exit with an error code to say something went wrong + - SSH_COMMAND_STRING+="exit 1" + # Print it out so we can see what happened for debugging purposes. + - echo "$SSH_COMMAND_STRING" + # Execute the deploy + - ssh $SSH_USER@$SSH_HOST "${SSH_COMMAND_STRING}" + # Make sure it is running + - "curl --location http://${SSH_HOST}:${RUN_PORT} | grep \"Go to /quote/# or /random to get a quote.\"" + when: manual + only: + - master variables: diff --git a/main/Quotes.cpp b/main/Quotes.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5671cbc0395d1f415c9f45fdc3c4871fe7d12142 --- /dev/null +++ b/main/Quotes.cpp @@ -0,0 +1,78 @@ +/************************************************************************* + * + * Homework 4: Exploring continuous deployment. + * + * File Name: quote.cpp + * Course: CPTR 245 + * + */ + +#include "Quotes.h" +#include +#include +#include + +Quotes::Quotes(unsigned int seed) { + this->seed = seed; + + quotes = { + {"Andrew Platner", "", ""}, + {"Austin Garner", + "Men talk of killing time, while time quietly kills them.", + "Dion Boucicault"}, + {"Cameron Bierwagen", "", ""}, + {"Elon Bontemps", + "True humility is not thinking less of yourself; it is thinking of " + "yourself less", + "C.S. Lewis"}, + {"Ivan Guillen", + "Logic will get you from A to B. Imagination will take you " + "everywhere.", + "Albert Einstein"}, + {"James Foster", + "The most disastrous thing that you can ever learn is your first " + "programming language.", + "Alan Kay"}, + {"Jarod Owen", "I do not fear computers. I fear lack of them.", + "Isaac Asimov"}, + {"Jeff Peters", "God does not play dice with the universe.", + "A. Einstein"}, + {"Kaelan Willauer", + "Action without a name, a 'who' attached to it, is meaningless.", + "St. Jerome"}, + {"Luke Hagan", "", ""}, + {"Luke Irvine", + "Life is what happens when you're busy making other plans.", "Lennon"}, + {"Michael Stacy", + "Measuring programming progress by number of lines " + "is like measuring aircraft build process by the weight", + "anonymous author"}, + {"Nelson Phillips", "Ogres are like onions, they have layers", "Shrek"}, + {"Noah Olsen", "The greatest teacher, failure is", "Master Yoda"}, + {"Owen Hoffman", "", ""}, + {"Welcome! Please select a menu option.", "Talk is cheap. Show me the code.", + "Linus Torvalds"}, + {"Samuel Nguyen", "", ""}, + {"Trevor Claridge", + "Its easy to make frends if you let pepul laff at you.", + "Daniel Keyes"}, + {"Trevor Natiuk", + "Before you marry a person, you should first make " + "them use a computer with slow Internet to see who they really are", + "Will Ferrell"}, + {"Will Hensel", + "The question of whether a computer can think is no more " + "interesting than the question of whether a submaring can swim.", + "Edsger W. Dijkstra"}, + }; +} + +Quote Quotes::getRandomQuote() { + int index = rand_r(&seed) % quotes.size(); + return quotes.at(index); +} + +Quote Quotes::getQuote(int id) { + int index = id % quotes.size(); + return quotes.at(index); +} diff --git a/main/Quotes.h b/main/Quotes.h new file mode 100644 index 0000000000000000000000000000000000000000..c29086712f41ccd87518f53c69b96c82b4c7da50 --- /dev/null +++ b/main/Quotes.h @@ -0,0 +1,28 @@ +/************************************************************************* + * + * Homework 4: Exploring continuous deployment. + * + * File Name: quote.h + * Course: CPTR 245 + * + */ + +#include +#include + +struct Quote { + std::string student; + std::string quote; + std::string author; +}; + +class Quotes { + private: + std::vector quotes; + unsigned int seed; + + public: + explicit Quotes(unsigned int); + Quote getRandomQuote(); + Quote getQuote(int); +}; diff --git a/main/main.cpp b/main/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7070f77a63c2cba1d94f8a70dbcd4c7f2b57618f --- /dev/null +++ b/main/main.cpp @@ -0,0 +1,92 @@ +/************************************************************************* + * + * Homework 4: Exploring continuous deployment. + * + * File Name: quote.cpp + * Course: CPTR 245 + * + */ + +#include +#include +#include +#include +#include +#include "Quotes.h" + +std::vector explode(const std::string &s, const char &c) { + std::string buff; + std::vector v; + + for (auto n : s) { + if (n != c) { + buff += n; + } else if (n == c && !buff.empty()) { + v.push_back(buff); + buff = ""; + } + } + + if (!buff.empty()) { + v.push_back(buff); + } + + return v; +} + +int main(int argc, char **argv) { + if (argc != 2) { + std::cerr << "You must provide a port to run on" << std::endl; + return -1; + } + int port = 0; + + try { + port = std::stoi(argv[1]); + } catch (const std::invalid_argument &e) { + std::cerr << "Invalid port specified" << std::endl; + return -1; + } + + if (port < 1024 || port > 65535) { + std::cerr << "Port is not in allowable range" << std::endl; + return -1; + } + + httplib::Server svr; + + svr.Get("/", [](const httplib::Request &req, httplib::Response &res) { + res.set_content("Go to /quote/# or /random to get a quote.", "text/plain"); + }); + + svr.Get("/random", + [](const httplib::Request &req, httplib::Response &res) { + Quotes myQuotes(time(NULL)); + Quote quote = myQuotes.getRandomQuote(); + + std::string output = "Today's Random Quote was submitted by " + + quote.student + ".\n\n" + "\"" + quote.quote + + "\"\n ~ " + quote.author + "\n"; + + res.set_content(output, "text/plain"); + }); + + svr.Get(R"(/quote/([0-9]+))", + [](const httplib::Request &req, httplib::Response &res) { + auto urlExploded = explode(req.matches[0], '/'); + auto numbers = std::vector(urlExploded.begin() + 1, + urlExploded.end()); + + Quotes myQuotes(time(NULL)); + Quote quote = myQuotes.getQuote(std::stoi(numbers[0])); + std::string output = "Today's Quote was submitted by " + + quote.student + ".\n\n" + "\"" + quote.quote + + "\"\n ~ " + quote.author + "\n"; + + res.set_content(output, "text/plain"); + }); + + svr.listen("0.0.0.0", port); + + return 0; +} diff --git a/src/Entity.cpp b/src/Entity.cpp index a12b06875284651b0959f1b84d6ac83074cb3ff6..b6ee7d4b110ed63a42e82fd373f7ac27ef7afb0e 100644 --- a/src/Entity.cpp +++ b/src/Entity.cpp @@ -4,12 +4,14 @@ #include #include #include -#include "Grid.h" #include "Moves.h" -using namespace std; - -class MoveSet; +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; // void Entity::action() {} @@ -17,13 +19,18 @@ void Entity::move() { } void Entity::setPos() { + srand(time(0)); // Random Positioning - this->colPos = rand() % 4; - this->rowPos = rand() % 4; + this->colPos = rand_r() % 3; + this->rowPos = rand_r() % 3; } bool Entity::checkHealth() { - return (con > 0); + bool life = true; + if (con <= 0) { + life = false; + } + return life; } Player::Player() { @@ -31,41 +38,20 @@ Player::Player() { this->con = 10; this->str = 10; this->dex = 10; - // setClass('a'); } void Player::action() { char act; - do { - cout << "What will you do?" << endl; - cout << " a. Light Attack" << endl; - cout << " b. Heavy Attack" << endl; - cout << " c. Defend" << endl; - cout << " d. Counter" << endl; - cout << " e. Flee" << endl; - cout << " Enter Action Here: "; - cin >> act; - - switch (act) { - case 'a': - // callLightAttack(); - break; - case 'b': - // callHeavyAttack(); - break; - case 'c': - // callDefend(); - break; - case 'd': - break; - case 'e': - break; - default: - cout << "Please enter a valid option." << endl; - break; - } - } while (act != 'a' && act != 'b' && act != 'c' && act != 'd' && - act != 'e' && act != 'f'); + cout << "What will you do?" << endl; + cout << " a. Light Attack" << endl; + cout << " b. Heavy Attack" << endl; + cout << " c. Defend" << endl; + cout << " d. Counter" << endl; + cout << " f. Flee" << endl; + cout << " Enter Action Here: "; + cin >> act; + + switch (act) {} } void Player::setClass(char Class) { @@ -77,28 +63,16 @@ void Player::setClass(char Class) { break; case 'b': // Rogue break; + case 'c': // Mage + break; } } -void Enemy::action() { - int act = rand() % 10; - if (con <= 2) { - // Attempt flee - } else { - if (act <= 2) { - // Heavy Attack - } else if (act >= 3 && act <= 5) { - // Light Attack - } else if (act >= 6 && act <= 8) { - // Defend - } else if (act >= 9) { - // Counter - } - } -} +void Enemy::setBossClass() { + srand(time(0)); + int monster = rand_r() % 3; // Boss Monster Randomization -void Enemy::setBossClassByChoice(int boss) { - switch (boss) { + switch (monster) { case 1: // Minotaur this->str = 16; this->con = 14; @@ -117,12 +91,6 @@ void Enemy::setBossClassByChoice(int boss) { } } -void Enemy::setBossClassByRand() { - int monster = rand() % 3; // Boss Monster Randomization - - setBossClassByChoice(monster); -} - void Enemy::setClassByChoice(int monster) { switch (monster) { case 1: // Goblin @@ -144,16 +112,28 @@ void Enemy::setClassByChoice(int monster) { } void Enemy::setClassByRand() { - int monster = rand() % 3; // Monster Randomization + srand(time(0)); + int monster = rand_r() % 3; // Monster Randomization - setClassByChoice(monster); + switch (monster) { + case 1: // Goblin + this->str = 6; + this->con = 6; + this->dex = 12; + break; + case 2: // Orc + this->str = 14; + this->con = 10; + this->dex = 8; + break; + case 3: // Skeleton + this->str = 8; + this->con = 10; + this->dex = 10; + break; + } } -Enemy::Enemy(bool boss) { +Enemy::Enemy() { setPos(); - if (boss) { - setBossClassByRand(); - } else { - setClassByRand(); - } } diff --git a/src/Entity.h b/src/Entity.h index 1081e05130a231d08eac85dc1d742ffb27130fea..292f3e6e3d37e2c1c2430a23ccfe3458c4aa8925 100644 --- a/src/Entity.h +++ b/src/Entity.h @@ -1,24 +1,28 @@ // "Copyright [year] " -#ifndef ENTITY_H -#define ENTITY_H +#ifndef SRC_ENTITY_H_ +#define SRC_ENTITY_H_ + +// no includes? +#include + +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; class MoveSet; class Entity { - public: + public: bool checkHealth(); void move(); void setPos(); - int getCol() { - return colPos; - } - int getRow() { - return rowPos; - } virtual void action() const = 0; + virtual void setClass() const = 0; - protected: - // MoveSet* moves; + protected: int colPos; int rowPos; int con; @@ -27,29 +31,28 @@ class Entity { }; class Player : public Entity { - public: + public: Player(); void action(); void setClass(char Class); - private: + private: // Vector of inventory items // Vector of equipped items }; class Enemy : public Entity { - public: - Enemy(bool boss); + public: + Enemy(); void action(); - void setBossClassByChoice(int boss); - void setBossClassByRand(); + void setBossClass(); void setClassByRand(); void setClassByChoice(int monster); bool seesPlayer(); - private: + private: // Vector of drop items // Vector of equipped items }; -#endif +#endif // SRC_ENTITY_H_ diff --git a/src/Grid.cpp b/src/Grid.cpp index 300cc6276a849958b338633bf8d535e3bcb73e84..f1324bd064faf54924ba77e39e48fe9f1a5ecb6e 100644 --- a/src/Grid.cpp +++ b/src/Grid.cpp @@ -1,115 +1,12 @@ // "Copyright [year] " #include #include -using namespace std; -#include "Grid.h" - -// randomly generate grid and start score at 0 -// Ensure player and enemies start at different places - -// define the functions for grid -char Grid::getDirection() { - cout << "Where do you want to go?" << endl; - cout << "Please enter u for up, r for right, d for down, l for left, or m " - "for a random direction." - << endl; - cin >> direction; - return direction; -} +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; -// 2D array using subtraction in direction -/*int Grid::move(int GridRows, int GridColumns, char direction) { - if (direction == 'u') { - if ((room == 3) || (room == 2) || (room == 1)) { - } else { - room = room - 3; - } - } else if (direction == 'r') { - if ((room == 3) || (room == 6) || (room == 9)) { - } else { - room = room + 1; - } - } else if (direction == 'd') { - if ((room == 7) || (room == 8) || (room == 9)) { - } else { - room = room + 3; - } - } else if (direction == 'l') { - if ((room == 1) || (room == 4) || (room == 7)) { - } else { - room = room - 1; - } - } else if (direction == 'm') { - room = move(room, getRandDirection()); - } else { - cout << "Invalid entry. Please input valid entry. "; - room = move(room, getDirection()); - } - return room; -}*/ -int Grid::move(int GridRows, int GridColumns, char direction) { - if (direction == 'u') { - if ((GridRows == 4) || (GridRows == 3) || (GridRows == 2) || - (GridRows == 1)) { - } else { - GridRows += 1; - } - } else if (direction == 'r') { - if ((GridColumns == 4) || (GridColumns == 8) || (GridColumns == 12) || - (GridColumns == 16)) { - } else { - GridColumns += 1; - } - } else if (direction == 'd') { - if ((GridRows == 13) || (GridRows == 14) || (GridRows == 15) || - (GridRows == 16)) { - } else { - GridRows -= 1; - } - } else if (direction == 'l') { - if ((GridColumns == 1) || (GridColumns == 5) || (GridColumns == 9) || - (GridColumns == 13)) { - } else { - GridColumns -= 1; - } - } else if (direction == 'm') { - move(GridRows, GridColumns, getRandDirection()); - } -} - -char Grid::getRandDirection() { - otherDirection = rand() % 5 + 1; - if (otherDirection == 5) { - return 'u'; - } else if (otherDirection == 3) { - return 'r'; - } else if (otherDirection == 4) { - return 'd'; - } else { - return 'l'; - } -} - -void Grid::printGrid(int GridRows, int GridColumns) { - char grid[GridRows][GridColumns]; - for (int i = 0; i < GridRows; i++) { - for (int j = 0; j < GridColumns; j++) { - grid[i][j] = '.'; - cout << grid[i][j]; - } - cout << endl; - } -} -/*void Grid::printGrid(int player, int bosses) { - char grid[10]; - for (int i = 0; i < 10; i++) { - grid[i] = '.'; - } - grid[player] = 'P'; - grid[bosses] = 'B'; - cout << grid[1] << grid[2] << grid[3] << endl; - cout << grid[4] << grid[5] << grid[6] << endl; - cout << grid[7] << grid[8] << grid[9] << endl; -}*/ -// 2D array print inside a nested loop +#include "Grid.h" diff --git a/src/Grid.h b/src/Grid.h index 73da28741d18cc3f595d4c181d16d52e8f91b810..a55dbbc4a8fb499d58484f5ed56efe04bbe82d59 100644 --- a/src/Grid.h +++ b/src/Grid.h @@ -1,24 +1,31 @@ // "Copyright [year] " +#ifndef SRC_GRID_H_ +#define SRC_GRID_H_ + #include #include -using namespace std; +#include + +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; class Grid { - public: - // Grid(); + public: + Grid(); char getDirection(); char getRandDirection(); - int move(int GridRows, int GridColumns, char direction); - // void printGrid(); - void printGrid(int GridRows, int GridColumns); + int move_(int room, char direction); // changed function name due to + void printGrid(int player, int bosses); // library conflict - private: - int seed; + private: int room; int player; int bosses; char direction; - int otherDirection; - int GridRows; - int GridColumns; }; + +#endif // SRC_GRID_H_ diff --git a/src/Moves.cpp b/src/Moves.cpp index ce3d44718af7168f095aed2891d74d645e03df47..fd8ccf042a865723524cedc82b1af08bf97cd3b6 100644 --- a/src/Moves.cpp +++ b/src/Moves.cpp @@ -1,31 +1,3 @@ // "Copyright [year] " -#include "Moves.h" -#include -#include -#include -using namespace std; -int MoveSet::callLightAttack() { - int LightAttack = 0; - LightAttack = rand() % 10 + 1; - return LightAttack; -} - -int MoveSet::callHeavyAttack() { - int HeavyAttack = 0; - HeavyAttack = rand() % 10 + 10; - return HeavyAttack; -} - -int MoveSet::callDefend() { - int Damage, Attack, Defend; - Defend = rand() % 10 + 1; - Attack = rand() % 10 + 1; - if (Defend >= Attack) { - Damage = 0; - return Damage; - } else { - Damage = Attack - Defend; - return Damage; - } -} +#include "..src/Moves.h" diff --git a/src/Moves.h b/src/Moves.h index 6d2f67ce69bc5686a6ed2c4382e43f79160e026e..635c1cc967c79343a486a7760797c381669570fc 100644 --- a/src/Moves.h +++ b/src/Moves.h @@ -1,28 +1,32 @@ // "Copyright [year] " -#ifndef MOVES_H -#define MOVES_H +#ifndef SRC_MOVES_H_ +#define SRC_MOVES_H_ #include // for assert #include // for exit #include #include // for cin and cout +#include -using namespace std; +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; class MoveSet { - private: - /* - int LightAttack; - int HeavyAttack; - int Defend; - int counter; - */ + private: + int LightAttack; + int HeavyAttack; + int Defend; + int counter; - public: + public: int callLightAttack(); int callHeavyAttack(); int callDefend(); int callCounter(); }; -#endif +#endif // SRC_MOVES_H_ diff --git a/src/a.out b/src/a.out deleted file mode 100644 index 2796e0116cf702228cc22b3f17c13257f975f8fc..0000000000000000000000000000000000000000 Binary files a/src/a.out and /dev/null differ diff --git a/src/main.cpp b/src/main.cpp index a903666524504892cd0f238681b5cb634a27415f..bbec36cc98be46dde87a0cd86588fe22d187f3e1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,46 +9,18 @@ * Date: The End Times * */ + #include -#include "Entity.h" -#include "Grid.h" -#include "Moves.h" -using namespace std; +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; int main() { - srand(time(0)); - char option; - - do { // Menu options. Add other options later. - cout << "Welcome! Please select a menu option." << endl; - cout << "[A] Play Game." << endl; - cout << "[B] Quit Game." << endl; - cin >> option; - - while (option != 'A' && option != 'B') { - cout << "Please enter a valid option of A, or B. " << endl; - cin >> option; - } - // if (option == 'A') { - // launch game, so call what function? - //} - } while (option != 'B'); - cout << endl; - - // Jake's functions - /* MoveSet action; - - cout << action.callLightAttack() << endl; - cout << action.callHeavyAttack() << endl; - cout << action.callDefend() << endl; - - // Grace - Grid display; - int GridRows = 4, GridColumns = 4; - display.printGrid(GridRows, GridColumns); - - - */ - return 0; + cout << "Welcome! Please select a menu option." << endl; + // Create menu + // Start Game, } diff --git a/src/test_driver.cpp b/src/test_driver.cpp index b3ec46d31a33fae9cef61f20832865ae23a2ff98..856bc5d2d14157323cb9564f90eb5e3b87008683 100644 --- a/src/test_driver.cpp +++ b/src/test_driver.cpp @@ -1,3 +1,4 @@ +// "Copyright [year] " /************************************************************************* * * Project III: Start testing here. @@ -8,16 +9,3 @@ * Date: ? * */ - -#include -#include -using namespace std; -#include "Grid.cpp" - - - -int main() { - Grid display; - int GridRows = 4, GridColumns = 4; - display.printGrid(GridRows, GridColumns); -} diff --git a/test/QuotesTest.cpp b/test/QuotesTest.cpp index d1d2f8117f8757c83825f2d0af24fad563f2dfc3..2d083af8c36c5575a5c1d8e45f6337f986d5ddd3 100644 --- a/test/QuotesTest.cpp +++ b/test/QuotesTest.cpp @@ -2,47 +2,14 @@ #include #include "../main/Quotes.h" -TEST_CASE("Professor Carman's Quote", "[quote]") { +TEST_CASE("Intro Menu", "[quote]") { // Setup Quotes myQuote(9); Quote quote = myQuote.getQuote(15); SECTION("Get Quote") { - REQUIRE(quote.student == "Preston Carman"); - REQUIRE(quote.quote == "Talk is cheap. Show me the code."); - REQUIRE(quote.author == "Linus Torvalds"); - } - - // Teardown -} - -TEST_CASE("Professor Foster's Quote", "[quote]") { - // Setup - Quotes myQuote(14); - - Quote quote = myQuote.getQuote(5); - - SECTION("Get Quote") { - REQUIRE(quote.student == "James Foster"); - REQUIRE(quote.quote == - "The most disastrous thing that you can ever learn is your " - "first programming language."); - REQUIRE(quote.author == "Alan Kay"); - } - - // Teardown -} - -TEST_CASE("Random Quote", "[quote]") { - // Setup - Quotes myQuote(25); - - Quote quote = myQuote.getRandomQuote(); - SECTION("Random Quote") { - REQUIRE(quote.student == "Preston Carman"); - REQUIRE(quote.quote == "Talk is cheap. Show me the code."); - REQUIRE(quote.author == "Linus Torvalds"); + REQUIRE(quote.student == "Welcome! Please select a menu option."); } // Teardown