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

Joel Sherrill joel at rtems.org
Tue Dec 4 15:33:42 UTC 2018


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

Author:    Jacob Shin <jacobshin313 at gmail.com>
Date:      Mon Dec  3 23:42:01 2018 -0500

psxhdrs: Implement POSIX API Signature Compliance Tests for iconv.h (GCI 2018)

---

 testsuites/psxtests/Makefile.am                 |  5 ++-
 testsuites/psxtests/psxhdrs/iconv/iconv.c       | 44 +++++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/iconv/iconv_close.c | 37 +++++++++++++++++++++
 testsuites/psxtests/psxhdrs/iconv/iconv_open.c  | 36 ++++++++++++++++++++
 4 files changed, 121 insertions(+), 1 deletion(-)

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 3e8520c..c4df4ba 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1138,7 +1138,10 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
 	psxhdrs/regex/regerror.c \
 	psxhdrs/regex/regexec.c \
 	psxhdrs/regex/regfree.c \
-	psxhdrs/fnmatch/fnmatch.c
+	psxhdrs/fnmatch/fnmatch.c \
+	psxhdrs/iconv/iconv.c \
+	psxhdrs/iconv/iconv_close.c \
+	psxhdrs/iconv/iconv_open.c
 endif
 
 rtems_tests_PROGRAMS = $(psx_tests)
diff --git a/testsuites/psxtests/psxhdrs/iconv/iconv.c b/testsuites/psxtests/psxhdrs/iconv/iconv.c
new file mode 100755
index 0000000..1384fdc
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/iconv/iconv.c
@@ -0,0 +1,44 @@
+/**
+ *  @file
+ *  @brief iconv() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Jacob Shin
+  *
+  *  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 <iconv.h>
+
+int test( void );
+
+int test( void )
+{
+
+  iconv_t cd = iconv_open("ASCII", "UTF-8");
+  char inbuf[10] = "string";
+  char outbuf[10];
+  char *inptr = inbuf;
+  char *outptr = (char *)outbuf;
+  size_t inbytesLeft = 7;
+  size_t outbytesLeft = 10;
+  size_t return_value;
+
+  return_value = iconv(cd, &inptr, &inbytesLeft, &outptr, &outbytesLeft);
+  return (return_value != (size_t)-1);
+}
\ No newline at end of file
diff --git a/testsuites/psxtests/psxhdrs/iconv/iconv_close.c b/testsuites/psxtests/psxhdrs/iconv/iconv_close.c
new file mode 100755
index 0000000..285f1b5
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/iconv/iconv_close.c
@@ -0,0 +1,37 @@
+/**
+ *  @file
+ *  @brief iconv_close() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Jacob Shin
+  *
+  *  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 <iconv.h>
+
+int test( void );
+
+int test( void )
+{
+  iconv_t cd = iconv_open("UTF-8", "WCHAR_T");
+  int return_value;
+
+  return_value = iconv_close(cd);
+  return (return_value != -1);
+}
\ No newline at end of file
diff --git a/testsuites/psxtests/psxhdrs/iconv/iconv_open.c b/testsuites/psxtests/psxhdrs/iconv/iconv_open.c
new file mode 100755
index 0000000..7951239
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/iconv/iconv_open.c
@@ -0,0 +1,36 @@
+/**
+ *  @file
+ *  @brief iconv_open() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Jacob Shin
+  *
+  *  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 <iconv.h>
+
+int test( void );
+
+int test( void )
+{
+  iconv_t return_value;
+
+  return_value = iconv_open("WCHAR_T", "UTF-8");
+  return (return_value != (iconv_t)-1);
+}
\ No newline at end of file




More information about the vc mailing list