mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
test: add LaminarTest stub
This commit is contained in:
parent
e7cba68879
commit
46efb07285
@ -93,8 +93,8 @@ set(BUILD_TESTS FALSE CACHE BOOL "Build tests")
|
|||||||
if(BUILD_TESTS)
|
if(BUILD_TESTS)
|
||||||
find_package(GTest REQUIRED)
|
find_package(GTest REQUIRED)
|
||||||
include_directories(${GTEST_INCLUDE_DIRS} src)
|
include_directories(${GTEST_INCLUDE_DIRS} src)
|
||||||
add_executable(laminar-tests src/conf.cpp src/database.cpp src/run.cpp src/server.cpp laminar.capnp.c++ src/resources.cpp ${COMPRESSED_BINS} test/test-conf.cpp test/test-database.cpp test/test-run.cpp test/test-server.cpp)
|
add_executable(laminar-tests src/conf.cpp src/database.cpp src/laminar.cpp src/run.cpp src/server.cpp laminar.capnp.c++ src/resources.cpp ${COMPRESSED_BINS} test/test-conf.cpp test/test-database.cpp test/test-laminar.cpp test/test-run.cpp test/test-server.cpp)
|
||||||
target_link_libraries(laminar-tests ${GTEST_BOTH_LIBRARIES} gmock capnp-rpc capnp kj-async kj pthread boost_filesystem boost_system sqlite3)
|
target_link_libraries(laminar-tests ${GTEST_BOTH_LIBRARIES} gmock capnp-rpc capnp kj-async kj pthread boost_filesystem boost_system sqlite3 z)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS laminard laminarc RUNTIME DESTINATION usr/bin)
|
install(TARGETS laminard laminarc RUNTIME DESTINATION usr/bin)
|
||||||
|
@ -91,6 +91,8 @@ Laminar::Laminar() {
|
|||||||
buildNums[name] = build;
|
buildNums[name] = build;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
srv = nullptr;
|
||||||
|
|
||||||
// This is only a separate function because I imagined that it would
|
// This is only a separate function because I imagined that it would
|
||||||
// be nice to reload some configuration during runtime without restarting
|
// be nice to reload some configuration during runtime without restarting
|
||||||
// the server completely. Currently not called from anywhere else
|
// the server completely. Currently not called from anywhere else
|
||||||
|
34
test/test-laminar.cpp
Normal file
34
test/test-laminar.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
///
|
||||||
|
/// Copyright 2018 Oliver Giles
|
||||||
|
///
|
||||||
|
/// This file is part of Laminar
|
||||||
|
///
|
||||||
|
/// Laminar is free software: you can redistribute it and/or modify
|
||||||
|
/// it under the terms of the GNU General Public License as published by
|
||||||
|
/// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
/// (at your option) any later version.
|
||||||
|
///
|
||||||
|
/// Laminar is distributed in the hope that it will be useful,
|
||||||
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
/// GNU General Public License for more details.
|
||||||
|
///
|
||||||
|
/// You should have received a copy of the GNU General Public License
|
||||||
|
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
///
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <rapidjson/stringbuffer.h>
|
||||||
|
#include <rapidjson/document.h>
|
||||||
|
#include "laminar.h"
|
||||||
|
|
||||||
|
class TestLaminarClient : public LaminarClient {
|
||||||
|
public:
|
||||||
|
virtual void sendMessage(std::string p) { payload = p; }
|
||||||
|
std::string payload;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LaminarTest : public ::testing::Test {
|
||||||
|
protected:
|
||||||
|
Laminar laminar;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user