[PATCH] Testsuites for inttypes methods
Aditya Upadhyay
aadit0402 at gmail.com
Tue Aug 22 18:30:19 UTC 2017
---
testsuites/psxtests/Makefile.am | 6 ++
testsuites/psxtests/configure.ac | 6 ++
testsuites/psxtests/psxinttypes01/Makefile.am | 22 ++++++
testsuites/psxtests/psxinttypes01/init.c | 58 ++++++++++++++
.../psxtests/psxinttypes01/psxinttypes01.scn | 3 +
testsuites/psxtests/psxinttypes02/Makefile.am | 22 ++++++
testsuites/psxtests/psxinttypes02/init.c | 68 ++++++++++++++++
.../psxtests/psxinttypes02/psxinttypes02.scn | 4 +
testsuites/psxtests/psxinttypes03/Makefile.am | 22 ++++++
testsuites/psxtests/psxinttypes03/init.c | 90 ++++++++++++++++++++++
.../psxtests/psxinttypes03/psxinttypes03.scn | 10 +++
testsuites/psxtests/psxinttypes04/Makefile.am | 22 ++++++
testsuites/psxtests/psxinttypes04/init.c | 73 ++++++++++++++++++
.../psxtests/psxinttypes04/psxinttypes04.scn | 4 +
testsuites/psxtests/psxinttypes05/Makefile.am | 22 ++++++
testsuites/psxtests/psxinttypes05/init.c | 70 +++++++++++++++++
.../psxtests/psxinttypes05/psxinttypes05.scn | 3 +
testsuites/psxtests/psxinttypes06/Makefile.am | 22 ++++++
testsuites/psxtests/psxinttypes06/init.c | 70 +++++++++++++++++
.../psxtests/psxinttypes06/psxinttypes06.scn | 3 +
20 files changed, 600 insertions(+)
create mode 100644 testsuites/psxtests/psxinttypes01/Makefile.am
create mode 100644 testsuites/psxtests/psxinttypes01/init.c
create mode 100644 testsuites/psxtests/psxinttypes01/psxinttypes01.scn
create mode 100644 testsuites/psxtests/psxinttypes02/Makefile.am
create mode 100644 testsuites/psxtests/psxinttypes02/init.c
create mode 100644 testsuites/psxtests/psxinttypes02/psxinttypes02.scn
create mode 100644 testsuites/psxtests/psxinttypes03/Makefile.am
create mode 100644 testsuites/psxtests/psxinttypes03/init.c
create mode 100644 testsuites/psxtests/psxinttypes03/psxinttypes03.scn
create mode 100644 testsuites/psxtests/psxinttypes04/Makefile.am
create mode 100644 testsuites/psxtests/psxinttypes04/init.c
create mode 100644 testsuites/psxtests/psxinttypes04/psxinttypes04.scn
create mode 100644 testsuites/psxtests/psxinttypes05/Makefile.am
create mode 100644 testsuites/psxtests/psxinttypes05/init.c
create mode 100644 testsuites/psxtests/psxinttypes05/psxinttypes05.scn
create mode 100644 testsuites/psxtests/psxinttypes06/Makefile.am
create mode 100644 testsuites/psxtests/psxinttypes06/init.c
create mode 100644 testsuites/psxtests/psxinttypes06/psxinttypes06.scn
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index cccdb39..cda0061 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -58,6 +58,12 @@ _SUBDIRS += psxhdrs
_SUBDIRS += psxintrcritical01
_SUBDIRS += psxitimer
endif
+_SUBDIRS += psxinttypes01
+_SUBDIRS += psxinttypes02
+_SUBDIRS += psxinttypes03
+_SUBDIRS += psxinttypes04
+_SUBDIRS += psxinttypes05
+_SUBDIRS += psxinttypes06
_SUBDIRS += psxkey01
_SUBDIRS += psxkey02
_SUBDIRS += psxkey03
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 96a0149..dd5f23f 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -162,6 +162,12 @@ psxid01/Makefile
psximfs01/Makefile
psximfs02/Makefile
psxintrcritical01/Makefile
+psxinttypes01/Makefile
+psxinttypes02/Makefile
+psxinttypes03/Makefile
+psxinttypes04/Makefile
+psxinttypes05/Makefile
+psxinttypes06/Makefile
psxitimer/Makefile
psxkey01/Makefile
psxkey02/Makefile
diff --git a/testsuites/psxtests/psxinttypes01/Makefile.am b/testsuites/psxtests/psxinttypes01/Makefile.am
new file mode 100644
index 0000000..90608d4
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes01/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxinttypes01
+psxinttypes01_SOURCES = init.c
+
+dist_rtems_tests_DATA = psxinttypes01.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+#AM_CPPFLAGS = -I$(top_srcdir)/include
+#AM_CPPFLAGS = -I$(top_srcdir)/../support/include$(psxinttypes01_LDADD)
+
+LINK_OBJS = $(psxinttypes01_OBJECTS)
+LINK_LIBS = $(psxinttypes01_LDLIBS)
+
+psxinttypes01$(EXEEXT): $(psxinttypes01_OBJECTS) $(psxinttypes01_DEPENDENCIES)
+ @rm -f psxinttypes01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxinttypes01/init.c b/testsuites/psxtests/psxinttypes01/init.c
new file mode 100644
index 0000000..ad41a6d
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes01/init.c
@@ -0,0 +1,58 @@
+/*
+ * This is the test for inttypes imaxabs method.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/inttypes.h>
+#include <rtems/printer.h>
+#include <rtems/test.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <bsp.h>
+#include <stdint.h>
+#include <errno.h>
+#include <tmacros.h>
+
+/* forward declarations to avoid warnings */
+
+rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "PSXINTTYPE 01";
+rtems_printer rtems_test_printer;
+
+/*
+ * RTEMS Startup Task
+ */
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ rtems_print_printer_printf(&rtems_test_printer);
+ rtems_test_begin();
+
+ intmax_t a = -1234;
+
+ intmax_t b = imaxabs(a);
+ printf( "imaxabs_value = %jd\n", b);
+
+ rtems_test_end();
+ exit( 0 );
+}
+
+/* NOTICE: the clock driver is explicitly disabled */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
diff --git a/testsuites/psxtests/psxinttypes01/psxinttypes01.scn b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
new file mode 100644
index 0000000..15051e1
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
@@ -0,0 +1,3 @@
+*** BEGIN OF TEST PSXINTTYPE 01 ***
+imaxabs_value = 1234
+*** END OF TEST PSXINTTYPE 01 ***
diff --git a/testsuites/psxtests/psxinttypes02/Makefile.am b/testsuites/psxtests/psxinttypes02/Makefile.am
new file mode 100644
index 0000000..2e4ce3b
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes02/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxinttypes02
+psxinttypes02_SOURCES = init.c
+
+dist_rtems_tests_DATA = psxinttypes02.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+#AM_CPPFLAGS = -I$(top_srcdir)/include
+#AM_CPPFLAGS = -I$(top_srcdir)/../support/include$(psxinttypes02_LDADD)
+
+LINK_OBJS = $(psxinttypes02_OBJECTS)
+LINK_LIBS = $(psxinttypes02_LDLIBS)
+
+psxinttypes02$(EXEEXT): $(psxinttypes02_OBJECTS) $(psxinttypes02_DEPENDENCIES)
+ @rm -f psxinttypes02$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxinttypes02/init.c b/testsuites/psxtests/psxinttypes02/init.c
new file mode 100644
index 0000000..762a711
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes02/init.c
@@ -0,0 +1,68 @@
+/*
+ * This is the test for inttypes imaxdiv method.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/inttypes.h>
+#include <rtems/printer.h>
+#include <rtems/test.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <bsp.h>
+#include <stdint.h>
+#include <errno.h>
+#include <tmacros.h>
+
+/* forward declarations to avoid warnings */
+
+rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "PSXINTTYPE 02";
+rtems_printer rtems_test_printer;
+
+/*
+ * RTEMS Startup Task
+ */
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ rtems_print_printer_printf(&rtems_test_printer);
+ rtems_test_begin();
+
+ /*Test for imaxdiv */
+
+ intmax_t x,y;
+
+ imaxdiv_t div_result;
+
+ x = 27;
+ y = 4;
+
+ printf("The call to imaxdiv(%lld, %lld)\n", x, y);
+ div_result = imaxdiv(x, y);
+ printf("results in a quotient of %lld, and a remainder of %lld\n\n",
+ div_result.quot, div_result.rem);
+
+
+ rtems_test_end();
+ exit( 0 );
+}
+
+/* NOTICE: the clock driver is explicitly disabled */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
diff --git a/testsuites/psxtests/psxinttypes02/psxinttypes02.scn b/testsuites/psxtests/psxinttypes02/psxinttypes02.scn
new file mode 100644
index 0000000..d691475
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes02/psxinttypes02.scn
@@ -0,0 +1,4 @@
+*** BEGIN OF TEST PSXINTTYPE 02 ***
+The call to imaxdiv(27, 4)
+results in a quotient of 6 and a remainder of 4
+*** END OF TEST PSXINTTYPE 02 ***
diff --git a/testsuites/psxtests/psxinttypes03/Makefile.am b/testsuites/psxtests/psxinttypes03/Makefile.am
new file mode 100644
index 0000000..137f229
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes03/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxinttypes03
+psxinttypes03_SOURCES = init.c
+
+dist_rtems_tests_DATA = psxinttypes03.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+#AM_CPPFLAGS = -I$(top_srcdir)/include
+#AM_CPPFLAGS = -I$(top_srcdir)/../support/include$(psxinttypes03_LDADD)
+
+LINK_OBJS = $(psxinttypes03_OBJECTS)
+LINK_LIBS = $(psxinttypes03_LDLIBS)
+
+psxinttypes03$(EXEEXT): $(psxinttypes03_OBJECTS) $(psxinttypes03_DEPENDENCIES)
+ @rm -f psxinttypes03$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxinttypes03/init.c b/testsuites/psxtests/psxinttypes03/init.c
new file mode 100644
index 0000000..58dfb7b
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes03/init.c
@@ -0,0 +1,90 @@
+/*
+ * This is the test for inttypes library. It covers these functions :
+ * imaxabs(), imaxdiv(), strtoimax(), strtoumax(), wcstoimax(), wcstoumax().
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/inttypes.h>
+#include <rtems/printer.h>
+#include <rtems/test.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <bsp.h>
+#include <stdint.h>
+#include <errno.h>
+#include <tmacros.h>
+
+/* forward declarations to avoid warnings */
+
+rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "PSXINTTYPE 01";
+rtems_printer rtems_test_printer;
+
+/*
+ * RTEMS Startup Task
+ */
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ rtems_print_printer_printf(&rtems_test_printer);
+ rtems_test_begin();
+
+ /*Test for strtoimax */
+
+ char* endptr;
+
+ n = strtoimax ("-123junk", &endptr, 10); /* base 10 */
+ rtems_test_assert (n == ERANGE);
+ rtems_test_assert (n == EINVAL);
+ printf("BASE 10 : %jd\n", n);
+ n = strtoimax ("11111111", &endptr, 2); /* base 2 */
+ rtems_test_assert (n == ERANGE);
+ rtems_test_assert (n == EINVAL);
+ printf("BASE 2 : %jd\n", n);
+ n = strtoimax ("XyZ", &endptr, 36); /* base 36 */
+ rtems_test_assert (n == ERANGE);
+ rtems_test_assert (n == EINVAL);
+ printf("BASE 36 : %jd\n", n);
+ n = strtoimax ("010", &endptr, 0); /* octal auto-detection */
+ rtems_test_assert (n == ERANGE);
+ rtems_test_assert (n == EINVAL);
+ printf("OCTAL AUTO-DETECTION : %jd\n", n);
+ n = strtoimax ("10", &endptr, 0); /* decimal auto-detection */
+ rtems_test_assert (n == ERANGE);
+ rtems_test_assert (n == EINVAL);
+ printf("DECIMAL AUTO-DETECTION : %jd\n", n);
+ n = strtoimax ("0x10", &endptr, 0); /* hexadecimal auto-detection */
+ rtems_test_assert (n == ERANGE);
+ rtems_test_assert (n == EINVAL);
+ printf("HEXADECIMAL AUTO-DETECTION : %jd\n", n);
+
+ /* range error */
+ /* LONG_MAX+1 --> LONG_MAX */
+ errno = 0;
+ printf("%jd\n", strtoimax("9223372036854775808",&endptr,10));
+ printf("%s\n", strerror(errno));
+
+
+ rtems_test_end();
+ exit( 0 );
+}
+
+/* NOTICE: the clock driver is explicitly disabled */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
diff --git a/testsuites/psxtests/psxinttypes03/psxinttypes03.scn b/testsuites/psxtests/psxinttypes03/psxinttypes03.scn
new file mode 100644
index 0000000..05d909c
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes03/psxinttypes03.scn
@@ -0,0 +1,10 @@
+*** BEGIN OF TEST PSXINTTYPE 03 ***
+BASE 10 : -123
+BASE 2 : 255
+BASE 36 : 44027
+OCTAL AUTO-DETECTION : 8
+DECIMAL AUTO-DETECTION : 10
+HEXADECIMAL AUTO-DETECTION : 16
+9223372036854775807
+Result too large
+*** END OF TEST PSXINTTYPE 03 ***
diff --git a/testsuites/psxtests/psxinttypes04/Makefile.am b/testsuites/psxtests/psxinttypes04/Makefile.am
new file mode 100644
index 0000000..cc59a35
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes04/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxinttypes04
+psxinttypes04_SOURCES = init.c
+
+dist_rtems_tests_DATA = psxinttypes04.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+#AM_CPPFLAGS = -I$(top_srcdir)/include
+#AM_CPPFLAGS = -I$(top_srcdir)/../support/include$(psxinttypes04_LDADD)
+
+LINK_OBJS = $(psxinttypes04_OBJECTS)
+LINK_LIBS = $(psxinttypes04_LDLIBS)
+
+psxinttypes04$(EXEEXT): $(psxinttypes04_OBJECTS) $(psxinttypes04_DEPENDENCIES)
+ @rm -f psxinttypes04$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxinttypes04/init.c b/testsuites/psxtests/psxinttypes04/init.c
new file mode 100644
index 0000000..969fd49
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes04/init.c
@@ -0,0 +1,73 @@
+/*
+ * This is the test for inttypes library. It covers these functions :
+ * imaxabs(), imaxdiv(), strtoimax(), strtoumax(), wcstoimax(), wcstoumax().
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/inttypes.h>
+#include <rtems/printer.h>
+#include <rtems/test.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <bsp.h>
+#include <stdint.h>
+#include <errno.h>
+#include <tmacros.h>
+
+/* forward declarations to avoid warnings */
+
+rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "PSXINTTYPE 04";
+rtems_printer rtems_test_printer;
+
+/*
+ * RTEMS Startup Task
+ */
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ rtems_print_printer_printf(&rtems_test_printer);
+ rtems_test_begin();
+
+ char* endptr, *nptr;
+
+ uintmax_t j;
+
+ int base = 10;
+ rtems_test_assert (base == EINVAL);
+
+ nptr = "20690239864abc";
+
+ /* test for strtoumax */
+
+ j = strtoumax (nptr, &endptr, base);
+ rtems_test_assert (j == ERANGE);
+ rtems_test_assert (j == EINVAL);
+
+ printf( "strtoumax = %ju ( base %d )\n", j, base );
+ printf( "Stopped scan at %s\n\n", endptr );
+
+
+ rtems_test_end();
+ exit( 0 );
+}
+
+/* NOTICE: the clock driver is explicitly disabled */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
diff --git a/testsuites/psxtests/psxinttypes04/psxinttypes04.scn b/testsuites/psxtests/psxinttypes04/psxinttypes04.scn
new file mode 100644
index 0000000..c86bc44
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes04/psxinttypes04.scn
@@ -0,0 +1,4 @@
+*** BEGIN OF TEST PSXINTTYPE 04 ***
+strtoumax = 20690239864 (base 10)
+Stopped scan at abc
+*** END OF TEST PSXINTTYPE 04 ***
diff --git a/testsuites/psxtests/psxinttypes05/Makefile.am b/testsuites/psxtests/psxinttypes05/Makefile.am
new file mode 100644
index 0000000..1a9e1e6
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes05/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxinttypes05
+psxinttypes05_SOURCES = init.c
+
+dist_rtems_tests_DATA = psxinttypes05.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+#AM_CPPFLAGS = -I$(top_srcdir)/include
+#AM_CPPFLAGS = -I$(top_srcdir)/../support/include$(psxinttypes05_LDADD)
+
+LINK_OBJS = $(psxinttypes05_OBJECTS)
+LINK_LIBS = $(psxinttypes05_LDLIBS)
+
+psxinttypes05$(EXEEXT): $(psxinttypes05_OBJECTS) $(psxinttypes05_DEPENDENCIES)
+ @rm -f psxinttypes05$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxinttypes05/init.c b/testsuites/psxtests/psxinttypes05/init.c
new file mode 100644
index 0000000..bac42cc
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes05/init.c
@@ -0,0 +1,70 @@
+/*
+ * This is the test for inttypes wcstoimax method.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/inttypes.h>
+#include <rtems/printer.h>
+#include <rtems/test.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <bsp.h>
+#include <stdint.h>
+#include <errno.h>
+#include <tmacros.h>
+
+/* forward declarations to avoid warnings */
+
+rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "PSXINTTYPE 05";
+rtems_printer rtems_test_printer;
+
+/*
+ * RTEMS Startup Task
+ */
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ rtems_print_printer_printf(&rtems_test_printer);
+ rtems_test_begin();
+
+ int base = 10;
+ rtems_test_assert (base == EINVAL);
+
+ wchar_t *nptr1, *endptr1;
+
+ intmax_t m;
+
+ nptr1 = L"10110134932";
+
+ /* Test for wcstoimax */
+
+ m = wcstoimax(nptr1, &endptr1, base);
+ rtems_test_assert (m == ERANGE);
+ rtems_test_assert (m == EINVAL);
+
+ printf( "wcstoimax = %jd\n", m );
+
+ rtems_test_end();
+ exit( 0 );
+}
+
+/* NOTICE: the clock driver is explicitly disabled */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
diff --git a/testsuites/psxtests/psxinttypes05/psxinttypes05.scn b/testsuites/psxtests/psxinttypes05/psxinttypes05.scn
new file mode 100644
index 0000000..67e3eb8
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes05/psxinttypes05.scn
@@ -0,0 +1,3 @@
+*** BEGIN OF TEST PSXINTTYPE 05 ***
+wcstoumax = 10110134932
+*** END OF TEST PSXINTTYPE 05 ***
diff --git a/testsuites/psxtests/psxinttypes06/Makefile.am b/testsuites/psxtests/psxinttypes06/Makefile.am
new file mode 100644
index 0000000..a284e5a
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes06/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxinttypes06
+psxinttypes06_SOURCES = init.c
+
+dist_rtems_tests_DATA = psxinttypes06.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+#AM_CPPFLAGS = -I$(top_srcdir)/include
+#AM_CPPFLAGS = -I$(top_srcdir)/../support/include$(psxinttypes06_LDADD)
+
+LINK_OBJS = $(psxinttypes06_OBJECTS)
+LINK_LIBS = $(psxinttypes06_LDLIBS)
+
+psxinttypes06$(EXEEXT): $(psxinttypes06_OBJECTS) $(psxinttypes06_DEPENDENCIES)
+ @rm -f psxinttypes06$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxinttypes06/init.c b/testsuites/psxtests/psxinttypes06/init.c
new file mode 100644
index 0000000..15c75cf
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes06/init.c
@@ -0,0 +1,70 @@
+/*
+ * This is the test for inttypes wcstoumax method.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/inttypes.h>
+#include <rtems/printer.h>
+#include <rtems/test.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <bsp.h>
+#include <stdint.h>
+#include <errno.h>
+#include <tmacros.h>
+
+/* forward declarations to avoid warnings */
+
+rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "PSXINTTYPE 06";
+rtems_printer rtems_test_printer;
+
+/*
+ * RTEMS Startup Task
+ */
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ rtems_print_printer_printf(&rtems_test_printer);
+ rtems_test_begin();
+
+ uintmax_t k;
+
+ int base = 10;
+ rtems_test_assert (base == EINVAL);
+
+ wchar_t *nptr1, *endptr1;
+
+ nptr1 = L"10110134932";
+
+ /*test for wcstoumax */
+
+ k = wcstoumax (nptr1, &endptr1, base);
+ rtems_test_assert (k == ERANGE);
+ rtems_test_assert (k == EINVAL);
+
+ printf( "wcstoumax value : %ju\n", k );
+
+ rtems_test_end();
+ exit( 0 );
+}
+
+/* NOTICE: the clock driver is explicitly disabled */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
diff --git a/testsuites/psxtests/psxinttypes06/psxinttypes06.scn b/testsuites/psxtests/psxinttypes06/psxinttypes06.scn
new file mode 100644
index 0000000..d14b9a8
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes06/psxinttypes06.scn
@@ -0,0 +1,3 @@
+*** BEGIN OF TEST PSXINTTYPE 06 ***
+wcstoumax = 10110134932
+*** END OF TEST PSXINTTYPE 06 ***
--
2.7.4
More information about the devel
mailing list