[rtems commit] psxhdrs: add POSIX API Signature Compliance Tests for locale.h (GCI 2018)

Joel Sherrill joel at rtems.org
Sun Dec 2 14:48:29 UTC 2018


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

Author:    Himanshu40 <himanshuwindows8.1 at gmail.com>
Date:      Sun Dec  2 16:49:18 2018 +0530

psxhdrs: add POSIX API Signature Compliance Tests for locale.h (GCI 2018)

---

 testsuites/psxtests/Makefile.am                 |  8 ++++-
 testsuites/psxtests/psxhdrs/locale/duplocale.c  | 41 +++++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/locale/freelocale.c | 40 ++++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/locale/localeconv.c | 39 +++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/locale/newlocale.c  | 39 +++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/locale/setlocale.c  | 39 +++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/locale/uselocale.c  | 41 +++++++++++++++++++++++++
 7 files changed, 246 insertions(+), 1 deletion(-)

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 6921828..3d076b0 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1126,7 +1126,13 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
 	psxhdrs/dlfcn/dlopen.c \
 	psxhdrs/dlfcn/dlclose.c \
 	psxhdrs/dlfcn/dlerror.c \
-	psxhdrs/dlfcn/dlsym.c
+	psxhdrs/dlfcn/dlsym.c \
+	psxhdrs/locale/newlocale.c \
+	psxhdrs/locale/freelocale.c \
+	psxhdrs/locale/uselocale.c \
+	psxhdrs/locale/setlocale.c \
+	psxhdrs/locale/duplocale.c \
+	psxhdrs/locale/localeconv.c
 endif
 
 rtems_tests_PROGRAMS = $(psx_tests)
diff --git a/testsuites/psxtests/psxhdrs/locale/duplocale.c b/testsuites/psxtests/psxhdrs/locale/duplocale.c
new file mode 100644
index 0000000..74cb413
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/locale/duplocale.c
@@ -0,0 +1,41 @@
+/**
+ *  @file
+ *  @brief duplocale() 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 <locale.h>
+
+int test( void );
+
+int test( void )
+{
+  locale_t newloc;
+  locale_t locobj;
+  int category_mask = LC_CTYPE_MASK | LC_TIME_MASK;
+  char *locale = "loc1";
+
+  newloc = newlocale( category_mask, locale, (locale_t)0 );
+  locobj = duplocale( newloc );
+
+  return (locobj != NULL);
+}
diff --git a/testsuites/psxtests/psxhdrs/locale/freelocale.c b/testsuites/psxtests/psxhdrs/locale/freelocale.c
new file mode 100644
index 0000000..077ce8c
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/locale/freelocale.c
@@ -0,0 +1,40 @@
+/**
+ *  @file
+ *  @brief freelocale() 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 <locale.h>
+
+int test( void );
+
+int test( void )
+{
+  locale_t newloc;
+  int category_mask = LC_CTYPE_MASK | LC_TIME_MASK;
+  char *locale = "loc1";
+
+  newloc = newlocale( category_mask, locale, (locale_t)0 );
+  freelocale( newloc );
+
+  return (newloc != NULL);
+}
diff --git a/testsuites/psxtests/psxhdrs/locale/localeconv.c b/testsuites/psxtests/psxhdrs/locale/localeconv.c
new file mode 100644
index 0000000..2dbf0f9
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/locale/localeconv.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief localeconv() 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 <locale.h>
+
+int test( void );
+
+int test( void )
+{
+  struct lconv *lc;
+  int category = LC_MONETARY;
+
+  setlocale( category, "" );
+  lc = localeconv();
+
+  return (lc != NULL);
+}
diff --git a/testsuites/psxtests/psxhdrs/locale/newlocale.c b/testsuites/psxtests/psxhdrs/locale/newlocale.c
new file mode 100644
index 0000000..16d3964
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/locale/newlocale.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief newlocale() 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 <locale.h>
+
+int test( void );
+
+int test( void )
+{
+  locale_t newloc;
+  int category_mask = LC_CTYPE_MASK | LC_TIME_MASK;
+  char *locale = "loc1";
+
+  newloc = newlocale( category_mask, locale, (locale_t)0 );
+
+  return (newloc != NULL);
+}
diff --git a/testsuites/psxtests/psxhdrs/locale/setlocale.c b/testsuites/psxtests/psxhdrs/locale/setlocale.c
new file mode 100644
index 0000000..476788a
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/locale/setlocale.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief setlocale() 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 <locale.h>
+
+int test( void );
+
+int test( void )
+{
+  int category = LC_ALL;
+  char *locale = "loc1";
+  char *ostring;
+
+  ostring = setlocale( category, locale );
+
+  return (ostring != NULL);
+}
diff --git a/testsuites/psxtests/psxhdrs/locale/uselocale.c b/testsuites/psxtests/psxhdrs/locale/uselocale.c
new file mode 100644
index 0000000..3b36ecf
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/locale/uselocale.c
@@ -0,0 +1,41 @@
+/**
+ *  @file
+ *  @brief uselocale() 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 <locale.h>
+
+int test( void );
+
+int test( void )
+{
+  locale_t newloc;
+  locale_t currentloc;
+  int category_mask = LC_CTYPE_MASK | LC_TIME_MASK;
+  char *locale = "loc1";
+
+  newloc = newlocale( category_mask, locale, (locale_t)0 );
+  currentloc = uselocale( newloc );
+
+  return (currentloc != NULL);
+}




More information about the vc mailing list