Skip to content

Commit

Permalink
Be extorted by GCC's weird views.
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstenhater committed Sep 10, 2024
1 parent d205d8e commit 28a0cce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/unit/test_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,20 +444,20 @@ TEST(range, sort) {
{
// simple sort
char cstr[] = "howdy";
util::sort(util::range_n(std::begin(cstr), sizeof(cstr) - 1));
util::sort(util::range_n(cstr, 5));
EXPECT_EQ("dhowy"s, cstr);
}
{
// reverse sort by transform c to -c
// char cstr[] = "howdy";
// util::sort_by(util::make_range(std::begin(cstr), null_terminated),
// [](char c) { return -c; });
// EXPECT_EQ("ywohd"s, cstr);
char cstr[] = "howdy";
util::sort_by(util::range_n(cstr, 5),
[](char c) { return -c; });
EXPECT_EQ("ywohd"s, cstr);
}
{
// stable sort: move capitals to front, numbers to back
char mixed[] = "t5hH4E3erLL2e1O";
util::stable_sort_by(util::make_range(std::begin(mixed), null_terminated),
util::stable_sort_by(util::strict_view(util::make_range(std::begin(mixed), null_terminated)),
[](char c) { return std::isupper(c)? 0: std::isdigit(c)? 2: 1; });
EXPECT_EQ("HELLOthere54321"s, mixed);
}
Expand Down

0 comments on commit 28a0cce

Please sign in to comment.