[PATCH v2] Testsuite of inttypes methods.
Aditya Upadhyay
aadit0402 at gmail.com
Sat Sep 2 16:45:00 UTC 2017
---
testsuites/psxtests/psxinttypes01/init.c | 23 +++++++++++-----------
.../psxtests/psxinttypes01/psxinttypes01.scn | 6 +++---
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/testsuites/psxtests/psxinttypes01/init.c b/testsuites/psxtests/psxinttypes01/init.c
index e593e43..8fc79f6 100644
--- a/testsuites/psxtests/psxinttypes01/init.c
+++ b/testsuites/psxtests/psxinttypes01/init.c
@@ -13,12 +13,13 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
+#include <stdint.h>
#include <tmacros.h>
/* forward declarations to avoid warnings */
rtems_task Init(rtems_task_argument argument);
-const char rtems_test_name[] = "PSXINTTYPE 01";
+const char rtems_test_name[] = "PSXINTTYPES 01";
rtems_printer rtems_test_printer;
/*
@@ -48,16 +49,16 @@ rtems_task Init(
/* Test for wcstoimax */
m = wcstoimax(nptr1, &endptr1, base);
- rtems_test_assert (m == ERANGE);
- rtems_test_assert (m == EINVAL);
-
+ rtems_test_assert (m != 0);
+ rtems_test_assert (!(*endptr1));
+
printf( "wcstoimax = %jd\n", m );
/* test for strtoumax */
j = strtoumax (nptr, &endptr, base);
- rtems_test_assert (j == ERANGE);
- rtems_test_assert (j == EINVAL);
+ rtems_test_assert (j != 0);
+ rtems_test_assert (*endptr);
printf( "strtoumax = %ju ( base %d )\n", j, base );
printf( "Stopped scan at %s\n\n", endptr );
@@ -65,8 +66,8 @@ rtems_task Init(
/*test for wcstoumax */
k = wcstoumax (nptr1, &endptr1, base);
- rtems_test_assert (k == ERANGE);
- rtems_test_assert (k == EINVAL);
+ rtems_test_assert (k != 0);
+ rtems_test_assert (!(*endptr1));
printf( "wcstoumax = %ju\n", k );
@@ -81,9 +82,9 @@ rtems_task Init(
/*Test for strtoimax */
- n = strtoimax ("11111111", &endptr, 2);
- rtems_test_assert (n == ERANGE);
- rtems_test_assert (n == EINVAL);
+ n = strtoimax ("-123junk", &endptr, base);
+ rtems_test_assert (n != 0);
+ rtems_test_assert (*endptr);
printf( "strtoimax value = %jd\n", n);
diff --git a/testsuites/psxtests/psxinttypes01/psxinttypes01.scn b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
index 47a5416..79553be 100644
--- a/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
+++ b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
@@ -1,4 +1,4 @@
-*** BEGIN OF TEST PSXINTTYPE 01 ***
+*** BEGIN OF TEST PSXINTTYPES 01 ***
wcstoimax = 10110134932
strtoumax = 20690239864 ( base 10 )
Stopped scan at abc
@@ -6,6 +6,6 @@ Stopped scan at abc
wcstoumax = 10110134932
imax div value = 3
imaxabs_value = 1234
-strtoimax value = 255
-*** END OF TEST PSXINTTYPE 01 ***
+strtoimax value = -123
+*** END OF TEST PSXINTTYPES 01 ***
--
2.7.4
More information about the devel
mailing list