mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
fix: scientific notation is incorrectly parsed in general numeric sort (#10437)
* fix: scientific notation is incorrectly parsed in general sort * test(sort): refactor exponents_positive_general test --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
co-authored by
Sylvestre Ledru
parent
07567b1c63
commit
808865e4ac
@@ -2816,7 +2816,7 @@ fn get_leading_gen(inp: &[u8], decimal_pt: u8) -> Range<usize> {
|
||||
if let Some(&(_, &next_char)) = char_indices.peek() {
|
||||
if (next_char == b'+' || next_char == b'-')
|
||||
&& matches!(
|
||||
char_indices.peek_nth(2),
|
||||
char_indices.peek_nth(1),
|
||||
Some((_, c)) if c.is_ascii_digit()
|
||||
)
|
||||
{
|
||||
|
||||
@@ -478,10 +478,19 @@ fn test_non_printing_chars() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exponents_positive_general_fixed() {
|
||||
fn test_exponents_general() {
|
||||
test_helper("exponents_general", &["-g"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exponents_positive_general() {
|
||||
new_ucmd!()
|
||||
.pipe_in("1\n2e3\n1e-5")
|
||||
.arg("-g")
|
||||
.succeeds()
|
||||
.stdout_only("1e-5\n1\n2e3\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exponents_positive_numeric() {
|
||||
test_helper(
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
10E
|
||||
1000EDKLD
|
||||
10000K78
|
||||
+100000
|
||||
100E6
|
||||
50e10
|
||||
@@ -1,12 +0,0 @@
|
||||
10000K78
|
||||
10E
|
||||
|
||||
|
||||
1000EDKLD
|
||||
|
||||
|
||||
100E6
|
||||
|
||||
50e10
|
||||
+100000
|
||||
|
||||
Reference in New Issue
Block a user