Skip to content

Commit e611bb1

Browse files
committed
Test that Osc(Reversed(X)) = Osc(X)
1 parent 297bbc1 commit e611bb1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/probes/osc.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
* Copyright (c) 2016-2025 Morwenn
33
* SPDX-License-Identifier: MIT
44
*/
5+
#include <algorithm>
56
#include <forward_list>
67
#include <vector>
78
#include <catch2/catch_test_macros.hpp>
9+
#include <rapidcheck.h>
10+
#include <rapidcheck/catch.h>
811
#include <cpp-sort/probes/osc.h>
912
#include <cpp-sort/utility/size.h>
1013
#include <testing-tools/internal_compare.h>
@@ -63,4 +66,10 @@ TEST_CASE( "measure of disorder: osc", "[probe][osc]" )
6366
};
6467
CHECK( osc(vec, comp, &wrapper::value) == 17 );
6568
}
69+
70+
rc::prop("Osc(Reversed(X)) = Osc(X)", [](std::vector<int> sequence) {
71+
auto osc_x = cppsort::probe::osc(sequence);
72+
std::reverse(sequence.begin(), sequence.end());
73+
return cppsort::probe::osc(sequence) == osc_x;
74+
});
6675
}

0 commit comments

Comments
 (0)