[rtems commit] Implement POSIX API Signature Compliance Tests for uchar.h

Joel Sherrill joel at rtems.org
Sat Dec 8 00:35:09 UTC 2018


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

Author:    Marçal Comajoan Cara <mcomajoancara at gmail.com>
Date:      Fri Dec  7 18:59:38 2018 +0100

Implement POSIX API Signature Compliance Tests for uchar.h

This header file is C11 and not currently supported by RTEMS.
See #3643.

This work was part of GCI 2018.

---

 testsuites/psxtests/Makefile.am                  |  4 +++
 testsuites/psxtests/psxhdrs/c11/uchar/c16rtomb.c | 41 ++++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/c11/uchar/c32rtomb.c | 41 ++++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc16.c | 41 ++++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc32.c | 41 ++++++++++++++++++++++++
 5 files changed, 168 insertions(+)

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 1ac5a31..736e8c4 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1612,6 +1612,10 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
 ## lib_a_SOURCES += psxhdrs/ucontext/makecontext.c See ticket #3640
 ## lib_a_SOURCES += psxhdrs/ucontext/setcontext.c  See ticket #3640
 ## lib_a_SOURCES += psxhdrs/ucontext/swapcontext.c See ticket #3640
+## lib_a_SOURCES += psxhdrs/c11/uchar/c16rtomb.c   See ticket #3643
+## lib_a_SOURCES += psxhdrs/c11/uchar/c32rtomb.c   See ticket #3643
+## lib_a_SOURCES += psxhdrs/c11/uchar/c32rtomb.c   See ticket #3643
+## lib_a_SOURCES += psxhdrs/c11/uchar/mbrtoc32.c   See ticket #3643
 endif
 
 rtems_tests_PROGRAMS = $(psx_tests)
diff --git a/testsuites/psxtests/psxhdrs/c11/uchar/c16rtomb.c b/testsuites/psxtests/psxhdrs/c11/uchar/c16rtomb.c
new file mode 100644
index 0000000..46197d2
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/c11/uchar/c16rtomb.c
@@ -0,0 +1,41 @@
+/**
+ *  @file
+ *  @brief c16rtomb() API Conformance Test. This is a C11 method.
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Marçal Comajoan Cara
+ *
+ *  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 <uchar.h>
+#include <stdlib.h>
+
+int test( void );
+
+int test( void )
+{
+  char16_t* c16_str = u"Mar\u00E7al";
+  char out[MB_CUR_MAX];
+  mbstate_t mbs;
+  int result;
+
+  result = c16rtomb( out, *c16_str, &mbs );
+
+  return result;
+}
diff --git a/testsuites/psxtests/psxhdrs/c11/uchar/c32rtomb.c b/testsuites/psxtests/psxhdrs/c11/uchar/c32rtomb.c
new file mode 100644
index 0000000..6eb6ec3
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/c11/uchar/c32rtomb.c
@@ -0,0 +1,41 @@
+/**
+ *  @file
+ *  @brief c32rtomb() API Conformance Test. This is a C11 method.
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Marçal Comajoan Cara
+ *
+ *  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 <uchar.h>
+#include <stdlib.h>
+
+int test( void );
+
+int test( void )
+{
+  char32_t* c32_str = U"Mar\u00E7al";
+  char out[MB_CUR_MAX];
+  mbstate_t mbs;
+  int result;
+
+  result = c32rtomb( out, *c32_str, &mbs );
+
+  return result;
+}
diff --git a/testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc16.c b/testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc16.c
new file mode 100644
index 0000000..e1724df
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc16.c
@@ -0,0 +1,41 @@
+/**
+ *  @file
+ *  @brief mbrtoc16() API Conformance Test. This is a C11 method.
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Marçal Comajoan Cara
+ *
+ *  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 <uchar.h>
+#include <stdlib.h>
+
+int test( void );
+
+int test( void )
+{
+  char16_t pc16;
+  char* str = u8"Mar\u00E7al";
+  mbstate_t mbs;
+  int result;
+
+  result = mbrtoc16( &pc16, str, MB_CUR_MAX, &mbs );
+
+  return result;
+}
diff --git a/testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc32.c b/testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc32.c
new file mode 100644
index 0000000..adc54cd
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc32.c
@@ -0,0 +1,41 @@
+/**
+ *  @file
+ *  @brief mbrtoc32() API Conformance Test. This is a C11 method.
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Marçal Comajoan Cara
+ *
+ *  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 <uchar.h>
+#include <stdlib.h>
+
+int test( void );
+
+int test( void )
+{
+  char32_t pc32;
+  char* str = u8"Mar\u00E7al";
+  mbstate_t mbs;
+  int result;
+
+  result = mbrtoc32( &pc32, str, MB_CUR_MAX, &mbs );
+
+  return result;
+}



More information about the vc mailing list