Refine CMake, update UT.
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
# Unit test
|
||||
if(CSOAP_ENABLE_UT)
|
||||
if(WEBCC_BUILD_UNITTEST)
|
||||
set(UT_SRCS
|
||||
rest_service_manager_test.cc
|
||||
)
|
||||
|
||||
set(UT_TARGET_NAME csoap_unittest)
|
||||
set(UT_TARGET_NAME webcc_unittest)
|
||||
|
||||
add_executable(${UT_TARGET_NAME} ${UT_SRCS})
|
||||
target_link_libraries(${UT_TARGET_NAME} csoap pugixml gtest)
|
||||
target_link_libraries(${UT_TARGET_NAME} webcc pugixml gtest ${Boost_LIBRARIES})
|
||||
target_link_libraries(${UT_TARGET_NAME} "${CMAKE_THREAD_LIBS_INIT}")
|
||||
|
||||
add_test(${UT_TARGET_NAME} ${UT_TARGET_NAME})
|
||||
endif()
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
#include "csoap/rest_server.h"
|
||||
#include "webcc/rest_server.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace csoap;
|
||||
using namespace webcc;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestRestService : public RestService {
|
||||
public:
|
||||
~TestRestService() override {
|
||||
}
|
||||
|
||||
bool Handle(const std::string& http_method,
|
||||
const std::string& request,
|
||||
std::string* response) override {
|
||||
const std::vector<std::string>& url_sub_matches,
|
||||
const std::string& request_content,
|
||||
std::string* response_content) override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user