diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index 917f14b6..111066c3 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -1336,7 +1336,7 @@ int32 CF_CFDP_InitEngine(void) for (k = 0; k < CF_Direction_NUM; ++k, ++c) { CF_Assert((chunk_mem_offset + CF_max_chunks[k][i]) <= CF_NUM_CHUNKS_ALL_CHANNELS); - CF_Chunks_Init(&c->chunks, CF_max_chunks[k][i], &CF_AppData.engine.chunk_mem[chunk_mem_offset]); + CF_ChunkListInit(&c->chunks, CF_max_chunks[k][i], &CF_AppData.engine.chunk_mem[chunk_mem_offset]); chunk_mem_offset += CF_max_chunks[k][i]; CF_CList_InitNode(&c->cl_node); CF_CList_InsertBack(&CF_AppData.engine.channels[i].cs[k], &c->cl_node); diff --git a/fsw/src/cf_cfdp.h b/fsw/src/cf_cfdp.h index 14908b14..3d82e54f 100644 --- a/fsw/src/cf_cfdp.h +++ b/fsw/src/cf_cfdp.h @@ -108,8 +108,8 @@ typedef struct typedef struct { - chunks_t chunks; - clist_node_t cl_node; + CF_ChunkList_t chunks; + clist_node_t cl_node; } CF_ChunkWrapper_t; typedef struct @@ -337,7 +337,7 @@ typedef struct CF_Channel_t channels[CF_NUM_CHANNELS]; CF_ChunkWrapper_t chunks[CF_NUM_TRANSACTIONS * CF_Direction_NUM]; - chunk_t chunk_mem[CF_NUM_CHUNKS_ALL_CHANNELS]; + CF_Chunk_t chunk_mem[CF_NUM_CHUNKS_ALL_CHANNELS]; uint32 outgoing_counter; uint8 enabled; diff --git a/fsw/src/cf_cfdp_r.c b/fsw/src/cf_cfdp_r.c index b37929bc..9c4db059 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -165,7 +165,7 @@ static void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) else { /* only look for 1 gap, since the goal here is just to know that there are gaps */ - uint32 ret = CF_Chunks_ComputeGaps(&t->chunks->chunks, 1, t->fsize, 0, NULL, NULL); + uint32 ret = CF_ChunkList_ComputeGaps(&t->chunks->chunks, 1, t->fsize, 0, NULL, NULL); if (ret) { @@ -481,7 +481,7 @@ static void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, const CF_CFDP_P cfdp_ldst_uint32(offset, STATIC_CAST(ph, CF_CFDP_PduFd_t)->fdh.offset); /* class 2 does crc at FIN, but track gaps */ - CF_Chunks_Add(&t->chunks->chunks, offset, (uint32)bytes_received); + CF_ChunkListAdd(&t->chunks->chunks, offset, (uint32)bytes_received); if (t->flags.rx.fd_nak_sent) { @@ -515,7 +515,7 @@ static void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, const CF_CFDP_P ** \endreturns ** *************************************************************************/ -static void CF_CFDP_R2_GapCompute(const chunks_t *chunks, const chunk_t *c, void *opaque) +static void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, void *opaque) { gap_compute_args_t *args = (gap_compute_args_t *)opaque; CF_CFDP_PduNak_t *nak = STATIC_CAST(args->ph, CF_CFDP_PduNak_t); @@ -567,11 +567,11 @@ static int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) uint32 cret; cfdp_ldst_uint32(nak->scope_start, 0); - cret = CF_Chunks_ComputeGaps(&t->chunks->chunks, - (t->chunks->chunks.count < t->chunks->chunks.CF_max_chunks) - ? t->chunks->chunks.CF_max_chunks - : (t->chunks->chunks.CF_max_chunks - 1), - t->fsize, 0, CF_CFDP_R2_GapCompute, &args); + cret = CF_ChunkList_ComputeGaps(&t->chunks->chunks, + (t->chunks->chunks.count < t->chunks->chunks.CF_max_chunks) + ? t->chunks->chunks.CF_max_chunks + : (t->chunks->chunks.CF_max_chunks - 1), + t->fsize, 0, CF_CFDP_R2_GapCompute, &args); if (!cret) { diff --git a/fsw/src/cf_cfdp_s.c b/fsw/src/cf_cfdp_s.c index f2b70af1..80911bbc 100644 --- a/fsw/src/cf_cfdp_s.c +++ b/fsw/src/cf_cfdp_s.c @@ -267,8 +267,8 @@ static void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t) *************************************************************************/ static int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) { - const chunk_t *c; - int ret = 0; + const CF_Chunk_t *c; + int ret = 0; if (t->flags.tx.md_need_send) { @@ -290,12 +290,12 @@ static int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) /* unless CF_SendRet_ERROR, return 1 to keep caller from sending file data */ ret = 1; /* 1 means nak processed, so don't send filedata */ } - else if ((c = CF_Chunks_GetFirstChunk(&t->chunks->chunks))) + else if ((c = CF_ChunkList_GetFirstChunk(&t->chunks->chunks))) { ret = CF_CFDP_S_SendFileData(t, c->offset, c->size, 0); if (ret > 0) { - CF_Chunks_RemoveFromFirst(&t->chunks->chunks, ret); + CF_ChunkList_RemoveFromFirst(&t->chunks->chunks, ret); ret = 1; /* processed nak, so caller doesn't send file data */ } else if (ret < 0) @@ -535,7 +535,7 @@ static void CF_CFDP_S2_Nak(CF_Transaction_t *t, const CF_CFDP_PduHeader_t *ph) if ((start + size) <= t->fsize) { /* insert gap data in chunks */ - CF_Chunks_Add(&t->chunks->chunks, start, size); + CF_ChunkListAdd(&t->chunks->chunks, start, size); } else { diff --git a/fsw/src/cf_chunk.c b/fsw/src/cf_chunk.c index 85200255..93db20c1 100644 --- a/fsw/src/cf_chunk.c +++ b/fsw/src/cf_chunk.c @@ -53,7 +53,7 @@ ** chunks must not be NULL. ** *************************************************************************/ -static void CF_Chunks_EraseRange(chunks_t *chunks, index_t start, index_t end) +static void CF_Chunks_EraseRange(CF_ChunkList_t *chunks, CF_ChunkIdx_t start, CF_ChunkIdx_t end) { CF_Assert(end >= start); if (start < chunks->count) @@ -70,7 +70,7 @@ static void CF_Chunks_EraseRange(chunks_t *chunks, index_t start, index_t end) ** chunks must not be NULL. ** *************************************************************************/ -static void CF_Chunks_EraseChunk(chunks_t *chunks, index_t erase_index) +static void CF_Chunks_EraseChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t erase_index) { CF_Assert(chunks->count > 0); CF_Assert(erase_index < chunks->count); @@ -88,7 +88,7 @@ static void CF_Chunks_EraseChunk(chunks_t *chunks, index_t erase_index) ** chunks must not be NULL. chunk must not be NULL. ** *************************************************************************/ -static void CF_Chunks_InsertChunk(chunks_t *chunks, index_t index_before, const chunk_t *chunk) +static void CF_Chunks_InsertChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t index_before, const CF_Chunk_t *chunk) { CF_Assert(chunks->count < chunks->CF_max_chunks); CF_Assert(index_before <= chunks->count); @@ -117,12 +117,12 @@ static void CF_Chunks_InsertChunk(chunks_t *chunks, index_t index_before, const ** \endreturns ** *************************************************************************/ -static index_t CF_Chunks_FindInsertPosition(chunks_t *chunks, const chunk_t *chunk) +static CF_ChunkIdx_t CF_Chunks_FindInsertPosition(CF_ChunkList_t *chunks, const CF_Chunk_t *chunk) { - index_t first = 0; - index_t i; - index_t count = chunks->count; - index_t step; + CF_ChunkIdx_t first = 0; + CF_ChunkIdx_t i; + CF_ChunkIdx_t count = chunks->count; + CF_ChunkIdx_t step; while (count > 0) { @@ -154,17 +154,17 @@ static index_t CF_Chunks_FindInsertPosition(chunks_t *chunks, const chunk_t *chu ** \endreturns ** *************************************************************************/ -static int CF_Chunks_CombinePrevious(chunks_t *chunks, index_t i, const chunk_t *chunk) +static int CF_Chunks_CombinePrevious(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t *chunk) { int ret = 0; CF_Assert(i <= chunks->CF_max_chunks); - chunk_offset_t chunk_end = chunk->offset + chunk->size; + CF_ChunkOffset_t chunk_end = chunk->offset + chunk->size; if ((i && chunks->count)) { - chunk_t *prev = &chunks->chunks[i - 1]; - chunk_offset_t prev_end = prev->offset + prev->size; + CF_Chunk_t *prev = &chunks->chunks[i - 1]; + CF_ChunkOffset_t prev_end = prev->offset + prev->size; if (chunk->offset <= prev_end) { if (prev_end < chunk_end) @@ -189,25 +189,25 @@ static int CF_Chunks_CombinePrevious(chunks_t *chunks, index_t i, const chunk_t ** \endreturns ** *************************************************************************/ -static int CF_Chunks_CombineNext(chunks_t *chunks, index_t i, const chunk_t *chunk) +static int CF_Chunks_CombineNext(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t *chunk) { /* check if not at the end */ int ret = 0; if (i != chunks->count) { - chunk_offset_t chunk_end = chunk->offset + chunk->size; + CF_ChunkOffset_t chunk_end = chunk->offset + chunk->size; CF_Assert(chunk_end >= chunk->offset); /* check if anything can be combined */ if (chunks->chunks[i].offset <= chunk_end) { /* figure out how many chunks can be combined */ - index_t combined_i = i; - chunk_offset_t new_end; /* initialized below */ + CF_ChunkIdx_t combined_i = i; + CF_ChunkOffset_t new_end; /* initialized below */ for (; combined_i < chunks->count; ++combined_i) { - chunk_offset_t existing_end = chunks->chunks[combined_i].offset + chunks->chunks[combined_i].size; + CF_ChunkOffset_t existing_end = chunks->chunks[combined_i].offset + chunks->chunks[combined_i].size; if (chunk_end < existing_end) { break; @@ -251,10 +251,10 @@ static int CF_Chunks_CombineNext(chunks_t *chunks, index_t i, const chunk_t *chu ** \endreturns ** *************************************************************************/ -static index_t CF_Chunks_FindSmallestSize(const chunks_t *chunks) +static CF_ChunkIdx_t CF_Chunks_FindSmallestSize(const CF_ChunkList_t *chunks) { - index_t i; - index_t smallest = 0; + CF_ChunkIdx_t i; + CF_ChunkIdx_t smallest = 0; for (i = 1; i < chunks->count; ++i) { @@ -278,7 +278,7 @@ static index_t CF_Chunks_FindSmallestSize(const chunks_t *chunks) ** chunks must not be NULL. chunk must not be NULL. ** *************************************************************************/ -static void CF_Chunks_Insert(chunks_t *chunks, index_t i, const chunk_t *chunk) +static void CF_Chunks_Insert(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t *chunk) { int n = CF_Chunks_CombineNext(chunks, i, chunk); if (n) @@ -300,8 +300,8 @@ static void CF_Chunks_Insert(chunks_t *chunks, index_t i, const chunk_t *chunk) } else { - index_t smallest_i = CF_Chunks_FindSmallestSize(chunks); - chunk_t *smallest_c = &chunks->chunks[smallest_i]; + CF_ChunkIdx_t smallest_i = CF_Chunks_FindSmallestSize(chunks); + CF_Chunk_t *smallest_c = &chunks->chunks[smallest_i]; if (smallest_c->size < chunk->size) { CF_Chunks_EraseChunk(chunks, smallest_i); @@ -319,10 +319,10 @@ static void CF_Chunks_Insert(chunks_t *chunks, index_t i, const chunk_t *chunk) ** chunks must not be NULL. ** *************************************************************************/ -void CF_Chunks_Add(chunks_t *chunks, chunk_offset_t offset, chunk_size_t size) +void CF_ChunkListAdd(CF_ChunkList_t *chunks, CF_ChunkOffset_t offset, CF_ChunkSize_t size) { - const chunk_t chunk = {offset, size}; - const index_t i = CF_Chunks_FindInsertPosition(chunks, &chunk); + const CF_Chunk_t chunk = {offset, size}; + const CF_ChunkIdx_t i = CF_Chunks_FindInsertPosition(chunks, &chunk); /* PTFO: files won't be so big we need to gracefully handle overflow, * and in that case the user should change everything in chunks @@ -353,9 +353,9 @@ void CF_Chunks_Add(chunks_t *chunks, chunk_offset_t offset, chunk_size_t size) ** chunks must not be NULL. ** *************************************************************************/ -void CF_Chunks_RemoveFromFirst(chunks_t *chunks, chunk_size_t size) +void CF_ChunkList_RemoveFromFirst(CF_ChunkList_t *chunks, CF_ChunkSize_t size) { - chunk_t *c = &chunks->chunks[0]; /* front is always 0 */ + CF_Chunk_t *c = &chunks->chunks[0]; /* front is always 0 */ if (size > c->size) { @@ -385,7 +385,7 @@ void CF_Chunks_RemoveFromFirst(chunks_t *chunks, chunk_size_t size) ** chunks must not be NULL. ** *************************************************************************/ -const chunk_t *CF_Chunks_GetFirstChunk(const chunks_t *chunks) +const CF_Chunk_t *CF_ChunkList_GetFirstChunk(const CF_ChunkList_t *chunks) { return chunks->count ? &chunks->chunks[0] : NULL; } @@ -397,12 +397,12 @@ const chunk_t *CF_Chunks_GetFirstChunk(const chunks_t *chunks) ** chunks must not be NULL. chunks_mem must not be NULL. ** *************************************************************************/ -void CF_Chunks_Init(chunks_t *chunks, index_t CF_max_chunks, chunk_t *chunks_mem) +void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Chunk_t *chunks_mem) { CF_Assert(CF_max_chunks > 0); chunks->CF_max_chunks = CF_max_chunks; chunks->chunks = chunks_mem; - CF_ChunksReset(chunks); + CF_ChunkListReset(chunks); } /************************************************************************/ @@ -412,7 +412,7 @@ void CF_Chunks_Init(chunks_t *chunks, index_t CF_max_chunks, chunk_t *chunks_mem ** chunks must not be NULL. ** *************************************************************************/ -void CF_ChunksReset(chunks_t *chunks) +void CF_ChunkListReset(CF_ChunkList_t *chunks) { chunks->count = 0; memset(chunks->chunks, 0, sizeof(*chunks->chunks) * chunks->CF_max_chunks); @@ -434,19 +434,19 @@ void CF_ChunksReset(chunks_t *chunks) ** \endreturns ** *************************************************************************/ -uint32 CF_Chunks_ComputeGaps(const chunks_t *chunks, index_t max_gaps, chunk_size_t total, chunk_offset_t start, - compute_gap_fn_t compute_gap_fn, void *opaque) +uint32 CF_ChunkList_ComputeGaps(const CF_ChunkList_t *chunks, CF_ChunkIdx_t max_gaps, CF_ChunkSize_t total, + CF_ChunkOffset_t start, CF_ChunkList_ComputeGapFn_t compute_gap_fn, void *opaque) { - uint32 ret = 0; - index_t i = 0; - int started = 0; + uint32 ret = 0; + CF_ChunkIdx_t i = 0; + int started = 0; CF_Assert(total); /* does it make sense to have a 0 byte file? */ CF_Assert(start < total); /* simple case: there is no chunk data, which means there is a single gap of the entire size */ if (!chunks->count) { - chunk_t c = {0, total}; + CF_Chunk_t c = {0, total}; if (compute_gap_fn) { compute_gap_fn(chunks, &c, opaque); @@ -457,10 +457,10 @@ uint32 CF_Chunks_ComputeGaps(const chunks_t *chunks, index_t max_gaps, chunk_siz while ((ret < max_gaps) && (i < chunks->count)) { - chunk_offset_t next_off = (i == (chunks->count - 1)) ? total : chunks->chunks[i + 1].offset; - chunk_offset_t gap_start = (chunks->chunks[i].offset + chunks->chunks[i].size); - chunk_size_t gap_size = (next_off - gap_start); - chunk_t c = {gap_start, gap_size}; + CF_ChunkOffset_t next_off = (i == (chunks->count - 1)) ? total : chunks->chunks[i + 1].offset; + CF_ChunkOffset_t gap_start = (chunks->chunks[i].offset + chunks->chunks[i].size); + CF_ChunkSize_t gap_size = (next_off - gap_start); + CF_Chunk_t c = {gap_start, gap_size}; if (gap_start >= total) { @@ -470,7 +470,7 @@ uint32 CF_Chunks_ComputeGaps(const chunks_t *chunks, index_t max_gaps, chunk_siz /* check if start has been passed */ if (!started && ((c.offset + c.size) >= start)) { - chunk_size_t start_diff = (start - c.offset); + CF_ChunkSize_t start_diff = (start - c.offset); if (start_diff < c.offset) { c.offset += start_diff; diff --git a/fsw/src/cf_chunk.h b/fsw/src/cf_chunk.h index a04640f7..40fbc92e 100644 --- a/fsw/src/cf_chunk.h +++ b/fsw/src/cf_chunk.h @@ -24,47 +24,47 @@ ** *************************************************************************/ -#ifndef CF_CHUNK__H -#define CF_CHUNK__H +#ifndef CF_CHUNK_H +#define CF_CHUNK_H #include "cfe.h" -typedef uint32 index_t; -typedef uint32 chunk_offset_t; -typedef uint32 chunk_size_t; +typedef uint32 CF_ChunkIdx_t; +typedef uint32 CF_ChunkOffset_t; +typedef uint32 CF_ChunkSize_t; /* I talked this over with a friend, Stephen Newell (stephen@sjnewell.com) and he wrote something in c++. * I liked it, so converted it to C. Giving credit where it's due. */ typedef struct { - chunk_offset_t offset; - chunk_size_t size; -} chunk_t; + CF_ChunkOffset_t offset; + CF_ChunkSize_t size; +} CF_Chunk_t; typedef struct { - index_t count; - index_t CF_max_chunks; - chunk_t *chunks; -} chunks_t; + CF_ChunkIdx_t count; + CF_ChunkIdx_t CF_max_chunks; + CF_Chunk_t *chunks; +} CF_ChunkList_t; -void CF_Chunks_Init(chunks_t *chunks, index_t CF_max_chunks, chunk_t *chunks_mem); -void CF_Chunks_Add(chunks_t *chunks, chunk_offset_t offset, chunk_size_t size); -void CF_ChunksReset(chunks_t *chunks); -/* CF_Chunks_RemoveFromFirst - +void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Chunk_t *chunks_mem); +void CF_ChunkListAdd(CF_ChunkList_t *chunks, CF_ChunkOffset_t offset, CF_ChunkSize_t size); +void CF_ChunkListReset(CF_ChunkList_t *chunks); +/* CF_ChunkList_RemoveFromFirst - * * Good computer science would have a generic remove function, but that's much more complex * than we need for the use case. We aren't trying to make chunks a general purpose * reusable module, so just take the simple case that we need. * - * Same applies for CF_Chunks_GetFirstChunk() */ -void CF_Chunks_RemoveFromFirst(chunks_t *chunks, chunk_size_t size); -const chunk_t *CF_Chunks_GetFirstChunk(const chunks_t *chunks); + * Same applies for CF_ChunkList_GetFirstChunk() */ +void CF_ChunkList_RemoveFromFirst(CF_ChunkList_t *chunks, CF_ChunkSize_t size); +const CF_Chunk_t *CF_ChunkList_GetFirstChunk(const CF_ChunkList_t *chunks); -typedef void (*compute_gap_fn_t)(const chunks_t *cs, const chunk_t *c, void *opaque); +typedef void (*CF_ChunkList_ComputeGapFn_t)(const CF_ChunkList_t *cs, const CF_Chunk_t *c, void *opaque); /* returns number of gaps, in case anyone cares about number of gaps */ -uint32 CF_Chunks_ComputeGaps(const chunks_t *chunks, index_t max_gaps, chunk_size_t total, chunk_offset_t start, - compute_gap_fn_t compute_gap_fn, void *opaque); +uint32 CF_ChunkList_ComputeGaps(const CF_ChunkList_t *chunks, CF_ChunkIdx_t max_gaps, CF_ChunkSize_t total, + CF_ChunkOffset_t start, CF_ChunkList_ComputeGapFn_t compute_gap_fn, void *opaque); -#endif /* !CF_CHUNK__H */ +#endif /* !CF_CHUNK_H */ diff --git a/unit-test/cf_cfdp_r_tests.c b/unit-test/cf_cfdp_r_tests.c index c5fee993..e5d81e3c 100644 --- a/unit-test/cf_cfdp_r_tests.c +++ b/unit-test/cf_cfdp_r_tests.c @@ -376,7 +376,7 @@ void Test_CF_CFDP_R2_Complete_Given_t_history_cc_IsNotEqTo_CC_NO_ERROR_DoNothing CF_CFDP_R2_Complete(arg_t, arg_ok_to_send_nak); /* Assert */ - UtAssert_STUB_COUNT(CF_Chunks_ComputeGaps, 0); + UtAssert_STUB_COUNT(CF_ChunkList_ComputeGaps, 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(arg_t->state_data.r.sub_state == initial_sub_state, "t->state_data.r.sub_state is %u and should be %u (unchanged)", arg_t->state_data.r.sub_state, @@ -405,7 +405,7 @@ void Test_CF_CFDP_R2_Complete_Given_t_Sets_send_nak_To_1_Given_ok_to_send_nak_Is CF_CFDP_R2_Complete(arg_t, arg_ok_to_send_nak); /* Assert */ - UtAssert_STUB_COUNT(CF_Chunks_ComputeGaps, 0); + UtAssert_STUB_COUNT(CF_ChunkList_ComputeGaps, 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(arg_t->state_data.r.sub_state == CF_RxSubState_FILEDATA, "t->state_data.r.sub_state is %u and should be %u (CF_RxSubState_FILEDATA)", @@ -441,7 +441,7 @@ void Test_CF_CFDP_R2_Complete_Given_t_Sets_send_nak_To_1_Given_ok_to_send_nak_Is CF_CFDP_R2_Complete(arg_t, arg_ok_to_send_nak); /* Assert */ - UtAssert_STUB_COUNT(CF_Chunks_ComputeGaps, 0); + UtAssert_STUB_COUNT(CF_ChunkList_ComputeGaps, 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_True(arg_t->state_data.r.sub_state == CF_RxSubState_FILEDATA, "t->state_data.r.sub_state is %u and should be %u (CF_RxSubState_FILEDATA)", @@ -478,7 +478,7 @@ void Test_CF_CFDP_R2_Complete_Given_t_Sets_send_nak_To_1_Given_ok_to_send_nak_Is CF_CFDP_R2_Complete(arg_t, arg_ok_to_send_nak); /* Assert */ - UtAssert_STUB_COUNT(CF_Chunks_ComputeGaps, 0); + UtAssert_STUB_COUNT(CF_ChunkList_ComputeGaps, 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(arg_t->flags.rx.send_nak == 1, "t->flags.rx.send_nak is %u and should be 1", arg_t->flags.rx.send_nak); @@ -509,7 +509,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_ arg_t->flags.rx.md_recv = 1; arg_t->flags.rx.send_nak = 0; - UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), Any_int_Except(0)); + UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), Any_int_Except(0)); CF_AppData.config_table = &dummy_config_table; CF_AppData.config_table->nak_limit = Any_uint8_GreaterThan(1); @@ -519,7 +519,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_ CF_CFDP_R2_Complete(arg_t, arg_ok_to_send_nak); /* Assert */ - UtAssert_STUB_COUNT(CF_Chunks_ComputeGaps, 1); + UtAssert_STUB_COUNT(CF_ChunkList_ComputeGaps, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(arg_t->flags.rx.send_nak == 1, "t->flags.rx.send_nak is %u and should be 1", arg_t->flags.rx.send_nak); @@ -550,7 +550,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_ arg_t->flags.rx.md_recv = 1; arg_t->flags.rx.send_nak = 0; - UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), 0); + UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), 0); arg_t->flags.rx.eof_recv = 0; CF_AppData.config_table = &dummy_config_table; @@ -561,7 +561,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_ CF_CFDP_R2_Complete(arg_t, arg_ok_to_send_nak); /* Assert */ - UtAssert_STUB_COUNT(CF_Chunks_ComputeGaps, 1); + UtAssert_STUB_COUNT(CF_ChunkList_ComputeGaps, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(arg_t->flags.rx.send_nak == 0, "t->flags.rx.send_nak is %u and should be 0", arg_t->flags.rx.send_nak); @@ -593,7 +593,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_ arg_t->flags.rx.send_nak = 0; arg_t->flags.rx.send_fin = 0; - UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), 0); + UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), 0); arg_t->flags.rx.eof_recv = 1; CF_AppData.config_table = &dummy_config_table; @@ -604,7 +604,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_ CF_CFDP_R2_Complete(arg_t, arg_ok_to_send_nak); /* Assert */ - UtAssert_STUB_COUNT(CF_Chunks_ComputeGaps, 1); + UtAssert_STUB_COUNT(CF_ChunkList_ComputeGaps, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(arg_t->flags.rx.send_nak == 0, "t->flags.rx.send_nak is %u and should be 0", arg_t->flags.rx.send_nak); @@ -1503,7 +1503,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_non0_Cal /* Assert */ UtAssert_STUB_COUNT(CF_CFDP_RecvFd, 1); - UtAssert_STUB_COUNT(CF_Chunks_Add, 0); + UtAssert_STUB_COUNT(CF_ChunkListAdd, 0); /* Assert for CF_CFDP_R_ProcessFd */ UtAssert_STUB_COUNT(CF_HeaderSize, 0); /* Assert for CF_CFDP_R2_Reset via CF_CFDP_R1_Reset */ @@ -1534,7 +1534,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_0_CallTo /* Assert */ UtAssert_STUB_COUNT(CF_CFDP_RecvFd, 1); - UtAssert_STUB_COUNT(CF_Chunks_Add, 0); + UtAssert_STUB_COUNT(CF_ChunkListAdd, 0); /* Assert for CF_CFDP_R_ProcessFd */ UtAssert_STUB_COUNT(CF_HeaderSize, 1); /* Assert for CF_CFDP_R2_Reset via CF_CFDP_R1_Reset */ @@ -1597,7 +1597,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_0_And_t_flag /* Assert */ UtAssert_STUB_COUNT(CF_CFDP_RecvFd, 1); - UtAssert_STUB_COUNT(CF_Chunks_Add, 1); + UtAssert_STUB_COUNT(CF_ChunkListAdd, 1); UtAssert_True(arg_t->state_data.r.r2.counter.nak == 0, "t->state_data.r.r2.counter.nak is %u and should be 0", arg_t->state_data.r.r2.counter.nak); /* Assert for CF_CFDP_R_ProcessFd - 3 calls, one in function two in STATIC_CAST */ @@ -1665,7 +1665,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_1_Call_CF_CF /* Assert */ UtAssert_STUB_COUNT(CF_CFDP_RecvFd, 1); - UtAssert_STUB_COUNT(CF_Chunks_Add, 1); + UtAssert_STUB_COUNT(CF_ChunkListAdd, 1); UtAssert_True(arg_t->state_data.r.r2.counter.nak == 0, "t->state_data.r.r2.counter.nak is %u and should be 0", arg_t->state_data.r.r2.counter.nak); /* Assert for CF_CFDP_R_ProcessFd - 3 calls, one in function two in STATIC_CAST */ @@ -1730,7 +1730,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_0_And_t_flag /* Assert */ UtAssert_STUB_COUNT(CF_CFDP_RecvFd, 1); - UtAssert_STUB_COUNT(CF_Chunks_Add, 1); + UtAssert_STUB_COUNT(CF_ChunkListAdd, 1); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 1); UtAssert_True(arg_t->state_data.r.r2.counter.nak == 0, "t->state_data.r.r2.counter.nak is %u and should be 0", arg_t->state_data.r.r2.counter.nak); @@ -1753,9 +1753,9 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_0_And_t_flag void Test_CF_CFDP_R2_GapCompute_AssertsWhenGiven_c_size_Is_0(void) { // /* Arrange */ - // chunks_t* arg_chunks; - // chunk_t dummy_c; - // chunk_t* arg_c = &dummy_c; + // CF_ChunkList_t* arg_chunks; + // CF_Chunk_t dummy_c; + // CF_Chunk_t* arg_c = &dummy_c; // gap_compute_args_t dummy_args; // void* arg_opaque = &dummy_args; @@ -1771,10 +1771,10 @@ void Test_CF_CFDP_R2_GapCompute_AssertsWhenGiven_c_size_Is_0(void) void Test_CF_CFDP_R2_GapCompute_WhenGiven_c_size_IsGreaterThan_0_Increment_gap_counter(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_t dummy_c; - chunk_t *arg_c = &dummy_c; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_Chunk_t dummy_c; + CF_Chunk_t *arg_c = &dummy_c; CF_UT_fullhdr_t dummy; gap_compute_args_t dummy_args; void *arg_opaque = &dummy_args; @@ -1959,7 +1959,7 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput UT_SetDataBuffer(UT_KEY(CF_CFDP_ConstructPduHeader), &context_CF_CFDP_ConstructPduHeader, sizeof(context_CF_CFDP_ConstructPduHeader), false); - UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), Any_uint32_Except(0)); + UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), Any_uint32_Except(0)); context_CF_CFDP_SendNak.forced_return = Any_uint8_ExceptThese(exceptions, 2); UT_SetDataBuffer(UT_KEY(CF_CFDP_SendNak), &context_CF_CFDP_SendNak, sizeof(context_CF_CFDP_SendNak), false); @@ -1998,7 +1998,7 @@ void Test_CF_CFDP_R_SubstateSendNak_AssertsBecauseGiven_t_md_recv_Is_1_CallTo_CF // UT_SetDataBuffer(UT_KEY(CF_CFDP_ConstructPduHeader), &context_CF_CFDP_ConstructPduHeader, // sizeof(context_CF_CFDP_ConstructPduHeader), false); - // UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), Any_uint32_Except(0)); + // UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), Any_uint32_Except(0)); // context_CF_CFDP_SendNak.forced_return = CF_SendRet_ERROR; // UT_SetDataBuffer(UT_KEY(CF_CFDP_SendNak), &context_CF_CFDP_SendNak, @@ -2042,7 +2042,7 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput UT_SetDataBuffer(UT_KEY(CF_CFDP_ConstructPduHeader), &context_CF_CFDP_ConstructPduHeader, sizeof(context_CF_CFDP_ConstructPduHeader), false); - UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), Any_uint32_Except(0)); + UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), Any_uint32_Except(0)); context_CF_CFDP_SendNak.forced_return = CF_SendRet_SUCCESS; UT_SetDataBuffer(UT_KEY(CF_CFDP_SendNak), &context_CF_CFDP_SendNak, sizeof(context_CF_CFDP_SendNak), false); @@ -2081,7 +2081,7 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput UT_SetDataBuffer(UT_KEY(CF_CFDP_ConstructPduHeader), &context_CF_CFDP_ConstructPduHeader, sizeof(context_CF_CFDP_ConstructPduHeader), false); - UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), 0); + UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), 0); dummy_chunks.chunks.CF_max_chunks = Any_uint32_Except(0); dummy_chunks.chunks.count = Any_uint32_LessThan(dummy_chunks.chunks.CF_max_chunks); @@ -2119,7 +2119,7 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput UT_SetDataBuffer(UT_KEY(CF_CFDP_ConstructPduHeader), &context_CF_CFDP_ConstructPduHeader, sizeof(context_CF_CFDP_ConstructPduHeader), false); - UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), 0); + UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), 0); dummy_chunks.chunks.CF_max_chunks = Any_uint32_Except(0); dummy_chunks.chunks.count = dummy_chunks.chunks.CF_max_chunks; @@ -2157,7 +2157,7 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput UT_SetDataBuffer(UT_KEY(CF_CFDP_ConstructPduHeader), &context_CF_CFDP_ConstructPduHeader, sizeof(context_CF_CFDP_ConstructPduHeader), false); - UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), 0); + UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), 0); dummy_chunks.chunks.CF_max_chunks = Any_uint32_Except(UINT32_MAX); dummy_chunks.chunks.count = Any_uint32_GreaterThan(dummy_chunks.chunks.CF_max_chunks); @@ -4157,7 +4157,7 @@ void Test_CF_CFDP_R_Tick_Given_t_state_IsEqTo_CFDP_R2_And_inactivity_fired_Is_1_ UT_SetDataBuffer(UT_KEY(CF_CFDP_ConstructPduHeader), &context_CF_CFDP_ConstructPduHeader, sizeof(context_CF_CFDP_ConstructPduHeader), false); - UT_SetDefaultReturnValue(UT_KEY(CF_Chunks_ComputeGaps), Any_uint32_Except(0)); + UT_SetDefaultReturnValue(UT_KEY(CF_ChunkList_ComputeGaps), Any_uint32_Except(0)); context_CF_CFDP_SendNak.forced_return = CF_SendRet_SUCCESS; UT_SetDataBuffer(UT_KEY(CF_CFDP_SendNak), &context_CF_CFDP_SendNak, sizeof(context_CF_CFDP_SendNak), false); diff --git a/unit-test/cf_cfdp_s_tests.c b/unit-test/cf_cfdp_s_tests.c index 58180af8..d1ced661 100644 --- a/unit-test/cf_cfdp_s_tests.c +++ b/unit-test/cf_cfdp_s_tests.c @@ -1161,7 +1161,7 @@ void Test_CF_CFDP_S_CheckAndRespondNak_DoesNothingBecause_CF_Chunks_GetFirstChun arg_t->chunks = &dummy_chunks; context_CF_Chunks_GetFirstChunk.forced_return = NULL; - UT_SetDataBuffer(UT_KEY(CF_Chunks_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, + UT_SetDataBuffer(UT_KEY(CF_ChunkList_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, sizeof(context_CF_Chunks_GetFirstChunk), false); /* Act */ @@ -1173,7 +1173,7 @@ void Test_CF_CFDP_S_CheckAndRespondNak_DoesNothingBecause_CF_Chunks_GetFirstChun UtAssert_True(arg_t->flags.tx.md_need_send == 0, "CF_CFDP_S_CheckAndRespondNak did not set t->flags.tx.md_need_send %d and should be 0", arg_t->flags.tx.md_need_send); - UtAssert_STUB_COUNT(CF_Chunks_GetFirstChunk, 1); + UtAssert_STUB_COUNT(CF_ChunkList_GetFirstChunk, 1); UtAssert_ADDRESS_EQ(context_CF_Chunks_GetFirstChunk.chunks, &arg_t->chunks->chunks); } /* end Test_CF_CFDP_S_CheckAndRespondNak_DoesNothingBecause_CF_Chunks_GetFirstChunk_Returns_NULL_Return_0 */ @@ -1185,15 +1185,15 @@ void Test_CF_CFDP_S_CheckAndRespondNak_CallTo_CF_Chunks_GetFirstChunkReturns_non CF_Transaction_t *arg_t = &dummy_t; int local_result; CF_ChunkWrapper_t dummy_chunks; - chunk_t dummy_c_instance; - chunk_t *dummy_c = &dummy_c_instance; + CF_Chunk_t dummy_c_instance; + CF_Chunk_t *dummy_c = &dummy_c_instance; CF_Chunks_GetFirstChunk_context_t context_CF_Chunks_GetFirstChunk; arg_t->flags.tx.md_need_send = 0; /* 0 = false */ arg_t->chunks = &dummy_chunks; context_CF_Chunks_GetFirstChunk.forced_return = dummy_c; - UT_SetDataBuffer(UT_KEY(CF_Chunks_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, + UT_SetDataBuffer(UT_KEY(CF_ChunkList_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, sizeof(context_CF_Chunks_GetFirstChunk), false); /* Arrange for CF_CFDP_S_SendFileData - ph will be null err_out returns 0 */ @@ -1213,7 +1213,7 @@ void Test_CF_CFDP_S_CheckAndRespondNak_CallTo_CF_Chunks_GetFirstChunkReturns_non /* Assert */ UtAssert_True(local_result == 0, "CF_CFDP_S_CheckAndRespondNak returned %d and should be 0", local_result); UtAssert_STUB_COUNT(CF_CFDP_SendMd, 0); - UtAssert_STUB_COUNT(CF_Chunks_GetFirstChunk, 1); + UtAssert_STUB_COUNT(CF_ChunkList_GetFirstChunk, 1); UtAssert_ADDRESS_EQ(context_CF_Chunks_GetFirstChunk.chunks, &arg_t->chunks->chunks); /* Assert unstubbable:CF_CFDP_S_SendFileData */ UtAssert_STUB_COUNT(CF_CFDP_ConstructPduHeader, 1); @@ -1229,15 +1229,15 @@ void Test_CF_CFDP_S_CheckAndRespondNak_CallTo_CF_Chunks_GetFirstChunkReturns_non CF_Transaction_t *arg_t = &dummy_t; int local_result; CF_ChunkWrapper_t dummy_chunks; - chunk_t dummy_c_instance; - chunk_t *dummy_c = &dummy_c_instance; + CF_Chunk_t dummy_c_instance; + CF_Chunk_t *dummy_c = &dummy_c_instance; CF_Chunks_GetFirstChunk_context_t context_CF_Chunks_GetFirstChunk; arg_t->flags.tx.md_need_send = 0; /* 0 = false */ arg_t->chunks = &dummy_chunks; context_CF_Chunks_GetFirstChunk.forced_return = dummy_c; - UT_SetDataBuffer(UT_KEY(CF_Chunks_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, + UT_SetDataBuffer(UT_KEY(CF_ChunkList_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, sizeof(context_CF_Chunks_GetFirstChunk), false); /* Arrange for CF_CFDP_S_SendFileData - fail return -1 */ @@ -1263,7 +1263,7 @@ void Test_CF_CFDP_S_CheckAndRespondNak_CallTo_CF_Chunks_GetFirstChunkReturns_non // /* Assert */ UtAssert_True(local_result == -1, "CF_CFDP_S_CheckAndRespondNak returned %d and should be -1", local_result); UtAssert_STUB_COUNT(CF_CFDP_SendMd, 0); - UtAssert_STUB_COUNT(CF_Chunks_GetFirstChunk, 1); + UtAssert_STUB_COUNT(CF_ChunkList_GetFirstChunk, 1); UtAssert_ADDRESS_EQ(context_CF_Chunks_GetFirstChunk.chunks, &arg_t->chunks->chunks); /* Assert unstubbable:CF_CFDP_S_SendFileData */ UtAssert_STUB_COUNT(CF_CFDP_ConstructPduHeader, 1); @@ -1280,15 +1280,15 @@ void Test_CF_CFDP_S_CheckAndRespondNak_CallTo_CF_Chunks_GetFirstChunkReturned_no CF_Transaction_t *arg_t = &dummy_t; int local_result; CF_ChunkWrapper_t dummy_chunks; - chunk_t dummy_c_instance; - chunk_t *dummy_c = &dummy_c_instance; + CF_Chunk_t dummy_c_instance; + CF_Chunk_t *dummy_c = &dummy_c_instance; CF_Chunks_GetFirstChunk_context_t context_CF_Chunks_GetFirstChunk; arg_t->flags.tx.md_need_send = 0; /* 0 = false */ arg_t->chunks = &dummy_chunks; context_CF_Chunks_GetFirstChunk.forced_return = dummy_c; - UT_SetDataBuffer(UT_KEY(CF_Chunks_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, + UT_SetDataBuffer(UT_KEY(CF_ChunkList_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, sizeof(context_CF_Chunks_GetFirstChunk), false); dummy_c->size = Any_uint8_GreaterThan(0); /* uint8 used for small size during testing */ @@ -1324,9 +1324,9 @@ void Test_CF_CFDP_S_CheckAndRespondNak_CallTo_CF_Chunks_GetFirstChunkReturned_no // /* Assert */ UtAssert_True(local_result == 1, "CF_CFDP_S_CheckAndRespondNak returned %d and should be 1", local_result); UtAssert_STUB_COUNT(CF_CFDP_SendMd, 0); - UtAssert_STUB_COUNT(CF_Chunks_GetFirstChunk, 1); + UtAssert_STUB_COUNT(CF_ChunkList_GetFirstChunk, 1); UtAssert_ADDRESS_EQ(context_CF_Chunks_GetFirstChunk.chunks, &arg_t->chunks->chunks); - UtAssert_STUB_COUNT(CF_Chunks_RemoveFromFirst, 1); + UtAssert_STUB_COUNT(CF_ChunkList_RemoveFromFirst, 1); /* Assert unstubbable:CF_CFDP_S_SendFileData */ UtAssert_STUB_COUNT(CF_CFDP_ConstructPduHeader, 1); UtAssert_STUB_COUNT(CF_WrappedLseek, 0); @@ -1379,7 +1379,7 @@ void Test_CF_CFDP_S2_SubstateSendFileData_CallTo_CF_CFDP_S_CheckAndRespondNak_Re arg_t->flags.tx.md_need_send = 0; /* 0 = false */ context_CF_Chunks_GetFirstChunk.forced_return = NULL; - UT_SetDataBuffer(UT_KEY(CF_Chunks_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, + UT_SetDataBuffer(UT_KEY(CF_ChunkList_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, sizeof(context_CF_Chunks_GetFirstChunk), false); /* Arrange for CF_CFDP_S_SubstateSendFileData */ @@ -1404,7 +1404,7 @@ void Test_CF_CFDP_S2_SubstateSendFileData_CallTo_CF_CFDP_S_CheckAndRespondNak_Re /* Assert */ /* Assert for CF_CFDP_S_CheckAndRespondNak */ - UtAssert_STUB_COUNT(CF_Chunks_GetFirstChunk, 1); + UtAssert_STUB_COUNT(CF_ChunkList_GetFirstChunk, 1); /* Assert for CF_CFDP_S_SubstateSendFileData via CF_CFDP_S_SendFileData*/ UtAssert_STUB_COUNT(CF_CFDP_ConstructPduHeader, 1); } /* end @@ -1479,14 +1479,14 @@ void Test_CF_CFDP_S2_SubstateSendFileData_CallTo_CF_CFDP_S_CheckAndRespondNak_Re CF_Transaction_t *arg_t = &dummy_t; /* Arrange for CF_CFDP_S_CheckAndRespondNak (get it to return 0)*/ - chunk_t fake_c; - chunk_t *dummy_c = &fake_c; + CF_Chunk_t fake_c; + CF_Chunk_t *dummy_c = &fake_c; CF_Chunks_GetFirstChunk_context_t context_CF_Chunks_GetFirstChunk; arg_t->flags.tx.md_need_send = 0; /* 0 = false */ context_CF_Chunks_GetFirstChunk.forced_return = dummy_c; - UT_SetDataBuffer(UT_KEY(CF_Chunks_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, + UT_SetDataBuffer(UT_KEY(CF_ChunkList_GetFirstChunk), &context_CF_Chunks_GetFirstChunk, sizeof(context_CF_Chunks_GetFirstChunk), false); /* Arrange for CF_CFDP_S_SendFileData */ @@ -1523,7 +1523,7 @@ void Test_CF_CFDP_S2_SubstateSendFileData_CallTo_CF_CFDP_S_CheckAndRespondNak_Re /* Assert */ /* Assert for CF_CFDP_S_CheckAndRespondNak */ - UtAssert_STUB_COUNT(CF_Chunks_GetFirstChunk, 1); + UtAssert_STUB_COUNT(CF_ChunkList_GetFirstChunk, 1); /* Assert for CF_CFDP_S_SubstateSendFileData via CF_CFDP_S_SendFileData*/ UtAssert_STUB_COUNT(CF_CFDP_ConstructPduHeader, 1); } /* end Test_CF_CFDP_S2_SubstateSendFileData_CallTo_CF_CFDP_S_CheckAndRespondNak_ReturnsPositiveValueDoNothing */ @@ -2485,7 +2485,7 @@ void Test_CF_CFDP_S2_Nak_Calls_CF_Chunks_Add_Because_start_Plus_size_IsEqualToTr arg_t->flags.tx.md_need_send = 0; /* setting md_need_send is not required, but assists in verification */ - UT_SetDataBuffer(UT_KEY(CF_Chunks_Add), &context_CF_Chunks_Add, sizeof(context_CF_Chunks_Add), false); + UT_SetDataBuffer(UT_KEY(CF_ChunkListAdd), &context_CF_Chunks_Add, sizeof(context_CF_Chunks_Add), false); /* Act */ CF_CFDP_S2_Nak(arg_t, arg_ph); @@ -2500,13 +2500,13 @@ void Test_CF_CFDP_S2_Nak_Calls_CF_Chunks_Add_Because_start_Plus_size_IsEqualToTr context_CF_CFDP_RecvNak_forced_num_sr, initial_nak_segment_requests); UtAssert_True(arg_t->flags.tx.md_need_send == 0, "md_need_send is %u and should not have changed from 0", arg_t->flags.tx.md_need_send); - UtAssert_STUB_COUNT(CF_Chunks_Add, 1); + UtAssert_STUB_COUNT(CF_ChunkListAdd, 1); UtAssert_ADDRESS_EQ(context_CF_Chunks_Add.chunks, &arg_t->chunks->chunks); UtAssert_True(context_CF_Chunks_Add.offset == dummy_offset_start, - "CF_Chunks_Add received offset %u and should be %u (start)", context_CF_Chunks_Add.offset, + "CF_ChunkListAdd received offset %u and should be %u (start)", context_CF_Chunks_Add.offset, dummy_offset_start); UtAssert_True(context_CF_Chunks_Add.size == dummy_offset_end - dummy_offset_start, - "CF_Chunks_Add received size %u and should be %u (size)", context_CF_Chunks_Add.size, + "CF_ChunkListAdd received size %u and should be %u (size)", context_CF_Chunks_Add.size, dummy_offset_end - dummy_offset_start); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end Test_CF_CFDP_S2_Nak_Calls_CF_Chunks_Add_Because_start_Plus_size_IsEqualToTransaction_fsize */ @@ -2543,7 +2543,7 @@ void Test_CF_CFDP_S2_Nak_Calls_CF_Chunks_Add_Because_start_Plus_size_IsLessThanT arg_t->flags.tx.md_need_send = 0; /* setting md_need_send is not required, but assists in verification */ - UT_SetDataBuffer(UT_KEY(CF_Chunks_Add), &context_CF_Chunks_Add, sizeof(context_CF_Chunks_Add), false); + UT_SetDataBuffer(UT_KEY(CF_ChunkListAdd), &context_CF_Chunks_Add, sizeof(context_CF_Chunks_Add), false); /* Act */ CF_CFDP_S2_Nak(arg_t, arg_ph); @@ -2558,13 +2558,13 @@ void Test_CF_CFDP_S2_Nak_Calls_CF_Chunks_Add_Because_start_Plus_size_IsLessThanT context_CF_CFDP_RecvNak_forced_num_sr, initial_nak_segment_requests); UtAssert_True(arg_t->flags.tx.md_need_send == 0, "md_need_send is %u and should not have changed from 0", arg_t->flags.tx.md_need_send); - UtAssert_STUB_COUNT(CF_Chunks_Add, 1); + UtAssert_STUB_COUNT(CF_ChunkListAdd, 1); UtAssert_ADDRESS_EQ(context_CF_Chunks_Add.chunks, &arg_t->chunks->chunks); UtAssert_True(context_CF_Chunks_Add.offset == dummy_offset_start, - "CF_Chunks_Add received offset %u and should be %u (start)", context_CF_Chunks_Add.offset, + "CF_ChunkListAdd received offset %u and should be %u (start)", context_CF_Chunks_Add.offset, dummy_offset_start); UtAssert_True(context_CF_Chunks_Add.size == dummy_offset_end - dummy_offset_start, - "CF_Chunks_Add received size %u and should be %u (size)", context_CF_Chunks_Add.size, + "CF_ChunkListAdd received size %u and should be %u (size)", context_CF_Chunks_Add.size, dummy_offset_end - dummy_offset_start); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end Test_CF_CFDP_S2_Nak_Calls_CF_Chunks_Add_Because_start_Plus_size_IsLessThanTransaction_fsize */ diff --git a/unit-test/cf_chunk_tests.c b/unit-test/cf_chunk_tests.c index a16bf8c6..13553311 100644 --- a/unit-test/cf_chunk_tests.c +++ b/unit-test/cf_chunk_tests.c @@ -4,9 +4,9 @@ typedef struct { - const chunks_t *cs; - const chunk_t *c; - void *opaque; + const CF_ChunkList_t *cs; + const CF_Chunk_t *c; + void *opaque; } CF_PACK Dummy_compute_gap_fn_t_context_t; Dummy_compute_gap_fn_t_context_t context_Dummy_compute_gap_fn_t; @@ -39,12 +39,12 @@ void cf_chunk_tests_Teardown(void) ** *******************************************************************************/ -index_t Any_index_t(void) +CF_ChunkIdx_t Any_index_t(void) { - return (index_t)Any_uint32(); + return (CF_ChunkIdx_t)Any_uint32(); } -void Dummy_compute_gap_fn_t(const chunks_t *cs, const chunk_t *c, void *opaque) +void Dummy_compute_gap_fn_t(const CF_ChunkList_t *cs, const CF_Chunk_t *c, void *opaque) { UT_Stub_RegisterContextGenericArg(UT_KEY(Dummy_compute_gap_fn_t), cs); UT_Stub_RegisterContext(UT_KEY(Dummy_compute_gap_fn_t), c); @@ -118,10 +118,10 @@ void Test_MAX_WhenItIsEqualTo_b_Returns_a(void) void Test_CF_Chunks_EraseRange_AssertsBecause_end_IsLessThan_start(void) { // /* Arrange */ - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_start = Any_uint32_Except(UINT32_MAX); - // index_t arg_end = Any_uint32_LessThan(arg_start); + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_start = Any_uint32_Except(UINT32_MAX); + // CF_ChunkIdx_t arg_end = Any_uint32_LessThan(arg_start); // /* Act */ // CF_Chunks_EraseRange(&Test_chunks, Test_start, Test_end); @@ -134,10 +134,10 @@ void Test_CF_Chunks_EraseRange_AssertsBecause_end_IsLessThan_start(void) // void Test_CF_Chunks_EraseRange_AssertsBecause_end_EqTo_start(void) // { // /* Arrange */ -// chunks_t dummy_chunks; -// chunks_t* arg_chunks = &dummy_chunks; -// index_t arg_start = Any_uint32_Except(UINT32_MAX); -// index_t arg_end = arg_start; +// CF_ChunkList_t dummy_chunks; +// CF_ChunkList_t* arg_chunks = &dummy_chunks; +// CF_ChunkIdx_t arg_start = Any_uint32_Except(UINT32_MAX); +// CF_ChunkIdx_t arg_end = arg_start; // /* Act */ // //CF_Chunks_EraseRange(&Test_chunks, Test_start, Test_end); @@ -149,15 +149,15 @@ void Test_CF_Chunks_EraseRange_AssertsBecause_end_IsLessThan_start(void) void Test_CF_Chunks_When_start_Is_OneMoreThan_end_MovesOneChunk_EraseRange(void) { /* Arrange */ - chunk_t dummy_chunk_array[2]; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_start = 0; - index_t arg_end = 1; - chunk_offset_t dummy_start_offset = Any_uint32(); - chunk_size_t dummy_start_size = Any_uint32(); - chunk_offset_t dummy_end_offset = Any_uint32_Except(dummy_start_offset); - chunk_size_t dummy_end_size = Any_uint32_Except(dummy_start_size); + CF_Chunk_t dummy_chunk_array[2]; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_start = 0; + CF_ChunkIdx_t arg_end = 1; + CF_ChunkOffset_t dummy_start_offset = Any_uint32(); + CF_ChunkSize_t dummy_start_size = Any_uint32(); + CF_ChunkOffset_t dummy_end_offset = Any_uint32_Except(dummy_start_offset); + CF_ChunkSize_t dummy_end_size = Any_uint32_Except(dummy_start_size); arg_chunks->count = 2; arg_chunks->chunks = dummy_chunk_array; @@ -178,15 +178,15 @@ void Test_CF_Chunks_When_start_Is_OneMoreThan_end_MovesOneChunk_EraseRange(void) void Test_CF_Chunks_When_start_IsLessThan_chunks_count_DoesNotChangeStart_EraseRange(void) { /* Arrange */ - chunk_t dummy_chunk_array[2]; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_start = 2; - index_t arg_end = 3; - chunk_offset_t dummy_start_offset = Any_uint32(); - chunk_size_t dummy_start_size = Any_uint32(); - chunk_offset_t dummy_end_offset = Any_uint32_Except(dummy_start_offset); - chunk_size_t dummy_end_size = Any_uint32_Except(dummy_start_size); + CF_Chunk_t dummy_chunk_array[2]; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_start = 2; + CF_ChunkIdx_t arg_end = 3; + CF_ChunkOffset_t dummy_start_offset = Any_uint32(); + CF_ChunkSize_t dummy_start_size = Any_uint32(); + CF_ChunkOffset_t dummy_end_offset = Any_uint32_Except(dummy_start_offset); + CF_ChunkSize_t dummy_end_size = Any_uint32_Except(dummy_start_size); arg_chunks->count = 2; arg_chunks->chunks = dummy_chunk_array; @@ -218,9 +218,9 @@ void Test_CF_Chunks_When_start_IsLessThan_chunks_count_DoesNotChangeStart_EraseR void Test_CF_Chunks_EraseChunk_AssertsBecause_Given_chunks_count_IsEqTo_0(void) { // /* Arrange */ - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_erase_index = Any_index_t(); + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_erase_index = Any_index_t(); // arg_chunks->count = 0; @@ -234,9 +234,9 @@ void Test_CF_Chunks_EraseChunk_AssertsBecause_Given_chunks_count_IsEqTo_0(void) void Test_CF_Chunks_EraseChunk_AssertsBecause_Given_erase_index_IsEqTo_chunks_count(void) { // /* Arrange */ - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_erase_index; + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_erase_index; // arg_chunks->count = 1; @@ -252,10 +252,10 @@ void Test_CF_Chunks_EraseChunk_AssertsBecause_Given_erase_index_IsEqTo_chunks_co void Test_CF_Chunks_EraseChunk_WhenThereIsOnlyOneEraseOneChunkAndDecrement_count_To_0(void) { /* Arrange */ - chunk_t dummy_start_chunk[1]; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_erase_index; + CF_Chunk_t dummy_start_chunk[1]; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_erase_index; arg_chunks->count = 1; arg_chunks->chunks = dummy_start_chunk; @@ -274,15 +274,15 @@ void Test_CF_Chunks_EraseChunk_EraseOneChunkThatIsNotTheLastFrom_chunks_AndDecre /* Arrange */ uint8 intial_count = Any_uint8_LessThan(10) + 2; /* 2-11, reasonably small count for testing and not its normal uint32 */ - chunk_t dummy_chunk[11] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_erase_index; - uint8 i = 0; - chunk_offset_t offsets[11] = {0}; - chunk_size_t sizes[11] = {0}; - chunk_offset_t updated_offsets[10] = {0}; - chunk_size_t updated_sizes[10] = {0}; + CF_Chunk_t dummy_chunk[11] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_erase_index; + uint8 i = 0; + CF_ChunkOffset_t offsets[11] = {0}; + CF_ChunkSize_t sizes[11] = {0}; + CF_ChunkOffset_t updated_offsets[10] = {0}; + CF_ChunkSize_t updated_sizes[10] = {0}; arg_chunks->count = intial_count; arg_chunks->chunks = dummy_chunk; @@ -337,13 +337,13 @@ void Test_CF_Chunks_EraseChunk_ErasesLastChunkFrom_chunks_AndDecrements_count(vo /* Arrange */ uint8 initial_count = Any_uint8_LessThan(10) + 2; /* 2-11, reasonably small count for testing and not its normal uint32 */ - chunk_t dummy_chunk[11] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_erase_index = initial_count - 1; - uint8 i = 0; - chunk_offset_t offsets[11] = {0}; - chunk_size_t sizes[11] = {0}; + CF_Chunk_t dummy_chunk[11] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_erase_index = initial_count - 1; + uint8 i = 0; + CF_ChunkOffset_t offsets[11] = {0}; + CF_ChunkSize_t sizes[11] = {0}; arg_chunks->count = initial_count; arg_chunks->chunks = dummy_chunk; @@ -395,10 +395,10 @@ void Test_CF_Chunks_EraseChunk_ErasesLastChunkFrom_chunks_AndDecrements_count(vo void Test_CF_Chunks_InsertChunk_AssertsBecause_Given_chunks_count_IsEqTo_chunks_CF_max_chunks(void) { // /* Arrange */ - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_index_before = Any_index_t(); - // chunk_t arg_chunk = {0}; + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_index_before = Any_index_t(); + // CF_Chunk_t arg_chunk = {0}; // arg_chunks->count = Any_uint32(); // arg_chunks->CF_max_chunks = arg_chunks->count; @@ -415,11 +415,11 @@ void Test_CF_Chunks_InsertChunk_AssertsBecause_Given_chunks_count_IsEqTo_chunks_ // void Test_CF_Chunks_InsertChunk_AssertsBecause_Given_chunks_count_IsGreaterThan_chunks_CF_max_chunks(void) // { // /* Arrange */ -// chunks_t dummy_chunks; -// chunks_t* arg_chunks = &dummy_chunks; -// index_t arg_index_before = Any_index_t(); -// chunk_t dummy_chunk = {0}; -// chunk_t* arg_chunk = &dummy_chunk; +// CF_ChunkList_t dummy_chunks; +// CF_ChunkList_t* arg_chunks = &dummy_chunks; +// CF_ChunkIdx_t arg_index_before = Any_index_t(); +// CF_Chunk_t dummy_chunk = {0}; +// CF_Chunk_t* arg_chunk = &dummy_chunk; // arg_chunks->count = Any_uint32_Except(UINT32_MAX); // arg_chunks->CF_max_chunks = Any_uint32_GreaterThan(arg_chunks->count); @@ -434,12 +434,12 @@ void Test_CF_Chunks_InsertChunk_AssertsBecause_Given_chunks_count_IsEqTo_chunks_ void Test_CF_Chunks_InsertChunk_PutGiven_chunk_IntoEmpty_chunks(void) { /* Arrange */ - chunk_t initial_chunks[1]; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_index_before = 0; - chunk_t dummy_chunk = {0}; - const chunk_t *arg_chunk; + CF_Chunk_t initial_chunks[1]; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_index_before = 0; + CF_Chunk_t dummy_chunk = {0}; + const CF_Chunk_t *arg_chunk; arg_chunks->count = 0; arg_chunks->CF_max_chunks = @@ -465,13 +465,13 @@ void Test_CF_Chunks_InsertChunk_PutGiven_chunk_IntoEmpty_chunks(void) void Test_CF_Chunks_InsertChunk_PutGiven_chunk_IntoStartOfSingle_chunks(void) { /* Arrange */ - chunk_t initial_start_chunk; - chunk_t initial_chunks[2] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_index_before = 0; - chunk_t dummy_chunk = {0}; - const chunk_t *arg_chunk; + CF_Chunk_t initial_start_chunk; + CF_Chunk_t initial_chunks[2] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_index_before = 0; + CF_Chunk_t dummy_chunk = {0}; + const CF_Chunk_t *arg_chunk; initial_start_chunk.offset = Any_uint32(); initial_start_chunk.size = Any_uint32(); @@ -505,13 +505,13 @@ void Test_CF_Chunks_InsertChunk_PutGiven_chunk_IntoStartOfSingle_chunks(void) void Test_CF_Chunks_InsertChunk_PutGiven_chunk_IntoEndOfSingle_chunks(void) { /* Arrange */ - chunk_t initial_start_chunk; - chunk_t initial_chunks[2] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_index_before = 1; - chunk_t dummy_chunk = {0}; - const chunk_t *arg_chunk; + CF_Chunk_t initial_start_chunk; + CF_Chunk_t initial_chunks[2] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_index_before = 1; + CF_Chunk_t dummy_chunk = {0}; + const CF_Chunk_t *arg_chunk; initial_start_chunk.offset = Any_uint32(); initial_start_chunk.size = Any_uint32(); @@ -545,17 +545,17 @@ void Test_CF_Chunks_InsertChunk_PutGiven_chunk_IntoEndOfSingle_chunks(void) void Test_CF_Chunks_InsertChunk_PutGiven_chunk_IntoSome_chunks(void) { /* Arrange */ - index_t initial_count = + CF_ChunkIdx_t initial_count = Any_uint8_LessThan(10) + 1; /* 1-10, reasonably small count for testing and not its normal uint32 */ - chunk_t initial_chunks[11] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_index_before = 0; - chunk_t dummy_chunk = {0}; - const chunk_t *arg_chunk; - chunk_offset_t updated_offsets[10] = {0}; - chunk_size_t updated_sizes[10] = {0}; - uint8 i; + CF_Chunk_t initial_chunks[11] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_index_before = 0; + CF_Chunk_t dummy_chunk = {0}; + const CF_Chunk_t *arg_chunk; + CF_ChunkOffset_t updated_offsets[10] = {0}; + CF_ChunkSize_t updated_sizes[10] = {0}; + uint8 i; for (i = 0; i < initial_count; ++i) { @@ -612,11 +612,11 @@ void Test_CF_Chunks_InsertChunk_PutGiven_chunk_IntoSome_chunks(void) void Test_CF_Chunks_FindInsertPosition_Given_chunks_IsEmptyReturn_0(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - index_t local_result; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkIdx_t local_result; arg_chunks->count = 0; @@ -630,12 +630,12 @@ void Test_CF_Chunks_FindInsertPosition_Given_chunks_IsEmptyReturn_0(void) void Test_CF_Chunks_FindInsertPosition_Given_chunks_HasOneItemAndGiven_chunk_offset_LessThanItemOffsetReturn_0(void) { /* Arrange */ - chunk_t initial_chunks[1] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - index_t local_result; + CF_Chunk_t initial_chunks[1] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkIdx_t local_result; initial_chunks[0].offset = Any_uint32_Except(0); @@ -654,12 +654,12 @@ void Test_CF_Chunks_FindInsertPosition_Given_chunks_HasOneItemAndGiven_chunk_off void Test_CF_Chunks_FindInsertPosition_Given_chunks_HasOneItemAndGiven_chunk_offset_EqToItemOffsetReturn_0(void) { /* Arrange */ - chunk_t initial_chunks[1] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - index_t local_result; + CF_Chunk_t initial_chunks[1] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkIdx_t local_result; initial_chunks[0].offset = Any_uint32_Except(0); @@ -678,12 +678,12 @@ void Test_CF_Chunks_FindInsertPosition_Given_chunks_HasOneItemAndGiven_chunk_off void Test_CF_Chunks_FindInsertPosition_Given_chunks_HasOneItemAndGiven_chunk_offset_GreaterThanOffsetReturn_1(void) { /* Arrange */ - chunk_t initial_chunks[1] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - index_t local_result; + CF_Chunk_t initial_chunks[1] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkIdx_t local_result; initial_chunks[0].offset = Any_uint32_Except(UINT32_MAX); @@ -703,12 +703,12 @@ void Test_CF_Chunks_FindInsertPosition_Given_chunks_HasTwoItemsAndGiven_chunk_of void) { /* Arrange */ - chunk_t initial_chunks[2] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - index_t local_result; + CF_Chunk_t initial_chunks[2] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkIdx_t local_result; initial_chunks[0].offset = Any_uint32_BetweenExcludeMax(0, UINT32_MAX - 1); initial_chunks[1].offset = Any_uint32_BetweenInclusive(initial_chunks[0].offset + 2, UINT32_MAX); @@ -729,15 +729,16 @@ void Test_CF_Chunks_FindInsertPosition_Given_chunks_HasTwoItemsAndGiven_chunk_of void Test_CF_Chunks_FindInsertPosition_Given_chunks_HasAnyItemsAndReturnCorrectExpectedPosition(void) { /* Arrange */ - chunk_t initial_chunks[20] = {{0}}; /* 20 used as a reasonably fast size for the test, but is still illustrative */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - index_t local_result; - uint8 num_chunks_before = Any_uint8_LessThan(10); - uint8 num_chunks_after = Any_uint8_LessThan(10); - uint8 i = 0; + CF_Chunk_t initial_chunks[20] = { + {0}}; /* 20 used as a reasonably fast size for the test, but is still illustrative */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkIdx_t local_result; + uint8 num_chunks_before = Any_uint8_LessThan(10); + uint8 num_chunks_after = Any_uint8_LessThan(10); + uint8 i = 0; arg_chunk->offset = Any_uint32_BetweenInclusive(1, UINT32_MAX - 1); @@ -772,12 +773,12 @@ void Test_CF_Chunks_FindInsertPosition_Given_chunks_HasAnyItemsAndReturnCorrectE void Test_CF_Chunks_CombinePrevious_Asserts_i_GivenIsEqTo_chunks_CF_max_Chunks(void) { // /* Arrange */ - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_i; - // chunk_t dummy_chunk = {0}; - // chunk_t* arg_chunk = &dummy_chunk; - // index_t local_result; + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_i; + // CF_Chunk_t dummy_chunk = {0}; + // CF_Chunk_t* arg_chunk = &dummy_chunk; + // CF_ChunkIdx_t local_result; // arg_chunks->CF_max_chunks = Any_uint32_Except(0); // arg_i = arg_chunks->CF_max_chunks; @@ -793,12 +794,12 @@ void Test_CF_Chunks_CombinePrevious_Asserts_i_GivenIsEqTo_chunks_CF_max_Chunks(v // void Test_CF_Chunks_CombinePrevious_Asserts_i_GivenIsGreaterThan_chunks_CF_max_Chunks(void) // { // /* Arrange */ -// chunks_t dummy_chunks; -// chunks_t* arg_chunks = &dummy_chunks; -// index_t arg_i; -// chunk_t dummy_chunk = {0}; -// chunk_t* arg_chunk = &dummy_chunk; -// index_t local_result; +// CF_ChunkList_t dummy_chunks; +// CF_ChunkList_t* arg_chunks = &dummy_chunks; +// CF_ChunkIdx_t arg_i; +// CF_Chunk_t dummy_chunk = {0}; +// CF_Chunk_t* arg_chunk = &dummy_chunk; +// CF_ChunkIdx_t local_result; // arg_chunks->CF_max_chunks = Any_uint32_Except(0); // arg_i = Any_uint32_GreaterThan(arg_chunks->CF_max_chunks); @@ -813,12 +814,12 @@ void Test_CF_Chunks_CombinePrevious_Asserts_i_GivenIsEqTo_chunks_CF_max_Chunks(v void Test_CF_Chunks_CombinePrevious_Given_i_Is_0_Return_0(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - int local_result = Any_int_Except(0); + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + int local_result = Any_int_Except(0); arg_chunks->CF_max_chunks = Any_uint32_Except(0); arg_i = 0; @@ -834,12 +835,12 @@ void Test_CF_Chunks_CombinePrevious_Given_i_Is_0_Return_0(void) void Test_CF_Chunks_CombinePrevious_Given_chunks_count_Is_0_Return_0(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - int local_result = Any_int_Except(0); + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + int local_result = Any_int_Except(0); arg_chunks->CF_max_chunks = Any_uint32_Except(0); arg_i = Any_uint32_LessThan(arg_chunks->CF_max_chunks); @@ -855,12 +856,12 @@ void Test_CF_Chunks_CombinePrevious_Given_chunks_count_Is_0_Return_0(void) void Test_CF_Chunks_CombinePrevious_Given_i_Is_0_And_chunks_count_Is_0_Return_0(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - int local_result = Any_int_Except(0); + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + int local_result = Any_int_Except(0); arg_chunks->CF_max_chunks = Any_uint32_Except(0); arg_i = 0; @@ -877,18 +878,18 @@ void Test_CF_Chunks_CombinePrevious_GivenIndexMinusOne_chunks_chunks_ValueFor_pr void) { /* Arrange */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i = + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i = Any_uint32_LessThan(dummy_chunks_count) + 1; /* arg_i gets +1 because the index is 0 based, but the CUT expects an i of min 1 which is the 0 element */ - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - chunk_offset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); - chunk_size_t dummy_size = Any_uint32_LessThan(UINT32_MAX / 2); - int local_result = Any_int_Except(0); + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkOffset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); + CF_ChunkSize_t dummy_size = Any_uint32_LessThan(UINT32_MAX / 2); + int local_result = Any_int_Except(0); arg_chunks->CF_max_chunks = Any_uint32_GreaterThan(dummy_chunks_count); arg_chunks->count = dummy_chunks_count; @@ -911,18 +912,18 @@ void Test_CF_Chunks_CombinePrevious_GivenIndexMinusOne_chunks_chunks_ValueFor_pr void) { /* Arrange */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i = + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i = Any_uint32_LessThan(dummy_chunks_count) + 1; /* arg_i gets +1 because the index is 0 based, but the CUT expects an i of min 1 which is the 0 element */ - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - chunk_offset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); - chunk_size_t dummy_size = Any_uint32_LessThan(UINT32_MAX / 2); - int local_result = Any_int_Except(0); + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkOffset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); + CF_ChunkSize_t dummy_size = Any_uint32_LessThan(UINT32_MAX / 2); + int local_result = Any_int_Except(0); arg_chunks->CF_max_chunks = Any_uint32_GreaterThan(dummy_chunks_count); arg_chunks->count = dummy_chunks_count; @@ -946,18 +947,18 @@ void Test_CF_Chunks_CombinePrevious_GivenIndexMinusOne_chunks_chunks_ValueFor_pr void) { /* Arrange */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i = + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i = Any_uint32_LessThan(dummy_chunks_count) + 1; /* arg_i gets +1 because the index is 0 based, but the CUT expects an i of min 1 which is the 0 element */ - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - chunk_offset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); - chunk_size_t dummy_size = Any_uint32_LessThan(UINT32_MAX / 2); - int local_result = Any_int_Except(0); + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkOffset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); + CF_ChunkSize_t dummy_size = Any_uint32_LessThan(UINT32_MAX / 2); + int local_result = Any_int_Except(0); arg_chunks->CF_max_chunks = Any_uint32_GreaterThan(dummy_chunks_count); arg_chunks->count = dummy_chunks_count; @@ -981,18 +982,18 @@ void Test_CF_Chunks_CombinePrevious_GivenIndexMinusOne_chunks_chunks_ValueFor_pr void) { /* Arrange */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i = + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i = Any_uint32_LessThan(dummy_chunks_count) + 1; /* arg_i gets +1 because the index is 0 based, but the CUT expects an i of min 1 which is the 0 element */ - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - chunk_offset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); - chunk_size_t dummy_size = Any_uint32_LessThan(UINT32_MAX / 2); - int local_result = Any_int_Except(0); + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkOffset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); + CF_ChunkSize_t dummy_size = Any_uint32_LessThan(UINT32_MAX / 2); + int local_result = Any_int_Except(0); arg_chunks->CF_max_chunks = Any_uint32_GreaterThan(dummy_chunks_count); arg_chunks->count = dummy_chunks_count; @@ -1016,18 +1017,18 @@ void Test_CF_Chunks_CombinePrevious_GivenIndexMinusOne_chunks_chunks_ValueFor_pr void) { /* Arrange */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i = + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i = Any_uint32_LessThan(dummy_chunks_count) + 1; /* arg_i gets +1 because the index is 0 based, but the CUT expects an i of min 1 which is the 0 element */ - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - chunk_offset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); - chunk_size_t initial_size = Any_uint32_LessThan(UINT32_MAX / 2); - int local_result = Any_int_Except(0); + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkOffset_t dummy_offset = Any_uint32_LessThan(UINT32_MAX / 2); + CF_ChunkSize_t initial_size = Any_uint32_LessThan(UINT32_MAX / 2); + int local_result = Any_int_Except(0); arg_chunks->CF_max_chunks = Any_uint32_GreaterThan(dummy_chunks_count); arg_chunks->count = dummy_chunks_count; @@ -1060,12 +1061,12 @@ void Test_CF_Chunks_CombinePrevious_GivenIndexMinusOne_chunks_chunks_ValueFor_pr void Test_CF_Chunks_CombineNext_Given_i_IsEqTo_Given_chunks_count_Return_0(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i; - chunk_t dummy_chunk; - chunk_t *arg_chunk = &dummy_chunk; - int local_result = Any_int_Except(0); + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk; + CF_Chunk_t *arg_chunk = &dummy_chunk; + int local_result = Any_int_Except(0); arg_chunks->count = Any_uint32(); arg_i = arg_chunks->count; @@ -1081,12 +1082,12 @@ void Test_CF_Chunks_CombineNext_Given_i_IsNotEqTo_Given_chunks_count_AssertsBeca void) { // /* Arrange */ - // chunk_t dummy_chunks_chunks = {0}; - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_i; - // chunk_t dummy_chunk = {0}; - // chunk_t* arg_chunk = &dummy_chunk; + // CF_Chunk_t dummy_chunks_chunks = {0}; + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_i; + // CF_Chunk_t dummy_chunk = {0}; + // CF_Chunk_t* arg_chunk = &dummy_chunk; // int local_result = Any_int_Except(0); // arg_chunks->count = Any_uint32(); @@ -1105,14 +1106,14 @@ void Test_CF_Chunks_CombineNext_Given_i_IsNotEqTo_Given_chunks_count_Given_chunk void) { /* Arrange */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - int local_result = Any_int_Except(0); + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + int local_result = Any_int_Except(0); arg_chunks->count = dummy_chunks_count; arg_i = Any_uint32_LessThan(arg_chunks->count); @@ -1136,14 +1137,14 @@ void Test_CF_Chunks_CombineNext_Given_chunks_chunks_offset_IsLessThan_chunk_end_ void) { /* Arrange */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - int local_result = Any_int_Except(0); + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + int local_result = Any_int_Except(0); arg_chunks->count = dummy_chunks_count; arg_i = Any_uint32_LessThan(arg_chunks->count); @@ -1169,16 +1170,16 @@ void Test_CF_Chunks_CombineNext_Given_i_IsEqToGiven_chunks_count_BreaksBReplaceE void) { /* Arrange */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - uint32 expected_num_chunks_combined; - uint8 j = 0; - int local_result = Any_int_Except(0); + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + uint32 expected_num_chunks_combined; + uint8 j = 0; + int local_result = Any_int_Except(0); arg_chunks->count = dummy_chunks_count; arg_i = @@ -1212,14 +1213,14 @@ void Test_CF_Chunks_CombineNext_Given_i_IsEqToGiven_chunks_count_ReplaceEverythi void) { /* Arrange */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; - int local_result = Any_int_Except(0); + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; + int local_result = Any_int_Except(0); arg_chunks->count = dummy_chunks_count; arg_i = @@ -1252,9 +1253,9 @@ void Test_CF_Chunks_CombineNext_Given_i_IsEqToGiven_chunks_count_ReplaceEverythi void Test_CF_Chunks_FindSmallestSize_Given_chunks_IsEmptyReturn_0(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t local_result; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t local_result; arg_chunks->count = 0; @@ -1268,10 +1269,10 @@ void Test_CF_Chunks_FindSmallestSize_Given_chunks_IsEmptyReturn_0(void) void Test_CF_Chunks_FindSmallestSize_Given_chunks_HasOneChunkReturn_0(void) { /* Arrange */ - chunk_t initial_chunks[1] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t local_result; + CF_Chunk_t initial_chunks[1] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t local_result; initial_chunks[0].size = Any_uint32(); @@ -1288,11 +1289,11 @@ void Test_CF_Chunks_FindSmallestSize_Given_chunks_HasOneChunkReturn_0(void) void Test_CF_Chunks_FindSmallestSize_Given_chunks_HasTwoChunksReturnsCorrectIndexOfSmallest(void) { /* Arrange */ - chunk_t initial_chunks[2] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t expected_result; - index_t local_result; + CF_Chunk_t initial_chunks[2] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t expected_result; + CF_ChunkIdx_t local_result; initial_chunks[0].size = Any_uint32_Except(0); initial_chunks[1].size = Any_uint32_Except(initial_chunks[0].size); @@ -1319,13 +1320,13 @@ void Test_CF_Chunks_FindSmallestSize_Given_chunks_HasTwoChunksReturnsCorrectInde void Test_CF_Chunks_FindSmallestSize_Given_chunks_HasManyChunksReturnsCorrectIndexOfSmallest(void) { /* Arrange */ - uint8 dummy_count = 25; - chunk_t initial_chunks[25] = {{0}}; /* 25 for initial_chunks is arbitrary, small for speed */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t expected_result = Any_uint8_LessThan(25); - index_t local_result; - uint8 i = 0; + uint8 dummy_count = 25; + CF_Chunk_t initial_chunks[25] = {{0}}; /* 25 for initial_chunks is arbitrary, small for speed */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t expected_result = Any_uint8_LessThan(25); + CF_ChunkIdx_t local_result; + uint8 i = 0; for (i = 0; i < dummy_count; ++i) { @@ -1371,17 +1372,17 @@ void Test_CF_Chunks_Insert_CallTo_CF_Chunks_CombineNext_Returns_non0_CallTo_CF_C void) { /* Arrange */ - chunks_t *arg_chunks; - index_t initial_i; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkList_t *arg_chunks; + CF_ChunkIdx_t initial_i; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; /* Arrange for CF_Chunks_CombineNext to return 1 */ /* Arrange for CF_Chunks_CombinePrevious to return 0 */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; arg_chunks = &dummy_chunks; arg_chunks->CF_max_chunks = UINT32_MAX; @@ -1411,16 +1412,16 @@ void Test_CF_Chunks_Insert_CallTo_CF_Chunks_CombineNext_Returns_non0_CallTo_CF_C void Test_CF_Chunks_Insert_CombinesNextSuccessButCombinePreviousSuccessCalls_CF_Chunks_EraseChunk(void) { /* Arrange */ - chunks_t *arg_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkList_t *arg_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; /* Arrange for CF_Chunks_CombineNext to return 1 */ /* Arrange for CF_Chunks_CombinePrevious to return 1 */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; arg_chunks = &dummy_chunks; arg_chunks->CF_max_chunks = UINT32_MAX; @@ -1449,15 +1450,15 @@ void Test_CF_Chunks_Insert_CallTo_CF_Chunks_CombineNext_Returns_0_CallTo_CF_Chun void) { /* Arrange */ - chunks_t *arg_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkList_t *arg_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; /* Arrange for CF_Chunks_CombineNext to return 0 and CF_Chunks_CombinePrevious to return 1 */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; arg_chunks = &dummy_chunks; arg_chunks->CF_max_chunks = UINT32_MAX; @@ -1488,15 +1489,15 @@ void Test_CF_Chunks_Insert_CallTo_CF_Chunks_CombineNext_Returns_0_CallTo_CF_Chun void) { /* Arrange */ - chunks_t *arg_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkList_t *arg_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; /* Arrange for CF_Chunks_CombineNext to return 0 and CF_Chunks_CombinePrevious to return 0 */ - uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; + uint8 dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; arg_chunks = &dummy_chunks; arg_chunks->CF_max_chunks = UINT32_MAX; @@ -1528,15 +1529,15 @@ void Test_CF_Chunks_Insert_CallTo_CF_Chunks_CombineNext_Returns_0_CallTo_CF_Chun void) { /* Arrange */ - chunks_t *arg_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkList_t *arg_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; /* Arrange for CF_Chunks_CombineNext to return 0 and CF_Chunks_CombinePrevious to return 0 */ - uint8 dummy_chunks_count = 3; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; + uint8 dummy_chunks_count = 3; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; arg_chunks = &dummy_chunks; arg_chunks->CF_max_chunks = 3; @@ -1571,15 +1572,15 @@ void Test_CF_Chunks_Insert_CallTo_CF_Chunks_CombineNext_Returns_0_CallTo_CF_Chun void) { /* Arrange */ - chunks_t *arg_chunks; - index_t arg_i; - chunk_t dummy_chunk = {0}; - chunk_t *arg_chunk = &dummy_chunk; + CF_ChunkList_t *arg_chunks; + CF_ChunkIdx_t arg_i; + CF_Chunk_t dummy_chunk = {0}; + CF_Chunk_t *arg_chunk = &dummy_chunk; /* Arrange for CF_Chunks_CombineNext to return 0 and CF_Chunks_CombinePrevious to return 0 */ - uint8 dummy_chunks_count = 3; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ - chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ - chunks_t dummy_chunks; + uint8 dummy_chunks_count = 3; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */ + CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */ + CF_ChunkList_t dummy_chunks; arg_chunks = &dummy_chunks; arg_chunks->CF_max_chunks = 3; @@ -1616,19 +1617,19 @@ void Test_CF_Chunks_Insert_CallTo_CF_Chunks_CombineNext_Returns_0_CallTo_CF_Chun /******************************************************************************* ** -** CF_Chunks_Add tests +** CF_ChunkListAdd tests ** *******************************************************************************/ void Test_CF_Chunks_Add_Asserts_WhenGiven_offset_Plus_size_IsLessThanGiven_offset(void) { // /* Arrange */ - // chunk_offset_t arg_offset = UINT32_MAX; - // chunk_size_t arg_size = 1; - // chunk_t initial_chunks[20] = { {0} }; /* 20 used as a reasonably fast size for the test, but is still - // illustrative */ chunks_t dummy_chunks; chunks_t* arg_chunks = &dummy_chunks; + // CF_ChunkOffset_t arg_offset = UINT32_MAX; + // CF_ChunkSize_t arg_size = 1; + // CF_Chunk_t initial_chunks[20] = { {0} }; /* 20 used as a reasonably fast size for the test, but is + // still illustrative */ CF_ChunkList_t dummy_chunks; CF_ChunkList_t* arg_chunks = &dummy_chunks; // /* Arrange for CF_Chunks_FindInsertPosition */ - // chunk_t dummy_chunk = {0}; + // CF_Chunk_t dummy_chunk = {0}; // uint8 num_chunks_before = Any_uint8_LessThan(10); // uint8 num_chunks_after = Any_uint8_LessThan(10); // uint8 i = 0; @@ -1649,7 +1650,7 @@ void Test_CF_Chunks_Add_Asserts_WhenGiven_offset_Plus_size_IsLessThanGiven_offse // arg_chunks->chunks = initial_chunks; // /* Act */ - // CF_Chunks_Add(arg_chunks, arg_offset, arg_size); + // CF_ChunkListAdd(arg_chunks, arg_offset, arg_size); /* Assert */ UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert"); @@ -1659,13 +1660,13 @@ void Test_CF_Chunks_Add_Asserts_WhenInsertPositionIsNotEqualToGiven_chunks_count void) { // /* Arrange */ - // chunk_offset_t arg_offset = 1; - // chunk_size_t arg_size = 1; - // chunk_t initial_chunks[20] = { {0} }; /* 20 used as a reasonably fast size for the test, but is still - // illustrative */ chunks_t dummy_chunks; chunks_t* arg_chunks = &dummy_chunks; + // CF_ChunkOffset_t arg_offset = 1; + // CF_ChunkSize_t arg_size = 1; + // CF_Chunk_t initial_chunks[20] = { {0} }; /* 20 used as a reasonably fast size for the test, but is + // still illustrative */ CF_ChunkList_t dummy_chunks; CF_ChunkList_t* arg_chunks = &dummy_chunks; // /* Arrange for CF_Chunks_FindInsertPosition */ - // chunk_t dummy_chunk = {0}; + // CF_Chunk_t dummy_chunk = {0}; // uint8 num_chunks_before = Any_uint8_LessThan(10); // uint8 num_chunks_after = Any_uint8_LessThan(10); // uint8 i = 0; @@ -1687,7 +1688,7 @@ void Test_CF_Chunks_Add_Asserts_WhenInsertPositionIsNotEqualToGiven_chunks_count // /* Act */ // /* NOTE: unsure how to set this up to hit the assert. */ - // CF_Chunks_Add(arg_chunks, arg_offset, arg_size); + // CF_ChunkListAdd(arg_chunks, arg_offset, arg_size); // /* Assert */ UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert"); @@ -1698,17 +1699,18 @@ void Test_CF_Chunks_Add_Asserts_WhenInsertPositionIsNotEqualToGiven_chunks_count void Test_CF_Chunks_Add_WhenNotAtEndCall_CF_Chunks_Insert(void) { /* Arrange */ - chunk_offset_t arg_offset = 0; - chunk_size_t arg_size = 0; - chunk_t initial_chunks[20] = {{0}}; /* 20 used as a reasonably fast size for the test, but is still illustrative */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; + CF_ChunkOffset_t arg_offset = 0; + CF_ChunkSize_t arg_size = 0; + CF_Chunk_t initial_chunks[20] = { + {0}}; /* 20 used as a reasonably fast size for the test, but is still illustrative */ + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; /* Arrange for CF_Chunks_FindInsertPosition */ - chunk_t dummy_chunk = {0}; - uint8 num_chunks_before = Any_uint8_LessThan(10); - uint8 num_chunks_after = Any_uint8_LessThan(10); - uint8 i = 0; + CF_Chunk_t dummy_chunk = {0}; + uint8 num_chunks_before = Any_uint8_LessThan(10); + uint8 num_chunks_after = Any_uint8_LessThan(10); + uint8 i = 0; dummy_chunk.offset = Any_uint32_BetweenInclusive(1, UINT32_MAX - 1); @@ -1726,7 +1728,7 @@ void Test_CF_Chunks_Add_WhenNotAtEndCall_CF_Chunks_Insert(void) arg_chunks->chunks = initial_chunks; /* Act */ - CF_Chunks_Add(arg_chunks, arg_offset, arg_size); + CF_ChunkListAdd(arg_chunks, arg_offset, arg_size); /* Assert */ /* NOTE: find a way to verify results in this test */ @@ -1738,11 +1740,11 @@ void Test_CF_Chunks_Add_WhenNotAtEndCall_CF_Chunks_Insert(void) void Test_CF_Chunks_Add_WhenAtEndCall_CF_Chunks_Insert(void) { /* Arrange */ - chunk_offset_t arg_offset = 10; - chunk_size_t arg_size = 5; - chunk_t initial_chunks[2] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; + CF_ChunkOffset_t arg_offset = 10; + CF_ChunkSize_t arg_size = 5; + CF_Chunk_t initial_chunks[2] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; /* Arrange for CF_Chunks_FindInsertPosition */ @@ -1752,7 +1754,7 @@ void Test_CF_Chunks_Add_WhenAtEndCall_CF_Chunks_Insert(void) arg_chunks->chunks = initial_chunks; /* Act */ - CF_Chunks_Add(arg_chunks, arg_offset, arg_size); + CF_ChunkListAdd(arg_chunks, arg_offset, arg_size); /* Assert */ /* NOTE: find a way to verify results in this test */ @@ -1761,11 +1763,11 @@ void Test_CF_Chunks_Add_WhenAtEndCall_CF_Chunks_Insert(void) "Nothing is able to be asserted on here, success is measured by test not segfaulting and coverage check."); } /* end Test_CF_Chunks_Add_WhenAtEndCall_CF_Chunks_Insert */ -/* end CF_Chunks_Add tests */ +/* end CF_ChunkListAdd tests */ /******************************************************************************* ** -** CF_Chunks_RemoveFromFirst tests +** CF_ChunkList_RemoveFromFirst tests ** *******************************************************************************/ @@ -1773,11 +1775,11 @@ void Test_CF_Chunks_RemoveFromFirst_When_chunks_HasOnlyOneChunkAndIts_size_IsEqT void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_offset_t initial_chunks_chunks_offset = Any_uint32(); - chunk_size_t arg_size = Any_uint32_Except(0); - chunk_t dummy_chunks_chunks; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkOffset_t initial_chunks_chunks_offset = Any_uint32(); + CF_ChunkSize_t arg_size = Any_uint32_Except(0); + CF_Chunk_t dummy_chunks_chunks; arg_chunks->count = 1; arg_chunks->chunks = &dummy_chunks_chunks; @@ -1785,7 +1787,7 @@ void Test_CF_Chunks_RemoveFromFirst_When_chunks_HasOnlyOneChunkAndIts_size_IsEqT arg_chunks->chunks[0].size = arg_size; /* Act */ - CF_Chunks_RemoveFromFirst(arg_chunks, arg_size); + CF_ChunkList_RemoveFromFirst(arg_chunks, arg_size); /* Assert */ /* Assert Unstubbable: CF_Chunks_EraseChunk */ @@ -1799,12 +1801,12 @@ void Test_CF_Chunks_RemoveFromFirst_When_chunks_HasOnlyOneChunkAndIts_size_IsSma void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_offset_t initial_chunks_chunks_offset = Any_uint32(); - chunk_size_t arg_size = Any_uint32_Except(UINT32_MAX - 1) + 2; /* from 2 to UINT_32_MAX */ - chunk_size_t dummy_chunk_size = Any_uint32_LessThan(arg_size); - chunk_t dummy_chunks_chunks; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkOffset_t initial_chunks_chunks_offset = Any_uint32(); + CF_ChunkSize_t arg_size = Any_uint32_Except(UINT32_MAX - 1) + 2; /* from 2 to UINT_32_MAX */ + CF_ChunkSize_t dummy_chunk_size = Any_uint32_LessThan(arg_size); + CF_Chunk_t dummy_chunks_chunks; arg_chunks->count = 1; arg_chunks->chunks = &dummy_chunks_chunks; @@ -1812,7 +1814,7 @@ void Test_CF_Chunks_RemoveFromFirst_When_chunks_HasOnlyOneChunkAndIts_size_IsSma arg_chunks->chunks[0].size = dummy_chunk_size; /* Act */ - CF_Chunks_RemoveFromFirst(arg_chunks, arg_size); + CF_ChunkList_RemoveFromFirst(arg_chunks, arg_size); /* Assert */ /* Assert Unstubbable: CF_Chunks_EraseChunk */ @@ -1827,12 +1829,12 @@ void Test_CF_Chunks_RemoveFromFirst_When_chunks_size_IsGreaterThanGiven_size_Add void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - chunk_offset_t initial_chunks_chunks_offset = Any_uint32(); - chunk_size_t arg_size = Any_uint32_Except(0); /* from 2 to UINT_32_MAX */ - chunk_size_t dummy_chunk_size = Any_uint32_GreaterThan(arg_size); - chunk_t dummy_chunks_chunks; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkOffset_t initial_chunks_chunks_offset = Any_uint32(); + CF_ChunkSize_t arg_size = Any_uint32_Except(0); /* from 2 to UINT_32_MAX */ + CF_ChunkSize_t dummy_chunk_size = Any_uint32_GreaterThan(arg_size); + CF_Chunk_t dummy_chunks_chunks; arg_chunks->count = 1; arg_chunks->chunks = &dummy_chunks_chunks; @@ -1840,7 +1842,7 @@ void Test_CF_Chunks_RemoveFromFirst_When_chunks_size_IsGreaterThanGiven_size_Add arg_chunks->chunks[0].size = dummy_chunk_size; /* Act */ - CF_Chunks_RemoveFromFirst(arg_chunks, arg_size); + CF_ChunkList_RemoveFromFirst(arg_chunks, arg_size); /* Assert */ UtAssert_UINT32_EQ(arg_chunks->count, 1); @@ -1850,25 +1852,25 @@ void Test_CF_Chunks_RemoveFromFirst_When_chunks_size_IsGreaterThanGiven_size_Add Test_CF_Chunks_RemoveFromFirst_When_chunks_size_IsGreaterThanGiven_size_AddGiven_size_To_chunks_chunks_0_offset_AndSet_chunks_chunks_size_To_0 */ -/* end CF_Chunks_RemoveFromFirst tests */ +/* end CF_ChunkList_RemoveFromFirst tests */ /******************************************************************************* ** -** CF_Chunks_GetFirstChunk tests +** CF_ChunkList_GetFirstChunk tests ** *******************************************************************************/ void Test_CF_Chunks_GetFirstChunk_WhenGiven_chunks_count_Is_0_Return_NULL(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - const chunk_t *local_result; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + const CF_Chunk_t *local_result; arg_chunks->count = 0; /* Act */ - local_result = CF_Chunks_GetFirstChunk(arg_chunks); + local_result = CF_ChunkList_GetFirstChunk(arg_chunks); /* Assert */ UtAssert_NULL(local_result); @@ -1877,16 +1879,16 @@ void Test_CF_Chunks_GetFirstChunk_WhenGiven_chunks_count_Is_0_Return_NULL(void) void Test_CF_Chunks_GetFirstChunk_WhenGiven_chunks_count_Is_1_ReturnOnlyChunk(void) { /* Arrange */ - chunks_t dummy_chunks = {0}; - chunks_t *arg_chunks = &dummy_chunks; - chunk_t only_chunk; - const chunk_t *local_result; + CF_ChunkList_t dummy_chunks = {0}; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_Chunk_t only_chunk; + const CF_Chunk_t *local_result; arg_chunks->count = 1; arg_chunks->chunks = &only_chunk; /* Act */ - local_result = CF_Chunks_GetFirstChunk(arg_chunks); + local_result = CF_ChunkList_GetFirstChunk(arg_chunks); /* Assert */ UtAssert_ADDRESS_EQ(local_result, &arg_chunks->chunks[0]); @@ -1896,40 +1898,40 @@ void Test_CF_Chunks_GetFirstChunk_WhenGiven_chunks_count_Is_1_ReturnOnlyChunk(vo void Test_CF_Chunks_GetFirstChunk_WhenGiven_chunks_count_Is_Any_index_t_ReturnFirstChunk(void) { /* Arrange */ - chunks_t dummy_chunks = {0}; - chunks_t *arg_chunks = &dummy_chunks; - chunk_t first_chunk; - const chunk_t *local_result; + CF_ChunkList_t dummy_chunks = {0}; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_Chunk_t first_chunk; + const CF_Chunk_t *local_result; arg_chunks->count = Any_index_t(); arg_chunks->chunks = &first_chunk; /* Act */ - local_result = CF_Chunks_GetFirstChunk(arg_chunks); + local_result = CF_ChunkList_GetFirstChunk(arg_chunks); /* Assert */ UtAssert_ADDRESS_EQ(local_result, &arg_chunks->chunks[0]); UtAssert_ADDRESS_EQ(local_result, &first_chunk); } /* end Test_CF_Chunks_GetFirstChunk_WhenGiven_chunks_count_Is_Any_index_t_ReturnFirstChunk */ -/* CF_Chunks_GetFirstChunk tests */ +/* CF_ChunkList_GetFirstChunk tests */ /******************************************************************************* ** -** CF_Chunks_Init tests +** CF_ChunkListInit tests ** *******************************************************************************/ void Test_CF_Chunks_Init_AssertsBecauseGiven_CF_max_chunks_Is_0(void) { // /* Arrange */ - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_CF_max_chunks = Any_uint16() + 2; /* 2-65537, uint16 is used instead of index_t to have a - // reasonably decent size for the test without being too large (segfault) */ chunk_t* arg_chunks_mem; + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_CF_max_chunks = Any_uint16() + 2; /* 2-65537, uint16 is used instead of CF_ChunkIdx_t + // to have a reasonably decent size for the test without being too large (segfault) */ CF_Chunk_t* arg_chunks_mem; // /* Act */ - // CF_Chunks_Init(arg_chunks, arg_CF_max_chunks, arg_chunks_mem); + // CF_ChunkListInit(arg_chunks, arg_CF_max_chunks, arg_chunks_mem); // /* Assert */ UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert"); @@ -1938,64 +1940,66 @@ void Test_CF_Chunks_Init_AssertsBecauseGiven_CF_max_chunks_Is_0(void) void Test_CF_Chunks_Init_SetGiven_chunks_CF_max_chunks_ToGiven_CF_max_chunks(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_CF_max_chunks = Any_uint16() + 2; /* 2-65537, uint8 is used instead of index_t to have a reasonably - decent size for the test without being too large (segfault) */ - chunk_t arg_chunks_mem[arg_CF_max_chunks]; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_CF_max_chunks = + Any_uint16() + 2; /* 2-65537, uint8 is used instead of CF_ChunkIdx_t to have a reasonably + decent size for the test without being too large (segfault) */ + CF_Chunk_t arg_chunks_mem[arg_CF_max_chunks]; arg_chunks->count = 0; /* Act */ - CF_Chunks_Init(arg_chunks, arg_CF_max_chunks, arg_chunks_mem); + CF_ChunkListInit(arg_chunks, arg_CF_max_chunks, arg_chunks_mem); /* Assert */ UtAssert_UINT32_EQ(arg_chunks->CF_max_chunks, arg_CF_max_chunks); UtAssert_ADDRESS_EQ(arg_chunks->chunks, arg_chunks_mem); - /* Assert Unstubbable - CF_ChunksReset */ + /* Assert Unstubbable - CF_ChunkListReset */ UtAssert_ZERO(arg_chunks->count); UtAssert_MemCmpValue(arg_chunks->chunks, 0x00, sizeof(*arg_chunks->chunks) * arg_CF_max_chunks, "The chunks, %lu bytes (sizeof(*chunks->chunks)*chunks->CF_max_chunks), were all set to 0", - sizeof(chunk_t) * arg_CF_max_chunks); + sizeof(CF_Chunk_t) * arg_CF_max_chunks); } /* end Test_CF_Chunks_Init_SetGiven_chunks_CF_max_chunks_ToGiven_CF_max_chunks */ -/* CF_Chunks_Init tests */ +/* CF_ChunkListInit tests */ /******************************************************************************* ** -** CF_ChunksReset tests +** CF_ChunkListReset tests ** *******************************************************************************/ void Test_CF_ChunksReset_Set_count_To_0_Keeps_CF_max_chunks_AndMemsets_chunks_ToAll_0(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t initial_CF_max_chunks = Any_uint16() + 2; /* 2-65537, uint8 is used instead of index_t to have a reasonably - decent size for the test without being too large (segfault) */ - chunk_t dummy_chunks_chunks[initial_CF_max_chunks]; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t initial_CF_max_chunks = + Any_uint16() + 2; /* 2-65537, uint8 is used instead of CF_ChunkIdx_t to have a reasonably + decent size for the test without being too large (segfault) */ + CF_Chunk_t dummy_chunks_chunks[initial_CF_max_chunks]; arg_chunks->count = Any_index_t(); arg_chunks->CF_max_chunks = initial_CF_max_chunks; arg_chunks->chunks = dummy_chunks_chunks; /* Act */ - CF_ChunksReset(arg_chunks); + CF_ChunkListReset(arg_chunks); /* Assert */ UtAssert_ZERO(arg_chunks->count); UtAssert_UINT32_EQ(arg_chunks->CF_max_chunks, initial_CF_max_chunks); - UtAssert_MemCmpValue(arg_chunks->chunks, 0x00, sizeof(chunk_t) * initial_CF_max_chunks, - "The chunks, %lu bytes (sizeof(chunk_t)*chunks->CF_max_chunks), were all set to 0", - sizeof(chunk_t) * initial_CF_max_chunks); + UtAssert_MemCmpValue(arg_chunks->chunks, 0x00, sizeof(CF_Chunk_t) * initial_CF_max_chunks, + "The chunks, %lu bytes (sizeof(CF_Chunk_t)*chunks->CF_max_chunks), were all set to 0", + sizeof(CF_Chunk_t) * initial_CF_max_chunks); } /* end Test_CF_ChunksReset_Set_count_To_0_Keeps_CF_max_chunks_AndMemsets_chunks_ToAll_0 */ -/* CF_ChunksReset tests */ +/* CF_ChunkListReset tests */ /******************************************************************************* ** -** CF_Chunks_ComputeGaps tests (large) - Full coverage - NOTE: This is not a great example of good unit testing. In +** CF_ChunkList_ComputeGaps tests (large) - Full coverage - NOTE: This is not a great example of good unit testing. In *the quest for speed and full coverage, liberties with values were taken to find ones that achieved the desired coverage *in the CUT. Values should be more robust and be more indicative of the kind of values that will actually be *encountered during operation. Not enough time could be spent on deciphering intent and the creator of that intent is @@ -2006,16 +2010,16 @@ void Test_CF_ChunksReset_Set_count_To_0_Keeps_CF_max_chunks_AndMemsets_chunks_To void Test_CF_Chunks_ComputeGaps_AssertsBecauseGiven_total_Is_0(void) { // /* Arrange */ - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_max_gaps = Any_uint32(); - // chunk_size_t arg_total = 0; - // chunk_offset_t arg_start = Any_uint32(); - // compute_gap_fn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_max_gaps = Any_uint32(); + // CF_ChunkSize_t arg_total = 0; + // CF_ChunkOffset_t arg_start = Any_uint32(); + // CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; // void* arg_opaque = NULL; // /* Act */ - // CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + // CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); // /* Assert */ UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert"); @@ -2024,16 +2028,16 @@ void Test_CF_Chunks_ComputeGaps_AssertsBecauseGiven_total_Is_0(void) void Test_CF_Chunks_ComputeGaps_AssertsBecauseGiven_start_IsGreaterThanGiven_total(void) { // /* Arrange */ - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_max_gaps = Any_uint32(); - // chunk_size_t arg_total = Any_uint32_Except(UINT32_MAX - 1) + 1; /* from 1 to (UINT32_MAX - 1) */ - // chunk_offset_t arg_start = Any_uint32_GreaterThan(arg_total); - // compute_gap_fn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_max_gaps = Any_uint32(); + // CF_ChunkSize_t arg_total = Any_uint32_Except(UINT32_MAX - 1) + 1; /* from 1 to (UINT32_MAX - 1) */ + // CF_ChunkOffset_t arg_start = Any_uint32_GreaterThan(arg_total); + // CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; // void* arg_opaque = NULL; // /* Act */ - // CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + // CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); // /* Assert */ UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert"); @@ -2042,16 +2046,16 @@ void Test_CF_Chunks_ComputeGaps_AssertsBecauseGiven_start_IsGreaterThanGiven_tot void Test_CF_Chunks_ComputeGaps_AssertsBecauseGiven_start_IsEqToGiven_total(void) { // /* Arrange */ - // chunks_t dummy_chunks; - // chunks_t* arg_chunks = &dummy_chunks; - // index_t arg_max_gaps = Any_uint32(); - // chunk_size_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ - // chunk_offset_t arg_start = arg_total; - // compute_gap_fn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; + // CF_ChunkList_t dummy_chunks; + // CF_ChunkList_t* arg_chunks = &dummy_chunks; + // CF_ChunkIdx_t arg_max_gaps = Any_uint32(); + // CF_ChunkSize_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ + // CF_ChunkOffset_t arg_start = arg_total; + // CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; // void* arg_opaque = NULL; // /* Act */ - // CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + // CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); // /* Assert */ UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert"); @@ -2061,18 +2065,18 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_0_And_compute_gap_fn_Is_NU void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = Any_uint32(); - chunk_size_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ - chunk_offset_t arg_start = arg_total - 1; - compute_gap_fn_t arg_compute_gap_fn = NULL; - void *arg_opaque = NULL; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = Any_uint32(); + CF_ChunkSize_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ + CF_ChunkOffset_t arg_start = arg_total - 1; + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = NULL; + void *arg_opaque = NULL; arg_chunks->count = 0; /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_STUB_COUNT(Dummy_compute_gap_fn_t, 0); @@ -2084,18 +2088,18 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_0_And_compute_gap_fn_Is_NU void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_0_And_compute_gap_fn_Is_NULL_Return_1(void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = Any_uint32(); - chunk_size_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ - chunk_offset_t arg_start = Any_uint32_LessThan(arg_total); - compute_gap_fn_t arg_compute_gap_fn = NULL; - void *arg_opaque = NULL; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = Any_uint32(); + CF_ChunkSize_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ + CF_ChunkOffset_t arg_start = Any_uint32_LessThan(arg_total); + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = NULL; + void *arg_opaque = NULL; arg_chunks->count = 0; /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_STUB_COUNT(Dummy_compute_gap_fn_t, 0); @@ -2106,12 +2110,12 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_0_And_compute_gap_fn_IsNot void) { /* Arrange */ - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = Any_uint32(); - chunk_size_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ - chunk_offset_t arg_start = Any_uint32_LessThan(arg_total); - compute_gap_fn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = Any_uint32(); + CF_ChunkSize_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ + CF_ChunkOffset_t arg_start = Any_uint32_LessThan(arg_total); + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; void *arg_opaque = NULL; Dummy_compute_gap_fn_t_context_t context_Dummy_compute_gap_fn_t; @@ -2120,7 +2124,7 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_0_And_compute_gap_fn_IsNot UT_SetHookFunction(UT_KEY(Dummy_compute_gap_fn_t), stub_reporter_hook, &context_Dummy_compute_gap_fn_t); /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_STUB_COUNT(Dummy_compute_gap_fn_t, 1); @@ -2141,13 +2145,13 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_0_And_compute_gap_fn_IsNot void Test_CF_Chunks_ComputeGaps_Given_max_gaps_Is_0_Return_0(void) { /* Arrange */ - chunk_t dummy_chunks_chunks[1] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = 0; - chunk_size_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ - chunk_offset_t arg_start = Any_uint32_LessThan(arg_total); - compute_gap_fn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; + CF_Chunk_t dummy_chunks_chunks[1] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = 0; + CF_ChunkSize_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ + CF_ChunkOffset_t arg_start = Any_uint32_LessThan(arg_total); + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; void *arg_opaque = NULL; Dummy_compute_gap_fn_t_context_t context_Dummy_compute_gap_fn_t; @@ -2160,7 +2164,7 @@ void Test_CF_Chunks_ComputeGaps_Given_max_gaps_Is_0_Return_0(void) UT_SetHookFunction(UT_KEY(Dummy_compute_gap_fn_t), stub_reporter_hook, &context_Dummy_compute_gap_fn_t); /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_STUB_COUNT(Dummy_compute_gap_fn_t, 0); @@ -2170,13 +2174,13 @@ void Test_CF_Chunks_ComputeGaps_Given_max_gaps_Is_0_Return_0(void) void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_gap_start_IsEqTo_total_BreakAndReturn_0(void) { /* Arrange */ - chunk_t dummy_chunks_chunks[1] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = Any_uint32(); - chunk_size_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ - chunk_offset_t arg_start = Any_uint32_LessThan(arg_total); - compute_gap_fn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; + CF_Chunk_t dummy_chunks_chunks[1] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = Any_uint32(); + CF_ChunkSize_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ + CF_ChunkOffset_t arg_start = Any_uint32_LessThan(arg_total); + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; void *arg_opaque = NULL; Dummy_compute_gap_fn_t_context_t context_Dummy_compute_gap_fn_t; @@ -2189,7 +2193,7 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_gap_start_IsEqTo_tot UT_SetHookFunction(UT_KEY(Dummy_compute_gap_fn_t), stub_reporter_hook, &context_Dummy_compute_gap_fn_t); /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_STUB_COUNT(Dummy_compute_gap_fn_t, 0); @@ -2199,15 +2203,15 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_gap_start_IsEqTo_tot void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_gap_start_IsGreaterThan_total_BreakAndReturn_0(void) { /* Arrange */ - chunk_t dummy_chunks_chunks[1] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = Any_uint32(); - chunk_size_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ - chunk_offset_t arg_start = Any_uint32_LessThan(arg_total); - compute_gap_fn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; + CF_Chunk_t dummy_chunks_chunks[1] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = Any_uint32(); + CF_ChunkSize_t arg_total = Any_uint32_Except(UINT32_MAX) + 1; /* from 1 to UINT32_MAX */ + CF_ChunkOffset_t arg_start = Any_uint32_LessThan(arg_total); + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; void *arg_opaque = NULL; - chunk_offset_t dummy_gap_start = Any_uint32_GreaterThan(arg_total); + CF_ChunkOffset_t dummy_gap_start = Any_uint32_GreaterThan(arg_total); Dummy_compute_gap_fn_t_context_t context_Dummy_compute_gap_fn_t; arg_chunks->count = 1; @@ -2218,7 +2222,7 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_gap_start_IsGreaterT UT_SetHookFunction(UT_KEY(Dummy_compute_gap_fn_t), stub_reporter_hook, &context_Dummy_compute_gap_fn_t); /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_STUB_COUNT(Dummy_compute_gap_fn_t, 0); @@ -2229,14 +2233,14 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_gap_start_IsLessThan void) { /* Arrange */ - chunk_t dummy_chunks_chunks[1] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = UINT32_MAX; /* UINT32_MAX used to show this will not come into play for this test */ - chunk_size_t arg_total; - chunk_offset_t arg_start = 0; - compute_gap_fn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; - void *arg_opaque = NULL; + CF_Chunk_t dummy_chunks_chunks[1] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = UINT32_MAX; /* UINT32_MAX used to show this will not come into play for this test */ + CF_ChunkSize_t arg_total; + CF_ChunkOffset_t arg_start = 0; + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; + void *arg_opaque = NULL; Dummy_compute_gap_fn_t_context_t context_Dummy_compute_gap_fn_t; arg_chunks->count = 1; @@ -2252,7 +2256,7 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_gap_start_IsLessThan UT_SetHookFunction(UT_KEY(Dummy_compute_gap_fn_t), stub_reporter_hook, &context_Dummy_compute_gap_fn_t); /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_STUB_COUNT(Dummy_compute_gap_fn_t, 1); @@ -2265,14 +2269,14 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_c_offset_Plus_c_size void) { /* Arrange */ - chunk_t dummy_chunks_chunks[1] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = UINT32_MAX; /* UINT32_MAX used to show this will not come into play for this test */ - chunk_size_t arg_total; - chunk_offset_t arg_start; - compute_gap_fn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; - void *arg_opaque = NULL; + CF_Chunk_t dummy_chunks_chunks[1] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = UINT32_MAX; /* UINT32_MAX used to show this will not come into play for this test */ + CF_ChunkSize_t arg_total; + CF_ChunkOffset_t arg_start; + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = Dummy_compute_gap_fn_t; + void *arg_opaque = NULL; Dummy_compute_gap_fn_t_context_t context_Dummy_compute_gap_fn_t; arg_chunks->count = 1; @@ -2290,7 +2294,7 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_c_offset_Plus_c_size UT_SetHookFunction(UT_KEY(Dummy_compute_gap_fn_t), stub_reporter_hook, &context_Dummy_compute_gap_fn_t); /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_STUB_COUNT(Dummy_compute_gap_fn_t, 1); @@ -2303,14 +2307,14 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_c_offset_Plus_c_size void) { /* Arrange */ - chunk_t dummy_chunks_chunks[2] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = UINT32_MAX; /* UINT32_MAX used to show this will not come into play for this test */ - chunk_size_t arg_total; - chunk_offset_t arg_start; - compute_gap_fn_t arg_compute_gap_fn = NULL; - void *arg_opaque = NULL; + CF_Chunk_t dummy_chunks_chunks[2] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = UINT32_MAX; /* UINT32_MAX used to show this will not come into play for this test */ + CF_ChunkSize_t arg_total; + CF_ChunkOffset_t arg_start; + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = NULL; + void *arg_opaque = NULL; Dummy_compute_gap_fn_t_context_t context_Dummy_compute_gap_fn_t; arg_chunks->count = 2; @@ -2329,7 +2333,7 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_c_offset_Plus_c_size UT_SetHookFunction(UT_KEY(Dummy_compute_gap_fn_t), stub_reporter_hook, &context_Dummy_compute_gap_fn_t); /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_UINT32_EQ(result, 1); @@ -2342,14 +2346,14 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_c_offset_Plus_c_size void) { /* Arrange */ - chunk_t dummy_chunks_chunks[3] = {{0}}; - chunks_t dummy_chunks; - chunks_t *arg_chunks = &dummy_chunks; - index_t arg_max_gaps = UINT32_MAX; /* UINT32_MAX used to show this will not come into play for this test */ - chunk_size_t arg_total; - chunk_offset_t arg_start; - compute_gap_fn_t arg_compute_gap_fn = NULL; - void *arg_opaque = NULL; + CF_Chunk_t dummy_chunks_chunks[3] = {{0}}; + CF_ChunkList_t dummy_chunks; + CF_ChunkList_t *arg_chunks = &dummy_chunks; + CF_ChunkIdx_t arg_max_gaps = UINT32_MAX; /* UINT32_MAX used to show this will not come into play for this test */ + CF_ChunkSize_t arg_total; + CF_ChunkOffset_t arg_start; + CF_ChunkList_ComputeGapFn_t arg_compute_gap_fn = NULL; + void *arg_opaque = NULL; Dummy_compute_gap_fn_t_context_t context_Dummy_compute_gap_fn_t; arg_chunks->count = 3; @@ -2372,7 +2376,7 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_c_offset_Plus_c_size UT_SetHookFunction(UT_KEY(Dummy_compute_gap_fn_t), stub_reporter_hook, &context_Dummy_compute_gap_fn_t); /* Act */ - result = CF_Chunks_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); + result = CF_ChunkList_ComputeGaps(arg_chunks, arg_max_gaps, arg_total, arg_start, arg_compute_gap_fn, arg_opaque); /* Assert */ UtAssert_UINT32_EQ(result, 2); @@ -2381,7 +2385,7 @@ void Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_c_offset_Plus_c_size Test_CF_Chunks_ComputeGaps_Given_chunks_count_Is_1_And_c_offset_Plus_c_size_IsLessThanStart_And_started_Is_0_ButNextLoop_started_Is_1_And_compute_gap_fn_Is_NULL_Return_1 */ -/* end CF_Chunks_ComputeGaps tests */ +/* end CF_ChunkList_ComputeGaps tests */ /******************************************************************************* ** diff --git a/unit-test/stubs/cf_cfdp_r_stubs.c b/unit-test/stubs/cf_cfdp_r_stubs.c index 9638c929..a13b55b5 100644 --- a/unit-test/stubs/cf_cfdp_r_stubs.c +++ b/unit-test/stubs/cf_cfdp_r_stubs.c @@ -266,7 +266,7 @@ typedef struct ** \endreturns ** *************************************************************************/ -// static void CF_CFDP_R2_GapCompute(const chunks_t *chunks, const chunk_t *c, void *opaque) +// static void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, void *opaque) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); diff --git a/unit-test/stubs/cf_chunk_stubs.c b/unit-test/stubs/cf_chunk_stubs.c index 24a398a0..de738609 100644 --- a/unit-test/stubs/cf_chunk_stubs.c +++ b/unit-test/stubs/cf_chunk_stubs.c @@ -46,7 +46,7 @@ ** chunks must not be NULL. ** *************************************************************************/ -// static void CF_Chunks_EraseRange(chunks_t *chunks, index_t start, index_t end) +// static void CF_Chunks_EraseRange(CF_ChunkList_t *chunks, CF_ChunkIdx_t start, CF_ChunkIdx_t end) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -60,7 +60,7 @@ ** chunks must not be NULL. ** *************************************************************************/ -// static void CF_Chunks_EraseChunk(chunks_t *chunks, index_t erase_index) +// static void CF_Chunks_EraseChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t erase_index) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -74,7 +74,7 @@ ** chunks must not be NULL. chunk must not be NULL. ** *************************************************************************/ -// static void CF_Chunks_InsertChunk(chunks_t *chunks, index_t index_before, const chunk_t *chunk) +// static void CF_Chunks_InsertChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t index_before, const CF_Chunk_t *chunk) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -95,7 +95,7 @@ ** \endreturns ** *************************************************************************/ -// static index_t CF_Chunks_FindInsertPosition(chunks_t *chunks, const chunk_t *chunk) +// static CF_ChunkIdx_t CF_Chunks_FindInsertPosition(CF_ChunkList_t *chunks, const CF_Chunk_t *chunk) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -113,7 +113,7 @@ ** \endreturns ** *************************************************************************/ -// static int CF_Chunks_CombinePrevious(chunks_t *chunks, index_t i, const chunk_t *chunk) +// static int CF_Chunks_CombinePrevious(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t *chunk) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -131,7 +131,7 @@ ** \endreturns ** *************************************************************************/ -// static int CF_Chunks_CombineNext(chunks_t *chunks, index_t i, const chunk_t *chunk) +// static int CF_Chunks_CombineNext(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t *chunk) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -149,7 +149,7 @@ ** \endreturns ** *************************************************************************/ -// static index_t CF_Chunks_FindSmallestSize(const chunks_t *chunks) +// static CF_ChunkIdx_t CF_Chunks_FindSmallestSize(const CF_ChunkList_t *chunks) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -167,7 +167,7 @@ ** chunks must not be NULL. chunk must not be NULL. ** *************************************************************************/ -// static void CF_Chunks_Insert(chunks_t *chunks, index_t i, const chunk_t *chunk) +// static void CF_Chunks_Insert(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t *chunk) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -181,13 +181,13 @@ ** chunks must not be NULL. ** *************************************************************************/ -void CF_Chunks_Add(chunks_t *chunks, chunk_offset_t offset, chunk_size_t size) +void CF_ChunkListAdd(CF_ChunkList_t *chunks, CF_ChunkOffset_t offset, CF_ChunkSize_t size) { - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_Add), &chunks, sizeof(chunks)); - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_Add), &offset, sizeof(offset)); - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_Add), &size, sizeof(size)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkListAdd), &chunks, sizeof(chunks)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkListAdd), &offset, sizeof(offset)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkListAdd), &size, sizeof(size)); - UT_DEFAULT_IMPL(CF_Chunks_Add); + UT_DEFAULT_IMPL(CF_ChunkListAdd); } /************************************************************************/ @@ -202,12 +202,12 @@ void CF_Chunks_Add(chunks_t *chunks, chunk_offset_t offset, chunk_size_t size) ** chunks must not be NULL. ** *************************************************************************/ -void CF_Chunks_RemoveFromFirst(chunks_t *chunks, chunk_size_t size) +void CF_ChunkList_RemoveFromFirst(CF_ChunkList_t *chunks, CF_ChunkSize_t size) { - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_RemoveFromFirst), &chunks, sizeof(chunks)); - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_RemoveFromFirst), &size, sizeof(size)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkList_RemoveFromFirst), &chunks, sizeof(chunks)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkList_RemoveFromFirst), &size, sizeof(size)); - UT_DEFAULT_IMPL(CF_Chunks_RemoveFromFirst); + UT_DEFAULT_IMPL(CF_ChunkList_RemoveFromFirst); } /************************************************************************/ @@ -222,15 +222,15 @@ void CF_Chunks_RemoveFromFirst(chunks_t *chunks, chunk_size_t size) ** chunks must not be NULL. ** *************************************************************************/ -const chunk_t *CF_Chunks_GetFirstChunk(const chunks_t *chunks) +const CF_Chunk_t *CF_ChunkList_GetFirstChunk(const CF_ChunkList_t *chunks) { - chunk_t *forced_return; + CF_Chunk_t *forced_return; - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_GetFirstChunk), &chunks, sizeof(chunks)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkList_GetFirstChunk), &chunks, sizeof(chunks)); - UT_DEFAULT_IMPL(CF_Chunks_GetFirstChunk); + UT_DEFAULT_IMPL(CF_ChunkList_GetFirstChunk); - UT_Stub_CopyToLocal(UT_KEY(CF_Chunks_GetFirstChunk), &forced_return, sizeof(forced_return)); + UT_Stub_CopyToLocal(UT_KEY(CF_ChunkList_GetFirstChunk), &forced_return, sizeof(forced_return)); return forced_return; } @@ -242,13 +242,13 @@ const chunk_t *CF_Chunks_GetFirstChunk(const chunks_t *chunks) ** chunks must not be NULL. chunks_mem must not be NULL. ** *************************************************************************/ -void CF_Chunks_Init(chunks_t *chunks, index_t CF_max_chunks, chunk_t *chunks_mem) +void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Chunk_t *chunks_mem) { - UT_GenStub_AddParam(CF_Chunks_Init, chunks_t *, chunks); - UT_GenStub_AddParam(CF_Chunks_Init, index_t, CF_max_chunks); - UT_GenStub_AddParam(CF_Chunks_Init, chunk_t *, chunks_mem); + UT_GenStub_AddParam(CF_ChunkListInit, CF_ChunkList_t *, chunks); + UT_GenStub_AddParam(CF_ChunkListInit, CF_ChunkIdx_t, CF_max_chunks); + UT_GenStub_AddParam(CF_ChunkListInit, CF_Chunk_t *, chunks_mem); - UT_GenStub_Execute(CF_Chunks_Init, Basic, NULL); + UT_GenStub_Execute(CF_ChunkListInit, Basic, NULL); } /************************************************************************/ @@ -258,7 +258,7 @@ void CF_Chunks_Init(chunks_t *chunks, index_t CF_max_chunks, chunk_t *chunks_mem ** chunks must not be NULL. ** *************************************************************************/ -void CF_ChunksReset(chunks_t *chunks) +void CF_ChunkListReset(CF_ChunkList_t *chunks) { UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", __FILE__, __LINE__); exit(-86); @@ -280,14 +280,14 @@ void CF_ChunksReset(chunks_t *chunks) ** \endreturns ** *************************************************************************/ -uint32 CF_Chunks_ComputeGaps(const chunks_t *chunks, index_t max_gaps, chunk_size_t total, chunk_offset_t start, - compute_gap_fn_t compute_gap_fn, void *opaque) +uint32 CF_ChunkList_ComputeGaps(const CF_ChunkList_t *chunks, CF_ChunkIdx_t max_gaps, CF_ChunkSize_t total, + CF_ChunkOffset_t start, CF_ChunkList_ComputeGapFn_t compute_gap_fn, void *opaque) { - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_ComputeGaps), &chunks, sizeof(chunks)); - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_ComputeGaps), &max_gaps, sizeof(max_gaps)); - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_ComputeGaps), &total, sizeof(total)); - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_ComputeGaps), &compute_gap_fn, sizeof(compute_gap_fn)); - UT_Stub_CopyFromLocal(UT_KEY(CF_Chunks_ComputeGaps), &opaque, sizeof(opaque)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkList_ComputeGaps), &chunks, sizeof(chunks)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkList_ComputeGaps), &max_gaps, sizeof(max_gaps)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkList_ComputeGaps), &total, sizeof(total)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkList_ComputeGaps), &compute_gap_fn, sizeof(compute_gap_fn)); + UT_Stub_CopyFromLocal(UT_KEY(CF_ChunkList_ComputeGaps), &opaque, sizeof(opaque)); - return UT_DEFAULT_IMPL(CF_Chunks_ComputeGaps); + return UT_DEFAULT_IMPL(CF_ChunkList_ComputeGaps); } diff --git a/unit-test/utilities/cf_test_utils.h b/unit-test/utilities/cf_test_utils.h index f0fcae92..f21d3f2f 100644 --- a/unit-test/utilities/cf_test_utils.h +++ b/unit-test/utilities/cf_test_utils.h @@ -338,8 +338,8 @@ typedef struct typedef struct { - const chunks_t *chunks; - const chunk_t *forced_return; + const CF_ChunkList_t *chunks; + const CF_Chunk_t *forced_return; } CF_PACK CF_Chunks_GetFirstChunk_context_t; typedef struct @@ -364,9 +364,9 @@ typedef struct typedef struct { - chunks_t *chunks; - chunk_offset_t offset; - chunk_size_t size; + CF_ChunkList_t *chunks; + CF_ChunkOffset_t offset; + CF_ChunkSize_t size; } CF_PACK CF_Chunks_Add_context_t; typedef struct @@ -392,8 +392,8 @@ typedef struct typedef struct { - chunks_t *chunks; - chunk_size_t size; + CF_ChunkList_t *chunks; + CF_ChunkSize_t size; } CF_PACK CF_Chunks_RemoveFromFirst_context_t; typedef struct