Skip to content

Commit

Permalink
Partial nasa#42, naming convention pass thru cf_crc.h
Browse files Browse the repository at this point in the history
Updates names of all identifiers in cf_crc.h to follow naming
conventions from CFE.
  • Loading branch information
jphickey committed Dec 8, 2021
1 parent 4bd9010 commit b40e13a
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion fsw/src/cf_cfdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ typedef struct CF_Transaction
uint32 foffs; /* offset into file for next read */
osal_id_t fd;

cf_crc_t crc;
CF_Crc_t crc;

uint8 keep;
uint8 chan_num; /* if ever more than one engine, this may need to change to pointer */
Expand Down
6 changes: 3 additions & 3 deletions fsw/src/cf_crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
** c must not be NULL.
**
*************************************************************************/
void CF_CRC_Start(cf_crc_t *c)
void CF_CRC_Start(CF_Crc_t *c)
{
memset(c, 0, sizeof(*c));
}
Expand All @@ -57,7 +57,7 @@ void CF_CRC_Start(cf_crc_t *c)
** c must not be NULL.
**
*************************************************************************/
void CF_CRC_Digest(cf_crc_t *c, const uint8 *data, int len)
void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len)
{
int i = 0;

Expand Down Expand Up @@ -119,7 +119,7 @@ void CF_CRC_Digest(cf_crc_t *c, const uint8 *data, int len)
** c must not be NULL.
**
*************************************************************************/
void CF_CRC_Finalize(cf_crc_t *c)
void CF_CRC_Finalize(CF_Crc_t *c)
{
if (c->index)
{
Expand Down
14 changes: 7 additions & 7 deletions fsw/src/cf_crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
**
*************************************************************************/

#ifndef CF_CRC__H
#define CF_CRC__H
#ifndef CF_CRC_H
#define CF_CRC_H

#include "cfe.h"

Expand All @@ -34,10 +34,10 @@ typedef struct
uint32 working;
uint32 result;
uint8 index;
} cf_crc_t;
} CF_Crc_t;

extern void CF_CRC_Start(cf_crc_t *c);
extern void CF_CRC_Digest(cf_crc_t *c, const uint8 *data, int len);
extern void CF_CRC_Finalize(cf_crc_t *c);
extern void CF_CRC_Start(CF_Crc_t *c);
extern void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len);
extern void CF_CRC_Finalize(CF_Crc_t *c);

#endif /* !CF_CRC__H */
#endif /* !CF_CRC_H */
16 changes: 8 additions & 8 deletions unit-test/cf_cfdp_r_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ static void Dummy_fns(CF_Transaction_t *t, const CF_CFDP_PduHeader_t *pdu)

void Handler_CF_CRC_Finalize_SetResult(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context)
{
cf_crc_t *c = UT_Hook_GetArgValueByName(Context, "c", cf_crc_t *);
cf_crc_t *c_with_result = (cf_crc_t *)UserObj;
CF_Crc_t *c = UT_Hook_GetArgValueByName(Context, "c", CF_Crc_t *);
CF_Crc_t *c_with_result = (CF_Crc_t *)UserObj;

c->result = c_with_result->result;
}
Expand Down Expand Up @@ -281,8 +281,8 @@ void Test_CF_CFDP_R_CheckCrc_When_crc_NotEq_expected_crc_SendEventAndCountMismat
CF_History_t dummy_history;
CF_EntityId_t dummy_src_eid = Any_uint8();
CF_TransactionSeq_t dummy_seq_num = Any_uint32();
cf_crc_t dummy_crc;
cf_crc_t *received_crc;
CF_Crc_t dummy_crc;
CF_Crc_t *received_crc;
uint32 arg_expected_crc = Any_uint32();
int expected_result = 1;
int local_result;
Expand Down Expand Up @@ -327,8 +327,8 @@ void Test_CF_CFDP_R_CheckCrc_When_crc_calculated_IsEqTo_expected_crc_Return_0(vo
{
/* Arrange */
CF_Transaction_t arg_t;
cf_crc_t dummy_crc;
cf_crc_t *received_crc;
CF_Crc_t dummy_crc;
CF_Crc_t *received_crc;
uint32 arg_expected_crc = Any_uint32();
int expected_result = 0;
int local_result;
Expand Down Expand Up @@ -2662,8 +2662,8 @@ void Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_cached_pos_IsEqTo_RXC_Cal
arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILE_SIZE_ERROR);

/* Arrange for CF_CFDP_R_CheckCrc */
cf_crc_t dummy_crc;
cf_crc_t *received_crc = &dummy_crc;
CF_Crc_t dummy_crc;
CF_Crc_t *received_crc = &dummy_crc;

received_crc->result = Any_uint32_Except(arg_t->state_data.r.r2.eof_crc);

Expand Down
2 changes: 1 addition & 1 deletion unit-test/cf_cfdp_s_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void Test_CFDP_S_SendEof_When_flag_tx_crc_calc_Is_0_Call_CF_CRC_Finalize_AndSet_
/* Arrange */
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
cf_crc_t *context_CF_CRC_Finalize;
CF_Crc_t *context_CF_CRC_Finalize;
CF_SendRet_t local_result;
CF_SendRet_t forced_return_CF_CFDP_SendEof = Any_cfdp_send_ret_t();
CF_CFDP_SendEof_context_t context_CF_CFDP_SendEof;
Expand Down
56 changes: 28 additions & 28 deletions unit-test/cf_crc_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ void cf_crc_tests_Teardown(void)
void test_CF_CRC_Start_ReinitializeGiven_c_ToAllZeroValues(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;

arg_c->working = Any_uint32_Except(0);
arg_c->result = Any_uint32_Except(0);
Expand Down Expand Up @@ -80,8 +80,8 @@ void test_CF_CRC_Start_ReinitializeGiven_c_ToAllZeroValues(void)
void Test_CF_CRC_Digest_When_len_Is_0_DoNotAlter_c_working_or_c_result_or_c_index(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
const uint8 arg_data[1] = {UT_UINT_8_DEFAULT};
int32 arg_len = 0;
uint32 initial_c_working = Any_uint32();
Expand All @@ -108,8 +108,8 @@ void Test_CF_CRC_Digest_When_len_Is_0_DoNotAlter_c_working_or_c_result_or_c_inde
void Test_CF_CRC_Digest_When_len_Eq_1_PushDataLeftOnto_c_working(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
const uint8 arg_data[1] = {UT_UINT_8_DEFAULT};
int32 arg_len = 1;
int i = 0;
Expand All @@ -134,8 +134,8 @@ void Test_CF_CRC_Digest_When_len_Eq_1_PushDataLeftOnto_c_working(void)
void Test_CF_CRC_Digest_PushDataLeftOnto_c_working_NumberOfTimesEqTo_len(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
const uint8 *arg_data;
int32 arg_len;
int i = 0;
Expand Down Expand Up @@ -173,8 +173,8 @@ void Test_CF_CRC_Digest_PushDataLeftOnto_c_working_NumberOfTimesEqTo_len(void)
void Test_CF_CRC_Digest_When_index_IsNot_3_DoNotUpdate_c_result(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
const uint8 arg_data[1] = {UT_UINT_8_DEFAULT};
int32 arg_len = 1;
uint32 initial_c_result = Any_uint32();
Expand All @@ -195,8 +195,8 @@ void Test_CF_CRC_Digest_When_index_IsNot_3_DoNotUpdate_c_result(void)
void Test_CF_CRC_Digest_When_c_index_Is_3_Update_c_result(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
const uint8 arg_data[1] = {UT_UINT_8_DEFAULT};
int32 arg_len;
int i = 0;
Expand Down Expand Up @@ -224,8 +224,8 @@ void Test_CF_CRC_Digest_When_c_index_Is_3_Update_c_result(void)
void Test_CF_CRC_Digest_Update_c_result_TheNumberOfTimes_index_Reaches4(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
const uint8 *arg_data;
int32 arg_len;
uint32 dummy_c_working;
Expand Down Expand Up @@ -290,8 +290,8 @@ void Test_CF_CRC_Digest_Update_c_result_TheNumberOfTimes_index_Reaches4(void)
void Test_CF_CRC_Digest_When_len_Eq1_And_c_index_LessThan_3_Update_c_index_By_1(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
const uint8 arg_data[1] = {UT_UINT_8_DEFAULT};
int32 arg_len;
uint8 expected_c_index;
Expand All @@ -314,8 +314,8 @@ void Test_CF_CRC_Digest_When_len_Eq1_And_c_index_LessThan_3_Update_c_index_By_1(
void Test_CF_CRC_Digest_When_len_Eq1_And_c_index_Is_3_Update_c_index_To_0(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
const uint8 arg_data[1] = {UT_UINT_8_DEFAULT};
int32 arg_len;

Expand All @@ -335,8 +335,8 @@ void Test_CF_CRC_Digest_When_len_Eq1_And_c_index_Is_3_Update_c_index_To_0(void)
void Test_CF_CRC_Digest_Update_c_index_CorrectlyDependingOn_c_index_And_len_Values(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
const uint8 *arg_data;
int32 arg_len;
uint8 expected_c_index;
Expand Down Expand Up @@ -376,8 +376,8 @@ void Test_CF_CRC_Digest_Update_c_index_CorrectlyDependingOn_c_index_And_len_Valu
void Test_CF_CRC_Finalize_When_index_Is_0_DoNothing(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
uint32 initial_c_working = Any_uint32();
uint32 initial_c_result = Any_uint32();

Expand All @@ -399,8 +399,8 @@ void Test_CF_CRC_Finalize_When_index_Is_0_DoNothing(void)
void Test_CF_CRC_Finalize_ReceiveExpectedResultAt_index_1(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
uint32 working_shift = 256 * 256 * 256; /* 3 left shifts */
uint32 expected_result;

Expand All @@ -422,8 +422,8 @@ void Test_CF_CRC_Finalize_ReceiveExpectedResultAt_index_1(void)
void Test_CF_CRC_Finalize_ReceiveExpectedResultAt_index_2(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
uint8 dummy_index = 2;
uint32 working_shift = 256 * 256; /* 2 left shifts */
uint32 expected_result;
Expand All @@ -446,8 +446,8 @@ void Test_CF_CRC_Finalize_ReceiveExpectedResultAt_index_2(void)
void Test_CF_CRC_Finalize_ReceiveExpectedResultAt_index_3(void)
{
/* Arrange */
cf_crc_t dummy_c;
cf_crc_t *arg_c = &dummy_c;
CF_Crc_t dummy_c;
CF_Crc_t *arg_c = &dummy_c;
uint8 dummy_index = 3;
uint32 working_shift = 256; /* 1 left shift */
uint32 expected_result;
Expand Down
10 changes: 5 additions & 5 deletions unit-test/stubs/cf_crc_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
** c must not be NULL.
**
*************************************************************************/
void CF_CRC_Start(cf_crc_t *c)
void CF_CRC_Start(CF_Crc_t *c)
{
UT_GenStub_AddParam(CF_CRC_Start, cf_crc_t *, c);
UT_GenStub_AddParam(CF_CRC_Start, CF_Crc_t *, c);

UT_GenStub_Execute(CF_CRC_Start, Basic, NULL);
}
Expand All @@ -51,7 +51,7 @@ void CF_CRC_Start(cf_crc_t *c)
** c must not be NULL.
**
*************************************************************************/
void CF_CRC_Digest(cf_crc_t *c, const uint8 *data, int len)
void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len)
{
UT_Stub_CopyFromLocal(UT_KEY(CF_CRC_Digest), &c, sizeof(c));
UT_Stub_CopyFromLocal(UT_KEY(CF_CRC_Digest), &data, sizeof(data));
Expand All @@ -72,9 +72,9 @@ void CF_CRC_Digest(cf_crc_t *c, const uint8 *data, int len)
** c must not be NULL.
**
*************************************************************************/
void CF_CRC_Finalize(cf_crc_t *c)
void CF_CRC_Finalize(CF_Crc_t *c)
{
UT_GenStub_AddParam(CF_CRC_Finalize, cf_crc_t *, c);
UT_GenStub_AddParam(CF_CRC_Finalize, CF_Crc_t *, c);

/* TODO: UT_Stub_CopyFromLocal being used, but should be removed in defference to handler style functions */
UT_Stub_CopyFromLocal(UT_KEY(CF_CRC_Finalize), &c, sizeof(c));
Expand Down
2 changes: 1 addition & 1 deletion unit-test/utilities/cf_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ typedef struct

typedef struct
{
cf_crc_t *c;
CF_Crc_t *c;
const uint8 *data;
int len;
} CF_PACK CF_CRC_Digest_context_t;
Expand Down

0 comments on commit b40e13a

Please sign in to comment.