From: batt Date: Tue, 2 Dec 2008 16:01:33 +0000 (+0000) Subject: Remove c files inclusions: use libunittest instead. X-Git-Tag: 2.1.0~719 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=747bcac9a31ecd296ee45ff28090dde5707fc264;p=bertos.git Remove c files inclusions: use libunittest instead. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1963 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/algo/ramp_test.c b/bertos/algo/ramp_test.c index 918257f3..7666662f 100644 --- a/bertos/algo/ramp_test.c +++ b/bertos/algo/ramp_test.c @@ -184,12 +184,4 @@ int ramp_testRun(void) return 0; } -#if UNIT_TEST - #include "ramp.c" - #include - #include - #include - - TEST_MAIN(ramp); -#endif - +TEST_MAIN(ramp); diff --git a/bertos/cfg/test.h b/bertos/cfg/test.h index 048ff57b..ffa3a8d5 100644 --- a/bertos/cfg/test.h +++ b/bertos/cfg/test.h @@ -75,25 +75,28 @@ #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; \ + } #else /* !TEST */ #define UNIT_TEST 0 + + #define TEST_MAIN(module) /* nothing */ #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 a7839f41..07e75a66 100644 --- a/bertos/drv/timer_test.c +++ b/bertos/drv/timer_test.c @@ -154,14 +154,5 @@ int timer_testTearDown(void) return 0; } -#if UNIT_TEST - #include - #include - #include - #include - #include - #include - - TEST_MAIN(timer); -#endif +TEST_MAIN(timer); diff --git a/bertos/fs/battfs_test.c b/bertos/fs/battfs_test.c index dbaec18c..642e6d64 100644 --- a/bertos/fs/battfs_test.c +++ b/bertos/fs/battfs_test.c @@ -1144,12 +1144,6 @@ int battfs_testTearDown(void) return 0; } -TEST_MAIN(battfs) - -#include -#include -#include -#include -#include +TEST_MAIN(battfs); #endif // _TEST diff --git a/bertos/kern/proc_test.c b/bertos/kern/proc_test.c index e06e984f..dafd7cb9 100644 --- a/bertos/kern/proc_test.c +++ b/bertos/kern/proc_test.c @@ -91,7 +91,6 @@ int proc_testRun(void) return 0; } -#if UNIT_TEST int proc_testSetup(void) { @@ -112,24 +111,4 @@ int proc_testTearDown(void) return 0; } -#include -#include -#include -#include -#include -#if CONFIG_KERN_PREEMPT - #include - #include -#else - #include - // FIXME: we need to link with the switch asm code too! -#endif -#include -#include -#include -#include -#include - TEST_MAIN(proc); - -#endif // _TEST