summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spwkspace/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-13 17:09:14 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-13 17:09:14 +0000
commit4f7b4a88365ac991054affcc86aba178d3c86b16 (patch)
tree53af735f8615013c0932e4dbac388cc7a881a5a3 /testsuites/sptests/spwkspace/init.c
parent2009-05-13 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-4f7b4a88365ac991054affcc86aba178d3c86b16.tar.bz2
2009-05-13 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: New test to exercise rtems_workspace_XXX methods. * spwkspace/.cvsignore, spwkspace/Makefile.am, spwkspace/init.c, spwkspace/spwkspace.scn, spwkspace/system.h: New files.
Diffstat (limited to 'testsuites/sptests/spwkspace/init.c')
-rw-r--r--testsuites/sptests/spwkspace/init.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/testsuites/sptests/spwkspace/init.c b/testsuites/sptests/spwkspace/init.c
new file mode 100644
index 0000000000..0c4028b727
--- /dev/null
+++ b/testsuites/sptests/spwkspace/init.c
@@ -0,0 +1,63 @@
+/*
+ * Exercise SuperCore Object Get Next
+ *
+ * COPYRIGHT (c) 1989-2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ void *p1;
+ bool retbool;
+ Heap_Information_block info;
+
+ puts( "\n\n*** TEST WORKSPACE CLASSIC API ***" );
+
+ puts( "rtems_workspace_get_information - null pointer" );
+ retbool = rtems_workspace_get_information( NULL );
+ assert( retbool == false );
+
+ puts( "rtems_workspace_get_information - OK" );
+ retbool = rtems_workspace_get_information( &info );
+ assert( retbool == true );
+
+ puts( "rtems_workspace_allocate - null pointer" );
+ retbool = rtems_workspace_allocate( 42, NULL );
+ assert( retbool == false );
+
+ puts( "rtems_workspace_allocate - 0 bytes" );
+ retbool = rtems_workspace_allocate( 0, &p1 );
+ assert( retbool == false );
+
+ puts( "rtems_workspace_allocate - too many bytes" );
+ retbool = rtems_workspace_allocate( info.Free.largest * 2, &p1 );
+ assert( retbool == false );
+
+ puts( "rtems_workspace_allocate - 42 bytes" );
+ retbool = rtems_workspace_allocate( 42, &p1 );
+ assert( retbool == true );
+ assert( p1 != NULL );
+
+ puts( "rtems_workspace_free - NULL" );
+ retbool = rtems_workspace_free( NULL );
+ assert( retbool == false );
+
+ puts( "rtems_workspace_free - previous pointer to 42 bytes" );
+ retbool = rtems_workspace_free( p1 );
+ assert( retbool == true );
+
+
+ puts( "*** END OF TEST WORKSPACE CLASSIC API ***" );
+ rtems_test_exit( 0 );
+}