summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxhdrs
diff options
context:
space:
mode:
authorMarçal Comajoan Cara <mcomajoancara@gmail.com>2018-12-07 18:59:38 +0100
committerJoel Sherrill <joel@rtems.org>2018-12-07 18:34:31 -0600
commitadd0b6a3f5cd7638285aeb5f6132aee20af9ca70 (patch)
tree16ef23f33c5391315b14060d41886526dc7cac55 /testsuites/psxtests/psxhdrs
parentscore: Remove Objects_Information::the_api (diff)
downloadrtems-add0b6a3f5cd7638285aeb5f6132aee20af9ca70.tar.bz2
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.
Diffstat (limited to 'testsuites/psxtests/psxhdrs')
-rw-r--r--testsuites/psxtests/psxhdrs/c11/uchar/c16rtomb.c41
-rw-r--r--testsuites/psxtests/psxhdrs/c11/uchar/c32rtomb.c41
-rw-r--r--testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc16.c41
-rw-r--r--testsuites/psxtests/psxhdrs/c11/uchar/mbrtoc32.c41
4 files changed, 164 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxhdrs/c11/uchar/c16rtomb.c b/testsuites/psxtests/psxhdrs/c11/uchar/c16rtomb.c
new file mode 100644
index 0000000000..46197d21fe
--- /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 0000000000..6eb6ec3aae
--- /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 0000000000..e1724df6cd
--- /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 0000000000..adc54cd715
--- /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;
+}