On Wed, Jun 12, 2019 at 3:26 AM Gedare Bloom <ged...@rtems.org> wrote:
> On Mon, Jun 10, 2019 at 10:38 PM Vaibhav Gupta <vaibhavgupt...@gmail.com> > wrote: > > > > > > > > On Mon, Jun 10, 2019 at 10:01 PM Gedare Bloom <ged...@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 <vaibhavgupt...@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 >
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel