CMakeLists.txt cleanup, added minimal unittest, added run_test coeverage tool, added .gitignore file
parent
772fc95d56
commit
b9f55724d8
@ -0,0 +1,10 @@
|
|||||||
|
*CMakeCache*
|
||||||
|
*CMakeFiles*
|
||||||
|
*Makefile*
|
||||||
|
*cmake
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
*/cov
|
||||||
|
*/lcov.info
|
||||||
|
*/core
|
||||||
|
*.kdev_include_paths
|
@ -1,17 +1,11 @@
|
|||||||
cmake_minimum_required (VERSION 2.6)
|
cmake_minimum_required (VERSION 2.6)
|
||||||
project (CPP_UTILS_LIB)
|
project (CPP_UTILS_LIB)
|
||||||
|
|
||||||
message(STATUS "Lib dir:")
|
set (CXX_FLAGS "-Wall -Wextra -pedantic -Weffc++ -Wshadow -ggdb -fprofile-arcs -ftest-coverage")
|
||||||
|
|
||||||
set (CXX_FLAGS "-Wall -Wextra -pedantic")
|
|
||||||
add_definitions( ${CXX_FLAGS} )
|
add_definitions( ${CXX_FLAGS} )
|
||||||
message(STATUS "g++ flags: ${CXX_FLAGS}")
|
|
||||||
|
|
||||||
include_directories (../include)
|
include_directories (../include)
|
||||||
message(STATUS "include dir: ${CPP_UTILS_LIB}/include")
|
|
||||||
|
|
||||||
aux_source_directory(../src CPP_UTILS_LIB_SOURCES)
|
aux_source_directory(../src CPP_UTILS_LIB_SOURCES)
|
||||||
message(STATUS "sources: ${CPP_UTILS_LIB_SOURCES}")
|
|
||||||
|
|
||||||
add_library (CppUtils ${CPP_UTILS_LIB_SOURCES})
|
add_library (CppUtils SHARED ${CPP_UTILS_LIB_SOURCES})
|
||||||
target_link_libraries(CppUtils pthread rt)
|
target_link_libraries(CppUtils pthread rt gcov)
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
#include <cxxtest/TestSuite.h>
|
||||||
|
|
||||||
|
#include "Singleton.hpp"
|
||||||
|
|
||||||
|
class MyTestSuite : public CxxTest::TestSuite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void testAddition( void )
|
||||||
|
{
|
||||||
|
TS_ASSERT( 1 + 1 > 1 );
|
||||||
|
TS_ASSERT_EQUALS( 1 + 1, 2 );
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,36 @@
|
|||||||
|
#include <cxxtest/TestSuite.h>
|
||||||
|
/*
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>*/
|
||||||
|
|
||||||
|
#include "ThreadPool.hpp"
|
||||||
|
#include "Task.hpp"
|
||||||
|
#include "Common.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
class MyTestSuite : public CxxTest::TestSuite
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void testACica()
|
||||||
|
{
|
||||||
|
TRACE("Main start");
|
||||||
|
|
||||||
|
ThreadPool* tp = new ThreadPool(5);
|
||||||
|
tp->startWorkerThreads();
|
||||||
|
|
||||||
|
Task* t1 = new Task();
|
||||||
|
tp->pushTask(t1);
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
tp->stop();
|
||||||
|
tp->join();
|
||||||
|
delete tp;
|
||||||
|
|
||||||
|
TRACE("Main end");
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in new issue