Skip to content

Commit

Permalink
ch10: update
Browse files Browse the repository at this point in the history
  • Loading branch information
gav2xlin committed Jan 23, 2025
1 parent c9430c6 commit 5866153
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions Chapter10/customer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ find_package(doctest REQUIRED)
find_package(CppUTest REQUIRED)
find_package(ut REQUIRED) # C++20 library
find_package(GTest REQUIRED)
find_package(Boost REQUIRED)

include(CommonCompileFlags)

Expand Down
1 change: 1 addition & 0 deletions Chapter10/customer/conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[requires]
drogon/1.9.8
boost/1.86.0
catch2/3.7.1
doctest/2.4.11
cpputest/4.0
Expand Down
6 changes: 6 additions & 0 deletions Chapter10/customer/test/customer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ target_compile_options(drogontests PRIVATE ${BASE_COMPILE_FLAGS})
target_compile_features(drogontests PRIVATE cxx_std_17)
add_test(NAME drogontests COMMAND drogontests)

add_executable(boosttests boosttest.cpp)
target_link_libraries(boosttests PRIVATE tradefair::libcustomer boost::boost)
target_compile_options(boosttests PRIVATE ${BASE_COMPILE_FLAGS})
target_compile_features(boosttests PRIVATE cxx_std_17)
add_test(NAME boosttests COMMAND boosttests)

add_executable(boostuttests boostuttest.cpp)
target_link_libraries(boostuttests PRIVATE tradefair::libcustomer Boost::ut)
target_compile_options(boostuttests PRIVATE ${BASE_COMPILE_FLAGS})
Expand Down
16 changes: 16 additions & 0 deletions Chapter10/customer/test/customer/boosttest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// TODO: fix transitive dependencies in
// https://conan.io/center/recipes/drogon?version=1.9.8 when with_boost=False
#define BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER
#define BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER

#define BOOST_TEST_MODULE basic_responses
#include <boost/test/included/unit_test.hpp>

#include "customer/responder.h"

BOOST_AUTO_TEST_CASE(given_name_when_prepare_responses_then_greets_friendly) {
const auto name = "Bob";
const auto [status, value] = responder{}.prepare_response(name);
BOOST_CHECK_EQUAL(status, drogon::k200OK);
BOOST_CHECK_EQUAL(value, "Hello, Bob!");
}

0 comments on commit 5866153

Please sign in to comment.