Skip to content

Commit

Permalink
Merge branch 'main' into smp-dev-add-smp-unit-test
Browse files Browse the repository at this point in the history
  • Loading branch information
chinglee-iot authored Oct 19, 2023
2 parents bbb3543 + 1114e8f commit 4723b96
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 2 deletions.
90 changes: 90 additions & 0 deletions FreeRTOS/Test/CMock/tasks/tasks_1_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,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 )
{
Expand Down
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 4723b96

Please sign in to comment.