Skip to content

Commit 9a2be9a

Browse files
committed
Test a stronger bound on the relation between Dis and Max
1 parent 1b88211 commit 9a2be9a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/probes/relations.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ TEST_CASE( "relations between measures of presortedness", "[probe]" )
5353
rc::prop("Max(X) ≤ Dis(X)", [](const std::vector<int>& sequence) {
5454
return max(sequence) <= dis(sequence);
5555
});
56-
rc::prop("Dis(X) ≤ 2 Max(X)", [](const std::vector<int>& sequence) {
57-
return dis(sequence) <= 2 * max(sequence);
56+
rc::prop("Dis(X) < 2 Max(X)", [](const std::vector<int>& sequence) {
57+
auto dis = cppsort::probe::dis(sequence);
58+
auto max = cppsort::probe::max(sequence);
59+
return (dis == 0 && max == 0) || (dis < 2 * max);
5860
});
5961

6062
// A New Measure of Presortedness

0 commit comments

Comments
 (0)