diff --git a/tools/lutin_test-debug.py b/tools/lutin_test-debug.py new file mode 100644 index 0000000..fe0ea35 --- /dev/null +++ b/tools/lutin_test-debug.py @@ -0,0 +1,19 @@ +#!/usr/bin/python +import lutin.module as module +import lutin.tools as tools +import lutin.debug as debug + +def get_desc(): + return "basic debug log for test" + + +def create(target): + myModule = module.Module(__file__, 'test-debug', 'LIBRARY') + myModule.add_src_file([ + 'test-debug/debug.cpp' + ]) + myModule.add_module_depend('etk') + myModule.add_export_path(tools.get_current_path(__file__)) + return myModule + + diff --git a/tools/test-debug/debug.cpp b/tools/test-debug/debug.cpp new file mode 100644 index 0000000..7fc1d8c --- /dev/null +++ b/tools/test-debug/debug.cpp @@ -0,0 +1,15 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include + +int32_t test::getLogId() { + static int32_t g_val = etk::log::registerInstance("test"); + return g_val; +} + diff --git a/tools/test-debug/debug.h b/tools/test-debug/debug.h new file mode 100644 index 0000000..8ceacd4 --- /dev/null +++ b/tools/test-debug/debug.h @@ -0,0 +1,49 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include + +#ifndef __TEST_DEBUG_H__ +#define __TEST_DEBUG_H__ + +#include + +namespace test { + int32_t getLogId(); +}; + +#define TEST_BASE(info,data) TK_LOG_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) + +#endif +