Re: [PATCH v4] lib/math: Add int_sqrt test suite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 10 Dec 2024, Luis Felipe Hernandez wrote:

> On Tue, Dec 10, 2024 at 10:58:02PM -0500, Nicolas Pitre wrote:
> 
> > And for such kind of test, more values to test is not a bad thing. So 
> > I'd suggest keeping { 4294967295, 65535 ] as well in the set as this 
> > represents a nice 
> > edge case.
> > 
> > It wouldn't hurt adding the entire set from 0 to 9 as well. Many 
> > different edge cases in that range.
> 
> I see, agreed, thank you for your suggestions. I'll go ahead and carry
> out the following changes:
> 1. Replace the ULONG_MAX test case with the aforementioned { 2147483648,
> 46340, "large input"} case
> 2. Add the { 4294967295, 65535 } edge case
> 3. Add missing cases between 0 - 9
> 4. Add a couple more cases 
> 
> The updated test cases would be as follows:
> { 0, 0, "edge case: square root of 0" },
> { 1, 1, "perfect square: square root of 1" },
> { 2, 1, "non-perfect square: square root of 2" },
> { 3, 1, "non-perfect square: sqaure root of 3" },
> { 4, 2, "perfect square: square root of 4" },
> { 5, 2, "non-perfect square: square  root of 5" },
> { 6, 2, "non-perfect square: square root of 6" },
> { 7, 2, "non-perfect square: square root of 7" },
> { 8, 2, "non-perfect square: square root of 8" },
> { 9, 3, "perfect square: square root of 9" },
> { 16, 4, "perfect square: square root of 16" },
> { 81, 9, "perfect square: square root of 81" },
> { 256, 16, "perfect square: square root of 256" },
> { 2147483648, 46340, "large input: square root of 2147483648" },
> { 4294967295, 65535, "edge case: ULONG_MAX for 32-bit" },
> 
> I'll incorporate these changes and submit a new revision of this patch.
> Please let me know if there's anything else you'd like me to address.

Looks fine to me.


Nicolas




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux