Skip to content

Commit 4792076

Browse files
alexs-shsylvestre
andcommitted
split the tests in tests/by-util/test_seq.rs
Keep the test cases for 2 and 3 arguments separately. Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
1 parent a0840bc commit 4792076

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

tests/by-util/test_seq.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -828,20 +828,32 @@ fn test_parse_scientific_zero() {
828828
}
829829

830830
#[test]
831-
fn test_parse_valid_hexadecimal_float() {
831+
fn test_parse_valid_hexadecimal_float_two_args() {
832832
let test_cases = [
833-
(vec!["0x1p-1", "2"], "0.5\n1.5\n"),
834-
(vec!["1", "0x1p-1", "2"], "1\n1.5\n2\n"),
835-
(vec!["0x3.4p-1", "0x4p-1", "4"], "1.625\n3.625\n"),
836-
(vec!["0x.8p16", "32768"], "32768\n"),
833+
(["0x1p-1", "2"], "0.5\n1.5\n"),
834+
(["0x.8p16", "32768"], "32768\n"),
835+
(["0xffff.4p-4", "4096"], "4095.95\n"),
836+
(["0xA.A9p-1", "6"], "5.33008\n"),
837+
(["0xa.a9p-1", "6"], "5.33008\n"),
838+
(["0xffffffffffp-30", "1024"], "1024\n"), // spell-checker:disable-line
839+
];
840+
841+
for (input_arguments, expected_output) in &test_cases {
842+
new_ucmd!()
843+
.args(input_arguments)
844+
.succeeds()
845+
.stdout_only(expected_output);
846+
}
847+
}
848+
849+
#[test]
850+
fn test_parse_valid_hexadecimal_float_three_args() {
851+
let test_cases = [
852+
(["0x3.4p-1", "0x4p-1", "4"], "1.625\n3.625\n"),
837853
(
838-
vec!["-0x.ep-3", "-0x.1p-3", "-0x.fp-3"],
854+
["-0x.ep-3", "-0x.1p-3", "-0x.fp-3"],
839855
"-0.109375\n-0.117188\n",
840856
),
841-
(vec!["0xffff.4p-4", "4096"], "4095.95\n"),
842-
(vec!["0xA.A9p-1", "6"], "5.33008\n"),
843-
(vec!["0xa.a9p-1", "6"], "5.33008\n"),
844-
(vec!["0xffffffffffp-30", "1024"], "1024\n"),
845857
];
846858

847859
for (input_arguments, expected_output) in &test_cases {

0 commit comments

Comments
 (0)