[PATCH v3 2/2] Add Testsuite for PSXINTTYPES01

Vaibhav Gupta vaibhavgupta40 at gmail.com
Thu Jun 13 17:50:30 UTC 2019


Remove comments on variable declaration.
Remove licence from Doc
Correct the assert condition for wcstoimax for negative errange condition.
---
 testsuites/psxtests/psxinttypes01/init.c      | 26 +++++++++---------
 .../psxtests/psxinttypes01/psxinttypes01.doc  | 27 -------------------
 2 files changed, 13 insertions(+), 40 deletions(-)

diff --git a/testsuites/psxtests/psxinttypes01/init.c b/testsuites/psxtests/psxinttypes01/init.c
index 8eafae11ac..94df8206c0 100644
--- a/testsuites/psxtests/psxinttypes01/init.c
+++ b/testsuites/psxtests/psxinttypes01/init.c
@@ -52,16 +52,16 @@ rtems_task Init(rtems_task_argument ignored)
   int       base            = 10;
   int       invalid_base    = 40;
 
-  char     *nptr1_p         = "123abc";				//char* pointing to string with positive number
-  char 	   *nptr1_p_errange = "9999999999999999999999";         //char* pointing to string with positive number that is out of range
-  char     *nptr1_n         = "-123abc";			//char* pointing to string with negative number
-  char 	   *nptr1_n_errange = "-9999999999999999999999";	//char* pointing to string with negative number that is out of range
+  char     *nptr1_p         = "123abc";
+  char 	   *nptr1_p_errange = "9999999999999999999999";
+  char     *nptr1_n         = "-123abc";
+  char 	   *nptr1_n_errange = "-9999999999999999999999";
   char     *endptr1         = NULL;
 
-  wchar_t  *nptr2_p         = L"123junk";			//wchar_t* pointing to string with positive number
-  wchar_t  *nptr2_p_errange = L"9999999999999999999999";	//wchar_t* pointing to string with positive number that is out of range
-  wchar_t  *nptr2_n         = L"-123junk";			//wchar_t* pointing to string with negative number
-  wchar_t  *nptr2_n_errange = L"-9999999999999999999999";	//wchar_t* pointing to string with negative number that is out of range
+  wchar_t  *nptr2_p         = L"123junk";
+  wchar_t  *nptr2_p_errange = L"9999999999999999999999";
+  wchar_t  *nptr2_n         = L"-123junk";
+  wchar_t  *nptr2_n_errange = L"-9999999999999999999999";
   wchar_t  *endptr2         = NULL;
 
   intmax_t  result_strtoimax;
@@ -69,7 +69,7 @@ rtems_task Init(rtems_task_argument ignored)
 
   TEST_BEGIN();
 
-  /*Test for strtoimax  */
+  /* Test for strtoimax  */
   puts( "\nstrtoimax Testcases...." );
   puts( "Valid Inputs - Positive Number" );
   result_strtoimax = strtoimax( nptr1_p, &endptr1, base );
@@ -105,7 +105,7 @@ rtems_task Init(rtems_task_argument ignored)
   rtems_test_assert( result_strtoimax == 0 );
   rtems_test_assert( errno == EINVAL );
 
-  /*Test for strtoumax  */
+  /* Test for strtoumax  */
   puts( "\nstrtoumax Testcases...." );
   puts( "Valid Inputs - Positive Number" );
   result_strtoumax = strtoumax( nptr1_p, &endptr1, base ); 
@@ -141,7 +141,7 @@ rtems_task Init(rtems_task_argument ignored)
   rtems_test_assert( result_strtoumax == 0 );
   rtems_test_assert( errno == EINVAL );
 
-  /*Test for wcstoimax  */
+  /* Test for wcstoimax  */
   puts( "\nwcstoimax Testcases...." );
   puts( "Valid Inputs - Positive Number" );
   result_strtoimax = wcstoimax( nptr2_p, &endptr2, base );
@@ -164,7 +164,7 @@ rtems_task Init(rtems_task_argument ignored)
 
   puts( "Valid Input - Negative Number - Number out of Range" );
   result_strtoimax = wcstoimax( nptr2_n_errange, &endptr2, base );
-  rtems_test_assert( result_strtoimax != 0 );
+  rtems_test_assert( result_strtoimax == INTMAX_MIN );
   rtems_test_assert( errno == ERANGE );
  
   puts( "Invalid Input - Send NULL Pointer" );
@@ -177,7 +177,7 @@ rtems_task Init(rtems_task_argument ignored)
   rtems_test_assert( result_strtoimax == 0 );
   rtems_test_assert( errno == EINVAL );
 
-  /*Test for wcstoumax  */
+  /* Test for wcstoumax  */
   puts( "\nwcstoumax Testcases...." );
   puts( "Valid Inputs - Positive Number" );
   result_strtoumax = wcstoumax( nptr2_p, &endptr2, base );
diff --git a/testsuites/psxtests/psxinttypes01/psxinttypes01.doc b/testsuites/psxtests/psxinttypes01/psxinttypes01.doc
index b5fd8e6d0e..607d67015e 100644
--- a/testsuites/psxtests/psxinttypes01/psxinttypes01.doc
+++ b/testsuites/psxtests/psxinttypes01/psxinttypes01.doc
@@ -1,30 +1,3 @@
-/*
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (C) 2019, Vaibhav Gupta
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
 This File describes the concepts tested by this test suite.
 
 inttypes.h - fixed size integer types
-- 
2.21.0



More information about the devel mailing list