提交 a07d07cd 编写于 作者: A Aviv Palivoda

Allow specifying custom header declaration

The user can specify UNITY_OUTPUT_CHAR_HEADER_DECLARATION and
UNITY_OUTPUT_FLUSH_HEADER_DECLARATION when he would like to declare
UNITY_OUTPUT_CHAT or UNITY_OUTPUT_FLUSH respectivly
上级 c1bc32dc
......@@ -201,10 +201,12 @@
* `stdout` option. You decide to route your test result output to a custom
* serial `RS232_putc()` function you wrote like thus:
*/
/* #define UNITY_OUTPUT_CHAR(a) RS232_putc(a) */
/* #define UNITY_OUTPUT_FLUSH() RS232_flush() */
/* #define UNITY_OUTPUT_START() RS232_config(115200,1,8,0) */
/* #define UNITY_OUTPUT_COMPLETE() RS232_close() */
/* #define UNITY_OUTPUT_CHAR(a) RS232_putc(a) */
/* #define UNITY_OUTPUT_CHAR_HEADER_DECLARATION RS232_putc(int) */
/* #define UNITY_OUTPUT_FLUSH() RS232_flush() */
/* #define UNITY_OUTPUT_FLUSH_HEADER_DECLARATION RS232_flush(void) */
/* #define UNITY_OUTPUT_START() RS232_config(115200,1,8,0) */
/* #define UNITY_OUTPUT_COMPLETE() RS232_close() */
/* For some targets, Unity can make the otherwise required `setUp()` and
* `tearDown()` functions optional. This is a nice convenience for test writers
......
......@@ -246,8 +246,8 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
#else
/* If defined as something else, make sure we declare it here so it's ready for use */
#ifndef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
extern void UNITY_OUTPUT_CHAR(int);
#ifdef UNITY_OUTPUT_CHAR_HEADER_DECLARATION
extern void UNITY_OUTPUT_CHAR_HEADER_DECLARATION;
#endif
#endif
......@@ -255,22 +255,22 @@ extern void UNITY_OUTPUT_CHAR(int);
#ifdef UNITY_USE_FLUSH_STDOUT
/* We want to use the stdout flush utility */
#include <stdio.h>
#define UNITY_OUTPUT_FLUSH (void)fflush(stdout)
#define UNITY_OUTPUT_FLUSH() (void)fflush(stdout)
#else
/* We've specified nothing, therefore flush should just be ignored */
#define UNITY_OUTPUT_FLUSH
#define UNITY_OUTPUT_FLUSH()
#endif
#else
/* We've defined flush as something else, so make sure we declare it here so it's ready for use */
#ifndef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
extern void UNITY_OUTPUT_FLUSH(void);
#ifdef UNITY_OUTPUT_FLUSH_HEADER_DECLARATION
extern void UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION;
#endif
#endif
#ifndef UNITY_OUTPUT_FLUSH
#define UNITY_FLUSH_CALL()
#else
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH()
#endif
#ifndef UNITY_PRINT_EOL
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册