Changeset 83b0229 in rtems


Ignore:
Timestamp:
Jun 28, 2016, 4:59:29 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
da15db78
Parents:
796f12a
git-author:
Sebastian Huber <sebastian.huber@…> (06/28/16 04:59:29)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/06/16 08:52:19)
Message:

score: Add _RBTree_Initialize_one()

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/rbtree.h

    r796f12a r83b0229  
    386386{
    387387  RB_INIT( the_rbtree );
     388}
     389
     390/**
     391 * @brief Initializes this red-black tree to contain exactly the specified
     392 * node.
     393 *
     394 * @param[in] the_rbtree The red-black tree control.
     395 * @param[in] the_node The one and only node.
     396 */
     397RTEMS_INLINE_ROUTINE void _RBTree_Initialize_one(
     398  RBTree_Control *the_rbtree,
     399  RBTree_Node    *the_node
     400)
     401{
     402  _Assert( _RBTree_Is_node_off_tree( the_node ) );
     403  RB_ROOT( the_rbtree ) = the_node;
     404  RB_PARENT( the_node, Node ) = NULL;
     405  RB_LEFT( the_node, Node ) = NULL;
     406  RB_RIGHT( the_node, Node ) = NULL;
     407  RB_COLOR( the_node, Node ) = RB_BLACK;
    388408}
    389409
  • testsuites/sptests/sprbtree01/init.c

    r796f12a r83b0229  
    1919/* forward declarations to avoid warnings */
    2020rtems_task Init(rtems_task_argument argument);
     21
     22static void test_rbtree_init_one(void)
     23{
     24  RBTree_Control tree;
     25  RBTree_Node    node;
     26
     27  puts( "INIT - Initialize one" );
     28
     29  _RBTree_Initialize_node( &node );
     30  _RBTree_Initialize_one( &tree, &node );
     31  rtems_test_assert( !_RBTree_Is_empty( &tree ) );
     32  rtems_test_assert( _RBTree_Is_root( &node ) );
     33  rtems_test_assert( !_RBTree_Is_node_off_tree( &node ) );
     34  rtems_test_assert( _RBTree_Left( &node ) == NULL );
     35  rtems_test_assert( _RBTree_Right( &node ) == NULL );
     36  rtems_test_assert( _RBTree_Parent( &node ) == NULL );
     37  rtems_test_assert( _RBTree_Successor( &node ) == NULL );
     38  rtems_test_assert( _RBTree_Predecessor( &node ) == NULL );
     39  rtems_test_assert( _RBTree_Minimum( &tree ) == &node );
     40  rtems_test_assert( _RBTree_Maximum( &tree ) == &node );
     41
     42  _RBTree_Extract( &tree, &node );
     43  rtems_test_assert( _RBTree_Is_empty( &tree ) );
     44}
    2145
    2246static const int numbers[20] = {
     
    22722296  }
    22732297
     2298  test_rbtree_init_one();
    22742299  test_rbtree_min_max();
    22752300  test_rbtree_insert_inline();
  • testsuites/sptests/sprbtree01/sprbtree01.scn

    r796f12a r83b0229  
    3131INIT - Verify rtems_rbtree_find in a duplicate tree
    3232INIT - Removing 100 nodes
     33INIT - Initialize one
    3334INIT - Verify min/max node updates
    3435INIT - Verify _RBTree_Insert_inline
Note: See TracChangeset for help on using the changeset viewer.