From eb6448f8597f4d4c2f647ab8e3bd5fdd9a757570 Mon Sep 17 00:00:00 2001 From: Marko Zivanovic Date: Wed, 2 Sep 2015 12:10:33 +0200 Subject: [PATCH] Initial support for unit testing --- CMakeLists.txt | 8 +++++++ build/.gitignore | 2 ++ src/CMakeLists.txt | 5 +++++ src/SyslogBulkUploader.cpp | 30 +++++++++++++++++++++++++ src/SyslogBulkUploader.h | 38 ++++++++++++++++++++++++++++++++ src/main.cpp | 30 +++++++++++++++++++++++++ test/CMakeLists.txt | 12 ++++++++++ test/SyslogBulkUploaderTests.cpp | 31 ++++++++++++++++++++++++++ 8 files changed, 156 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 build/.gitignore create mode 100644 src/CMakeLists.txt create mode 100644 src/SyslogBulkUploader.cpp create mode 100644 src/SyslogBulkUploader.h create mode 100644 src/main.cpp create mode 100644 test/CMakeLists.txt create mode 100644 test/SyslogBulkUploaderTests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ece8e0f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 2.8) +project(syslog-bulk-uploader) +set(CMAKE_CXX_FLAGS "-g -Wall") +add_subdirectory(src) +add_subdirectory(test) +enable_testing() +add_test(NAME SyslogBulkUploaderTests COMMAND SyslogBulkUploaderTests) + diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/build/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..d46d96e --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,5 @@ +add_library(slbu-lib + SyslogBulkUploader.cpp +) +add_executable(syslog-bulk-uploader main.cpp) +target_link_libraries(syslog-bulk-uploader slbu-lib) diff --git a/src/SyslogBulkUploader.cpp b/src/SyslogBulkUploader.cpp new file mode 100644 index 0000000..b3c57b2 --- /dev/null +++ b/src/SyslogBulkUploader.cpp @@ -0,0 +1,30 @@ +/* + The MIT License (MIT) + +Copyright (c) 2015 Marko Živanović + +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. + */ + +#include "SyslogBulkUploader.h" + +SyslogBulkUploader::SyslogBulkUploader() { +} + + diff --git a/src/SyslogBulkUploader.h b/src/SyslogBulkUploader.h new file mode 100644 index 0000000..2e2cc66 --- /dev/null +++ b/src/SyslogBulkUploader.h @@ -0,0 +1,38 @@ +/* + The MIT License (MIT) + +Copyright (c) 2015 Marko Živanović + +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. + */ + +#ifndef SYSLOGBULKUPLOADER_H +#define SYSLOGBULKUPLOADER_H + +#include + +class SyslogBulkUploader : boost::noncopyable { +public: + SyslogBulkUploader(); +private: + +}; + +#endif /* SYSLOGBULKUPLOADER_H */ + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..f4c34e5 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,30 @@ +/* + The MIT License (MIT) + +Copyright (c) 2015 Marko Živanović + +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. + */ +#include + +int main(int argc, char** argv) { + std::cout << "Hello World!" << std::endl; +} + + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..f3af7b5 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,12 @@ +find_package(Boost COMPONENTS unit_test_framework REQUIRED) +include_directories( + ${TEST_SOURCE_DIR/src} + ${Boost_INLUDE_DIRS} +) +add_definitions(-DBOOST_TEST_DYN_LINK) +add_executable(SyslogBulkUploaderTests SyslogBulkUploaderTests.cpp) +target_link_libraries(SyslogBulkUploaderTests + slbu-lib + ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} +) + diff --git a/test/SyslogBulkUploaderTests.cpp b/test/SyslogBulkUploaderTests.cpp new file mode 100644 index 0000000..6d3b12b --- /dev/null +++ b/test/SyslogBulkUploaderTests.cpp @@ -0,0 +1,31 @@ +/* + The MIT License (MIT) + +Copyright (c) 2015 Marko Živanović + +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. + */ + +#include "../src/SyslogBulkUploader.h" +#define BOOST_TEST_MODULE SyslogBulkUploaderTests +#include + +BOOST_AUTO_TEST_CASE(fakeTest) { + BOOST_CHECK(true); +}