[DEV] get back the test-debug basic handle

This commit is contained in:
Edouard DUPIN 2016-10-02 10:35:29 +02:00
parent c9655922b6
commit 83f501010a
4 changed files with 100 additions and 2 deletions

View File

@ -21,10 +21,10 @@ def create(target, module_name):
'*operator<<*',
])
my_module.add_exclude_file([
'debug.h',
'debug.hpp',
])
my_module.add_file_patterns([
'*.h',
'*.hpp',
'*.md',
])

40
lutin_test-debug.py Normal file
View File

@ -0,0 +1,40 @@
#!/usr/bin/python
import lutin.module as module
import lutin.tools as tools
import lutin.debug as debug
def get_type():
return "LIBRARY"
def get_sub_type():
return "TEST"
def get_desc():
return "basic debug log for test"
def get_licence():
return "APACHE-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
def create(target, module_name):
my_module = module.Module(__file__, module_name, get_type())
my_module.add_src_file([
'test-debug/debug.cpp'
])
my_module.add_header_file([
'test-debug/debug.hpp'
])
my_module.add_depend('etk')
my_module.add_path(tools.get_current_path(__file__))
return my_module

13
test-debug/debug.cpp Normal file
View File

@ -0,0 +1,13 @@
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license APACHE v2.0 (see license file)
*/
#include <test-debug/debug.hpp>
int32_t test::getLogId() {
static int32_t g_val = elog::registerInstance("test");
return g_val;
}

45
test-debug/debug.hpp Normal file
View File

@ -0,0 +1,45 @@
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license APACHE v2.0 (see license file)
*/
#include <etk/types.hpp>
#pragma once
#include <elog/log.hpp>
namespace test {
int32_t getLogId();
};
#define TEST_BASE(info,data) ELOG_BASE(test::getLogId(),info,data)
#define TEST_PRINT(data) TEST_BASE(-1, data)
#define TEST_CRITICAL(data) TEST_BASE(1, data)
#define TEST_ERROR(data) TEST_BASE(2, data)
#define TEST_WARNING(data) TEST_BASE(3, data)
#ifdef DEBUG
#define TEST_INFO(data) TEST_BASE(4, data)
#define TEST_DEBUG(data) TEST_BASE(5, data)
#define TEST_VERBOSE(data) TEST_BASE(6, data)
#define TEST_TODO(data) TEST_BASE(4, "TODO : " << data)
#else
#define TEST_INFO(data) do { } while(false)
#define TEST_DEBUG(data) do { } while(false)
#define TEST_VERBOSE(data) do { } while(false)
#define TEST_TODO(data) do { } while(false)
#endif
#define TEST_HIDDEN(data) do { } while(false)
#define TEST_ASSERT(cond,data) \
do { \
if (!(cond)) { \
TEST_CRITICAL(data); \
assert(!#cond); \
} \
} while (0)