Update queue Unit Tests to add uxQueueItemSize (#1040)

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
kar-rahul-aws 2023-07-18 15:12:00 +05:30 committed by GitHub
parent 9f6437ca6a
commit 8b98d08bcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 20 deletions

View file

@ -68,17 +68,17 @@ int suiteTearDown( int numFailures )
static void test_long_queue( QueueHandle_t xQueue,
uint32_t maxItems )
{
/* Veify that queue is empty */
/* Verify that queue is empty */
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
queue_common_add_sequential_to_queue( xQueue, maxItems );
/* Veify that queue is full */
/* Verify that queue is full */
TEST_ASSERT_EQUAL( 0, uxQueueSpacesAvailable( xQueue ) );
queue_common_receive_sequential_from_queue( xQueue, maxItems, maxItems, 0 );
/* Veify that queue is empty */
/* Verify that queue is empty */
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
}
@ -154,7 +154,10 @@ void test_macro_xQueueCreate_oneItem_zeroLength( void )
TEST_ASSERT_EQUAL( QUEUE_T_SIZE, getLastMallocSize() );
/* Veify that new queue is empty */
/* Verify that Queue ItemSize is zero */
TEST_ASSERT_EQUAL( 0, uxQueueGetQueueItemSize( xQueue ) );
/* Verify that new queue is empty */
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
/* Valdiate that the queue has 1 space remaining */
@ -177,14 +180,17 @@ void test_macro_xQueueCreate_oneItem_oneLength( void )
TEST_ASSERT_EQUAL( QUEUE_T_SIZE + 1, getLastMallocSize() );
/* Veify that new queue is empty */
/* Verify that Queue ItemSize is one */
TEST_ASSERT_EQUAL( 1, uxQueueGetQueueItemSize( xQueue ) );
/* Verify that new queue is empty */
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
uint8_t testval = ( uint8_t ) getNextMonotonicTestValue();
TEST_ASSERT_EQUAL( pdTRUE, xQueueSend( xQueue, &testval, 0 ) );
/* Veify that queue is full */
/* Verify that queue is full */
TEST_ASSERT_EQUAL( 1, uxQueueMessagesWaiting( xQueue ) );
TEST_ASSERT_EQUAL( 0, uxQueueSpacesAvailable( xQueue ) );
@ -194,7 +200,7 @@ void test_macro_xQueueCreate_oneItem_oneLength( void )
TEST_ASSERT_EQUAL( pdTRUE, xQueueReceive( xQueue, &testVal2, 0 ) );
TEST_ASSERT_EQUAL( testval, testVal2 );
/* Veify that queue is empty */
/* Verify that queue is empty */
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
TEST_ASSERT_EQUAL( 1, uxQueueSpacesAvailable( xQueue ) );
@ -222,7 +228,10 @@ void test_macro_xQueueCreate_oneItem_multiLength( void )
TEST_ASSERT_EQUAL( QUEUE_T_SIZE + i, getLastMallocSize() );
/* Veify that queue is empty */
/* Verify that Queue ItemSize is equal to the mailbox size */
TEST_ASSERT_EQUAL( i, uxQueueGetQueueItemSize( xQueue ) );
/* Verify that queue is empty */
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
/* Mask off the bytes we won't use */
@ -242,7 +251,7 @@ void test_macro_xQueueCreate_oneItem_multiLength( void )
TEST_ASSERT_EQUAL( pdTRUE, xQueueSend( xQueue, &testVal, 0 ) );
/* Veify that queue is also full */
/* Verify that queue is also full */
TEST_ASSERT_EQUAL( 0, uxQueueSpacesAvailable( xQueue ) );
uint8_t testValCheck[ MAX_MULTI_LEN ];
@ -252,7 +261,7 @@ void test_macro_xQueueCreate_oneItem_multiLength( void )
TEST_ASSERT_EQUAL( pdTRUE, xQueueReceive( xQueue, &testValCheck, 0 ) );
TEST_ASSERT_EQUAL_MEMORY( testValCompare, testValCheck, MAX_MULTI_LEN );
/* Veify that queue is empty */
/* Verify that queue is empty */
TEST_ASSERT_EQUAL( 0, uxQueueMessagesWaiting( xQueue ) );
vQueueDelete( xQueue );