Changeset b1345b2 in rtems


Ignore:
Timestamp:
Dec 12, 2011, 3:18:18 PM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
e17789bf
Parents:
141b311
Message:

2011-12-12 Sebastian Huber <sebastian.huber@…>

  • spwkspace/init.c: Test _Workspace_String_duplicate().
Location:
testsuites/sptests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/ChangeLog

    r141b311 rb1345b2  
     12011-12-12      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * spwkspace/init.c: Test _Workspace_String_duplicate().
     4
    152011-12-08      Joel Sherrill <joel.sherrill@oarcorp.com>
    26
  • testsuites/sptests/spwkspace/init.c

    r141b311 rb1345b2  
    1818#include <tmacros.h>
    1919
     20#include <string.h>
     21
     22#include <rtems/score/wkspace.h>
     23
     24static void test_workspace_string_duplicate(void)
     25{
     26  char a [] = "abcd";
     27  char b [] = "abc";
     28  char c [] = "ab";
     29  char d [] = "a";
     30  char e [] = "";
     31  size_t maxlen = 3;
     32  char *dup_a = _Workspace_String_duplicate( a, maxlen );
     33  char *dup_b = _Workspace_String_duplicate( b, maxlen );
     34  char *dup_c = _Workspace_String_duplicate( c, maxlen );
     35  char *dup_d = _Workspace_String_duplicate( d, maxlen );
     36  char *dup_e = _Workspace_String_duplicate( e, maxlen );
     37
     38  rtems_test_assert( dup_a != NULL );
     39  rtems_test_assert( dup_b != NULL );
     40  rtems_test_assert( dup_c != NULL );
     41  rtems_test_assert( dup_d != NULL );
     42  rtems_test_assert( dup_e != NULL );
     43  rtems_test_assert( strcmp( dup_a, b ) == 0 );
     44  rtems_test_assert( strcmp( dup_b, b ) == 0 );
     45  rtems_test_assert( strcmp( dup_c, c ) == 0 );
     46  rtems_test_assert( strcmp( dup_d, d ) == 0 );
     47  rtems_test_assert( strcmp( dup_e, e ) == 0 );
     48
     49  _Workspace_Free( dup_a );
     50  _Workspace_Free( dup_b );
     51  _Workspace_Free( dup_c );
     52  _Workspace_Free( dup_d );
     53  _Workspace_Free( dup_e );
     54}
    2055
    2156rtems_task Init(
     
    6297  rtems_test_assert( retbool == true );
    6398
     99  puts( "_Workspace_String_duplicate - samples" );
     100  test_workspace_string_duplicate();
     101
    64102  puts( "*** END OF TEST WORKSPACE CLASSIC API ***" );
    65103  rtems_test_exit( 0 );
Note: See TracChangeset for help on using the changeset viewer.