1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

test_seq: Modify undefined behaviour tests

GNU `seq` doesn't support such large positive exponents anyway,
and we are limited by i64 range, so increase the exponent value
to make sure we fully overflow that range.

Also, add a test to check that a very, very, small number is
treated as 0 (that's also undefined behaviour, but it does
make sense in a way).
This commit is contained in:
Nicolas Boichat 2025-03-21 21:57:41 +01:00 committed by Daniel Hofstetter
parent 2cfed639d3
commit d58f1cc0f1

View file

@ -752,21 +752,23 @@ fn test_undefined() {
#[test]
fn test_invalid_float_point_fail_properly() {
// Note that we support arguments that are much bigger than what GNU coreutils supports.
// Tests below use exponents larger than we support (i64)
new_ucmd!()
.args(&["66000e000000000000000000000000000000000000000000000000000009223372036854775807"])
.args(&["66000e0000000000000000000000000000000000000000000000000000092233720368547758070"])
.fails()
.no_stdout()
.usage_error("invalid floating point argument: '66000e000000000000000000000000000000000000000000000000000009223372036854775807'");
.usage_error("invalid floating point argument: '66000e0000000000000000000000000000000000000000000000000000092233720368547758070'");
new_ucmd!()
.args(&["-1.1e9223372036854775807"])
.args(&["-1.1e92233720368547758070"])
.fails()
.no_stdout()
.usage_error("invalid floating point argument: '-1.1e9223372036854775807'");
.usage_error("invalid floating point argument: '-1.1e92233720368547758070'");
new_ucmd!()
.args(&["-.1e9223372036854775807"])
.args(&["-.1e92233720368547758070"])
.fails()
.no_stdout()
.usage_error("invalid floating point argument: '-.1e9223372036854775807'");
.usage_error("invalid floating point argument: '-.1e92233720368547758070'");
}
#[test]