Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #50, do not instantiate globals in header file #80

Merged
merged 1 commit into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions unit-test/cf_cmd_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/* cf_cmd_tests globals */
extern type_of_context_CF_CList_Traverse_t type_of_context_CF_CList_Traverse;

CFE_MSG_GetSize_context_t context_CFE_MSG_GetSize;

/*******************************************************************************
**
** cf_cmd_tests Setup and Teardown
Expand Down
11 changes: 10 additions & 1 deletion unit-test/utilities/cf_test_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
#define HEADS true
#define TAILS false

int32 result;
uint16 EventID;

type_of_context_CF_CList_Traverse_t type_of_context_CF_CList_Traverse;

CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent;
CFE_MSG_GetMsgId_context_t context_CFE_MSG_GetMsgId;
CFE_MSG_SetMsgTime_context_t context_CFE_MSG_SetMsgTime;

const char *ut_default_const_char = "!WARNING! - UNSET CONST CHAR";
const uint8 ut_default_uint8 = UT_UINT_8_DEFAULT;
/* default_ptr changes per run, but value pointed at if not set correctly in test will always
Expand Down Expand Up @@ -817,4 +826,4 @@ CFE_SB_MsgId_t Any_MsgId_ExceptThese(CFE_SB_MsgId_t exceptions[], uint8 num_exce

return (CFE_SB_MsgId_t)UT_UINT_16_DEFAULT; /* default for switch(msg_id_size) will always assert, this should not be
able to happen, but removes warning on build */
}
}
22 changes: 9 additions & 13 deletions unit-test/utilities/cf_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
#define SECOND_CALL 2
#define NEXT_CALL 1

int32 result;
uint16 EventID;
extern int32 result;
extern uint16 EventID;

extern const char *ut_default_const_char;
extern const uint8 ut_default_uint8;
Expand Down Expand Up @@ -87,30 +87,29 @@ typedef struct
{
CFE_MSG_Message_t *MsgPtr;
CFE_TIME_SysTime_t Time;
} CF_PACK CFE_MSG_SetMsgTime_context_t;
CFE_MSG_SetMsgTime_context_t context_CFE_MSG_SetMsgTime;
} CF_PACK CFE_MSG_SetMsgTime_context_t;
extern CFE_MSG_SetMsgTime_context_t context_CFE_MSG_SetMsgTime;

typedef struct
{
const CFE_MSG_Message_t *MsgPtr;
CFE_SB_MsgId_t *returned_MsgId;
} CF_PACK CFE_MSG_GetMsgId_context_t;
CFE_MSG_GetMsgId_context_t context_CFE_MSG_GetMsgId;
} CF_PACK CFE_MSG_GetMsgId_context_t;
extern CFE_MSG_GetMsgId_context_t context_CFE_MSG_GetMsgId;

typedef struct
{
uint16 EventID;
uint16 EventType;
const char *Spec;
} CF_PACK CFE_EVS_SendEvent_context_t;
CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent;
} CF_PACK CFE_EVS_SendEvent_context_t;
extern CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent;

typedef struct
{
const CFE_MSG_Message_t *MsgPtr;
CFE_MSG_Size_t *Size;
} CF_PACK CFE_MSG_GetSize_context_t;
CFE_MSG_GetSize_context_t context_CFE_MSG_GetSize;
} CF_PACK CFE_MSG_GetSize_context_t;

typedef struct
{
Expand Down Expand Up @@ -427,9 +426,6 @@ typedef enum
MAX_TYPE_OF_CONTEXT_CF_CLIST_TRAVERSE
} type_of_context_CF_CList_Traverse_t;

type_of_context_CF_CList_Traverse_t
type_of_context_CF_CList_Traverse; /* moved here to remove warning, a special setting for the stub */

void cf_tests_Setup(void);
void cf_tests_Teardown(void);

Expand Down