> > -  grub_test_assert (g->tm_sec == dt.second, "time %d bad second: %d vs 
> > %d", v,
> > +  grub_datetime2unixtime (&dt, &back);
> > +
> > +  grub_test_assert (g->tm_sec == dt.second, "time %lld bad second: %d vs 
> > %d", (long long)v,
>
> Missing space before "v"...
Agreed, will fix in v4.

> >                   g->tm_sec, dt.second);
> > -  grub_test_assert (g->tm_min == dt.minute, "time %d bad minute: %d vs 
> > %d", v,
> > +  grub_test_assert (g->tm_min == dt.minute, "time %lld bad minute: %d vs 
> > %d", (long long)v,
>
> Ditto... Here and below...
Agreed, will fix in v4.

> > -  grub_int32_t tests[] = { -1, 0, +1, -2133156255, GRUB_INT32_MIN,
> > +  grub_int32_t tests[] = { -1, 0, +1, 978224552, -2133156255, -2110094321, 
> > GRUB_INT32_MIN,
> >                          GRUB_INT32_MAX };
> > +  grub_int64_t tests64[] = { 5774965200LL, 4108700725LL, -5029179792LL };
>
> It would be nice to know how these values were chosen...
Agreed, I will investigate and add appropriate commentary in v4.

> > +      for (i = 0; i < ARRAY_SIZE (tests64); i++)
> > +        date_test (tests64[i]);
> > +      for (i = 0; i < 10000000; i++)
> > +        {
> > +          /* Ranges from 0064 to 6869.  */
>
> How were you come up with this range?
I will investigate and add appropriate commentary in v4.

> >
> > > +          grub_int64_t x = rand () + (rand () % 100 - 28) * 
> > > (grub_uint64_t)GRUB_INT32_MAX;
> >
> Where these numbers come from?
I will investigate and add appropriate commentary in v4.

>
> ... and missing space before GRUB_INT32_MAX...
Agreed, will fix in V4.

> >  static void
> >  date_test_iter (void)
> >  {
> > -  grub_int32_t tests[] = { -1, 0, +1, -2133156255, GRUB_INT32_MIN,
> > +  grub_int32_t tests[] = { -1, 0, +1, 978224552, -2133156255, -2110094321, 
> > GRUB_INT32_MIN,
> >                          GRUB_INT32_MAX };
> > +  grub_int64_t tests64[] = { 5774965200LL, 4108700725LL, -5029179792LL };
>
> ... and I think it would be more correct to cast these values to
> grub_int64_t instead of using "LL"...
Ok, I will make this change in v4.

Thanks,
Andrew


On Mon, Aug 25, 2025 at 12:33 PM Daniel Kiper <daniel.ki...@oracle.com> wrote:
>
> On Fri, Apr 18, 2025 at 09:54:00AM -0500, Andrew Hamilton wrote:
> > Signed-off-by: Vladimir Serbinenko <phco...@gmail.com>
> > Signed-off-by: Andrew Hamilton <adham...@gmail.com>
> >  static void
>
> [...]
>
> >  date_test_iter (void)
> >  {
> > -  grub_int32_t tests[] = { -1, 0, +1, -2133156255, GRUB_INT32_MIN,
> > +  grub_int32_t tests[] = { -1, 0, +1, 978224552, -2133156255, -2110094321, 
> > GRUB_INT32_MIN,
> >                          GRUB_INT32_MAX };
> > +  grub_int64_t tests64[] = { 5774965200LL, 4108700725LL, -5029179792LL };
>
> ... and I think it would be more correct to cast these values to
> grub_int64_t instead of using "LL"...
>
> Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to