mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
tests/functional/lang: Add sort stability test for lists langer than 16 elements
libstdc++'s std::stable_sort and new builtins.sort implementation special-case ranges with length less than or equal to 16 and delegate to insertionsort. Having a larger e2e test would allow catching sort stability issues at functional level as well.
This commit is contained in:
parent
ddcfc81ff1
commit
f9170a84f6
2 changed files with 75 additions and 1 deletions
|
@ -37,6 +37,80 @@ with builtins;
|
|||
value = "fnord";
|
||||
}
|
||||
])
|
||||
(sort (x: y: x.key < y.key) [
|
||||
{
|
||||
key = 1;
|
||||
value = "foo";
|
||||
}
|
||||
{
|
||||
key = 2;
|
||||
value = "bar";
|
||||
}
|
||||
{
|
||||
key = 1;
|
||||
value = "foo2";
|
||||
}
|
||||
{
|
||||
key = 2;
|
||||
value = "bar2";
|
||||
}
|
||||
{
|
||||
key = 2;
|
||||
value = "bar3";
|
||||
}
|
||||
{
|
||||
key = 2;
|
||||
value = "bar4";
|
||||
}
|
||||
{
|
||||
key = 1;
|
||||
value = "foo3";
|
||||
}
|
||||
{
|
||||
key = 3;
|
||||
value = "baz";
|
||||
}
|
||||
{
|
||||
key = 3;
|
||||
value = "baz2";
|
||||
}
|
||||
{
|
||||
key = 1;
|
||||
value = "foo4";
|
||||
}
|
||||
{
|
||||
key = 3;
|
||||
value = "baz3";
|
||||
}
|
||||
{
|
||||
key = 1;
|
||||
value = "foo5";
|
||||
}
|
||||
{
|
||||
key = 1;
|
||||
value = "foo6";
|
||||
}
|
||||
{
|
||||
key = 2;
|
||||
value = "bar5";
|
||||
}
|
||||
{
|
||||
key = 3;
|
||||
value = "baz4";
|
||||
}
|
||||
{
|
||||
key = 1;
|
||||
value = "foo7";
|
||||
}
|
||||
{
|
||||
key = 4;
|
||||
value = "biz1";
|
||||
}
|
||||
{
|
||||
key = 1;
|
||||
value = "foo8";
|
||||
}
|
||||
])
|
||||
(sort lessThan [
|
||||
[
|
||||
1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue