From 0553fc7b0e13b52aac2c544ab7eeb5e3d1786f10 Mon Sep 17 00:00:00 2001 From: astrogeco <59618057+astrogeco@users.noreply.github.com> Date: Thu, 27 Aug 2020 12:32:37 -0400 Subject: [PATCH] Fix #37, Apply standard code style --- fsw/mission_inc/sample_app_perfids.h | 5 +- fsw/platform_inc/sample_app_msgids.h | 8 +- fsw/platform_inc/sample_app_table.h | 4 +- fsw/src/sample_app.c | 158 ++++++---------- fsw/src/sample_app.h | 34 ++-- fsw/src/sample_app_events.h | 19 +- fsw/src/sample_app_msg.h | 24 +-- fsw/src/sample_app_version.h | 29 +-- fsw/tables/sample_app_tbl.c | 5 +- .../coveragetest/coveragetest_sample_app.c | 174 ++++++------------ .../sample_app_coveragetest_common.h | 17 +- unit-test/inc/ut_sample_app.h | 1 - 12 files changed, 190 insertions(+), 288 deletions(-) diff --git a/fsw/mission_inc/sample_app_perfids.h b/fsw/mission_inc/sample_app_perfids.h index 683a7ad..2b701b9 100644 --- a/fsw/mission_inc/sample_app_perfids.h +++ b/fsw/mission_inc/sample_app_perfids.h @@ -20,7 +20,7 @@ ** ** File: sample_app_perfids.h ** -** Purpose: +** Purpose: ** Define Sample App Performance IDs ** ** Notes: @@ -29,8 +29,7 @@ #ifndef _sample_app_perfids_h_ #define _sample_app_perfids_h_ - -#define SAMPLE_APP_PERF_ID 91 +#define SAMPLE_APP_PERF_ID 91 #endif /* _sample_app_perfids_h_ */ diff --git a/fsw/platform_inc/sample_app_msgids.h b/fsw/platform_inc/sample_app_msgids.h index 3395402..4efdf2b 100644 --- a/fsw/platform_inc/sample_app_msgids.h +++ b/fsw/platform_inc/sample_app_msgids.h @@ -20,7 +20,7 @@ ** ** File: sample_app_msgids.h ** -** Purpose: +** Purpose: ** Define Sample App Message IDs ** ** Notes: @@ -30,9 +30,9 @@ #ifndef _sample_app_msgids_h_ #define _sample_app_msgids_h_ -#define SAMPLE_APP_CMD_MID 0x1882 -#define SAMPLE_APP_SEND_HK_MID 0x1883 -#define SAMPLE_APP_HK_TLM_MID 0x0883 +#define SAMPLE_APP_CMD_MID 0x1882 +#define SAMPLE_APP_SEND_HK_MID 0x1883 +#define SAMPLE_APP_HK_TLM_MID 0x0883 #endif /* _sample_app_msgids_h_ */ diff --git a/fsw/platform_inc/sample_app_table.h b/fsw/platform_inc/sample_app_table.h index 62637b9..86d662b 100644 --- a/fsw/platform_inc/sample_app_table.h +++ b/fsw/platform_inc/sample_app_table.h @@ -35,8 +35,8 @@ */ typedef struct { - uint16 Int1; - uint16 Int2; + uint16 Int1; + uint16 Int2; } SAMPLE_APP_Table_t; diff --git a/fsw/src/sample_app.c b/fsw/src/sample_app.c index bc10da3..220e227 100644 --- a/fsw/src/sample_app.c +++ b/fsw/src/sample_app.c @@ -46,9 +46,9 @@ SAMPLE_AppData_t SAMPLE_AppData; /* SAMPLE_AppMain() -- Application entry point and main process loop */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ -void SAMPLE_AppMain( void ) +void SAMPLE_AppMain(void) { - int32 status; + int32 status; /* ** Register the app with Executive services @@ -82,9 +82,7 @@ void SAMPLE_AppMain( void ) CFE_ES_PerfLogExit(SAMPLE_APP_PERF_ID); /* Pend on receipt of command packet */ - status = CFE_SB_RcvMsg(&SAMPLE_AppData.MsgPtr, - SAMPLE_AppData.CommandPipe, - CFE_SB_PEND_FOREVER); + status = CFE_SB_RcvMsg(&SAMPLE_AppData.MsgPtr, SAMPLE_AppData.CommandPipe, CFE_SB_PEND_FOREVER); /* ** Performance Log Entry Stamp @@ -97,13 +95,11 @@ void SAMPLE_AppMain( void ) } else { - CFE_EVS_SendEvent(SAMPLE_PIPE_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(SAMPLE_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "SAMPLE APP: SB Pipe Read Error, App Will Exit"); SAMPLE_AppData.RunStatus = CFE_ES_RunStatus_APP_ERROR; } - } /* @@ -120,9 +116,9 @@ void SAMPLE_AppMain( void ) /* SAMPLE_AppInit() -- initialization */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ -int32 SAMPLE_AppInit( void ) +int32 SAMPLE_AppInit(void) { - int32 status; + int32 status; SAMPLE_AppData.RunStatus = CFE_ES_RunStatus_APP_RUN; @@ -160,89 +156,69 @@ int32 SAMPLE_AppInit( void ) /* ** Register the events */ - status = CFE_EVS_Register(SAMPLE_AppData.EventFilters, - SAMPLE_EVENT_COUNTS, - CFE_EVS_EventFilter_BINARY); + status = CFE_EVS_Register(SAMPLE_AppData.EventFilters, SAMPLE_EVENT_COUNTS, CFE_EVS_EventFilter_BINARY); if (status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("Sample App: Error Registering Events, RC = 0x%08lX\n", - (unsigned long)status); - return ( status ); + CFE_ES_WriteToSysLog("Sample App: Error Registering Events, RC = 0x%08lX\n", (unsigned long)status); + return (status); } /* ** Initialize housekeeping packet (clear user data area). */ - CFE_SB_InitMsg(&SAMPLE_AppData.HkBuf.MsgHdr, - SAMPLE_APP_HK_TLM_MID, - sizeof(SAMPLE_AppData.HkBuf), - true); + CFE_SB_InitMsg(&SAMPLE_AppData.HkBuf.MsgHdr, SAMPLE_APP_HK_TLM_MID, sizeof(SAMPLE_AppData.HkBuf), true); /* ** Create Software Bus message pipe. */ - status = CFE_SB_CreatePipe(&SAMPLE_AppData.CommandPipe, - SAMPLE_AppData.PipeDepth, - SAMPLE_AppData.PipeName); + status = CFE_SB_CreatePipe(&SAMPLE_AppData.CommandPipe, SAMPLE_AppData.PipeDepth, SAMPLE_AppData.PipeName); if (status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("Sample App: Error creating pipe, RC = 0x%08lX\n", - (unsigned long)status); - return ( status ); + CFE_ES_WriteToSysLog("Sample App: Error creating pipe, RC = 0x%08lX\n", (unsigned long)status); + return (status); } /* ** Subscribe to Housekeeping request commands */ - status = CFE_SB_Subscribe(SAMPLE_APP_SEND_HK_MID, - SAMPLE_AppData.CommandPipe); + status = CFE_SB_Subscribe(SAMPLE_APP_SEND_HK_MID, SAMPLE_AppData.CommandPipe); if (status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("Sample App: Error Subscribing to HK request, RC = 0x%08lX\n", - (unsigned long)status); - return ( status ); + CFE_ES_WriteToSysLog("Sample App: Error Subscribing to HK request, RC = 0x%08lX\n", (unsigned long)status); + return (status); } /* ** Subscribe to ground command packets */ - status = CFE_SB_Subscribe(SAMPLE_APP_CMD_MID, - SAMPLE_AppData.CommandPipe); - if (status != CFE_SUCCESS ) + status = CFE_SB_Subscribe(SAMPLE_APP_CMD_MID, SAMPLE_AppData.CommandPipe); + if (status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("Sample App: Error Subscribing to Command, RC = 0x%08lX\n", - (unsigned long)status); + CFE_ES_WriteToSysLog("Sample App: Error Subscribing to Command, RC = 0x%08lX\n", (unsigned long)status); - return ( status ); + return (status); } /* ** Register Table(s) */ - status = CFE_TBL_Register(&SAMPLE_AppData.TblHandles[0], - "SampleAppTable", - sizeof(SAMPLE_APP_Table_t), - CFE_TBL_OPT_DEFAULT, - SAMPLE_TblValidationFunc); - if ( status != CFE_SUCCESS ) + status = CFE_TBL_Register(&SAMPLE_AppData.TblHandles[0], "SampleAppTable", sizeof(SAMPLE_APP_Table_t), + CFE_TBL_OPT_DEFAULT, SAMPLE_TblValidationFunc); + if (status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("Sample App: Error Registering Table, RC = 0x%08lX\n", (unsigned long)status); - return ( status ); + return (status); } else { - status = CFE_TBL_Load(SAMPLE_AppData.TblHandles[0], - CFE_TBL_SRC_FILE, - SAMPLE_APP_TABLE_FILE); + status = CFE_TBL_Load(SAMPLE_AppData.TblHandles[0], CFE_TBL_SRC_FILE, SAMPLE_APP_TABLE_FILE); } - CFE_EVS_SendEvent (SAMPLE_STARTUP_INF_EID, - CFE_EVS_EventType_INFORMATION, - "SAMPLE App Initialized.%s", - SAMPLE_APP_VERSION_STRING); + CFE_EVS_SendEvent(SAMPLE_STARTUP_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE App Initialized.%s", + SAMPLE_APP_VERSION_STRING); - return ( CFE_SUCCESS ); + return (CFE_SUCCESS); } /* End of SAMPLE_AppInit() */ @@ -254,9 +230,9 @@ int32 SAMPLE_AppInit( void ) /* command pipe. */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SAMPLE_ProcessCommandPacket( CFE_SB_MsgPtr_t Msg ) +void SAMPLE_ProcessCommandPacket(CFE_SB_MsgPtr_t Msg) { - CFE_SB_MsgId_t MsgId; + CFE_SB_MsgId_t MsgId; MsgId = CFE_SB_GetMsgId(Msg); @@ -271,10 +247,8 @@ void SAMPLE_ProcessCommandPacket( CFE_SB_MsgPtr_t Msg ) break; default: - CFE_EVS_SendEvent(SAMPLE_INVALID_MSGID_ERR_EID, - CFE_EVS_EventType_ERROR, - "SAMPLE: invalid command packet,MID = 0x%x", - (unsigned int)CFE_SB_MsgIdToValue(MsgId)); + CFE_EVS_SendEvent(SAMPLE_INVALID_MSGID_ERR_EID, CFE_EVS_EventType_ERROR, + "SAMPLE: invalid command packet,MID = 0x%x", (unsigned int)CFE_SB_MsgIdToValue(MsgId)); break; } @@ -287,7 +261,7 @@ void SAMPLE_ProcessCommandPacket( CFE_SB_MsgPtr_t Msg ) /* SAMPLE_ProcessGroundCommand() -- SAMPLE ground commands */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ -void SAMPLE_ProcessGroundCommand( CFE_SB_MsgPtr_t Msg ) +void SAMPLE_ProcessGroundCommand(CFE_SB_MsgPtr_t Msg) { uint16 CommandCode; @@ -324,9 +298,7 @@ void SAMPLE_ProcessGroundCommand( CFE_SB_MsgPtr_t Msg ) /* default case already found during FC vs length test */ default: - CFE_EVS_SendEvent(SAMPLE_COMMAND_ERR_EID, - CFE_EVS_EventType_ERROR, - "Invalid ground command code: CC = %d", + CFE_EVS_SendEvent(SAMPLE_COMMAND_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid ground command code: CC = %d", CommandCode); break; } @@ -344,7 +316,7 @@ void SAMPLE_ProcessGroundCommand( CFE_SB_MsgPtr_t Msg ) /* telemetry, packetize it and send it to the housekeeping task via */ /* the software bus */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 SAMPLE_ReportHousekeeping( const CFE_SB_CmdHdr_t *Msg ) +int32 SAMPLE_ReportHousekeeping(const CFE_SB_CmdHdr_t *Msg) { int i; @@ -352,7 +324,7 @@ int32 SAMPLE_ReportHousekeeping( const CFE_SB_CmdHdr_t *Msg ) ** Get command execution counters... */ SAMPLE_AppData.HkBuf.HkTlm.Payload.CommandErrorCounter = SAMPLE_AppData.ErrCounter; - SAMPLE_AppData.HkBuf.HkTlm.Payload.CommandCounter = SAMPLE_AppData.CmdCounter; + SAMPLE_AppData.HkBuf.HkTlm.Payload.CommandCounter = SAMPLE_AppData.CmdCounter; /* ** Send housekeeping telemetry packet... @@ -363,7 +335,7 @@ int32 SAMPLE_ReportHousekeeping( const CFE_SB_CmdHdr_t *Msg ) /* ** Manage any pending table loads, validations, etc. */ - for (i=0; iInt1, - TblPtr->Int2); + CFE_ES_WriteToSysLog("Sample App: Table Value 1: %d Value 2: %d", TblPtr->Int1, TblPtr->Int2); SAMPLE_GetCrc(TableName); status = CFE_TBL_ReleaseAddress(SAMPLE_AppData.TblHandles[0]); if (status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("Sample App: Fail to release table address: 0x%08lx", - (unsigned long)status); + CFE_ES_WriteToSysLog("Sample App: Fail to release table address: 0x%08lx", (unsigned long)status); return status; } @@ -463,7 +427,7 @@ int32 SAMPLE_Process( const SAMPLE_Process_t *Msg ) /* SAMPLE_VerifyCmdLength() -- Verify command packet length */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ -bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength ) +bool SAMPLE_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) { bool result = true; @@ -477,20 +441,16 @@ bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength ) CFE_SB_MsgId_t MessageID = CFE_SB_GetMsgId(Msg); uint16 CommandCode = CFE_SB_GetCmdCode(Msg); - CFE_EVS_SendEvent(SAMPLE_LEN_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(SAMPLE_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Msg length: ID = 0x%X, CC = %d, Len = %d, Expected = %d", - (unsigned int)CFE_SB_MsgIdToValue(MessageID), - CommandCode, - ActualLength, - ExpectedLength); + (unsigned int)CFE_SB_MsgIdToValue(MessageID), CommandCode, ActualLength, ExpectedLength); result = false; SAMPLE_AppData.ErrCounter++; } - return( result ); + return (result); } /* End of SAMPLE_VerifyCmdLength() */ @@ -500,9 +460,9 @@ bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength ) /* buffer contents */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 SAMPLE_TblValidationFunc( void *TblData ) +int32 SAMPLE_TblValidationFunc(void *TblData) { - int32 ReturnCode = CFE_SUCCESS; + int32 ReturnCode = CFE_SUCCESS; SAMPLE_APP_Table_t *TblDataPtr = (SAMPLE_APP_Table_t *)TblData; /* @@ -524,11 +484,11 @@ int32 SAMPLE_TblValidationFunc( void *TblData ) /* */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SAMPLE_GetCrc( const char *TableName ) +void SAMPLE_GetCrc(const char *TableName) { - int32 status; - uint32 Crc; - CFE_TBL_Info_t TblInfoPtr; + int32 status; + uint32 Crc; + CFE_TBL_Info_t TblInfoPtr; status = CFE_TBL_GetInfo(&TblInfoPtr, TableName); if (status != CFE_SUCCESS) diff --git a/fsw/src/sample_app.h b/fsw/src/sample_app.h index 089e91a..3a3fbab 100644 --- a/fsw/src/sample_app.h +++ b/fsw/src/sample_app.h @@ -43,16 +43,16 @@ #include "sample_app_msg.h" /***********************************************************************/ -#define SAMPLE_PIPE_DEPTH 32 /* Depth of the Command Pipe for Application */ +#define SAMPLE_PIPE_DEPTH 32 /* Depth of the Command Pipe for Application */ -#define SAMPLE_NUMBER_OF_TABLES 1 /* Number of Table(s) */ +#define SAMPLE_NUMBER_OF_TABLES 1 /* Number of Table(s) */ /* Define filenames of default data images for tables */ -#define SAMPLE_APP_TABLE_FILE "/cf/sample_app_tbl.tbl" +#define SAMPLE_APP_TABLE_FILE "/cf/sample_app_tbl.tbl" -#define SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE -1 +#define SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE -1 -#define SAMPLE_APP_TBL_ELEMENT_1_MAX 10 +#define SAMPLE_APP_TBL_ELEMENT_1_MAX 10 /************************************************************************ ** Type Definitions *************************************************************************/ @@ -63,8 +63,8 @@ */ typedef union { - CFE_SB_Msg_t MsgHdr; - SAMPLE_HkTlm_t HkTlm; + CFE_SB_Msg_t MsgHdr; + SAMPLE_HkTlm_t HkTlm; } SAMPLE_HkBuffer_t; /* @@ -75,13 +75,13 @@ typedef struct /* ** Command interface counters... */ - uint8 CmdCounter; - uint8 ErrCounter; + uint8 CmdCounter; + uint8 ErrCounter; /* ** Housekeeping telemetry packet... */ - SAMPLE_HkBuffer_t HkBuf; + SAMPLE_HkBuffer_t HkBuf; /* ** Run Status variable used in the main processing loop @@ -91,17 +91,17 @@ typedef struct /* ** Operational data (not reported in housekeeping)... */ - CFE_SB_PipeId_t CommandPipe; - CFE_SB_MsgPtr_t MsgPtr; + CFE_SB_PipeId_t CommandPipe; + CFE_SB_MsgPtr_t MsgPtr; /* ** Initialization data (not reported in housekeeping)... */ - char PipeName[16]; - uint16 PipeDepth; + char PipeName[16]; + uint16 PipeDepth; - CFE_EVS_BinFilter_t EventFilters[SAMPLE_EVENT_COUNTS]; - CFE_TBL_Handle_t TblHandles[SAMPLE_NUMBER_OF_TABLES]; + CFE_EVS_BinFilter_t EventFilters[SAMPLE_EVENT_COUNTS]; + CFE_TBL_Handle_t TblHandles[SAMPLE_NUMBER_OF_TABLES]; } SAMPLE_AppData_t; @@ -124,6 +124,6 @@ void SAMPLE_GetCrc(const char *TableName); int32 SAMPLE_TblValidationFunc(void *TblData); -bool SAMPLE_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength); +bool SAMPLE_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength); #endif /* _sample_app_h_ */ diff --git a/fsw/src/sample_app_events.h b/fsw/src/sample_app_events.h index b329ae0..5a4748e 100644 --- a/fsw/src/sample_app_events.h +++ b/fsw/src/sample_app_events.h @@ -29,17 +29,16 @@ #ifndef _sample_app_events_h_ #define _sample_app_events_h_ +#define SAMPLE_RESERVED_EID 0 +#define SAMPLE_STARTUP_INF_EID 1 +#define SAMPLE_COMMAND_ERR_EID 2 +#define SAMPLE_COMMANDNOP_INF_EID 3 +#define SAMPLE_COMMANDRST_INF_EID 4 +#define SAMPLE_INVALID_MSGID_ERR_EID 5 +#define SAMPLE_LEN_ERR_EID 6 +#define SAMPLE_PIPE_ERR_EID 7 -#define SAMPLE_RESERVED_EID 0 -#define SAMPLE_STARTUP_INF_EID 1 -#define SAMPLE_COMMAND_ERR_EID 2 -#define SAMPLE_COMMANDNOP_INF_EID 3 -#define SAMPLE_COMMANDRST_INF_EID 4 -#define SAMPLE_INVALID_MSGID_ERR_EID 5 -#define SAMPLE_LEN_ERR_EID 6 -#define SAMPLE_PIPE_ERR_EID 7 - -#define SAMPLE_EVENT_COUNTS 7 +#define SAMPLE_EVENT_COUNTS 7 #endif /* _sample_app_events_h_ */ diff --git a/fsw/src/sample_app_msg.h b/fsw/src/sample_app_msg.h index 37c67ee..c41da6b 100644 --- a/fsw/src/sample_app_msg.h +++ b/fsw/src/sample_app_msg.h @@ -33,9 +33,9 @@ /* ** SAMPLE App command codes */ -#define SAMPLE_APP_NOOP_CC 0 -#define SAMPLE_APP_RESET_COUNTERS_CC 1 -#define SAMPLE_APP_PROCESS_CC 2 +#define SAMPLE_APP_NOOP_CC 0 +#define SAMPLE_APP_RESET_COUNTERS_CC 1 +#define SAMPLE_APP_PROCESS_CC 2 /*************************************************************************/ @@ -44,7 +44,7 @@ */ typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; + uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; } SAMPLE_NoArgsCmd_t; @@ -55,9 +55,9 @@ typedef struct ** allows them to change independently in the future without changing the prototype ** of the handler function */ -typedef SAMPLE_NoArgsCmd_t SAMPLE_Noop_t; -typedef SAMPLE_NoArgsCmd_t SAMPLE_ResetCounters_t; -typedef SAMPLE_NoArgsCmd_t SAMPLE_Process_t; +typedef SAMPLE_NoArgsCmd_t SAMPLE_Noop_t; +typedef SAMPLE_NoArgsCmd_t SAMPLE_ResetCounters_t; +typedef SAMPLE_NoArgsCmd_t SAMPLE_Process_t; /*************************************************************************/ /* @@ -66,15 +66,15 @@ typedef SAMPLE_NoArgsCmd_t SAMPLE_Process_t; typedef struct { - uint8 CommandErrorCounter; - uint8 CommandCounter; - uint8 spare[2]; + uint8 CommandErrorCounter; + uint8 CommandCounter; + uint8 spare[2]; } SAMPLE_HkTlm_Payload_t; typedef struct { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; - SAMPLE_HkTlm_Payload_t Payload; + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + SAMPLE_HkTlm_Payload_t Payload; } OS_PACK SAMPLE_HkTlm_t; diff --git a/fsw/src/sample_app_version.h b/fsw/src/sample_app_version.h index e80f1d7..35c8600 100644 --- a/fsw/src/sample_app_version.h +++ b/fsw/src/sample_app_version.h @@ -21,10 +21,10 @@ *************************************************************************/ /*! @file sample_app_version.h - * @brief Purpose: - * + * @brief Purpose: + * * The Sample App header file containing version information - * + * */ #ifndef SAMPLE_APP_VERSION_H @@ -33,7 +33,8 @@ /* Development Build Macro Definitions */ #define SAMPLE_APP_BUILD_NUMBER 65 /*!< Development Build: Number of commits since baseline */ -#define SAMPLE_APP_BUILD_BASELINE "v1.1.0" /*!< Development Build: git tag that is the base for the current development */ +#define SAMPLE_APP_BUILD_BASELINE \ + "v1.1.0" /*!< Development Build: git tag that is the base for the current development */ /* Version Macro Definitions */ @@ -43,22 +44,22 @@ #define SAMPLE_APP_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ #define SAMPLE_APP_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer macros */ -#define SAMPLE_APP_STR(x) SAMPLE_APP_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer macros */ +#define SAMPLE_APP_STR(x) \ + SAMPLE_APP_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer macros */ -/*! @brief Development Build Version Number. +/*! @brief Development Build Version Number. * @details Baseline git tag + Number of commits since baseline. @n * See @ref cfsversions for format differences between development and release versions. */ -#define SAMPLE_APP_VERSION SAMPLE_APP_BUILD_BASELINE "+dev" SAMPLE_APP_STR(SAMPLE_APP_BUILD_NUMBER) +#define SAMPLE_APP_VERSION SAMPLE_APP_BUILD_BASELINE "+dev" SAMPLE_APP_STR(SAMPLE_APP_BUILD_NUMBER) /*! @brief Development Build Version String. - * @details Reports the current development build's baseline, number, and name. Also includes a note about the latest official version. @n - * See @ref cfsversions for format differences between development and release versions. -*/ -#define SAMPLE_APP_VERSION_STRING \ - " Sample App DEVELOPMENT BUILD " \ - SAMPLE_APP_VERSION \ - ", Last Official Release: v1.1.0" /* For full support please use this version */ + * @details Reports the current development build's baseline, number, and name. Also includes a note about the latest + * official version. @n See @ref cfsversions for format differences between development and release versions. + */ +#define SAMPLE_APP_VERSION_STRING \ + " Sample App DEVELOPMENT BUILD " SAMPLE_APP_VERSION \ + ", Last Official Release: v1.1.0" /* For full support please use this version */ #endif /* SAMPLE_APP_VERSION_H */ diff --git a/fsw/tables/sample_app_tbl.c b/fsw/tables/sample_app_tbl.c index 8319693..8849c26 100644 --- a/fsw/tables/sample_app_tbl.c +++ b/fsw/tables/sample_app_tbl.c @@ -20,7 +20,7 @@ ** */ -#include "cfe_tbl_filedef.h" /* Required to obtain the CFE_TBL_FILEDEF macro definition */ +#include "cfe_tbl_filedef.h" /* Required to obtain the CFE_TBL_FILEDEF macro definition */ #include "sample_app_table.h" /* @@ -36,5 +36,4 @@ SAMPLE_APP_Table_t SampleAppTable = {1, 2}; ** 3) a brief description of the contents of the file image ** 4) the desired name of the table image binary file that is cFE compatible */ -CFE_TBL_FILEDEF( SampleAppTable, SAMPLE_APP.SampleAppTable, Table Utility Test Table, sample_app_tbl.tbl ) - +CFE_TBL_FILEDEF(SampleAppTable, SAMPLE_APP.SampleAppTable, Table Utility Test Table, sample_app_tbl.tbl) diff --git a/unit-test/coveragetest/coveragetest_sample_app.c b/unit-test/coveragetest/coveragetest_sample_app.c index 0b78d9e..d3dc1c9 100644 --- a/unit-test/coveragetest/coveragetest_sample_app.c +++ b/unit-test/coveragetest/coveragetest_sample_app.c @@ -34,7 +34,6 @@ ** complex functions. */ - /* * Includes */ @@ -47,21 +46,21 @@ typedef struct { - uint16 ExpectedEvent; - uint32 MatchCount; + uint16 ExpectedEvent; + uint32 MatchCount; const char *ExpectedText; } UT_CheckEvent_t; /* * An example hook function to check for a specific event. */ -static int32 UT_CheckEvent_Hook(void *UserObj, int32 StubRetcode, - uint32 CallCount, const UT_StubContext_t *Context, va_list va) +static int32 UT_CheckEvent_Hook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context, + va_list va) { UT_CheckEvent_t *State = UserObj; - char TestText[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; - uint16 EventId; - const char *Spec; + char TestText[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; + uint16 EventId; + const char * Spec; /* * The CFE_EVS_SendEvent stub passes the EventID as the @@ -89,7 +88,7 @@ static int32 UT_CheckEvent_Hook(void *UserObj, int32 StubRetcode, if (Spec != NULL) { vsnprintf(TestText, sizeof(TestText), Spec, va); - if (strcmp(TestText,State->ExpectedText) == 0) + if (strcmp(TestText, State->ExpectedText) == 0) { ++State->MatchCount; } @@ -113,12 +112,10 @@ static void UT_CheckEvent_Setup(UT_CheckEvent_t *Evt, uint16 ExpectedEvent, cons { memset(Evt, 0, sizeof(*Evt)); Evt->ExpectedEvent = ExpectedEvent; - Evt->ExpectedText = ExpectedText; + Evt->ExpectedText = ExpectedText; UT_SetVaHookFunction(UT_KEY(CFE_EVS_SendEvent), UT_CheckEvent_Hook, Evt); } - - /* ********************************************************************************** ** TEST CASE FUNCTIONS @@ -147,8 +144,7 @@ void Test_SAMPLE_AppMain(void) /* * Confirm that CFE_ES_ExitApp() was called at the end of execution */ - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_ExitApp)) == 1, - "CFE_ES_ExitApp() called"); + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_ExitApp)) == 1, "CFE_ES_ExitApp() called"); /* * Now set up individual cases for each of the error paths. @@ -159,8 +155,7 @@ void Test_SAMPLE_AppMain(void) * The call to CFE_EVS_Register is the first opportunity. * Any identifiable (non-success) return code should work. */ - UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, - CFE_EVS_INVALID_PARAMETER); + UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, CFE_EVS_INVALID_PARAMETER); /* * Just call the function again. It does not return @@ -179,9 +174,8 @@ void Test_SAMPLE_AppMain(void) * log will show what the incorrect value was. */ UtAssert_True(SAMPLE_AppData.RunStatus == CFE_ES_RunStatus_APP_ERROR, - "SAMPLE_AppData.RunStatus (%lu) == CFE_ES_RunStatus_APP_ERROR", - (unsigned long)SAMPLE_AppData.RunStatus); - + "SAMPLE_AppData.RunStatus (%lu) == CFE_ES_RunStatus_APP_ERROR", + (unsigned long)SAMPLE_AppData.RunStatus); /* * Note that CFE_ES_RunLoop returns a boolean value, @@ -202,8 +196,7 @@ void Test_SAMPLE_AppMain(void) /* * Confirm that CFE_SB_RcvMsg() (inside the loop) was called */ - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_SB_RcvMsg)) == 1, - "CFE_SB_RcvMsg() called"); + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_SB_RcvMsg)) == 1, "CFE_SB_RcvMsg() called"); /* * Now also make the CFE_SB_RcvMsg call fail, @@ -222,9 +215,7 @@ void Test_SAMPLE_AppMain(void) /* * Confirm that the event was generated */ - UtAssert_True(EventTest.MatchCount == 1, - "SAMPLE_PIPE_ERR_EID generated (%u)", - (unsigned int)EventTest.MatchCount); + UtAssert_True(EventTest.MatchCount == 1, "SAMPLE_PIPE_ERR_EID generated (%u)", (unsigned int)EventTest.MatchCount); } void Test_SAMPLE_AppInit(void) @@ -243,29 +234,23 @@ void Test_SAMPLE_AppInit(void) * is _not_ reset between these test cases. */ UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, CFE_EVS_INVALID_PARAMETER); UT_TEST_FUNCTION_RC(SAMPLE_AppInit(), CFE_EVS_INVALID_PARAMETER); - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, - "CFE_ES_WriteToSysLog() called"); + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, "CFE_ES_WriteToSysLog() called"); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, CFE_SB_BAD_ARGUMENT); UT_TEST_FUNCTION_RC(SAMPLE_AppInit(), CFE_SB_BAD_ARGUMENT); - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 2, - "CFE_ES_WriteToSysLog() called"); + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 2, "CFE_ES_WriteToSysLog() called"); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, CFE_SB_BAD_ARGUMENT); UT_TEST_FUNCTION_RC(SAMPLE_AppInit(), CFE_SB_BAD_ARGUMENT); - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 3, - "CFE_ES_WriteToSysLog() called"); + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 3, "CFE_ES_WriteToSysLog() called"); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, CFE_SB_BAD_ARGUMENT); UT_TEST_FUNCTION_RC(SAMPLE_AppInit(), CFE_SB_BAD_ARGUMENT); - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 4, - "CFE_ES_WriteToSysLog() called"); + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 4, "CFE_ES_WriteToSysLog() called"); UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Register), 1, CFE_TBL_ERR_INVALID_OPTIONS); UT_TEST_FUNCTION_RC(SAMPLE_AppInit(), CFE_TBL_ERR_INVALID_OPTIONS); - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 5, - "CFE_ES_WriteToSysLog() called"); - + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 5, "CFE_ES_WriteToSysLog() called"); } void Test_SAMPLE_ProcessCommandPacket(void) @@ -277,13 +262,13 @@ void Test_SAMPLE_ProcessCommandPacket(void) /* a buffer large enough for any command message */ union { - CFE_SB_Msg_t Base; - CFE_SB_CmdHdr_t Cmd; - SAMPLE_Noop_t Noop; + CFE_SB_Msg_t Base; + CFE_SB_CmdHdr_t Cmd; + SAMPLE_Noop_t Noop; SAMPLE_ResetCounters_t Reset; - SAMPLE_Process_t Process; + SAMPLE_Process_t Process; } TestMsg; - CFE_SB_MsgId_t TestMsgId; + CFE_SB_MsgId_t TestMsgId; UT_CheckEvent_t EventTest; memset(&TestMsg, 0, sizeof(TestMsg)); @@ -294,32 +279,25 @@ void Test_SAMPLE_ProcessCommandPacket(void) * message ID values to return. */ TestMsgId = SAMPLE_APP_CMD_MID; - UT_SetDataBuffer(UT_KEY(CFE_SB_GetMsgId), &TestMsgId, - sizeof(TestMsgId), false); + UT_SetDataBuffer(UT_KEY(CFE_SB_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); SAMPLE_ProcessCommandPacket(&TestMsg.Base); TestMsgId = SAMPLE_APP_SEND_HK_MID; - UT_SetDataBuffer(UT_KEY(CFE_SB_GetMsgId), &TestMsgId, - sizeof(TestMsgId), false); + UT_SetDataBuffer(UT_KEY(CFE_SB_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); SAMPLE_ProcessCommandPacket(&TestMsg.Base); /* invalid message id */ TestMsgId = CFE_SB_INVALID_MSG_ID; - UT_SetDataBuffer(UT_KEY(CFE_SB_GetMsgId), &TestMsgId, - sizeof(TestMsgId), false); + UT_SetDataBuffer(UT_KEY(CFE_SB_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); SAMPLE_ProcessCommandPacket(&TestMsg.Base); - /* * Confirm that the event was generated only _once_ */ - UtAssert_True(EventTest.MatchCount == 1, - "SAMPLE_COMMAND_ERR_EID generated (%u)", - (unsigned int)EventTest.MatchCount); + UtAssert_True(EventTest.MatchCount == 1, "SAMPLE_COMMAND_ERR_EID generated (%u)", + (unsigned int)EventTest.MatchCount); } - - void Test_SAMPLE_ProcessGroundCommand(void) { /* @@ -330,11 +308,11 @@ void Test_SAMPLE_ProcessGroundCommand(void) /* a buffer large enough for any command message */ union { - CFE_SB_Msg_t Base; - CFE_SB_CmdHdr_t Cmd; - SAMPLE_Noop_t Noop; + CFE_SB_Msg_t Base; + CFE_SB_CmdHdr_t Cmd; + SAMPLE_Noop_t Noop; SAMPLE_ResetCounters_t Reset; - SAMPLE_Process_t Process; + SAMPLE_Process_t Process; } TestMsg; UT_CheckEvent_t EventTest; @@ -380,10 +358,8 @@ void Test_SAMPLE_ProcessGroundCommand(void) /* * Confirm that the event was generated only _once_ */ - UtAssert_True(EventTest.MatchCount == 1, - "SAMPLE_COMMAND_ERR_EID generated (%u)", - (unsigned int)EventTest.MatchCount); - + UtAssert_True(EventTest.MatchCount == 1, "SAMPLE_COMMAND_ERR_EID generated (%u)", + (unsigned int)EventTest.MatchCount); } void Test_SAMPLE_ReportHousekeeping(void) @@ -392,9 +368,9 @@ void Test_SAMPLE_ReportHousekeeping(void) * Test Case For: * void SAMPLE_ReportHousekeeping( const CFE_SB_CmdHdr_t *Msg ) */ - CFE_SB_Msg_t *MsgSend; - CFE_SB_Msg_t *MsgTimestamp; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(SAMPLE_APP_SEND_HK_MID); + CFE_SB_Msg_t * MsgSend; + CFE_SB_Msg_t * MsgTimestamp; + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(SAMPLE_APP_SEND_HK_MID); /* Set message id to return so SAMPLE_Housekeeping will be called */ UT_SetDataBuffer(UT_KEY(CFE_SB_GetMsgId), &MsgId, sizeof(MsgId), false); @@ -419,9 +395,7 @@ void Test_SAMPLE_ReportHousekeeping(void) /* * Confirm that the CFE_TBL_Manage() call was done */ - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_TBL_Manage)) == 1, - "CFE_TBL_Manage() called"); - + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_TBL_Manage)) == 1, "CFE_TBL_Manage() called"); } void Test_SAMPLE_NoopCmd(void) @@ -430,7 +404,7 @@ void Test_SAMPLE_NoopCmd(void) * Test Case For: * void SAMPLE_NoopCmd( const SAMPLE_Noop_t *Msg ) */ - SAMPLE_Noop_t TestMsg; + SAMPLE_Noop_t TestMsg; UT_CheckEvent_t EventTest; memset(&TestMsg, 0, sizeof(TestMsg)); @@ -443,9 +417,8 @@ void Test_SAMPLE_NoopCmd(void) /* * Confirm that the event was generated */ - UtAssert_True(EventTest.MatchCount == 1, - "SAMPLE_COMMANDNOP_INF_EID generated (%u)", - (unsigned int)EventTest.MatchCount); + UtAssert_True(EventTest.MatchCount == 1, "SAMPLE_COMMANDNOP_INF_EID generated (%u)", + (unsigned int)EventTest.MatchCount); } void Test_SAMPLE_ResetCounters(void) @@ -455,7 +428,7 @@ void Test_SAMPLE_ResetCounters(void) * void SAMPLE_ResetCounters( const SAMPLE_ResetCounters_t *Msg ) */ SAMPLE_ResetCounters_t TestMsg; - UT_CheckEvent_t EventTest; + UT_CheckEvent_t EventTest; memset(&TestMsg, 0, sizeof(TestMsg)); @@ -466,9 +439,8 @@ void Test_SAMPLE_ResetCounters(void) /* * Confirm that the event was generated */ - UtAssert_True(EventTest.MatchCount == 1, - "SAMPLE_COMMANDRST_INF_EID generated (%u)", - (unsigned int)EventTest.MatchCount); + UtAssert_True(EventTest.MatchCount == 1, "SAMPLE_COMMANDRST_INF_EID generated (%u)", + (unsigned int)EventTest.MatchCount); } void Test_SAMPLE_ProcessCC(void) @@ -477,9 +449,9 @@ void Test_SAMPLE_ProcessCC(void) * Test Case For: * void SAMPLE_ProcessCC( const SAMPLE_Process_t *Msg ) */ - SAMPLE_Process_t TestMsg; + SAMPLE_Process_t TestMsg; SAMPLE_APP_Table_t TestTblData; - void *TblPtr = &TestTblData; + void * TblPtr = &TestTblData; memset(&TestTblData, 0, sizeof(TestTblData)); memset(&TestMsg, 0, sizeof(TestMsg)); @@ -493,16 +465,13 @@ void Test_SAMPLE_ProcessCC(void) /* * Confirm that the CFE_TBL_GetAddress() call was done */ - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_TBL_GetAddress)) == 1, - "CFE_TBL_GetAddress() called"); - + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_TBL_GetAddress)) == 1, "CFE_TBL_GetAddress() called"); /* * Confirm that the SAMPLE_Function() call was done * NOTE: This stub is provided by the sample_lib library */ - UtAssert_True(UT_GetStubCount(UT_KEY(SAMPLE_Function)) == 1, - "SAMPLE_Function() called"); + UtAssert_True(UT_GetStubCount(UT_KEY(SAMPLE_Function)) == 1, "SAMPLE_Function() called"); /* * Configure the CFE_TBL_GetAddress function to return an error @@ -518,7 +487,7 @@ void Test_SAMPLE_VerifyCmdLength(void) * Test Case For: * bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength ) */ - CFE_SB_Msg_t TestMsg; + CFE_SB_Msg_t TestMsg; UT_CheckEvent_t EventTest; memset(&TestMsg, 0, sizeof(TestMsg)); @@ -527,30 +496,27 @@ void Test_SAMPLE_VerifyCmdLength(void) * test a match case */ UT_SetDeferredRetcode(UT_KEY(CFE_SB_GetTotalMsgLength), 1, sizeof(TestMsg)); - UT_CheckEvent_Setup(&EventTest, SAMPLE_LEN_ERR_EID, "Invalid Msg length: ID = 0xFFFF, CC = 0, Len = 18, Expected = 8"); + UT_CheckEvent_Setup(&EventTest, SAMPLE_LEN_ERR_EID, + "Invalid Msg length: ID = 0xFFFF, CC = 0, Len = 18, Expected = 8"); SAMPLE_VerifyCmdLength(&TestMsg, sizeof(TestMsg)); /* * Confirm that the event was NOT generated */ - UtAssert_True(EventTest.MatchCount == 0, - "SAMPLE_LEN_ERR_EID NOT generated (%u)", - (unsigned int)EventTest.MatchCount); + UtAssert_True(EventTest.MatchCount == 0, "SAMPLE_LEN_ERR_EID NOT generated (%u)", + (unsigned int)EventTest.MatchCount); /* * test a mismatch case */ - UT_SetDeferredRetcode(UT_KEY(CFE_SB_GetTotalMsgLength), 1, - 10 + sizeof(TestMsg)); + UT_SetDeferredRetcode(UT_KEY(CFE_SB_GetTotalMsgLength), 1, 10 + sizeof(TestMsg)); SAMPLE_VerifyCmdLength(&TestMsg, sizeof(TestMsg)); /* * Confirm that the event WAS generated */ - UtAssert_True(EventTest.MatchCount == 1, - "SAMPLE_LEN_ERR_EID generated (%u)", - (unsigned int)EventTest.MatchCount); + UtAssert_True(EventTest.MatchCount == 1, "SAMPLE_LEN_ERR_EID generated (%u)", (unsigned int)EventTest.MatchCount); } void Test_SAMPLE_TblValidationFunc(void) @@ -568,13 +534,9 @@ void Test_SAMPLE_TblValidationFunc(void) /* error case should return SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE */ TestTblData.Int1 = 1 + SAMPLE_APP_TBL_ELEMENT_1_MAX; - UT_TEST_FUNCTION_RC(SAMPLE_TblValidationFunc(&TestTblData), - SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE); + UT_TEST_FUNCTION_RC(SAMPLE_TblValidationFunc(&TestTblData), SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE); } - - - void Test_SAMPLE_GetCrc(void) { /* @@ -593,18 +555,13 @@ void Test_SAMPLE_GetCrc(void) UT_SetForceFail(UT_KEY(CFE_TBL_GetInfo), CFE_TBL_ERR_INVALID_NAME); SAMPLE_GetCrc("UT"); - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, - "CFE_ES_WriteToSysLog() called"); + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, "CFE_ES_WriteToSysLog() called"); UT_ClearForceFail(UT_KEY(CFE_TBL_GetInfo)); SAMPLE_GetCrc("UT"); - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 2, - "CFE_ES_WriteToSysLog() called"); - + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 2, "CFE_ES_WriteToSysLog() called"); } - - /* * Setup function prior to every test */ @@ -616,11 +573,7 @@ void Sample_UT_Setup(void) /* * Teardown function after every test */ -void Sample_UT_TearDown(void) -{ - -} - +void Sample_UT_TearDown(void) {} /* * Register the test cases to execute with the unit test tool @@ -639,8 +592,3 @@ void UtTest_Setup(void) ADD_TEST(SAMPLE_TblValidationFunc); ADD_TEST(SAMPLE_GetCrc); } - - - - - diff --git a/unit-test/coveragetest/sample_app_coveragetest_common.h b/unit-test/coveragetest/sample_app_coveragetest_common.h index 2f258b4..0366374 100644 --- a/unit-test/coveragetest/sample_app_coveragetest_common.h +++ b/unit-test/coveragetest/sample_app_coveragetest_common.h @@ -25,7 +25,6 @@ ** Common definitions for all sample_app coverage tests */ - #ifndef _SAMPLE_APP_COVERAGETEST_COMMON_H_ #define _SAMPLE_APP_COVERAGETEST_COMMON_H_ @@ -45,18 +44,17 @@ /* * Macro to call a function and check its int32 return code */ -#define UT_TEST_FUNCTION_RC(func,exp) \ -{ \ - int32 rcexp = exp; \ - int32 rcact = func; \ - UtAssert_True(rcact == rcexp, "%s (%ld) == %s (%ld)", \ - #func, (long)rcact, #exp, (long)rcexp); \ -} +#define UT_TEST_FUNCTION_RC(func, exp) \ + { \ + int32 rcexp = exp; \ + int32 rcact = func; \ + UtAssert_True(rcact == rcexp, "%s (%ld) == %s (%ld)", #func, (long)rcact, #exp, (long)rcexp); \ + } /* * Macro to add a test case to the list of tests to execute */ -#define ADD_TEST(test) UtTest_Add((Test_ ## test),Sample_UT_Setup,Sample_UT_TearDown, #test) +#define ADD_TEST(test) UtTest_Add((Test_##test), Sample_UT_Setup, Sample_UT_TearDown, #test) /* * Setup function prior to every test @@ -69,4 +67,3 @@ void Sample_UT_Setup(void); void Sample_UT_TearDown(void); #endif - diff --git a/unit-test/inc/ut_sample_app.h b/unit-test/inc/ut_sample_app.h index d0202a3..3042bc1 100644 --- a/unit-test/inc/ut_sample_app.h +++ b/unit-test/inc/ut_sample_app.h @@ -48,4 +48,3 @@ extern SAMPLE_AppData_t SAMPLE_AppData; #endif /* _UT_SAMPLE_APP_H_ */ -