History log of /openbsd-current/regress/lib/libutil/fmt_scaled/fmt_test.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.19 04-Dec-2022 cheloha

userspace: remove vestigial '?' cases from top-level getopt(3) loops

getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument. We can
handle this case with the "default" failure case with no loss of
legibility. Hence, remove all the redundant "case '?':" lines.

Prompted by dlg@. With help from dlg@ and millert@.

Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2

ok naddy@ millert@ dlg@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.18 11-Mar-2022 dtucker

Check for underflow as well as overflow when scaling negative numbers.
ok millert@


Revision tags: OPENBSD_7_0_BASE
# 1.17 20-Jun-2021 tb

Add a test case for fmt_scaled.c r1.20


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.16 14-Feb-2020 schwarze

no need to declare "extern optarg" and "extern optind"
when <unistd.h> is included;
patch from Jan Stary <hans at stare dot cz>;
OK millert


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.15 16-Mar-2017 dtucker

Enable tests for +/-LLONG_MAX and add tests for other boundary conditions.
ok millert@


# 1.14 15-Mar-2017 dtucker

Add tests for scaled overflow and underflow and the exact overflow and
underflow boundaries for 64bit platforms. Tests for exactly under the
boundaries disabled pending fixes. ok millert@ djm@ (previous version).


# 1.13 15-Mar-2017 dtucker

Clean up errno handling in fmt_scaled test:
- always clear before calling function under test.
- save immediately after function under test.
- always use saved value for validation and reporting.
- remove "fraction too big" testcase that never atually worked (but looked
like it did because the previous test's errno was never cleared).
- delete unecessary "extern int errno".


# 1.12 25-Feb-2017 jsg

Add missing includes to avoid implicit function declarations.


# 1.11 14-Aug-2016 guenther

Convert quad_t to long long


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.10 12-Nov-2012 halex

require scan_scaled to set errno to EINVAL rather than ERANGE if it
encounters an invalid multiplier, like the man page says it should

"looks sensible" deraadt@, ok ian@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.9 20-Jun-2009 ian

Repair comment ID & typo, no binary change


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.8 21-Oct-2005 deraadt

bullshit test; pointed out by david


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.7 09-Mar-2005 otto

Now that rounding is done properly for fractionless numbers, fix the
regression cases and add a few too.


# 1.6 08-Mar-2005 otto

Some more real-life regression cases.


# 1.5 16-Sep-2004 otto

new regression found in the wild: 1099512676352 -> 2.0T; fixed a minute ago.


Revision tags: OPENBSD_3_6_BASE
# 1.4 16-Jul-2004 david

errno -> err in a structure. OK deraadt@


Revision tags: OPENBSD_3_5_BASE
# 1.3 28-Dec-2003 otto

Add a few test cases.

ok ian@


Revision tags: OPENBSD_3_4_BASE
# 1.2 31-Jul-2003 deraadt

various cleanups; david says results are same


# 1.1 15-May-2003 ian

Regression for fmt_scaled() and scan_scaled().


# 1.18 11-Mar-2022 dtucker

Check for underflow as well as overflow when scaling negative numbers.
ok millert@


Revision tags: OPENBSD_7_0_BASE
# 1.17 20-Jun-2021 tb

Add a test case for fmt_scaled.c r1.20


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.16 14-Feb-2020 schwarze

no need to declare "extern optarg" and "extern optind"
when <unistd.h> is included;
patch from Jan Stary <hans at stare dot cz>;
OK millert


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.15 16-Mar-2017 dtucker

Enable tests for +/-LLONG_MAX and add tests for other boundary conditions.
ok millert@


# 1.14 15-Mar-2017 dtucker

Add tests for scaled overflow and underflow and the exact overflow and
underflow boundaries for 64bit platforms. Tests for exactly under the
boundaries disabled pending fixes. ok millert@ djm@ (previous version).


# 1.13 15-Mar-2017 dtucker

Clean up errno handling in fmt_scaled test:
- always clear before calling function under test.
- save immediately after function under test.
- always use saved value for validation and reporting.
- remove "fraction too big" testcase that never atually worked (but looked
like it did because the previous test's errno was never cleared).
- delete unecessary "extern int errno".


# 1.12 25-Feb-2017 jsg

Add missing includes to avoid implicit function declarations.


# 1.11 14-Aug-2016 guenther

Convert quad_t to long long


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.10 12-Nov-2012 halex

require scan_scaled to set errno to EINVAL rather than ERANGE if it
encounters an invalid multiplier, like the man page says it should

"looks sensible" deraadt@, ok ian@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.9 20-Jun-2009 ian

Repair comment ID & typo, no binary change


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.8 21-Oct-2005 deraadt

bullshit test; pointed out by david


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.7 09-Mar-2005 otto

Now that rounding is done properly for fractionless numbers, fix the
regression cases and add a few too.


# 1.6 08-Mar-2005 otto

Some more real-life regression cases.


# 1.5 16-Sep-2004 otto

new regression found in the wild: 1099512676352 -> 2.0T; fixed a minute ago.


Revision tags: OPENBSD_3_6_BASE
# 1.4 16-Jul-2004 david

errno -> err in a structure. OK deraadt@


Revision tags: OPENBSD_3_5_BASE
# 1.3 28-Dec-2003 otto

Add a few test cases.

ok ian@


Revision tags: OPENBSD_3_4_BASE
# 1.2 31-Jul-2003 deraadt

various cleanups; david says results are same


# 1.1 15-May-2003 ian

Regression for fmt_scaled() and scan_scaled().


# 1.17 20-Jun-2021 tb

Add a test case for fmt_scaled.c r1.20


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.16 14-Feb-2020 schwarze

no need to declare "extern optarg" and "extern optind"
when <unistd.h> is included;
patch from Jan Stary <hans at stare dot cz>;
OK millert


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.15 16-Mar-2017 dtucker

Enable tests for +/-LLONG_MAX and add tests for other boundary conditions.
ok millert@


# 1.14 15-Mar-2017 dtucker

Add tests for scaled overflow and underflow and the exact overflow and
underflow boundaries for 64bit platforms. Tests for exactly under the
boundaries disabled pending fixes. ok millert@ djm@ (previous version).


# 1.13 15-Mar-2017 dtucker

Clean up errno handling in fmt_scaled test:
- always clear before calling function under test.
- save immediately after function under test.
- always use saved value for validation and reporting.
- remove "fraction too big" testcase that never atually worked (but looked
like it did because the previous test's errno was never cleared).
- delete unecessary "extern int errno".


# 1.12 25-Feb-2017 jsg

Add missing includes to avoid implicit function declarations.


# 1.11 14-Aug-2016 guenther

Convert quad_t to long long


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.10 12-Nov-2012 halex

require scan_scaled to set errno to EINVAL rather than ERANGE if it
encounters an invalid multiplier, like the man page says it should

"looks sensible" deraadt@, ok ian@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.9 20-Jun-2009 ian

Repair comment ID & typo, no binary change


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.8 21-Oct-2005 deraadt

bullshit test; pointed out by david


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.7 09-Mar-2005 otto

Now that rounding is done properly for fractionless numbers, fix the
regression cases and add a few too.


# 1.6 08-Mar-2005 otto

Some more real-life regression cases.


# 1.5 16-Sep-2004 otto

new regression found in the wild: 1099512676352 -> 2.0T; fixed a minute ago.


Revision tags: OPENBSD_3_6_BASE
# 1.4 16-Jul-2004 david

errno -> err in a structure. OK deraadt@


Revision tags: OPENBSD_3_5_BASE
# 1.3 28-Dec-2003 otto

Add a few test cases.

ok ian@


Revision tags: OPENBSD_3_4_BASE
# 1.2 31-Jul-2003 deraadt

various cleanups; david says results are same


# 1.1 15-May-2003 ian

Regression for fmt_scaled() and scan_scaled().


# 1.16 14-Feb-2020 schwarze

no need to declare "extern optarg" and "extern optind"
when <unistd.h> is included;
patch from Jan Stary <hans at stare dot cz>;
OK millert


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.15 16-Mar-2017 dtucker

Enable tests for +/-LLONG_MAX and add tests for other boundary conditions.
ok millert@


# 1.14 15-Mar-2017 dtucker

Add tests for scaled overflow and underflow and the exact overflow and
underflow boundaries for 64bit platforms. Tests for exactly under the
boundaries disabled pending fixes. ok millert@ djm@ (previous version).


# 1.13 15-Mar-2017 dtucker

Clean up errno handling in fmt_scaled test:
- always clear before calling function under test.
- save immediately after function under test.
- always use saved value for validation and reporting.
- remove "fraction too big" testcase that never atually worked (but looked
like it did because the previous test's errno was never cleared).
- delete unecessary "extern int errno".


# 1.12 25-Feb-2017 jsg

Add missing includes to avoid implicit function declarations.


# 1.11 14-Aug-2016 guenther

Convert quad_t to long long


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.10 12-Nov-2012 halex

require scan_scaled to set errno to EINVAL rather than ERANGE if it
encounters an invalid multiplier, like the man page says it should

"looks sensible" deraadt@, ok ian@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.9 20-Jun-2009 ian

Repair comment ID & typo, no binary change


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.8 21-Oct-2005 deraadt

bullshit test; pointed out by david


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.7 09-Mar-2005 otto

Now that rounding is done properly for fractionless numbers, fix the
regression cases and add a few too.


# 1.6 08-Mar-2005 otto

Some more real-life regression cases.


# 1.5 16-Sep-2004 otto

new regression found in the wild: 1099512676352 -> 2.0T; fixed a minute ago.


Revision tags: OPENBSD_3_6_BASE
# 1.4 16-Jul-2004 david

errno -> err in a structure. OK deraadt@


Revision tags: OPENBSD_3_5_BASE
# 1.3 28-Dec-2003 otto

Add a few test cases.

ok ian@


Revision tags: OPENBSD_3_4_BASE
# 1.2 31-Jul-2003 deraadt

various cleanups; david says results are same


# 1.1 15-May-2003 ian

Regression for fmt_scaled() and scan_scaled().


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.15 16-Mar-2017 dtucker

Enable tests for +/-LLONG_MAX and add tests for other boundary conditions.
ok millert@


# 1.14 15-Mar-2017 dtucker

Add tests for scaled overflow and underflow and the exact overflow and
underflow boundaries for 64bit platforms. Tests for exactly under the
boundaries disabled pending fixes. ok millert@ djm@ (previous version).


# 1.13 15-Mar-2017 dtucker

Clean up errno handling in fmt_scaled test:
- always clear before calling function under test.
- save immediately after function under test.
- always use saved value for validation and reporting.
- remove "fraction too big" testcase that never atually worked (but looked
like it did because the previous test's errno was never cleared).
- delete unecessary "extern int errno".


# 1.12 25-Feb-2017 jsg

Add missing includes to avoid implicit function declarations.


# 1.11 14-Aug-2016 guenther

Convert quad_t to long long


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.10 12-Nov-2012 halex

require scan_scaled to set errno to EINVAL rather than ERANGE if it
encounters an invalid multiplier, like the man page says it should

"looks sensible" deraadt@, ok ian@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.9 20-Jun-2009 ian

Repair comment ID & typo, no binary change


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.8 21-Oct-2005 deraadt

bullshit test; pointed out by david


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.7 09-Mar-2005 otto

Now that rounding is done properly for fractionless numbers, fix the
regression cases and add a few too.


# 1.6 08-Mar-2005 otto

Some more real-life regression cases.


# 1.5 16-Sep-2004 otto

new regression found in the wild: 1099512676352 -> 2.0T; fixed a minute ago.


Revision tags: OPENBSD_3_6_BASE
# 1.4 16-Jul-2004 david

errno -> err in a structure. OK deraadt@


Revision tags: OPENBSD_3_5_BASE
# 1.3 28-Dec-2003 otto

Add a few test cases.

ok ian@


Revision tags: OPENBSD_3_4_BASE
# 1.2 31-Jul-2003 deraadt

various cleanups; david says results are same


# 1.1 15-May-2003 ian

Regression for fmt_scaled() and scan_scaled().