mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 18:35:27 +08:00
psxhdrs: add POSIX API signature tests for strings.h file (GCI 2018)
This commit is contained in:
committed by
Joel Sherrill
parent
f40f86d75a
commit
e3086c9c5a
@@ -1113,7 +1113,16 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
|
||||
psxhdrs/semaphore/sem_post.c \
|
||||
psxhdrs/semaphore/sem_wait.c \
|
||||
psxhdrs/semaphore/sem_trywait.c \
|
||||
psxhdrs/semaphore/sem_timedwait.c
|
||||
psxhdrs/semaphore/sem_timedwait.c \
|
||||
psxhdrs/strings/bcmp.c \
|
||||
psxhdrs/strings/bcopy.c \
|
||||
psxhdrs/strings/ffs.c \
|
||||
psxhdrs/strings/index.c \
|
||||
psxhdrs/strings/rindex.c \
|
||||
psxhdrs/strings/strcasecmp.c \
|
||||
psxhdrs/strings/strcasecmp_l.c \
|
||||
psxhdrs/strings/strncasecmp.c \
|
||||
psxhdrs/strings/strncasecmp_l.c
|
||||
endif
|
||||
|
||||
rtems_tests_PROGRAMS = $(psx_tests)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief bcmp() API Conformance Test
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT (c) 2018.
|
||||
* Himanshu Sekhar Nayak
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software
|
||||
* for any purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
int test( void );
|
||||
|
||||
int test( void )
|
||||
{
|
||||
int result;
|
||||
|
||||
result = bcmp( "Hello there", "Hello world", 6 );
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief bcopy() API Conformance Test
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT (c) 2018.
|
||||
* Himanshu Sekhar Nayak
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software
|
||||
* for any purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
int test( void );
|
||||
|
||||
int result = 1;
|
||||
|
||||
int test( void )
|
||||
{
|
||||
auto char buffer[50];
|
||||
|
||||
bcopy( "Hello ", buffer, 6 );
|
||||
bcopy( "world", &buffer[6], 6 );
|
||||
result = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief ffs() API Conformance Test
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT (c) 2018.
|
||||
* Himanshu Sekhar Nayak
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software
|
||||
* for any purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
int test( void );
|
||||
|
||||
int test( void )
|
||||
{
|
||||
int i;
|
||||
int result;
|
||||
|
||||
i = 64;
|
||||
|
||||
result = ffs( i );
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief index() API Conformance Test
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT (c) 2018.
|
||||
* Himanshu Sekhar Nayak
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software
|
||||
* for any purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
int test( void );
|
||||
|
||||
int result = 1;
|
||||
|
||||
int test( void )
|
||||
{
|
||||
char *p;
|
||||
char *string = "This is a string for testing";
|
||||
|
||||
p = index( string, 'i' );
|
||||
(void) p;
|
||||
result = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief rindex() API Conformance Test
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT (c) 2018.
|
||||
* Himanshu Sekhar Nayak
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software
|
||||
* for any purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
int test( void );
|
||||
|
||||
int result = 1;
|
||||
|
||||
int test( void )
|
||||
{
|
||||
char *p;
|
||||
char *string = "This is a string for testing";
|
||||
|
||||
p = rindex( string, 'i' );
|
||||
(void) p;
|
||||
result = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief strcasecmp() API Conformance Test
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT (c) 2018.
|
||||
* Himanshu Sekhar Nayak
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software
|
||||
* for any purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
int test( void );
|
||||
|
||||
int test( void )
|
||||
{
|
||||
char *string1 = "STRING";
|
||||
char *string2 = "string";
|
||||
int result;
|
||||
|
||||
result = strcasecmp( string1, string2 );
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief strcasecmp_l() API Conformance Test
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT (c) 2018.
|
||||
* Himanshu Sekhar Nayak
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software
|
||||
* for any purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
#include <locale.h>
|
||||
|
||||
int test( void );
|
||||
|
||||
int test( void )
|
||||
{
|
||||
char *string1 = "STRING";
|
||||
char *string2 = "string";
|
||||
int result;
|
||||
|
||||
result = strcasecmp_l( string1, string2, LC_CTYPE );
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief strncasecmp() API Conformance Test
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT (c) 2018.
|
||||
* Himanshu Sekhar Nayak
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software
|
||||
* for any purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
int test( void );
|
||||
|
||||
int test( void )
|
||||
{
|
||||
char *string1 = "STRING ONE";
|
||||
char *string2 = "string TWO";
|
||||
int result;
|
||||
|
||||
result = strncasecmp( string1, string2, 6 );
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief strcasecmp_l() API Conformance Test
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT (c) 2018.
|
||||
* Himanshu Sekhar Nayak
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software
|
||||
* for any purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
#include <locale.h>
|
||||
|
||||
int test( void );
|
||||
|
||||
int test( void )
|
||||
{
|
||||
char *string1 = "STRING";
|
||||
char *string2 = "string";
|
||||
int result;
|
||||
|
||||
result = strncasecmp_l( string1, string2, 6, LC_CTYPE );
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user