Add new --sort option

This adds a new `--sort` option to choose the way in which the results
in the speed comparison and the markup exports are ordered.

closes #614
closes #601
This commit is contained in:
David Peter authored and David Peter committed 2023-06-03 21:34:36 +02:00
1 parent 2393de0c36
commit ac617c8714
12 files changed
+285 -89

No files matched your search

+25
View File
@@ -398,3 +398,28 @@ fn unused_parameters_are_shown_in_benchmark_name() {
.and(predicate::str::contains("echo test (branch = feature)")),
);
}
#[test]
fn speed_comparison_sort_order() {
for sort_order in ["auto", "mean-time"] {
hyperfine_debug()
.arg("sleep 2")
.arg("sleep 1")
.arg(format!("--sort={sort_order}"))
.assert()
.success()
.stdout(predicate::str::contains(
"sleep 1 ran\n 2.00 ± 0.00 times faster than sleep 2",
));
}
hyperfine_debug()
.arg("sleep 2")
.arg("sleep 1")
.arg("--sort=command")
.assert()
.success()
.stdout(predicate::str::contains(
"2.00 ± 0.00 sleep 2\n 1.00 sleep 1",
));
}