c++: tests: add extern "C" in header files, i.e. only present in ./unittests

This commit is contained in:
BytesGalore 2014-10-10 08:03:06 +02:00
parent 8c3a207a3f
commit 6dc157208a
21 changed files with 169 additions and 0 deletions

View File

@ -35,6 +35,10 @@
#ifndef __HELPERMACRO_H__ #ifndef __HELPERMACRO_H__
#define __HELPERMACRO_H__ #define __HELPERMACRO_H__
#ifdef __cplusplus
extern "C" {
#endif
#define EMB_UNIT_TESTCASE(ca,sup,tdw,run) \ #define EMB_UNIT_TESTCASE(ca,sup,tdw,run) \
static const TestCase ca = new_TestCase(#ca,sup,tdw,run) static const TestCase ca = new_TestCase(#ca,sup,tdw,run)
@ -56,4 +60,8 @@
#define EMB_UNIT_REPEATEDTEST(repeater,test,tmrp) \ #define EMB_UNIT_REPEATEDTEST(repeater,test,tmrp) \
static const RepeatedTest repeater = new_RepeatedTest(test,tmrp) static const RepeatedTest repeater = new_RepeatedTest(test,tmrp)
#ifdef __cplusplus
}
#endif
#endif/*__HELPERMACRO_H__*/ #endif/*__HELPERMACRO_H__*/

View File

@ -35,6 +35,10 @@
#ifndef __REPEATEDTEST_H__ #ifndef __REPEATEDTEST_H__
#define __REPEATEDTEST_H__ #define __REPEATEDTEST_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct __RepeatedTest RepeatedTest; typedef struct __RepeatedTest RepeatedTest;
typedef struct __RepeatedTest* RepeatedTestRef; /*downward compatible*/ typedef struct __RepeatedTest* RepeatedTestRef; /*downward compatible*/
@ -53,4 +57,8 @@ extern const TestImplement RepeatedTestImplement;
tmrp,\ tmrp,\
} }
#ifdef __cplusplus
}
#endif
#endif/*__REPEATEDTEST_H__*/ #endif/*__REPEATEDTEST_H__*/

View File

@ -35,6 +35,10 @@
#ifndef __TEST_H__ #ifndef __TEST_H__
#define __TEST_H__ #define __TEST_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct __TestResult TestResult; typedef struct __TestResult TestResult;
typedef struct __TestResult* TestResultRef;/*downward compatible*/ typedef struct __TestResult* TestResultRef;/*downward compatible*/
@ -62,4 +66,8 @@ struct __Test {
#define Test_run(s,r) ((Test*)s)->isa->run(s,r) #define Test_run(s,r) ((Test*)s)->isa->run(s,r)
#define Test_countTestCases(s) ((Test*)s)->isa->countTestCases(s) #define Test_countTestCases(s) ((Test*)s)->isa->countTestCases(s)
#ifdef __cplusplus
}
#endif
#endif/*__TEST_H__*/ #endif/*__TEST_H__*/

View File

@ -35,6 +35,10 @@
#ifndef __TESTCALLER_H__ #ifndef __TESTCALLER_H__
#define __TESTCALLER_H__ #define __TESTCALLER_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct __TestFixture TestFixture; typedef struct __TestFixture TestFixture;
typedef struct __TestFixture* TestFixtureRef;/*downward compatible*/ typedef struct __TestFixture* TestFixtureRef;/*downward compatible*/
@ -69,4 +73,8 @@ extern const TestImplement TestCallerImplement;
fixtuers,\ fixtuers,\
} }
#ifdef __cplusplus
}
#endif
#endif/*__TESTCALLER_H__*/ #endif/*__TESTCALLER_H__*/

View File

@ -35,6 +35,10 @@
#ifndef __TESTCASE_H__ #ifndef __TESTCASE_H__
#define __TESTCASE_H__ #define __TESTCASE_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct __TestCase TestCase; typedef struct __TestCase TestCase;
typedef struct __TestCase* TestCaseRef;/*compatible embUnit1.0*/ typedef struct __TestCase* TestCaseRef;/*compatible embUnit1.0*/
@ -57,4 +61,8 @@ extern const TestImplement TestCaseImplement;
runTest,\ runTest,\
} }
#ifdef __cplusplus
}
#endif
#endif/*__TESTCASE_H__*/ #endif/*__TESTCASE_H__*/

View File

@ -35,6 +35,10 @@
#ifndef __TESTLISTENER_H__ #ifndef __TESTLISTENER_H__
#define __TESTLISTENER_H__ #define __TESTLISTENER_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct __TestListnerImplement TestListnerImplement; typedef struct __TestListnerImplement TestListnerImplement;
typedef struct __TestListnerImplement* TestListnerImplementRef;/*downward compatible*/ typedef struct __TestListnerImplement* TestListnerImplementRef;/*downward compatible*/
@ -59,4 +63,8 @@ struct __TestListner {
#define TestListner_endTest(s,t) ((TestListner*)s)->isa->endTest(s,t) #define TestListner_endTest(s,t) ((TestListner*)s)->isa->endTest(s,t)
#define TestListner_addFailure(s,t,m,l,f) ((TestListner*)s)->isa->addFailure(s,t,m,l,f) #define TestListner_addFailure(s,t,m,l,f) ((TestListner*)s)->isa->addFailure(s,t,m,l,f)
#ifdef __cplusplus
}
#endif
#endif/*__TESTLISTENER_H__*/ #endif/*__TESTLISTENER_H__*/

View File

@ -35,6 +35,10 @@
#ifndef __TESTSUITE_H__ #ifndef __TESTSUITE_H__
#define __TESTSUITE_H__ #define __TESTSUITE_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct __TestSuite TestSuite; typedef struct __TestSuite TestSuite;
typedef struct __TestSuite* TestSuiteRef;/*downward compatible*/ typedef struct __TestSuite* TestSuiteRef;/*downward compatible*/
@ -55,4 +59,8 @@ extern const TestImplement TestSuiteImplement;
tests,\ tests,\
} }
#ifdef __cplusplus
}
#endif
#endif/*__TESTSUITE_H__*/ #endif/*__TESTSUITE_H__*/

View File

@ -35,6 +35,10 @@
#ifndef __CONFIG_H__ #ifndef __CONFIG_H__
#define __CONFIG_H__ #define __CONFIG_H__
#ifdef __cplusplus
extern "C" {
#endif
/* #define NO_STDIO_PRINTF*/ /* #define NO_STDIO_PRINTF*/
#ifdef NO_STDIO_PRINTF #ifdef NO_STDIO_PRINTF
extern void stdimpl_print(const char *string); extern void stdimpl_print(const char *string);
@ -45,4 +49,8 @@
#define ASSERT_STRING_BUFFER_MAX 64 #define ASSERT_STRING_BUFFER_MAX 64
#ifdef __cplusplus
}
#endif
#endif/*__CONFIG_H__*/ #endif/*__CONFIG_H__*/

View File

@ -47,4 +47,12 @@
#include <embUnit/AssertImpl.h> #include <embUnit/AssertImpl.h>
#include <embUnit/HelperMacro.h> #include <embUnit/HelperMacro.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif/*__EMBUNIT_H__*/ #endif/*__EMBUNIT_H__*/

View File

@ -37,6 +37,14 @@
#include "Outputter.h" #include "Outputter.h"
#ifdef __cplusplus
extern "C" {
#endif
OutputterRef CompilerOutputter_outputter(void); OutputterRef CompilerOutputter_outputter(void);
#ifdef __cplusplus
}
#endif
#endif/*__COMPILEROUTPUTTER_H__*/ #endif/*__COMPILEROUTPUTTER_H__*/

View File

@ -37,6 +37,10 @@
#include <embUnit/embUnit.h> #include <embUnit/embUnit.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct __OutputterImplement OutputterImplement; typedef struct __OutputterImplement OutputterImplement;
typedef struct __OutputterImplement* OutputterImplementRef; typedef struct __OutputterImplement* OutputterImplementRef;
@ -71,4 +75,8 @@ struct __Outputter {
#define Outputter_printFailure(o,t,m,l,f,c) (o)->isa->printFailure(o,t,m,l,f,c) #define Outputter_printFailure(o,t,m,l,f,c) (o)->isa->printFailure(o,t,m,l,f,c)
#define Outputter_printStatistics(o,r) (o)->isa->printStatistics(o,r) #define Outputter_printStatistics(o,r) (o)->isa->printStatistics(o,r)
#ifdef __cplusplus
}
#endif
#endif/*__OUTPUTTER_H__*/ #endif/*__OUTPUTTER_H__*/

View File

@ -37,6 +37,14 @@
#include "Outputter.h" #include "Outputter.h"
#ifdef __cplusplus
extern "C" {
#endif
OutputterRef TextOutputter_outputter(void); OutputterRef TextOutputter_outputter(void);
#ifdef __cplusplus
}
#endif
#endif/*__TEXTOUTPUTTER_H__*/ #endif/*__TEXTOUTPUTTER_H__*/

View File

@ -39,10 +39,18 @@
#include <embUnit/embUnit.h> #include <embUnit/embUnit.h>
#ifdef __cplusplus
extern "C" {
#endif
void TextUIRunner_setOutputter(OutputterRef outputter); void TextUIRunner_setOutputter(OutputterRef outputter);
void TextUIRunner_startWithOutputter(OutputterRef outputter); void TextUIRunner_startWithOutputter(OutputterRef outputter);
void TextUIRunner_start(void); void TextUIRunner_start(void);
void TextUIRunner_runTest(TestRef test); void TextUIRunner_runTest(TestRef test);
void TextUIRunner_end(void); void TextUIRunner_end(void);
#ifdef __cplusplus
}
#endif
#endif/*__TEXTUIRUNNER_H__*/ #endif/*__TEXTUIRUNNER_H__*/

View File

@ -37,7 +37,15 @@
#include "Outputter.h" #include "Outputter.h"
#ifdef __cplusplus
extern "C" {
#endif
void XMLOutputter_setStyleSheet(char *style); void XMLOutputter_setStyleSheet(char *style);
OutputterRef XMLOutputter_outputter(void); OutputterRef XMLOutputter_outputter(void);
#ifdef __cplusplus
}
#endif
#endif/*__XMLOUTPUTTER_H__*/ #endif/*__XMLOUTPUTTER_H__*/

View File

@ -29,6 +29,10 @@
#ifndef MAP_H_INCLUDED #ifndef MAP_H_INCLUDED
#define MAP_H_INCLUDED #define MAP_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#define EVAL0(...) __VA_ARGS__ #define EVAL0(...) __VA_ARGS__
#define EVAL1(...) EVAL0 (EVAL0 (EVAL0 (__VA_ARGS__))) #define EVAL1(...) EVAL0 (EVAL0 (EVAL0 (__VA_ARGS__)))
#define EVAL2(...) EVAL1 (EVAL1 (EVAL1 (__VA_ARGS__))) #define EVAL2(...) EVAL1 (EVAL1 (EVAL1 (__VA_ARGS__)))
@ -48,4 +52,8 @@
#define MAP1(f, x, peek, ...) f(x) MAP_NEXT (peek, MAP0) (f, peek, __VA_ARGS__) #define MAP1(f, x, peek, ...) f(x) MAP_NEXT (peek, MAP0) (f, peek, __VA_ARGS__)
#define MAP(f, ...) EVAL (MAP1 (f, __VA_ARGS__, (), 0)) #define MAP(f, ...) EVAL (MAP1 (f, __VA_ARGS__, (), 0))
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -20,6 +20,10 @@
#include "../unittests.h" #include "../unittests.h"
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief The entry point of this test suite. * @brief The entry point of this test suite.
*/ */
@ -74,5 +78,9 @@ Test *tests_core_priority_queue_tests(void);
*/ */
Test *tests_core_byteorder_tests(void); Test *tests_core_byteorder_tests(void);
#ifdef __cplusplus
}
#endif
#endif /* __TESTS_CORE_H_ */ #endif /* __TESTS_CORE_H_ */
/** @} */ /** @} */

View File

@ -20,6 +20,10 @@
#include "../unittests.h" #include "../unittests.h"
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief The entry point of this test suite. * @brief The entry point of this test suite.
*/ */
@ -32,5 +36,9 @@ void tests_lib(void);
*/ */
Test *tests_lib_ringbuffer_tests(void); Test *tests_lib_ringbuffer_tests(void);
#ifdef __cplusplus
}
#endif
#endif /* __TESTS_CORE_H_ */ #endif /* __TESTS_CORE_H_ */
/** @} */ /** @} */

View File

@ -20,10 +20,18 @@
#include "../unittests.h" #include "../unittests.h"
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief The entry point of this test suite. * @brief The entry point of this test suite.
*/ */
void tests_pktbuf(void); void tests_pktbuf(void);
#ifdef __cplusplus
}
#endif
#endif /* __TESTS_PKTBUF_H_ */ #endif /* __TESTS_PKTBUF_H_ */
/** @} */ /** @} */

View File

@ -20,10 +20,19 @@
#include "../unittests.h" #include "../unittests.h"
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief The entry point of this test suite. * @brief The entry point of this test suite.
*/ */
void tests_pktqueue(void); void tests_pktqueue(void);
#ifdef __cplusplus
}
#endif
#endif /* __TESTS_PKTQUEUE_H_ */ #endif /* __TESTS_PKTQUEUE_H_ */
/** @} */ /** @} */

View File

@ -21,6 +21,10 @@
#include "../unittests.h" #include "../unittests.h"
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief The entry point of this test suite. * @brief The entry point of this test suite.
*/ */
@ -33,5 +37,9 @@ void tests_timex(void);
*/ */
Test *tests_timex_tests(void); Test *tests_timex_tests(void);
#ifdef __cplusplus
}
#endif
#endif /* __TESTS_TIMEX_H_ */ #endif /* __TESTS_TIMEX_H_ */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef __UNITTESTS__H #ifndef __UNITTESTS__H
#define __UNITTESTS__H #define __UNITTESTS__H
#ifdef __cplusplus
extern "C" {
#endif
#include "embUnit/embUnit.h" #include "embUnit/embUnit.h"
#ifdef OUTPUT #ifdef OUTPUT
@ -48,4 +52,8 @@
# define TESTS_END() TestRunner_end() # define TESTS_END() TestRunner_end()
#endif #endif
#ifdef __cplusplus
}
#endif
#endif #endif