Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #130

Merged
merged 26 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
af3fcac
created Meal, Bun and Ingredient classes
JMPastoll Nov 1, 2023
edb048b
Completed making function definitions for Order.cpp and related Classes
Remiku-bit Nov 1, 2023
a8448ee
Fixed small errors in Ingredient, Bun and Meal
JMPastoll Nov 2, 2023
48e71d4
Merge pull request #105 from waveyboym/Jaide
u22528492 Nov 2, 2023
a17bc4d
changed bool to shared_ptr<Meal>
Remiku-bit Nov 2, 2023
f6753c7
Merge pull request #107 from waveyboym/lunga
waveyboym Nov 2, 2023
ac6eb5c
Added super basic Meal initialisation unit tests
u22528492 Nov 2, 2023
a5eef61
Added simple getTotalCost Unit Test
u22528492 Nov 3, 2023
b59c9b9
Added more meal unit tests for:
u22528492 Nov 3, 2023
6b5797e
Implementation of Orders(and related Child Classes) added, Testing St…
Remiku-bit Nov 3, 2023
126cb5a
Completed Basic Testing Of Orders
Remiku-bit Nov 4, 2023
8d39a8c
Merge pull request #120 from waveyboym/develop
u22528492 Nov 4, 2023
b493910
Created Integration Test File
u22528492 Nov 4, 2023
614c3b1
Merge branch 'Jaden-Order-to-Serving-Food-Integration-Testing' into J…
u22528492 Nov 4, 2023
7106c26
Fisxed toStrings
u22528492 Nov 4, 2023
c980dd1
Merge branch 'Jaden-Meal-Unit-Tests' of https://github.com/waveyboym/…
u22528492 Nov 4, 2023
fe4f94b
Merge pull request #122 from waveyboym/Jaden-Meal-Unit-Tests
u22528492 Nov 4, 2023
2b4202e
Merge branch 'develop' into unit-test-orders
waveyboym Nov 4, 2023
b8edaec
Update Order.cpp
waveyboym Nov 4, 2023
0f3295d
Delete src/backend/Order/Order.cpp
waveyboym Nov 4, 2023
e9a049a
Update tests.cpp
waveyboym Nov 4, 2023
2ff5c45
Merge pull request #123 from waveyboym/unit-test-orders
waveyboym Nov 4, 2023
cce4658
Create ,gitignore
waveyboym Nov 4, 2023
7fce53d
Rename ,gitignore to .gitignore
waveyboym Nov 4, 2023
54dfda4
Delete .vscode/settings.json
waveyboym Nov 4, 2023
db5f657
Merge pull request #124 from waveyboym/waveyboym-patch-1
waveyboym Nov 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
48 changes: 48 additions & 0 deletions src/backend/Meal/Bun.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "../includes/Bun.hpp"

Bun::Bun(std::string name, double cost): Meal(name, cost){
this->setTotalCost(cost);
}

std::string Bun::getItemizedList(std::string tail){
double value = this->getCost();
std::ostringstream stream;
stream << std::fixed << std::setprecision(2) << value;
std::string result = stream.str();

std::string out = this->getName() + " R" + result + "\n";
out += tail;

value = this->getTotalCost();
std::ostringstream stream2;
stream2 << std::fixed << std::setprecision(2) << value;
result = stream2.str();

out += "\nTotal: R" + result;
return out;
}

std::string Bun::getItemizedList(){
double value = this->getCost();
std::ostringstream stream;
stream << std::fixed << std::setprecision(2) << value;
std::string result = stream.str();

std::string out = this->getName() + " R" + result + "\n";

value = this->getTotalCost();
std::ostringstream stream2;
stream2 << std::fixed << std::setprecision(2) << value;
result = stream2.str();

out += "\nTotal: R" + result;
return out;
}

double Bun::getTotalCost(){
return this->totalCost;
}

void Bun::setTotalCost(double c){
this->totalCost += c;
}
13 changes: 13 additions & 0 deletions src/backend/Meal/ConcreteBuns.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "../includes/ConcreteBuns.hpp"

NoBun::NoBun(): Bun("no bun", 0){};
std::string NoBun::getItemizedList(){
return "\nTotal: R" + std::to_string(this->getTotalCost());
}
std::string NoBun::getItemizedList(std::string tail){
return "tail + \nTotal: R" + std::to_string(this->getTotalCost());
}

PlainBun::PlainBun() : Bun("Plain bun", 10){}

WholewheatBun::WholewheatBun(): Bun("Wholewheat Bun", 15.13){}
29 changes: 29 additions & 0 deletions src/backend/Meal/ConcreteIngredients.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "../includes/ConcreteIngredients.hpp"

//Patties
BeefPatty::BeefPatty(std::shared_ptr<Meal> meal) : Ingredient("Beef Patty", 10, meal){}
ChickenPatty::ChickenPatty(std::shared_ptr<Meal> meal) : Ingredient("Chicken Patty", 10.99, meal){}
VeggiePatty::VeggiePatty(std::shared_ptr<Meal> meal) : Ingredient("Chicken Patty", 8.52, meal){}

//Toppings
Pickles::Pickles(std::shared_ptr<Meal> meal) : Ingredient("Pickles", 4, meal){}
Onion::Onion(std::shared_ptr<Meal> meal) : Ingredient("Fresh Red Onion", 3.12, meal){}
CaramelizedOnion::CaramelizedOnion(std::shared_ptr<Meal> meal) : Ingredient("Caramelized Onion", 6.54, meal){}
Tomato::Tomato(std::shared_ptr<Meal> meal) : Ingredient("Tomato", 2.57, meal){}
Cheese::Cheese(std::shared_ptr<Meal> meal) : Ingredient("Cheese", 4.38, meal){}
Lettuce::Lettuce(std::shared_ptr<Meal> meal) : Ingredient("Lettuce", 1.20, meal){}
Pineapple::Pineapple(std::shared_ptr<Meal> meal) : Ingredient("Pineapple", 12.99, meal){}

//Side Dishes
Fries::Fries(std::shared_ptr<Meal> meal) : Ingredient("Fries", 10.25, meal){}
Salad::Salad(std::shared_ptr<Meal> meal) : Ingredient("Salad", 11.15, meal){}

//Sauces
TomatoSauce::TomatoSauce(std::shared_ptr<Meal> meal) : Ingredient("Tomato Sauce", 2.01, meal){}
BBQSauce::BBQSauce(std::shared_ptr<Meal> meal) : Ingredient("Barbecue Sauce", 2.14, meal){}
Mayo::Mayo(std::shared_ptr<Meal> meal) : Ingredient("Mayonnaise", 2.18, meal){}

//Drinks
Water::Water(std::shared_ptr<Meal> meal) : Ingredient("Water", 0, meal){}
ColdDrink::ColdDrink(std::shared_ptr<Meal> meal) : Ingredient("Cold Drink",12.30, meal){}
Juice::Juice(std::shared_ptr<Meal> meal) : Ingredient("Juice", 14.36, meal){}
50 changes: 50 additions & 0 deletions src/backend/Meal/Ingredient.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#include "../includes/Ingredient.hpp"

Ingredient::Ingredient(std::string name, double cost, std::shared_ptr<Meal> m): Meal(name, cost), meal(m){
this->meal->setTotalCost(cost);
}

double Ingredient::getTotalCost(){
if(meal){
return meal->getTotalCost();
}
else{
return 0;
}
}

void Ingredient::setTotalCost(double c){
if(meal){
meal->setTotalCost(c);
}
}

std::string Ingredient::getItemizedList(){
if(meal){
double value = this->getCost();
std::ostringstream stream;
stream << std::fixed << std::setprecision(2) << value;
std::string result = stream.str();

std::string s = this->getName() + " R" + result + "\n";
return meal->getItemizedList(s);
}
else{
return "";
}
}

std::string Ingredient::getItemizedList(std::string tail){
if(meal){
double value = this->getCost();
std::ostringstream stream;
stream << std::fixed << std::setprecision(2) << value;
std::string result = stream.str();

std::string mine = this->getName() + " R" + result + "\n";
return meal->getItemizedList(mine + tail);
}
else{
return "";
}
}
15 changes: 15 additions & 0 deletions src/backend/Meal/Meal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "../includes/Meal.hpp"

Meal::Meal(std::string name, double cost){
this->name = name;
this->cost = cost;
}

std::string Meal::getName(){
return this->name;
}

double Meal::getCost(){
return this->cost;
}

12 changes: 12 additions & 0 deletions src/backend/Orders/AddBBQSauce.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "../includes/AddBBQSauce.hpp"

AddBBQSauce::AddBBQSauce():Order(){}

std::shared_ptr<Meal> AddBBQSauce::executeOrder(std::shared_ptr<Meal> m){
if(addedToList){
return m;
}else{
addedToList = true;
return std::make_shared<BBQSauce>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddBeefBurgerPatty.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddBeefBurgerPatty.hpp"

std::shared_ptr<Meal> AddBeefBurgerPatty::executeOrder(std::shared_ptr<Meal> m){
if(addedToList){
return m;
}else{
addedToList = true;
return std::make_shared<BeefPatty>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddCaramelizedOnion.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddCaramelizedOnion.hpp"

std::shared_ptr<Meal> AddCaramelizedOnion::executeOrder(std::shared_ptr<Meal> m){
if(addedToList){
return m;
}else{
addedToList = true;
return std::make_shared<CaramelizedOnion>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddCheese.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddCheese.hpp"

std::shared_ptr<Meal> AddCheese::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<Cheese>(m);
}
}
11 changes: 11 additions & 0 deletions src/backend/Orders/AddChickenBurgerPatty.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "../includes/AddChickenBurgerPatty.hpp"

std::shared_ptr<Meal> AddChickenBurgerPatty::executeOrder(
std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<ChickenPatty>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddColdDrink.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddColdDrink.hpp"

std::shared_ptr<Meal> AddColdDrink::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<ColdDrink>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddFries.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddFries.hpp"

std::shared_ptr<Meal> AddFries::executeOrder(std::shared_ptr<Meal> m){
if(addedToList){
return m;
}else{
addedToList = true;
return std::make_shared<Fries>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddJuice.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddJuice.hpp"

std::shared_ptr<Meal> AddJuice::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<Juice>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddLettuce.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddLettuce.hpp"

std::shared_ptr<Meal> AddLettuce::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<Lettuce>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddMayo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddMayo.hpp"

std::shared_ptr<Meal> AddMayo::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<Mayo>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddNoBun.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddNoBun.hpp"

std::shared_ptr<Meal> AddNoBun::executeOrder(std::shared_ptr<Meal> m){
if(addedToList)
return m;
else{
addedToList=true;
return std::make_shared<NoBun>();
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddNormalBun.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddNormalBun.hpp"

std::shared_ptr<Meal> AddNormalBun::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<PlainBun>();
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddOnion.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddOnion.hpp"

std::shared_ptr<Meal> AddOnion::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<Onion>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddPickles.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddPickles.hpp"

std::shared_ptr<Meal> AddPickles::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<Pickles>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddPineapple.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddPineapple.hpp"

std::shared_ptr<Meal> AddPineApple::executeOrder(std::shared_ptr<Meal> m){
if(addedToList){
return m;
}else{
addedToList = true;
return std::make_shared<Pineapple>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddTomato.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddTomato.hpp"

std::shared_ptr<Meal> AddTomato::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<Tomato>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddVeggieBurgerPatty.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddVeggieBurgerPatty.hpp"

std::shared_ptr<Meal> AddVeggieBurgerPatty::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<VeggiePatty>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddWater.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddWater.hpp"

std::shared_ptr<Meal> AddWater::executeOrder(std::shared_ptr<Meal> m) {
if (addedToList) {
return m;
} else {
addedToList = true;
return std::make_shared<Water>(m);
}
}
10 changes: 10 additions & 0 deletions src/backend/Orders/AddWholeWheatBun.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../includes/AddWholeWheatBun.hpp"

std::shared_ptr<Meal> AddWholeWheatBun::executeOrder(std::shared_ptr<Meal> m){
if(addedToList){
return m;
}else{
addedToList = true;
return std::make_shared<WholewheatBun>();
}
}
Loading