coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: new discriminator-based test for sort -n and -h


From: Jim Meyering
Subject: Re: [PATCH] tests: new discriminator-based test for sort -n and -h
Date: Tue, 13 Mar 2012 18:02:02 +0100

Paul Eggert wrote:
> The coauthors of this change are myself, Drew Kutilek, and James Wendt.
> * tests/Makefile.am (TESTS): Add misc/sort-discrim.
> * tests/misc/sort-discrim: New file, which tests a discriminator-based
> implementation of 'sort'.  Coreutils doesn't use this implementation
> yet, but the test is useful anyway.
...

Other than the log nit (Co-authored-by:) I mentioned,
I noticed two more things:

> +# A long-enough string so that it overruns a small discriminator buffer size.
> +long_prefix='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
> +seq -f "$long_prefix%5.0f" 10000 > exp || fail=1
> +sort -R exp | LC_ALL=C sort > out || fail=1
> +compare out exp || fail=1
> +
> +
> +# Test numeric sorting.
> +
> +# These tests are designed for an internal representation that ordinarily 
> looks

I think an "at" should be inserted here.

> +# the number plus two decimal digits, but if -h is
> +# used it looks at one decimal place plus a 4-bit SI prefix value.
> +# In both cases, there's an extra factor of 2 for the sign.
> +max_int200=$(expr $UINTMAX_MAX / 200) &&
> +max_frac200=$(printf '%.2d' $(expr $UINTMAX_MAX / 2 % 100)) &&
> +max_int320=$(expr $UINTMAX_MAX / 320) &&
> +max_frac320=$(expr $UINTMAX_MAX / 32 % 10) &&

Since you don't really need a sub-shell, just the grouping,
{ ... } is slightly more appropriate than ( ... ):

> +( printf -- "\
...
> +"
> +) > exp || fail=1

You're welcome to push that.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]