mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
added unit tests
This commit is contained in:
parent
3b6e19653c
commit
6c96e8c6f8
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@ -25,3 +25,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||||
|
|
||||||
|
- name: Unit Test
|
||||||
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target test
|
||||||
|
@ -1,5 +1,32 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(webfuse VERSION 2.0.0)
|
project(webfuse VERSION 2.0.0)
|
||||||
|
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(FUSE REQUIRED IMPORTED_TARGET fuse3)
|
||||||
|
pkg_check_modules(LWS REQUIRED IMPORTED_TARGET libwebsockets)
|
||||||
|
|
||||||
|
add_library(webfuse_static STATIC
|
||||||
|
src/webfuse/webfuse.cpp)
|
||||||
|
|
||||||
|
target_include_directories(webfuse_static PUBLIC src)
|
||||||
|
target_link_libraries(webfuse_static PUBLIC PkgConfig::FUSE PkgConfig::LWS)
|
||||||
|
|
||||||
add_executable(webfuse
|
add_executable(webfuse
|
||||||
src/main.cpp)
|
src/main.cpp)
|
||||||
|
|
||||||
|
target_link_libraries(webfuse PRIVATE webfuse_static)
|
||||||
|
|
||||||
|
if(NOT(WITHOUT_TEST))
|
||||||
|
|
||||||
|
pkg_check_modules(GTEST REQUIRED IMPORTED_TARGET gtest_main)
|
||||||
|
|
||||||
|
add_executable(alltests
|
||||||
|
test/webfuse/test_app.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(alltests PRIVATE webfuse_static PkgConfig::GTEST)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(NAME alltests COMMAND alltests)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <iostream>
|
#include "webfuse/webfuse.hpp"
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
return EXIT_SUCCESS;
|
webfuse::app app(argc, argv);
|
||||||
|
return app.run();
|
||||||
}
|
}
|
27
src/webfuse/webfuse.cpp
Normal file
27
src/webfuse/webfuse.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "webfuse/webfuse.hpp"
|
||||||
|
|
||||||
|
namespace webfuse
|
||||||
|
{
|
||||||
|
|
||||||
|
class app::detail
|
||||||
|
{
|
||||||
|
int dummy;
|
||||||
|
};
|
||||||
|
|
||||||
|
app::app(int argc, char * argv[])
|
||||||
|
: d(new detail)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
app::~app()
|
||||||
|
{
|
||||||
|
delete d;
|
||||||
|
}
|
||||||
|
|
||||||
|
int app::run()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
src/webfuse/webfuse.hpp
Normal file
24
src/webfuse/webfuse.hpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef WEBFUSE_HPP
|
||||||
|
#define WEBFUSE_HPP
|
||||||
|
|
||||||
|
namespace webfuse
|
||||||
|
{
|
||||||
|
|
||||||
|
class app
|
||||||
|
{
|
||||||
|
app(app const &) = delete;
|
||||||
|
app& operator=(app const &) = delete;
|
||||||
|
app(app &&) = delete;
|
||||||
|
app& operator=(app &&) = delete;
|
||||||
|
public:
|
||||||
|
app(int argc, char * argv[]);
|
||||||
|
~app();
|
||||||
|
int run();
|
||||||
|
private:
|
||||||
|
class detail;
|
||||||
|
detail * d;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
9
test/webfuse/test_app.cpp
Normal file
9
test/webfuse/test_app.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include "webfuse/webfuse.hpp"
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
TEST(app, init)
|
||||||
|
{
|
||||||
|
char args0[] = "webfuse";
|
||||||
|
char * args[] = { args0, nullptr };
|
||||||
|
webfuse::app(1, args);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user