<div dir="ltr"><div><div>I sent this patch a few days ago.<br></div>if anyone could look at it. <br></div><div>the code was tested by dr joel.</div><div>But had some style issues.<br></div><div>I have covered all the suggestions.<br></div><div>Do any more changes need to be made before it is merged?</div><div><br></div><div>Thanks</div><div>-Eshan <br> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 4, 2020 at 12:46 AM Eshan dhawan <<a href="mailto:eshandhawan51@gmail.com">eshandhawan51@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">---<br>
testsuites/psxtests/psxinttypes01/init.c | 28 +++++++++++++++++--<br>
.../psxtests/psxinttypes01/psxinttypes01.doc | 10 ++++++-<br>
2 files changed, 34 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/testsuites/psxtests/psxinttypes01/init.c b/testsuites/psxtests/psxinttypes01/init.c<br>
index 030aa2aa57..28f7336fb8 100644<br>
--- a/testsuites/psxtests/psxinttypes01/init.c<br>
+++ b/testsuites/psxtests/psxinttypes01/init.c<br>
@@ -6,6 +6,7 @@<br>
/*<br>
* SPDX-License-Identifier: BSD-2-Clause<br>
*<br>
+ * Copyright (C) 2020, Eshan Dhawan <br>
* Copyright (C) 2019, Aditya Upadhyay and Vaibhav Gupta<br>
*<br>
* Redistribution and use in source and binary forms, with or without<br>
@@ -64,11 +65,32 @@ rtems_task Init(rtems_task_argument ignored)<br>
wchar_t *nptr2_n_errange = L"-9999999999999999999999";<br>
wchar_t *endptr2 = NULL;<br>
<br>
- intmax_t result_strtoimax;<br>
+ intmax_t result_strtoimax, result_imaxabs, input_1, input_2;<br>
+ imaxdiv_t result_exp, result_imaxdiv;<br>
uintmax_t result_strtoumax;<br>
<br>
TEST_BEGIN();<br>
-<br>
+ <br>
+ /* Test for imaxabs */ <br>
+ input_1 = -10;<br>
+ result_imaxabs = 10;<br>
+ rtems_test_assert( imaxabs(input_1) == result_imaxabs );<br>
+ <br>
+ input_1 = 10;<br>
+ result_imaxabs = 10;<br>
+ rtems_test_assert( imaxabs(input_1) == result_imaxabs );<br>
+<br>
+ /* Test for imaxdiv */<br>
+ input_1 = 10;<br>
+ input_2 = 3;<br>
+ result_exp.quot = input_1 / input_2;<br>
+ result_exp.rem = input_1 % input_2;<br>
+ result_imaxdiv = imaxdiv( input_1, input_2 ); <br>
+ rtems_test_assert( <br>
+ result_imaxdiv.quot == result_exp.quot && <br>
+ result_imaxdiv.rem == result_exp.rem <br>
+ ); <br>
+ <br>
/* Test for strtoimax */<br>
puts( "\nstrtoimax Testcases...." );<br>
puts( "Valid Inputs - Positive Number" );<br>
@@ -83,7 +105,7 @@ rtems_task Init(rtems_task_argument ignored)<br>
rtems_test_assert( result_strtoimax == -123 );<br>
<br>
puts( "Final string pointed by endptr" );<br>
- rtems_test_assert( endptr1 == ( nptr1_n + 4 ) );<br>
+ rtems_test_assert( endptr1 == ( nptr1_n + 4 ) ); <br>
<br>
puts( "Valid Input - Positive Number - Number out of Range" );<br>
result_strtoimax = strtoimax( nptr1_p_errange, &endptr1, base );<br>
diff --git a/testsuites/psxtests/psxinttypes01/psxinttypes01.doc b/testsuites/psxtests/psxinttypes01/psxinttypes01.doc<br>
index 19f63af34b..59b76796e2 100644<br>
--- a/testsuites/psxtests/psxinttypes01/psxinttypes01.doc<br>
+++ b/testsuites/psxtests/psxinttypes01/psxinttypes01.doc<br>
@@ -1,4 +1,4 @@<br>
-This File describes the concepts tested by this test suite.<br>
+This File describes the concepts tested by this test suite.<br>
<br>
inttypes.h - fixed size integer types<br>
<br>
@@ -37,3 +37,11 @@ test suite name: PSXINTTYPE 01<br>
- checks for output for string having a negative number - Number Out of Range<br>
- checks for final string pointed by endptr<br>
- checks for output for invalid argument - Invalid Base<br>
+<br>
+- Checks for imaxabs Testcases <br>
+ - checks for output with an input with any negative number <br>
+ - checks for output with an input with any positive number <br>
+<br>
+- Checks for imaxdiv Testcases <br>
+ - checks for the output quotient and remainder with input with positive numbers <br>
+ <br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>