From cbd07e4ce0ede36bacf6920bd594579e931b1bdd Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 21 Dec 2012 09:50:15 +0100 Subject: score: Add rtems_chain_node_count_unprotected() --- testsuites/sptests/spchain/init.c | 22 +++++++++++++++++++++- testsuites/sptests/spchain/spchain.doc | 1 + testsuites/sptests/spchain/spchain.scn | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'testsuites') diff --git a/testsuites/sptests/spchain/init.c b/testsuites/sptests/spchain/init.c index 00e2d778b6..f8d54b0fa4 100644 --- a/testsuites/sptests/spchain/init.c +++ b/testsuites/sptests/spchain/init.c @@ -136,7 +136,6 @@ static void test_chain_with_notification(void) rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( p == &a ); - puts( "INIT - Verify rtems_chain_prepend_with_notification" ); puts( "INIT - Verify rtems_chain_get_with_notification" ); rtems_chain_initialize_empty( &chain ); @@ -199,6 +198,26 @@ static void test_chain_with_empty_check(void) rtems_test_assert( p == &b ); } +static void test_chain_node_count(void) +{ + rtems_chain_control chain; + rtems_chain_node nodes[3]; + size_t count; + size_t i; + + puts( "INIT - Verify rtems_chain_node_count_unprotected" ); + + rtems_chain_initialize_empty( &chain ); + count = rtems_chain_node_count_unprotected( &chain ); + rtems_test_assert( count == 0 ); + + for (i = 0; i < RTEMS_ARRAY_SIZE( nodes ); ++i) { + rtems_chain_append_unprotected( &chain, &nodes[i] ); + count = rtems_chain_node_count_unprotected( &chain ); + rtems_test_assert( count == i + 1 ); + } +} + rtems_task Init( rtems_task_argument ignored ) @@ -240,6 +259,7 @@ rtems_task Init( test_chain_get_with_wait(); test_chain_control_layout(); test_chain_control_initializer(); + test_chain_node_count(); puts( "*** END OF RTEMS CHAIN API TEST ***" ); rtems_test_exit(0); diff --git a/testsuites/sptests/spchain/spchain.doc b/testsuites/sptests/spchain/spchain.doc index 119d42baeb..29c9d1045c 100644 --- a/testsuites/sptests/spchain/spchain.doc +++ b/testsuites/sptests/spchain/spchain.doc @@ -23,6 +23,7 @@ directives: rtems_chain_prepend_with_notification rtems_chain_get_with_notification rtems_chain_get_with_wait + rtems_chain_node_count_unprotected concepts: diff --git a/testsuites/sptests/spchain/spchain.scn b/testsuites/sptests/spchain/spchain.scn index 4b06949bf6..9cf4d5212f 100644 --- a/testsuites/sptests/spchain/spchain.scn +++ b/testsuites/sptests/spchain/spchain.scn @@ -12,4 +12,5 @@ INIT - Verify rtems_chain_get_with_notification INIT - Verify rtems_chain_get_with_wait INIT - Verify rtems_chain_control layout INIT - Verify rtems_chain_control initializer +INIT - Verify rtems_chain_node_count_unprotected *** END OF RTEMS CHAIN API TEST *** -- cgit v1.2.3