Page MenuHomeFreeBSD

Add tests for expand_number(3).
AcceptedPublic

Authored by jhb on Jun 28 2019, 6:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 29, 8:28 PM
Unknown Object (File)
Nov 10 2024, 9:47 PM
Unknown Object (File)
Oct 2 2024, 11:36 PM
Unknown Object (File)
Oct 2 2024, 5:30 PM
Unknown Object (File)
Oct 1 2024, 7:29 AM
Unknown Object (File)
Sep 28 2024, 12:47 AM
Unknown Object (File)
Sep 23 2024, 12:15 AM
Unknown Object (File)
Sep 21 2024, 3:25 PM
Subscribers

Details

Summary

Note that some tests currently fail and are commented out. The
manpage is pretty weak on the supported format. One of des' commits
claim negative numbers aren't supported, but humanize_number(3)
supports them. Note that negative numbers without suffixes do work if
you cast the result, but negative numbers with scales are incorrectly
detected as overflow. Some other questions I have:

  • Should we only support decimal since that is what humanize_number(3) generates?
  • Should we support negative numbers?
Test Plan
  • run the tests

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25110
Build 23809: arc lint + arc unit

Event Timeline

One more question, should we fail for trailing garbage? I think we should but we don't currently.

pstef added a subscriber: pstef.
@jhb wrote:

Should we only support decimal since that is what humanize_number(3) generates?

My answer would be a no. Input might come from elsewhere and this is true for code that possibly exists now and also code that might be written in the future.

Should we support negative numbers?

It would be a nice feature, but seems out of scope of this change.

One more question, should we fail for trailing garbage? I think we should but we don't currently.

I think we should, as it seems that a consumer would still be able to accept the result regardless (by reading num and ignoring the returned -1). But I'd suggest doing that via separate review/commit in order avoid blocking this one.

This revision is now accepted and ready to land.Sep 24 2021, 10:41 AM