first import
This commit is contained in:
commit
e30a6b3e85
5 changed files with 293 additions and 0 deletions
14
tests/CMakeLists.txt
Normal file
14
tests/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
function(add_simple_test tname)
|
||||
add_executable(${tname} ${tname}.cpp)
|
||||
add_test(NAME ${tname} COMMAND ${tname})
|
||||
endfunction()
|
||||
|
||||
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
|
||||
|
||||
foreach(filename ${sources})
|
||||
# File name without directory or longest extension
|
||||
get_filename_component(name ${filename} NAME_WE)
|
||||
add_simple_test(${name})
|
||||
endforeach()
|
||||
|
||||
34
tests/t-core.cpp
Normal file
34
tests/t-core.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "../clutchlog/clutchlog.h"
|
||||
|
||||
void g()
|
||||
{
|
||||
CLUTCHLOG(info, "!");
|
||||
}
|
||||
|
||||
void f()
|
||||
{
|
||||
CLUTCHLOG(warning, "world");
|
||||
g();
|
||||
}
|
||||
|
||||
int main(const int argc, char* argv[])
|
||||
{
|
||||
#ifdef WITH_CLUTCHLOG
|
||||
auto& log = clutchlog::logger();
|
||||
|
||||
log.out(std::clog);
|
||||
|
||||
size_t below = 2;
|
||||
if(argc >= 2) { below = atoi(argv[1]); }
|
||||
log.depth(below);
|
||||
|
||||
log.threshold(clutchlog::level::warning);
|
||||
|
||||
log.file("core");
|
||||
log.func("(main|f)");
|
||||
#endif
|
||||
|
||||
CLUTCHLOG(error, "hello " << argc);
|
||||
|
||||
f();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue