added first batch
This commit is contained in:
parent
b9d9b65a1d
commit
22d42fa236
9 changed files with 107 additions and 0 deletions
5
.clang-format
Normal file
5
.clang-format
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
BasedOnStyle: Mozilla
|
||||||
|
IndentWidth: 4
|
||||||
|
...
|
||||||
|
# vim: set filetype=yaml:
|
4
.cmake-format.yaml
Normal file
4
.cmake-format.yaml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
format:
|
||||||
|
tab_size: 4
|
||||||
|
use_tabchars: true
|
||||||
|
fractional_tab_policy: round-up
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -66,3 +66,4 @@ tags
|
||||||
*.exe
|
*.exe
|
||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
/version.hpp
|
||||||
|
|
|
@ -1,2 +1,45 @@
|
||||||
# CMake configuration for demo project
|
# CMake configuration for demo project
|
||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_CLANG_TIDY clang-tidy)
|
||||||
|
set(BOOST_ENABLE_CMAKE ON)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND git describe --tags --dirty --always
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE VERSION_STRING
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
string(REGEX REPLACE "^v?([0-9]+)\\.([0-9]+)\\.([0-9]+).*$" "\\1.\\2.\\3"
|
||||||
|
MODIFIED_VERSION_STRING "${VERSION_STRING}")
|
||||||
|
project(
|
||||||
|
collector
|
||||||
|
VERSION ${MODIFIED_VERSION_STRING}
|
||||||
|
LANGUAGES CXX)
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
set(FETCHCONTENT_QUIET FALSE)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
boostorg
|
||||||
|
GIT_REPOSITORY https://github.com/boostorg/boost.git
|
||||||
|
GIT_TAG boost-1.80.0
|
||||||
|
GIT_PROGRESS TRUE
|
||||||
|
GIT_SHALLOW TRUE
|
||||||
|
FETCHCONTENT_QUIET FALSE)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(boostorg)
|
||||||
|
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
configure_file(version.hpp.in ${PROJECT_SOURCE_DIR}/version.hpp)
|
||||||
|
|
||||||
|
add_executable(collector_test test.cpp)
|
||||||
|
target_compile_options(${PROJECT_NAME}_test PUBLIC -Wall -Wextra -Wshadow
|
||||||
|
-Wnon-virtual-dtor)
|
||||||
|
add_test(NAME test1 COMMAND collector_test)
|
||||||
|
|
||||||
|
target_link_libraries(collector_test PRIVATE Boost::filesystem Boost::system
|
||||||
|
Boost::unit_test_framework)
|
||||||
|
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Tobias Schmidl
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
14
collector.hpp
Normal file
14
collector.hpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#pragma once
|
||||||
|
#include <deque>
|
||||||
|
namespace collector
|
||||||
|
{
|
||||||
|
class Event
|
||||||
|
{};
|
||||||
|
class Collector
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::deque<Event> _event_queue;
|
||||||
|
public:
|
||||||
|
const auto get_length() const { return _event_queue.size(); }
|
||||||
|
};
|
||||||
|
}
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
cmakelang[yaml]~=0.6.13
|
13
test.cpp
Normal file
13
test.cpp
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#include "collector.hpp"
|
||||||
|
#include "version.hpp"
|
||||||
|
#define BOOST_TEST_MODULE Collector test
|
||||||
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
using namespace collector;
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(collector_test)
|
||||||
|
{
|
||||||
|
BOOST_TEST_MESSAGE( "Test version " << VERSION );
|
||||||
|
Collector foo;
|
||||||
|
BOOST_TEST(foo.get_length() == 0u);
|
||||||
|
}
|
5
version.hpp.in
Normal file
5
version.hpp.in
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#define VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||||
|
#define VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||||
|
#define VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||||
|
#define VERSION_TWEAK @PROJECT_VERSION_TWEAK@
|
||||||
|
#define VERSION "@PROJECT_VERSION@"
|
Loading…
Add table
Reference in a new issue