61 #include "Mock_rkhsm.h"
62 #include "Mock_rkhsma.h"
69 static RKHROM
RKH_ROM_T base = {0, 0,
"receiver"};
73 static RKH_ST_T state = {{RKH_BASIC,
"state"}};
74 static RKH_ST_T pseudoState = {{RKH_CHOICE,
"pseudoState"}};
98 test_FlagAfterInit(
void)
103 TEST_ASSERT_NOT_NULL(output);
104 TEST_ASSERT_EQUAL(
RKH_FLG, *output);
108 test_NotFullAfterInit(
void)
117 test_NotEmptyThenEmpty(
void)
123 TEST_ASSERT_EQUAL(0, nData);
127 test_GetPutOneValue(
void)
138 TEST_ASSERT_NOT_NULL(output);
139 TEST_ASSERT_EQUAL(expected, *output);
143 test_GetPutAFew(
void)
152 TEST_ASSERT_NOT_NULL(output);
153 TEST_ASSERT_EQUAL(
RKH_FLG, *output);
155 TEST_ASSERT_NOT_NULL(output);
156 TEST_ASSERT_EQUAL(1, *output);
158 TEST_ASSERT_NOT_NULL(output);
159 TEST_ASSERT_EQUAL(2, *output);
161 TEST_ASSERT_NOT_NULL(output);
162 TEST_ASSERT_EQUAL(3, *output);
179 test_EmptyToFullToEmpty(
void)
194 TEST_ASSERT_EQUAL(0, nData);
198 test_WrapAround(
void)
212 TEST_ASSERT_NOT_NULL(output);
215 TEST_ASSERT_EQUAL(128, *output);
219 test_GetFromEmptyReturnsNull(
void)
226 test_GetContinuousBlock(
void)
234 for (i = 0; i < qty; i++)
239 TEST_ASSERT_EQUAL(qty, nData);
241 for (i = 0; i < nData; i++, output++)
242 TEST_ASSERT_EQUAL((rui8_t)i, *output);
246 test_GetManyFromEmptyUsingWholeBlock(
void)
252 TEST_ASSERT_EQUAL(0, nGetElem);
256 test_GetManyElemsLessThanStoredUsingWholeBlock(
void)
260 memset(block, 0xaa, 8);
266 TEST_ASSERT_EQUAL(3, nGetElem);
267 TEST_ASSERT_EQUAL(
RKH_FLG, block[0]);
268 TEST_ASSERT_EQUAL(1, block[1]);
269 TEST_ASSERT_EQUAL(2, block[2]);
270 TEST_ASSERT_EQUAL(0xaa, block[3]);
274 test_GetManyElemsEqualThanStoredWholeBlock(
void)
278 memset(block, 0xaa, 8);
284 TEST_ASSERT_EQUAL(4, nGetElem);
285 TEST_ASSERT_EQUAL(
RKH_FLG, block[0]);
286 TEST_ASSERT_EQUAL(1, block[1]);
287 TEST_ASSERT_EQUAL(2, block[2]);
288 TEST_ASSERT_EQUAL(3, block[3]);
289 TEST_ASSERT_EQUAL(0xaa, block[4]);
293 test_GetManyElemsMoreThanStoredUsingWholeBlock(
void)
297 memset(block, 0xaa, 8);
303 TEST_ASSERT_EQUAL(4, nGetElem);
304 TEST_ASSERT_EQUAL(
RKH_FLG, block[0]);
305 TEST_ASSERT_EQUAL(1, block[1]);
306 TEST_ASSERT_EQUAL(2, block[2]);
307 TEST_ASSERT_EQUAL(3, block[3]);
308 TEST_ASSERT_EQUAL(0xaa, block[4]);
312 test_GetManyElemsEqualThanStoredWrapAroundUsingWholeBlock(
void)
317 memset(block, 0xaa, 8);
326 TEST_ASSERT_EQUAL(4, nGetElem);
327 TEST_ASSERT_EQUAL(0xaa, block[0]);
332 TEST_ASSERT_EQUAL(0xaa, block[5]);
336 test_GetManyElemsLessThanStoredWrapAroundUsingWholeBlock(
void)
341 memset(block, 0xaa, 8);
350 TEST_ASSERT_EQUAL(3, nGetElem);
351 TEST_ASSERT_EQUAL(0xaa, block[0]);
355 TEST_ASSERT_EQUAL(0xaa, block[4]);
359 test_GetManyElemsMoreThanStoredWrapAroundUsingWholeBlock(
void)
373 TEST_ASSERT_EQUAL(0xaa, block[0]);
#define RKH_CFG_TRC_SIZEOF_STREAM
Specify the maximum number of trace events in the stream. The smaller this number,...
Specifies the trace stream manager (circular buffer).
TRCQTY_T rkh_trc_getWholeBlock(rui8_t *destBlock, TRCQTY_T nElem)
Copies the last nElem bytes of the stream to destBlock. Frequently, this function is used by the ca...
void rkh_trc_put(rui8_t b)
Put a data byte into the trace stream.
rui8_t * rkh_trc_get(void)
Retrieves a pointer to oldest stored byte in the trace stream. Frequently, this function is used by t...
void rkh_trcStream_init(void)
Initializes the RKH's trace stream.
rui8_t * rkh_trc_get_block(TRCQTY_T *nget)
Retrieves a pointer to a contiguous block of data from the trace stream.
Represents events without parameters.
Constant parameters of state machine.
Describes the SMA (active object in UML).
Describes the common properties of regular states (basic, composite, and submachine).