validation: Add checks to static assert tests

This ensures that the test cases have at least one test step.

Update #3716.
This commit is contained in:
Sebastian Huber
2023-05-19 08:09:26 +02:00
parent 9db208019b
commit 976f208ff2
2 changed files with 50 additions and 13 deletions
+31 -8
View File
@@ -7,7 +7,7 @@
*/
/*
* Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
* Copyright (C) 2021, 2023 embedded brains GmbH (http://www.embedded-brains.de)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -66,18 +66,22 @@
*
* This test case performs the following actions:
*
* - Check that calling rtems_scheduler_get_processor() is a constant
* - Assert that rtems_scheduler_get_processor() is a constant expression which
* evaluates to zero.
*
* - Check that calling rtems_scheduler_get_processor() returns zero.
*
* - Assert that rtems_scheduler_get_processor_maximum() is a constant
* expression which evaluates to zero.
*
* - Check that calling rtems_scheduler_get_processor_maximum() is a constant
* expression which evaluates to zero.
* - Check that calling rtems_scheduler_get_processor_maximum() returns one.
*
* @{
*/
/**
* @brief Check that calling rtems_scheduler_get_processor() is a constant
* expression which evaluates to zero.
* @brief Assert that rtems_scheduler_get_processor() is a constant expression
* which evaluates to zero.
*/
static void RtemsSchedulerValNonSmp_Action_0( void )
{
@@ -85,10 +89,18 @@ static void RtemsSchedulerValNonSmp_Action_0( void )
}
/**
* @brief Check that calling rtems_scheduler_get_processor_maximum() is a
* constant expression which evaluates to zero.
* @brief Check that calling rtems_scheduler_get_processor() returns zero.
*/
static void RtemsSchedulerValNonSmp_Action_1( void )
{
T_eq_u32( rtems_scheduler_get_processor(), 0 );
}
/**
* @brief Assert that rtems_scheduler_get_processor_maximum() is a constant
* expression which evaluates to zero.
*/
static void RtemsSchedulerValNonSmp_Action_2( void )
{
RTEMS_STATIC_ASSERT(
rtems_scheduler_get_processor_maximum() == 1,
@@ -96,6 +108,15 @@ static void RtemsSchedulerValNonSmp_Action_1( void )
);
}
/**
* @brief Check that calling rtems_scheduler_get_processor_maximum() returns
* one.
*/
static void RtemsSchedulerValNonSmp_Action_3( void )
{
T_eq_u32( rtems_scheduler_get_processor_maximum(), 1 );
}
/**
* @fn void T_case_body_RtemsSchedulerValNonSmp( void )
*/
@@ -103,6 +124,8 @@ T_TEST_CASE( RtemsSchedulerValNonSmp )
{
RtemsSchedulerValNonSmp_Action_0();
RtemsSchedulerValNonSmp_Action_1();
RtemsSchedulerValNonSmp_Action_2();
RtemsSchedulerValNonSmp_Action_3();
}
/** @} */
+19 -5
View File
@@ -7,7 +7,7 @@
*/
/*
* Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
* Copyright (C) 2021, 2023 embedded brains GmbH (http://www.embedded-brains.de)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -67,12 +67,16 @@
*
* - Validate the status code constants.
*
* - Check that RTEMS_STATUS_CODES_FIRST has the expected value and is a
* - Assert that RTEMS_STATUS_CODES_FIRST has the expected value and is a
* constant expression.
*
* - Check that RTEMS_STATUS_CODES_LAST has the expected value and is a
* - Check that RTEMS_STATUS_CODES_FIRST has the expected value.
*
* - Assert that RTEMS_STATUS_CODES_LAST has the expected value and is a
* constant expression.
*
* - Check that RTEMS_STATUS_CODES_LAST has the expected value.
*
* @{
*/
@@ -84,16 +88,26 @@ static void RtemsStatusValStatus_Action_0( void )
/* Nothing to do */
/*
* Check that RTEMS_STATUS_CODES_FIRST has the expected value and is a
* Assert that RTEMS_STATUS_CODES_FIRST has the expected value and is a
* constant expression.
*/
RTEMS_STATIC_ASSERT( RTEMS_STATUS_CODES_FIRST == 0, FIRST );
/*
* Check that RTEMS_STATUS_CODES_LAST has the expected value and is a
* Check that RTEMS_STATUS_CODES_FIRST has the expected value.
*/
T_eq_int( RTEMS_STATUS_CODES_FIRST, 0 );
/*
* Assert that RTEMS_STATUS_CODES_LAST has the expected value and is a
* constant expression.
*/
RTEMS_STATIC_ASSERT( RTEMS_STATUS_CODES_LAST == 29, LAST );
/*
* Check that RTEMS_STATUS_CODES_LAST has the expected value.
*/
T_eq_int( RTEMS_STATUS_CODES_LAST, 29 );
}
/**