1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

sort: make GNU test sort-debug-keys pass (#2269)

* sort: disable support for thousand separators

In order to be compatible with GNU, we have to disable thousands
separators. GNU does not enable them for the C locale, either.

Once we add support for locales we can add this feature back.

* sort: delete unused fixtures

* sort: compare -0 and 0 equal

I must have misunderstood this when implementing, but GNU considers
-0, 0, and invalid numbers to be equal.

* sort: strip blanks before applying the char index

* sort: don't crash when key start is after key end

* sort: add "no match" for months at the first non-whitespace char

We should put the "^ no match for key" indicator at the first
non-whitespace character of a field.

* sort: improve support for e notation

* sort: use maches! macros
This commit is contained in:
Michael Debertol 2021-05-28 22:38:29 +02:00 committed by GitHub
parent 9442f26fdb
commit e9656a6c32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 191 additions and 231 deletions

View file

@ -6,8 +6,15 @@
-12e-5555.5
0b10 // binary not supported
0x10 // hexadecimal not supported, but it should be
55e-20
55e-20.10
5.5.5.5
10E
64e+
99e-
1000EDKLD
10000K78
+100000
@ -15,5 +22,7 @@
100E6
100E6
10e10e10e10
13e+10
45e+10.5
50e10
50e10

View file

@ -22,12 +22,33 @@
^ no match for key
^ no match for key
> -12e-5555.5
_________
______________
0b10 // binary not supported
_
____________________________
0x10 // hexadecimal not supported, but it should be
_
___________________________________________________
55e-20
______
______
55e-20.10
______
_________
5.5.5.5
___
_______
10E
__
___
64e+
__
____
99e-
__
____
1000EDKLD
____
_________
@ -49,6 +70,12 @@ _____
10e10e10e10
_____
___________
13e+10
______
______
45e+10.5
______
________
50e10
_____
_____

View file

@ -4,16 +4,25 @@
+100000
10000K78
0x10 // hexadecimal not supported, but it should be
10E
0b10 // binary not supported
64e+
99e-
45e+10.5
1000EDKLD
13e+10
100E6
50e10
-12e-5555.5
+100000
10e10e10e10
5.5.5.5
55e-20
55e-20.10

View file

@ -0,0 +1,3 @@
cab
abc
bca

View file

@ -0,0 +1,9 @@
>cab
__
____
>abc
__
____
>bca
__
____

3
tests/fixtures/sort/keys_blanks.txt vendored Normal file
View file

@ -0,0 +1,3 @@
abc
cab
bca

View file

@ -0,0 +1 @@
a b c

View file

@ -0,0 +1,3 @@
a b c
^ no match for key
_____

View file

@ -0,0 +1 @@
a b c

View file

@ -21,10 +21,10 @@ CARAvan
8.013
45
46.89
4567.
37800
576,446.88800000
576,446.890
4567.
37800
4798908.340000000000
4798908.45
4798908.8909800

View file

@ -67,18 +67,18 @@ __
46.89
_____
_____
576,446.88800000
___
________________
576,446.890
___
___________
4567.
_____
____________________
>>>>37800
_____
_________
576,446.88800000
________________
________________
576,446.890
___________
___________
4798908.340000000000
____________________
____________________

View file

@ -1,30 +0,0 @@
4798908.8909800
4798908.45
4798908.340000000000
576,446.890
576,446.88800000
37800
4567.
46.89
45
8.013
1.58590
1.444
1.040000000
1
00000001
CARAvan
000
-.05
-1
-8.90880
-896689
-2028789030

View file

@ -1,30 +0,0 @@
4798908.8909800
4798908.45
4798908.340000000000
576,446.890
576,446.88800000
37800
4567.
46.89
45
8.013
1.58590
1.444
1.040000000
1
00000001
CARAvan
000
-.05
-1
-8.90880
-896689
-2028789030

View file

@ -1,30 +0,0 @@
576,446.890
576,446.88800000
4567.
45
46.89
-1
1
00000001
4798908.340000000000
4798908.45
4798908.8909800
37800
-2028789030
-896689
CARAvan
-8.90880
-.05
1.444
1.58590
1.040000000
8.013
000

View file

@ -8,11 +8,14 @@
-0
CARAvan
-0
000
-0
1
00000001
1.040000000
@ -21,10 +24,10 @@ CARAvan
8.013
45
46.89
576,446.890
576,446.88800000
4567.
37800
576,446.88800000
576,446.890
4798908.340000000000
4798908.45
4798908.8909800

View file

@ -18,8 +18,12 @@ ____
^ no match for key
^ no match for key
-0
__
CARAvan
^ no match for key
-0
__
^ no match for key
@ -28,6 +32,8 @@ CARAvan
^ no match for key
000
___
-0
__
1
_
00000001
@ -44,14 +50,14 @@ _____
__
46.89
_____
576,446.890
___
576,446.88800000
___
4567.
_____
>>>>37800
_____
576,446.88800000
________________
576,446.890
___________
4798908.340000000000
____________________
4798908.45

View file

@ -17,7 +17,9 @@
-2028789030
-896689
-0
CARAvan
-0
-8.90880
-.05
@ -28,3 +30,4 @@ CARAvan
8.013
000
-0

View file

@ -11,10 +11,9 @@
8.013
45
46.89
576,446.890
4567.
37800
576,446.88800000
576,446.890
4798908.340000000000
4798908.45
4798908.8909800

View file

@ -24,14 +24,12 @@ _____
__
46.89
_____
576,446.890
___
4567.
_____
>>>>37800
_____
576,446.88800000
________________
576,446.890
___________
4798908.340000000000
____________________
4798908.45

View file

@ -1,10 +1,9 @@
4798908.8909800
4798908.45
4798908.340000000000
576,446.890
576,446.88800000
37800
4567.
576,446.890
46.89
45
8.013

View file

@ -4,14 +4,12 @@ _______________
__________
4798908.340000000000
____________________
576,446.890
___________
576,446.88800000
________________
>>>>37800
_____
4567.
_____
576,446.890
___
46.89
_____
45

View file

@ -1,20 +0,0 @@
4798908.8909800
4798908.45
4798908.340000000000
576,446.890
576,446.88800000
37800
4567.
46.89
45
8.013
1.58590
1.444
1.040000000
1
-.05
-1
-8.90880
-896689
-2028789030

View file

@ -1,20 +0,0 @@
4798908.8909800
4798908.45
4798908.340000000000
576,446.890
576,446.88800000
37800
4567.
46.89
45
8.013
1.58590
1.444
1.040000000
1
-.05
-1
-8.90880
-896689
-2028789030

View file

@ -1,30 +0,0 @@
576,446.890
576,446.88800000
4567.
45
46.89
-1
1
00000001
4798908.340000000000
4798908.45
4798908.8909800
37800
-2028789030
-896689
CARAvan
-8.90880
-.05
1.444
1.58590
1.040000000
8.013
000

View file

@ -1,3 +1,4 @@
asdf
N/A Ut enim ad minim veniam, quis
Jan Lorem ipsum dolor sit amet
mar laboris nisi ut aliquip ex ea

View file

@ -1,3 +1,6 @@
asdf
^ no match for key
_____
N/A Ut enim ad minim veniam, quis
^ no match for key
_________________________________

View file

@ -8,3 +8,4 @@ mar laboris nisi ut aliquip ex ea
Jul 2 these three lines
Jul 1 should remain 2,1,3
Jul 3 if --stable is provided
asdf

View file

@ -1,4 +1,5 @@
N/A Ut enim ad minim veniam, quis
asdf
Jan Lorem ipsum dolor sit amet
mar laboris nisi ut aliquip ex ea
May sed do eiusmod tempor incididunt

View file

@ -1,5 +1,7 @@
N/A Ut enim ad minim veniam, quis
^ no match for key
asdf
^ no match for key
Jan Lorem ipsum dolor sit amet
___
mar laboris nisi ut aliquip ex ea

View file

@ -8,3 +8,4 @@ mar laboris nisi ut aliquip ex ea
Jul 2 these three lines
Jul 1 should remain 2,1,3
Jul 3 if --stable is provided
asdf

View file

@ -21,6 +21,8 @@ CARAvan
8.013
45
46.89
576,446.88800000
576,446.890
4567..457
4567.
4567.1
@ -28,8 +30,6 @@ CARAvan
37800
45670.89079.098
45670.89079.1
576,446.88800000
576,446.890
4798908.340000000000
4798908.45
4798908.8909800

View file

@ -67,6 +67,12 @@ __
46.89
_____
_____
576,446.88800000
___
________________
576,446.890
___
___________
>>>>>>>>>>4567..457
_____
___________________
@ -88,12 +94,6 @@ _____________________
>>>>>>45670.89079.1
___________
___________________
576,446.88800000
________________
________________
576,446.890
___________
___________
4798908.340000000000
____________________
____________________