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

pizzas #99

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 24 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
cmake_minimum_required(VERSION 3.11.0)
project(pizzas)

set(CMAKE_CXX_STANDARD 17)
set(SRC_LIST src/Funghi.cpp src/Margherita.cpp src/Pizza.cpp src/Pizzeria.cpp)
set(TEST_SRC_LIST test/test_main.cpp)


include(FetchContent)
FetchContent_Declare (googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG v1.14.0)
set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

include_directories(${CMAKE_SOURCE_DIR}/src)

link_libraries(gmock)
add_library(${PROJECT_NAME}-lib STATIC ${SRC_LIST} ${TEST_SRC_LIST})
add_executable(${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}-lib)

add_executable(${PROJECT_NAME}-ut test/PizzeriaTest.cpp)
target_link_libraries(${PROJECT_NAME}-ut ${PROJECT_NAME}-lib)

enable_testing()
add_test(NAME someTests COMMAND ${PROJECT_NAME}-ut)

# TODO: Write proper build system :)
2 changes: 1 addition & 1 deletion src/Pizza.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ std::string Pizza::getName() const

double Pizza::getPrice() const
{
return 30.0;
return price_;
}

minutes Pizza::getBakingTime() const
Expand Down
4 changes: 2 additions & 2 deletions src/Pizzeria.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void Pizzeria::bakePizzas(int orderId)
}
std::get<Status>(*order) = Status::Baked;
}
throw std::invalid_argument("Order with id: " + std::to_string(orderId) + "not found");
//throw std::invalid_argument("Order with id: " + std::to_string(orderId) + "not found");
}

void Pizzeria::completeOrder(int orderId)
Expand All @@ -67,7 +67,7 @@ void Pizzeria::completeOrder(int orderId)
std::cout << "Order " << orderId << " completed" << std::endl;
std::get<Status>(*order) = Status::Completed;
}
throw std::invalid_argument("Order with id: " + std::to_string(orderId) + "not found");
//throw std::invalid_argument("Order with id: " + std::to_string(orderId) + "not found");
}


1 change: 1 addition & 0 deletions test/PizzeriaTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Pizzeria.hpp"
#include "Margherita.hpp"
#include "Funghi.hpp"
#include "Pizza.hpp"

using namespace std;
using namespace ::testing;
Expand Down
Loading