[PATCH] Add testsuite for psxinttypes01

Gedare Bloom gedare at rtems.org
Tue Jun 11 21:56:21 UTC 2019


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.

-Gedare



More information about the devel mailing list