From: batt Date: Fri, 29 Aug 2008 20:18:09 +0000 (+0000) Subject: Drop the magical test macros. X-Git-Tag: 2.0.0~177 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=e94a42a80537a6a2bd92be602d308eff4bc6d127;p=bertos.git Drop the magical test macros. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1757 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cfg/nothing.h b/bertos/cfg/nothing.h deleted file mode 100644 index 4c18a123..00000000 --- a/bertos/cfg/nothing.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * \file - * - * - * \brief Empty file used to include "nothing" in macro expansion. - * - * If you want to conditionally include some file you can use this module - * as a dummy header: - * - * \code - * #if COND - * #define MYHEADER - * #else - * #define MYHEADER - * #endif - * \endcode - * - * \version $Id$ - * - * \author Francesco Sacchi - */ - diff --git a/bertos/cfg/test.h b/bertos/cfg/test.h index 23ca1425..37425026 100644 --- a/bertos/cfg/test.h +++ b/bertos/cfg/test.h @@ -75,33 +75,25 @@ #if defined(ARCH_UNITTEST) && (ARCH & ARCH_UNITTEST) #define UNIT_TEST 1 - - /** - * Macro used to generate a main() for a test to be compiled - * on hosted platform. - */ - #define TEST_MAIN(module) \ - int main(void) \ - { \ - if (module##_testSetup() != 0) \ - return 1; \ - if (module##_testRun() != 0) \ - return 2; \ - if (module##_testTearDown() != 0) \ - return 3; \ - return 0; \ - } - - /** This macro will include the specified file only in test-mode */ - #define TEST_ONLY(file) PP_STRINGIZE(file) - -#else /* !_TEST */ +#else /* !TEST */ #define UNIT_TEST 0 +#endif /* TEST */ - #define TEST_MAIN(module) /* nothing */ - #define TEST_ONLY(file) - -#endif /* _TEST */ +/** + * Macro used to generate a main() for a test to be compiled + * on hosted platform. + */ +#define TEST_MAIN(module) \ +int main(void) \ +{ \ + if (module##_testSetup() != 0) \ + return 1; \ + if (module##_testRun() != 0) \ + return 2; \ + if (module##_testTearDown() != 0) \ + return 3; \ + return 0; \ +} /** * Silent an assert in a test. diff --git a/bertos/drv/timer_test.c b/bertos/drv/timer_test.c index 9c649a31..2171db06 100644 --- a/bertos/drv/timer_test.c +++ b/bertos/drv/timer_test.c @@ -154,12 +154,14 @@ int timer_testTearDown(void) return 0; } -#include TEST_ONLY(drv/timer.c) -#include TEST_ONLY(drv/kdebug.c) -#include TEST_ONLY(mware/event.c) -#include TEST_ONLY(mware/formatwr.c) -#include TEST_ONLY(mware/hex.c) -#include TEST_ONLY(os/hptime.c) - -TEST_MAIN(timer); +#if UNIT_TEST + #include + #include + #include + #include + #include + #include + + TEST_MAIN(timer); +#endif