Page MenuHomeFreeBSD

Add tests for expand_number(3).
AcceptedPublic

Authored by jhb on Jun 28 2019, 6:17 PM.
Tags
None
Referenced Files
F83689836: D20796.diff
Mon, May 13, 4:45 PM
Unknown Object (File)
Tue, Apr 30, 5:26 PM
Unknown Object (File)
Jan 14 2024, 8:00 AM
Unknown Object (File)
Dec 29 2023, 5:53 PM
Unknown Object (File)
Nov 7 2023, 1:58 PM
Unknown Object (File)
Oct 28 2023, 6:02 PM
Unknown Object (File)
Oct 12 2023, 11:29 PM
Unknown Object (File)
Oct 6 2023, 12:41 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