Add kernel base priority get unit test ()

* Add uxTaskBasePriorityGet and uxTaskBasePriorityGetFromISR unit test
pull/1055/head^2
chinglee-iot committed by GitHub
parent 03926888d8
commit 1114e8f39b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 4bfb9b2d707304917f35fd5e7dcf692abb3d0cb2
Subproject commit 4ada1d7d5e853f0f9415dc99cafae72eaf571b59

@ -1604,6 +1604,96 @@ void test_uxTaskPriorityGetFromISR_success_null_handle( void )
ASSERT_INVALID_INTERRUPT_PRIORITY_CALLED();
}
/* ----------------------- testing uxTaskBasePriorityGet API --------------------------- */
/**
* @brief Test uxTaskBasePriorityGet with a task.
* @details Test uxTaskBasePriorityGet returns the base priority of the task.
*/
void test_uxTaskBasePriorityGet_success( void )
{
TaskHandle_t taskHandle;
UBaseType_t ret_priority;
create_task_priority = 3;
taskHandle = create_task();
ptcb = ( TCB_t * ) taskHandle;
TEST_ASSERT_EQUAL_PTR( pxCurrentTCB, ptcb );
/* expectations */
/* API call */
ret_priority = uxTaskBasePriorityGet( taskHandle );
/* Validations */
TEST_ASSERT_EQUAL( 3, ret_priority );
}
/**
* @brief Test uxTaskBasePriorityGet with current task.
* @details Test uxTaskBasePriorityGet returns the base priority of current task.
*/
void test_uxTaskBasePriorityGet_success_null_handle( void )
{
TaskHandle_t taskHandle;
UBaseType_t ret_priority;
create_task_priority = 3;
taskHandle = create_task();
ptcb = ( TCB_t * ) taskHandle;
TEST_ASSERT_EQUAL_PTR( pxCurrentTCB, ptcb );
/* expectations */
/* API call */
ret_priority = uxTaskBasePriorityGet( NULL );
/* Validations */
TEST_ASSERT_EQUAL( 3, ret_priority );
}
/* ----------------------- testing uxTaskBasePriorityGetFromISR API --------------------------- */
/**
* @brief Test uxTaskBasePriorityGetFromISR with a task.
* @details Test uxTaskBasePriorityGetFromISR returns the base priority of the task.
*/
void test_uxTaskBasePriorityGetFromISR_success( void )
{
TaskHandle_t taskHandle;
UBaseType_t ret_priority;
create_task_priority = 3;
taskHandle = create_task();
ptcb = ( TCB_t * ) taskHandle;
TEST_ASSERT_EQUAL_PTR( pxCurrentTCB, ptcb );
ret_priority = uxTaskBasePriorityGetFromISR( taskHandle );
TEST_ASSERT_EQUAL( 3, ret_priority );
ASSERT_PORT_CLEAR_INTERRUPT_FROM_ISR_CALLED();
ASSERT_PORT_SET_INTERRUPT_FROM_ISR_CALLED();
ASSERT_INVALID_INTERRUPT_PRIORITY_CALLED();
}
/**
* @brief Test uxTaskBasePriorityGetFromISR with current task.
* @details Test uxTaskBasePriorityGetFromISR returns the base priority of current task.
*/
void test_uxTaskBasePriorityGetFromISR_success_null_handle( void )
{
TaskHandle_t taskHandle;
UBaseType_t ret_priority;
create_task_priority = 3;
taskHandle = create_task();
ptcb = ( TCB_t * ) taskHandle;
TEST_ASSERT_EQUAL_PTR( pxCurrentTCB, ptcb );
ret_priority = uxTaskBasePriorityGetFromISR( NULL );
TEST_ASSERT_EQUAL( 3, ret_priority );
ASSERT_PORT_CLEAR_INTERRUPT_FROM_ISR_CALLED();
ASSERT_PORT_SET_INTERRUPT_FROM_ISR_CALLED();
ASSERT_INVALID_INTERRUPT_PRIORITY_CALLED();
}
/* ----------------------- testing vTaskDelay API --------------------------- */
void test_vTaskDelay_success_gt_0_yield_called( void )
{

@ -5,7 +5,7 @@ license: "MIT"
dependencies:
- name: "FreeRTOS-Kernel"
version: "4bfb9b2d7"
version: "4ada1d7d5"
repository:
type: "git"
url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git"

Loading…
Cancel
Save