mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-17 02:07:48 -04:00
Update unit tests to match changes in queue.c (#614)
This commit is contained in:
parent
ea798d0612
commit
f37753da06
10 changed files with 57 additions and 535 deletions
|
@ -133,70 +133,6 @@ void test_macro_xQueueSend_fail_full( void )
|
|||
vQueueDelete( xQueue );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test xQueueSend with a queue of uxQueueLength=0, uxItemSize=0
|
||||
* @details This is an invalid queue configuration and causes a failed configASSERT.
|
||||
* @coverage xQueueGenericSend
|
||||
*/
|
||||
void test_macro_xQueueSend_fail_zeroQueueLength_zeroItemSize()
|
||||
{
|
||||
/* Expect that xQueueCreate will assert because a length of 0 is invalid */
|
||||
fakeAssertExpectFail();
|
||||
|
||||
QueueHandle_t xQueue = xQueueCreate( 0, 0 );
|
||||
|
||||
/* Clear the assert flag*/
|
||||
fakeAssertGetFlagAndClear();
|
||||
|
||||
uint32_t testVal = getNextMonotonicTestValue();
|
||||
|
||||
TEST_ASSERT_EQUAL( pdFALSE, xQueueSend( xQueue, &testVal, 0 ) );
|
||||
|
||||
vQueueDelete( xQueue );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test xQueueSend with a queue of uxQueueLength=0, uxItemSize=0 and NULL item.
|
||||
* @details This is an invalid queue configuration and causes a failed configASSERT.
|
||||
* @coverage xQueueGenericSend
|
||||
*/
|
||||
void test_macro_xQueueSend_fail_zeroQueueLength_zeroItemSize_null()
|
||||
{
|
||||
/* Expect that xQueueCreate will assert because a length of 0 is invalid */
|
||||
fakeAssertExpectFail();
|
||||
|
||||
QueueHandle_t xQueue = xQueueCreate( 0, 0 );
|
||||
|
||||
/* Clear the assert flag*/
|
||||
fakeAssertGetFlagAndClear();
|
||||
|
||||
TEST_ASSERT_EQUAL( pdFALSE, xQueueSend( xQueue, NULL, 0 ) );
|
||||
|
||||
vQueueDelete( xQueue );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test xQueueSend with uxQueueLength=0, uxItemSize=1
|
||||
* @details xQueueSend should return pdFALSE because the queue is full.
|
||||
* @coverage xQueueGenericSend
|
||||
*/
|
||||
void test_macro_xQueueSend_zeroQueueLength_oneItemSize( void )
|
||||
{
|
||||
/* Expect that xQueueCreate will assert because a length of 0 is invalid */
|
||||
fakeAssertExpectFail();
|
||||
|
||||
QueueHandle_t xQueue = xQueueCreate( 0, 1 );
|
||||
|
||||
/* Clear the assert flag*/
|
||||
fakeAssertGetFlagAndClear();
|
||||
|
||||
uint8_t testVal = getNextMonotonicTestValue();
|
||||
|
||||
TEST_ASSERT_EQUAL( pdFALSE, xQueueSend( xQueue, &testVal, 0 ) );
|
||||
|
||||
vQueueDelete( xQueue );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test xQueueSend with uxQueueLength=1, uxItemSize=0
|
||||
* @details xQueueSend should return pdTRUE because the queue is empty.
|
||||
|
@ -464,88 +400,6 @@ void test_macro_xQueueSendFromISR_fail( void )
|
|||
vQueueDelete( xQueue );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test xQueueSendFromISR with a queue of uxQueueLength=0, uxItemSize=0
|
||||
* @details This is an invalid queue configuration and causes a failed configASSERT.
|
||||
* @coverage xQueueGenericSendFromISR
|
||||
*/
|
||||
void test_macro_xQueueSendFromISR_fail_zeroQueueLength_zeroItemSize()
|
||||
{
|
||||
/* Expect that xQueueCreate will assert because a length of 0 is invalid */
|
||||
fakeAssertExpectFail();
|
||||
|
||||
QueueHandle_t xQueue = xQueueCreate( 0, 0 );
|
||||
|
||||
/* Clear the assert flag*/
|
||||
fakeAssertGetFlagAndClear();
|
||||
|
||||
vFakePortAssertIfInterruptPriorityInvalid_Expect();
|
||||
|
||||
uint32_t testVal = getNextMonotonicTestValue();
|
||||
|
||||
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
|
||||
|
||||
TEST_ASSERT_EQUAL( pdFALSE, xQueueSendFromISR( xQueue, &testVal, 0 ) );
|
||||
|
||||
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
|
||||
|
||||
vQueueDelete( xQueue );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test xQueueSendFromISR with a queue of uxQueueLength=0, uxItemSize=0 and NULL item.
|
||||
* @details This is an invalid queue configuration and causes a failed configASSERT.
|
||||
* @coverage xQueueGenericSendFromISR
|
||||
*/
|
||||
void test_macro_xQueueSendFromISR_fail_zeroQueueLength_zeroItemSize_null()
|
||||
{
|
||||
/* Expect that xQueueCreate will assert because a length of 0 is invalid */
|
||||
fakeAssertExpectFail();
|
||||
|
||||
QueueHandle_t xQueue = xQueueCreate( 0, 0 );
|
||||
|
||||
vFakePortAssertIfInterruptPriorityInvalid_Expect();
|
||||
|
||||
/* Clear the assert flag*/
|
||||
fakeAssertGetFlagAndClear();
|
||||
|
||||
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
|
||||
|
||||
TEST_ASSERT_EQUAL( pdFALSE, xQueueSendFromISR( xQueue, NULL, 0 ) );
|
||||
|
||||
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
|
||||
|
||||
vQueueDelete( xQueue );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test xQueueSendFromISR with uxQueueLength=0, uxItemSize=1
|
||||
* @details xQueueSendFromISR should return pdFALSE because the queue is full.
|
||||
* @coverage xQueueGenericSendFromISR
|
||||
*/
|
||||
void test_macro_xQueueSendFromISR_zeroQueueLength_oneItemSize( void )
|
||||
{
|
||||
/* Expect that xQueueCreate will assert because a length of 0 is invalid */
|
||||
fakeAssertExpectFail();
|
||||
|
||||
QueueHandle_t xQueue = xQueueCreate( 0, 1 );
|
||||
|
||||
/* Clear the assert flag*/
|
||||
fakeAssertGetFlagAndClear();
|
||||
|
||||
uint8_t testVal = getNextMonotonicTestValue();
|
||||
|
||||
vFakePortAssertIfInterruptPriorityInvalid_Expect();
|
||||
|
||||
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
|
||||
|
||||
TEST_ASSERT_EQUAL( pdFALSE, xQueueSendFromISR( xQueue, &testVal, 0 ) );
|
||||
|
||||
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
|
||||
|
||||
vQueueDelete( xQueue );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test xQueueSendFromISR with uxQueueLength=1, uxItemSize=0
|
||||
* @details xQueueSendFromISR should return pdTRUE because the queue is empty.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue