fix unit-algorithms test reliance on implementation specific behaviour (#5236)

the standard only specifies that the first elements are sorted.

this caused my experimental C++ standard library implementation to fail.

Signed-off-by: Paul Dreik <github@pauldreik.se>
This commit is contained in:
Paul Dreik
2026-07-06 08:25:30 +02:00
committed by GitHub
parent 83c87cb9e0
commit 33edc9751c
+4 -1
View File
@@ -229,7 +229,10 @@ TEST_CASE("algorithms")
{
json j = {13, 29, 3, {{"one", 1}, {"two", 2}}, true, false, {1, 2, 3}, "foo", "baz", nullptr};
std::partial_sort(j.begin(), j.begin() + 4, j.end());
CHECK(j == json({nullptr, false, true, 3, {{"one", 1}, {"two", 2}}, 29, {1, 2, 3}, "foo", "baz", 13}));
// only the first four elements are expected to be sorted, the rest are
// unspecified by the standard
const json expected({nullptr, false, true, 3});
CHECK(std::equal(j.begin(), j.begin() + 4, begin(expected)));
}
}