[PATCH] Add testsuite for psxinttypes01
Vaibhav Gupta
vaibhavgupta40 at gmail.com
Wed Jun 12 08:26:16 UTC 2019
On Wed, Jun 12, 2019 at 3:26 AM Gedare Bloom <gedare at rtems.org> wrote:
> On Mon, Jun 10, 2019 at 10:38 PM Vaibhav Gupta <vaibhavgupta40 at gmail.com>
> wrote:
> >
> >
> >
> > On Mon, Jun 10, 2019 at 10:01 PM Gedare Bloom <gedare at rtems.org> wrote:
> >>
> >> Hi Vaibhav,
> >>
> >> This is getting better, see below for review comments.
> >>
> >> On Mon, Jun 10, 2019 at 4:48 AM Vaibhav Gupta <vaibhavgupta40 at gmail.com>
> wrote:
> >> > + puts( "2 - Valid Inputs - Negative Number" );
> >> > + result_strtoumax = strtoumax( nptr1_n, &endptr1, base );
> >> > + puts( "Checking Results" );
> >> > + rtems_test_assert( result_strtoumax == ( UINTMAX_MAX - 123 + 1 ) );
> >> > + puts( "PASS" );
> >> Is it expected to convert the negative number correctly like this?
> >
> > In previous code, the test was rtems_test_assert( result_strtoumax
> != 0 );
> > On suggestion, I converted it to assert it with the output instead of
> zero.
> > .
> > I matched it with output, ( UINTMAX_MAX - 123 + 1 ) is giving correct
> result.
> > Can you brief, how else I should convert this negative number?
>
> I just meant is it guaranteed that the conversion will treat a
> negative string as a 2s complement integer. I guess it is fine to
> leave it.
>
Okay then, for the sake of test, for negative numbers, I will assert it
using zero: rtems_test_assert( result_strtoumax != 0 );
It will make sure that conversion took place.
-Vaibhav Gupta
>
> -Gedare
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20190612/ea996bac/attachment-0002.html>
More information about the devel
mailing list