[rtems commit] psxhdrs: add POSIX API signature tests for strings.h file ( GCI 2018)

Joel Sherrill joel at rtems.org
Sat Dec 1 18:10:29 UTC 2018


Module:    rtems
Branch:    master
Commit:    e3086c9c5af3c5d46da12b6e9796d2f209114bf8
Changeset: http://git.rtems.org/rtems/commit/?id=e3086c9c5af3c5d46da12b6e9796d2f209114bf8

Author:    Himanshu40 <himanshuwindows8.1 at gmail.com>
Date:      Sat Dec  1 23:41:06 2018 +0530

psxhdrs: add POSIX API signature tests for strings.h file (GCI 2018)

---

 testsuites/psxtests/Makefile.am                    | 11 +++++-
 testsuites/psxtests/psxhdrs/strings/bcmp.c         | 36 +++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/bcopy.c        | 40 +++++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/ffs.c          | 39 ++++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/index.c        | 41 ++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/rindex.c       | 41 ++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/strcasecmp.c   | 38 ++++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c | 39 ++++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/strncasecmp.c  | 38 ++++++++++++++++++++
 .../psxtests/psxhdrs/strings/strncasecmp_l.c       | 39 ++++++++++++++++++++
 10 files changed, 361 insertions(+), 1 deletion(-)

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 553b259..d40df4c 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -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)
diff --git a/testsuites/psxtests/psxhdrs/strings/bcmp.c b/testsuites/psxtests/psxhdrs/strings/bcmp.c
new file mode 100644
index 0000000..0e95a69
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/bcmp.c
@@ -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;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/bcopy.c b/testsuites/psxtests/psxhdrs/strings/bcopy.c
new file mode 100644
index 0000000..0a54f5a
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/bcopy.c
@@ -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;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/ffs.c b/testsuites/psxtests/psxhdrs/strings/ffs.c
new file mode 100644
index 0000000..e4b212d
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/ffs.c
@@ -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;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/index.c b/testsuites/psxtests/psxhdrs/strings/index.c
new file mode 100644
index 0000000..b4dbc32
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/index.c
@@ -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;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/rindex.c b/testsuites/psxtests/psxhdrs/strings/rindex.c
new file mode 100644
index 0000000..220a655
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/rindex.c
@@ -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;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/strcasecmp.c b/testsuites/psxtests/psxhdrs/strings/strcasecmp.c
new file mode 100644
index 0000000..3ed4b51
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/strcasecmp.c
@@ -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;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c b/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c
new file mode 100644
index 0000000..cdcdff7
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c
@@ -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;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/strncasecmp.c b/testsuites/psxtests/psxhdrs/strings/strncasecmp.c
new file mode 100644
index 0000000..26899f7
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/strncasecmp.c
@@ -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;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/strncasecmp_l.c b/testsuites/psxtests/psxhdrs/strings/strncasecmp_l.c
new file mode 100644
index 0000000..9b0792fd
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/strncasecmp_l.c
@@ -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;
+ }




More information about the vc mailing list